You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Felipe Jaekel <fk...@gmail.com> on 2019/11/27 18:56:53 UTC

Problem running Spring Boot app with CXF

Hi,

I have a Spring Boot (2.2.1) app that uses CXF for SOAP contract last web
services. It works fine with Tomcat (9.0.24), but when I try to run it on
TomEE (7.0.5, 8.0.0), I get the following exception:

Caused by: java.lang.ClassCastException: Cannot cast
org.apache.cxf.management.jmx.InstrumentationManagerImpl to
org.apache.cxf.management.InstrumentationManager at
java.lang.Class.cast(Class.java:3369) at
org.apache.cxf.bus.extension.ExtensionManagerImpl.getBeanOfType(ExtensionManagerImpl.java:307)
at
org.apache.cxf.bus.spring.SpringBeanLocator.getBeanOfType(SpringBeanLocator.java:128)
at
org.apache.cxf.bus.extension.ExtensionManagerBus.getExtension(ExtensionManagerBus.java:181)
at org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:104)
at org.apache.cxf.endpoint.ServerImpl.(ServerImpl.java:64) at
org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:182)
at
org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:211)
at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:460) at
org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:338) ... 62
more

Sample project: https://github.com/iancesar/webservice

Any ideias?
Thanks

Re: Problem running Spring Boot app with CXF

Posted by Ian Cesar Vidinha Rego <ia...@gmail.com>.
Hi Andy,
Thanks for your suggestion, i work with Felipe and we tried this approach,
unfortunately it didn't work. Others problemas relationated with Spring had
occurred. We decided to deploy Spring Boot applications only on Tomcat.

Thanks
Ian César

Em qua., 27 de nov. de 2019 às 18:56, Andy McCright <
j.andrew.mccright@gmail.com> escreveu:

> Hi Felipe,
>
> I'm not a TomEE guy - or even much of a JAX-WS guy, so take my advice with
> a grain of salt...
>
> I have seen problems like that in WebSphere and OpenLiberty - and that
> usually happens when the application archive(s) package the same jars as
> the runtime.  For example, I know that TomEE packages some CXF modules (as
> WebSphere and Liberty does) - and so if a user packaged those same CXF
> module jars in their application, then it is likely that they would see
> these ClassCastExceptions since the classes are loaded from different class
> loaders.
>
> I would start by checking your application archives (WARs/EARs/etc.) to see
> if it packages CXF.  If so, you may need to use the <scope>provided<scope>
> line in your pom.xml to avoid pulling in CXF jars.  Then you would use the
> CXF modules that are provided by TomEE - and there should no longer be any
> conflict.
>
> Hope this helps,
>
> Andy
>
> On Wed, Nov 27, 2019 at 12:57 PM Felipe Jaekel <fk...@gmail.com> wrote:
>
> > Hi,
> >
> > I have a Spring Boot (2.2.1) app that uses CXF for SOAP contract last web
> > services. It works fine with Tomcat (9.0.24), but when I try to run it on
> > TomEE (7.0.5, 8.0.0), I get the following exception:
> >
> > Caused by: java.lang.ClassCastException: Cannot cast
> > org.apache.cxf.management.jmx.InstrumentationManagerImpl to
> > org.apache.cxf.management.InstrumentationManager at
> > java.lang.Class.cast(Class.java:3369) at
> >
> >
> org.apache.cxf.bus.extension.ExtensionManagerImpl.getBeanOfType(ExtensionManagerImpl.java:307)
> > at
> >
> >
> org.apache.cxf.bus.spring.SpringBeanLocator.getBeanOfType(SpringBeanLocator.java:128)
> > at
> >
> >
> org.apache.cxf.bus.extension.ExtensionManagerBus.getExtension(ExtensionManagerBus.java:181)
> > at
> org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:104)
> > at org.apache.cxf.endpoint.ServerImpl.(ServerImpl.java:64) at
> >
> >
> org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:182)
> > at
> >
> >
> org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:211)
> > at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:460) at
> > org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:338) ... 62
> > more
> >
> > Sample project: https://github.com/iancesar/webservice
> >
> > Any ideias?
> > Thanks
> >
>

Re: Problem running Spring Boot app with CXF

Posted by Andy McCright <j....@gmail.com>.
Hi Felipe,

I'm not a TomEE guy - or even much of a JAX-WS guy, so take my advice with
a grain of salt...

