CXF Rest service in Websphere 8.5

258 Views Asked by At
>  webapp        E com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E: [Servlet Error]-[CXFServlet]: org.apache.cxf.bus.extension.ExtensionException`
        `at org.apache.cxf.bus.extension.Extension.load(Extension.java:114)
        at org.apache.cxf.bus.extension.ExtensionManagerImpl.loadAndRegister(ExtensionManagerImpl.java:183)
        at org.apache.cxf.bus.extension.ExtensionManagerImpl.processExtension(ExtensionManagerImpl.java:158)
        at org.apache.cxf.bus.extension.ExtensionManagerImpl.loadFragment(ExtensionManagerImpl.java:151)
        at org.apache.cxf.bus.extension.ExtensionManagerImpl.load(ExtensionManagerImpl.java:143)
        at org.apache.cxf.bus.extension.ExtensionManagerImpl.load(ExtensionManagerImpl.java:96)
        at org.apache.cxf.bus.extension.ExtensionManagerBus.<init>(ExtensionManagerBus.java:129)
        at org.apache.cxf.bus.CXFBusFactory.createBus(CXFBusFactory.java:41)
        at org.apache.cxf.bus.CXFBusFactory.createBus(CXFBusFactory.java:37)
        at org.apache.cxf.bus.CXFBusFactory.createBus(CXFBusFactory.java:33)
        at org.apache.cxf.transport.servlet.CXFNonSpringServlet.loadBusNoConfig(CXFNonSpringServlet.java:45)
        at org.apache.cxf.transport.servlet.CXFNonSpringServlet.loadBus(CXFNonSpringServlet.java:38)
        at org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet.loadBus(CXFNonSpringJaxrsServlet.java:69)
        at org.apache.cxf.transport.servlet.AbstractCXFServlet.init(AbstractCXFServlet.java:84)
        at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:344)
        at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.init(ServletWrapperImpl.java:168)
        at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:636)
        at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:480)
        at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
        at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:136)
        at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:97)
        at com.ibm.controller.InterceptFilter.doFilter(InterceptFilter.java:28)
        at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
        at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
        at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:967)
        at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1107)
        at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3951)
        at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
        at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1014)
        at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1817)
        at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200)
        at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:463)
        at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:530)
        at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:316)
        at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:287)
        at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
        at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
        at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
        at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
        at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
        at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
        at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
        at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
        at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
        at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1892)
Caused by: java.lang.InstantiationException: org.apache.cxf.wstx_msv_validation.WoodstoxValidationImpl
        at java.lang.J9VMInternals.newInstanceImpl(Native Method)
        at java.lang.Class.newInstance(Class.java:1781)
        at org.apache.cxf.bus.extension.Extension.load(Extension.java:110)
        ... 44 more>

Below JARS i have used

cxf-core-3.1.6.jar

cxf-rt-frontend-jaxrs-3.1.6.jar

cxf-rt-transports-http-3.1.6.jar

javax.ws.rs-api-2.0.1.jar

 <servlet>
        <servlet-name>CXFServlet</servlet-name>
        <servlet-class>org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet</servlet-class>
        <init-param>
            <param-name>javax.ws.rs.Application</param-name>
            <param-value>com.ibm.services.rest.Echo</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>CXFServlet</servlet-name>
        <url-pattern>/services/*</url-pattern>
    </servlet-mapping>

can anyone help me to fix this.. i am using CXF 3.16, WAS 8.5, JDK 1.7. WoodstoxValidationImpl is availabe in the cxf-core jar but dont why i am getting this error

1

There are 1 best solutions below

0
Andy McCright On

You may want to check with the CXF users mailing list to see if the community has seen this before or open an JIRA issue. In short, I don't see how the WoodstoxValidationImpl class would fail to initialize - it's constructor includes a try/catch block that handles all Throwables. Hopefully the CXF community will be able to provide more assistance.

I would advise upgrading to WebSphere v9 or WebSphere Liberty before going too far down this path. WebSphere v8.5 ships with the JAX-RS 1.1 APIs and there is no way to "turn them off" so the only way you will be able to load your JAX-RS 2.0 APIs from the jar in your app would be to use parent-last classloading (or other such classloading hacks). WAS v9 and Liberty both provide the 2.0 (and Liberty also provides 2.1) APIs, but more importantly, they both allow you to disable the APIs if you want. Also, FWIW, both WAS v9 and Liberty use CXF as the underlying JAX-RS implementation, so you can use a thinner WAR and still get the JAX-RS implementation you are looking for.

HTH, Andy