I have seen problems like that in WebSphere and OpenLiberty - and that
usually happens when the application archive(s) package the same jars as
the runtime.  For example, I know that TomEE packages some CXF modules (as
WebSphere and Liberty does) - and so if a user packaged those same CXF
module jars in their application, then it is likely that they would see
these ClassCastExceptions since the classes are loaded from different class
loaders.

I would start by checking your application archives (WARs/EARs/etc.) to see
if it packages CXF.  If so, you may need to use the <scope>provided<scope>
line in your pom.xml to avoid pulling in CXF jars.  Then you would use the
CXF modules that are provided by TomEE - and there should no longer be any
conflict.

Hope this helps,

Andy

On Wed, Nov 27, 2019 at 12:57 PM Felipe Jaekel <fk...@gmail.com> wrote:

> Hi,
>
> I have a Spring Boot (2.2.1) app that uses CXF for SOAP contract last web
> services. It works fine with Tomcat (9.0.24), but when I try to run it on
> TomEE (7.0.5, 8.0.0), I get the following exception:
>
> Caused by: java.lang.ClassCastException: Cannot cast
> org.apache.cxf.management.jmx.InstrumentationManagerImpl to
> org.apache.cxf.management.InstrumentationManager at
> java.lang.Class.cast(Class.java:3369) at
>
> org.apache.cxf.bus.extension.ExtensionManagerImpl.getBeanOfType(ExtensionManagerImpl.java:307)
> at
>
> org.apache.cxf.bus.spring.SpringBeanLocator.getBeanOfType(SpringBeanLocator.java:128)
> at
>
> org.apache.cxf.bus.extension.ExtensionManagerBus.getExtension(ExtensionManagerBus.java:181)
> at org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:104)
> at org.apache.cxf.endpoint.ServerImpl.(ServerImpl.java:64) at
>
> org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:182)
> at
>
> org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:211)
> at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:460) at
> org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:338) ... 62
> more
>
> Sample project: https://github.com/iancesar/webservice
>
> Any ideias?
> Thanks
>

Re: Problem running Spring Boot app with CXF

Posted by Andy McCright <j....@gmail.com>.
Hi Felipe,

I'm not a TomEE guy - or even much of a JAX-WS guy, so take my advice with
a grain of salt...

I have seen problems like that in WebSphere and OpenLiberty - and that
usually happens when the application archive(s) package the same jars as
the runtime.  For example, I know that TomEE packages some CXF modules (as
WebSphere and Liberty does) - and so if a user packaged those same CXF
module jars in their application, then it is likely that they would see
these ClassCastExceptions since the classes are loaded from different class
loaders.

I would start by checking your application archives (WARs/EARs/etc.) to see
if it packages CXF.  If so, you may need to use the <scope>provided<scope>
line in your pom.xml to avoid pulling in CXF jars.  Then you would use the
CXF modules that are provided by TomEE - and there should no longer be any
conflict.

Hope this helps,

Andy

On Wed, Nov 27, 2019 at 12:57 PM Felipe Jaekel <fk...@gmail.com> wrote:

> Hi,
>
> I have a Spring Boot (2.2.1) app that uses CXF for SOAP contract last web
> services. It works fine with Tomcat (9.0.24), but when I try to run it on
> TomEE (7.0.5, 8.0.0), I get the following exception:
>
> Caused by: java.lang.ClassCastException: Cannot cast
> org.apache.cxf.management.jmx.InstrumentationManagerImpl to
> org.apache.cxf.management.InstrumentationManager at
> java.lang.Class.cast(Class.java:3369) at
>
> org.apache.cxf.bus.extension.ExtensionManagerImpl.getBeanOfType(ExtensionManagerImpl.java:307)
> at
>
> org.apache.cxf.bus.spring.SpringBeanLocator.getBeanOfType(SpringBeanLocator.java:128)
> at
>
> org.apache.cxf.bus.extension.ExtensionManagerBus.getExtension(ExtensionManagerBus.java:181)
> at org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:104)
> at org.apache.cxf.endpoint.ServerImpl.(ServerImpl.java:64) at
>
> org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:182)
> at
>
> org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:211)
> at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:460) at
> org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:338) ... 62
> more
>
> Sample project: https://github.com/iancesar/webservice
>
> Any ideias?
> Thanks
>