0
votes

I try to deploy my application that uses spring+apache cxf on weblogic server. I keep getting this error message:

javax.servlet.ServletException: Servlet class: org.apache.cxf.transport.servlet.CXFServlet' does not implement javax.servlet.Servlet at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:330) at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:288) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57) at weblogic.servlet.internal.StubSecurityHelper.initServletInstance(StubSecurityHelper.java:98) at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:86) at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:74) at weblogic.servlet.internal.StubLifecycleHelper.(StubLifecycleHelper.java:60) at weblogic.servlet.internal.StubLifecycleHelper.(StubLifecycleHelper.java:34) at weblogic.servlet.internal.ServletStubImpl.initStubLifecycleHelper(ServletStubImpl.java:652) at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:593) at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1924) at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1901) at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1791) at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:2807) at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1661) at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:822) at weblogic.application.internal.ExtensibleModuleWrapper$StartStateChange.next(ExtensibleModuleWrapper.java:360) at weblogic.application.internal.ExtensibleModuleWrapper$StartStateChange.next(ExtensibleModuleWrapper.java:356) at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42) at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:138)

In my web.xml:

 <servlet>
        <description>Apache CXF Endpoint</description>
        <display-name>cxf</display-name>
        <servlet-name>cxf</servlet-name>
        <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
  <servlet-mapping>
        <servlet-name>cxf</servlet-name>
        <url-pattern>/ksas4/*</url-pattern>
    </servlet-mapping>

weblogic.xml:

<?xml version="1.0" encoding="UTF-8" ?>
<weblogic-web-app
        xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-web-app
        http://http://www.oracle.com/technology/weblogic/weblogic-web-app/1.1/weblogic-web-app.xsd">


    <container-descriptor>
        <show-archived-real-path-enabled>true</show-archived-real-path-enabled>
        <prefer-web-inf-classes>true</prefer-web-inf-classes>
    </container-descriptor>
</weblogic-web-app>

and my weblogic-application.xml:

<?xml version="1.0" encoding="UTF-8"?>
<weblogic-application xmlns="http://xmlns.oracle.com/weblogic/weblogic-application">

  <application-param>
    <param-name>webapp.encoding.default</param-name>
    <param-value>UTF-8</param-value>
  </application-param>

  <prefer-application-packages>
    <package-name>com.ctc.wstx.*</package-name>
    <package-name>javax.jws.*</package-name>
    <package-name>com.sun.xml.*</package-name>
    <package-name>javax.xml.bind.*</package-name>
    <package-name>org.slf4j.*</package-name>
    <package-name>ch.qos.logback.*</package-name>

    <!--<package-name>org.apache.cxf.*</package-name>-->
    <package-name>org.apache.xml.security.*</package-name>
    <package-name>antlr.*</package-name>
    <package-name>com.google.common.*</package-name>
    <package-name>com.sun.istack.*</package-name>
    <package-name>javax.annotation.*</package-name>
    <package-name>javax.annotation.security.*</package-name>
    <package-name>javax.annotation.sql.*</package-name>
    <package-name>javax.mail.*</package-name>
    <package-name>javax.mail.event.*</package-name>
    <package-name>javax.mail.internet.*</package-name>
    <package-name>javax.mail.search.*</package-name>
    <package-name>javax.mail.util.*</package-name>
    <package-name>javax.servlet.*</package-name>
    <package-name>javax.servlet.annotation.*</package-name>
    <package-name>javax.servlet.descriptor.*</package-name>
    <package-name>javax.servlet.http.*</package-name>
    <package-name>javax.wsdl.*</package-name>
    <package-name>javax.wsdl.extensions.*</package-name>
    <package-name>javax.wsdl.factory.*</package-name>
    <package-name>javax.wsdl.xml.*</package-name>
    <package-name>javax.xml.stream.*</package-name>
    <!--<package-name>javax.xml.ws.*</package-name>-->
    <package-name>org.bouncycastle.*</package-name>
    <package-name>org.bouncycastle.*</package-name>
    <package-name>org.bouncycastle.asn1.*</package-name>
    <package-name>org.bouncycastle.crypto.*</package-name>
    <package-name>org.bouncycastle.i18n.*</package-name>
    <package-name>org.bouncycastle.jce.*</package-name>
    <package-name>org.bouncycastle.math.*</package-name>
    <package-name>org.bouncycastle.util.*</package-name>
    <package-name>org.bouncycastle.x509.*</package-name>
    <package-name>org.codehaus.stax2.*</package-name>
    <package-name>org.joda.time.*</package-name>
    <package-name>org.jvnet.fastinfoset.*</package-name>
    <package-name>org.objectweb.asm.*</package-name>
    <package-name>org.opensaml.soap.*</package-name>
  </prefer-application-packages>

</weblogic-application>

I used this to add needed package and then ran analysis tool on weblogic that told me to add rest.

On glassfish everything works ok, so application itself should be ok. And CXFServlet does implement Servlet ( it extends GenericServlet ).

EDIT: If i don't use weblogic-application.xml, it gets deployed, however i keep getting

 o.a.c.p.PhaseInterceptorChain - Interceptor for {xxx}zzz
has thrown exception, unwinding now
org.apache.cxf.binding.soap.SoapFault: Error reading XMLStreamReader.
        at org.apache.cxf.binding.soap.saaj.SAAJInInterceptor$SAAJPreInInterceptor.handleMessage(SAA
JInInterceptor.java:146) ~[cxf-rt-bindings-soap-3.1.4.jar:3.1.4]
        at org.apache.cxf.binding.soap.saaj.SAAJInInterceptor$SAAJPreInInterceptor.handleMessage(SAA
JInInterceptor.java:108) ~[cxf-rt-bindings-soap-3.1.4.jar:3.1.4]
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) ~[
cxf-core-3.1.4.jar:3.1.4]
        at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:1
21) [cxf-core-3.1.4.jar:3.1.4]
        at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java
:251) [cxf-rt-transports-http-3.1.4.jar:3.1.4]
        at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.ja
va:234) [cxf-rt-transports-http-3.1.4.jar:3.1.4]
        at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208) [cx
f-rt-transports-http-3.1.4.jar:3.1.4]
        at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160) [cx
f-rt-transports-http-3.1.4.jar:3.1.4]
        at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:180)
 [cxf-rt-transports-http-3.1.4.jar:3.1.4]
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.ja
va:293) [cxf-rt-transports-http-3.1.4.jar:3.1.4]
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:212)
 [cxf-rt-transports-http-3.1.4.jar:3.1.4]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:751) [weblogic.server.merged.jar:
12.1.2.0.0]
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:268
) [cxf-rt-transports-http-3.1.4.jar:3.1.4]
        at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.
java:280) [weblogic.server.merged.jar:12.1.2.0.0]
        at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.
java:254) [weblogic.server.merged.jar:12.1.2.0.0]
        at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:136) [
weblogic.server.merged.jar:12.1.2.0.0]
        at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:341) [weblogic.ser
ver.merged.jar:12.1.2.0.0]
        at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:238) [weblogic.ser
ver.merged.jar:12.1.2.0.0]
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServ
letContext.java:3363) [weblogic.server.merged.jar:12.1.2.0.0]
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletC
ontext.java:3333) [weblogic.server.merged.jar:12.1.2.0.0]
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) [
weblogic.server.merged.jar:12.1.2.0.0]
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) [com.oracle.css
.weblogic.security.wls_7.0.0.0.jar:CSS 7.0 0.0]
        at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57) [weblogic.server
.merged.jar:12.1.2.0.0]
        at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java
:2220) [weblogic.server.merged.jar:12.1.2.0.0]
        at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2
146) [weblogic.server.merged.jar:12.1.2.0.0]
        at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2124) [w
eblogic.server.merged.jar:12.1.2.0.0]
        at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1564) [weblogic.
server.merged.jar:12.1.2.0.0]
        at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSu
pportProviderImpl.java:254) [weblogic.server.merged.jar:12.1.2.0.0]
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:295) [weblogic.server.merged.jar:1
2.1.2.0.0]
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:254) [weblogic.server.merged.jar:12.1.
2.0.0]
Caused by: javax.xml.soap.SOAPException: Unable to create message factory for SOAP: oracle.j2ee.ws.s
aaj.soap.MessageFactoryImpl cannot be cast to javax.xml.soap.MessageFactory
        at javax.xml.soap.MessageFactory.newInstance(MessageFactory.java:125) ~[saaj-api-1.3.4.jar:1
.7.0_67]
        at org.apache.cxf.binding.soap.saaj.SAAJFactoryResolver.createMessageFactory(SAAJFactoryReso
lver.java:62) ~[cxf-rt-bindings-soap-3.1.4.jar:3.1.4]
        at org.apache.cxf.binding.soap.saaj.SAAJInInterceptor$SAAJPreInInterceptor.getFactory(SAAJIn
Interceptor.java:158) ~[cxf-rt-bindings-soap-3.1.4.jar:3.1.4]
        at org.apache.cxf.binding.soap.saaj.SAAJInInterceptor$SAAJPreInInterceptor.handleMessage(SAA
JInInterceptor.java:134) ~[cxf-rt-bindings-soap-3.1.4.jar:3.1.4]
        ... 29 common frames omitted
08:09:22.195 [[ACTIVE] ExecuteThread: '15' for queue: 'weblogic.kernel.Default (self-tuning)'] WARN
 o.a.c.p.PhaseInterceptorChain - Interceptor for {xxx}zzz
has thrown exception, unwinding now
java.lang.NumberFormatException: null
        at java.lang.Integer.parseInt(Integer.java:454) ~[na:1.7.0_67]
        at java.lang.Integer.valueOf(Integer.java:582) ~[na:1.7.0_67]
        at webservice.interceptors.FaultOutInterceptor.handleMessage(FaultOutInterceptor.java:56) ~[
_wl_cls_gen.jar:na]
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) [c
xf-core-3.1.4.jar:3.1.4]
        at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultCha
inInitiatorObserver.java:112) [cxf-core-3.1.4.jar:3.1.4]
        at org.apache.cxf.phase.PhaseInterceptorChain.wrapExceptionAsFault(PhaseInterceptorChain.jav
a:366) [cxf-core-3.1.4.jar:3.1.4]
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:324) [c
xf-core-3.1.4.jar:3.1.4]
        at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:1
21) [cxf-core-3.1.4.jar:3.1.4]
        at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java
:251) [cxf-rt-transports-http-3.1.4.jar:3.1.4]
        at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.ja
va:234) [cxf-rt-transports-http-3.1.4.jar:3.1.4]
        at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208) [cx
f-rt-transports-http-3.1.4.jar:3.1.4]
        at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160) [cx
f-rt-transports-http-3.1.4.jar:3.1.4]
        at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:180)
 [cxf-rt-transports-http-3.1.4.jar:3.1.4]
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.ja
va:293) [cxf-rt-transports-http-3.1.4.jar:3.1.4]
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:212)
 [cxf-rt-transports-http-3.1.4.jar:3.1.4]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:751) [weblogic.server.merged.jar:
12.1.2.0.0]
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:268
) [cxf-rt-transports-http-3.1.4.jar:3.1.4]
        at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.
java:280) [weblogic.server.merged.jar:12.1.2.0.0]
        at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.
java:254) [weblogic.server.merged.jar:12.1.2.0.0]
        at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:136) [
weblogic.server.merged.jar:12.1.2.0.0]
        at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:341) [weblogic.ser
ver.merged.jar:12.1.2.0.0]
        at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:238) [weblogic.ser
ver.merged.jar:12.1.2.0.0]
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServ
letContext.java:3363) [weblogic.server.merged.jar:12.1.2.0.0]
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletC
ontext.java:3333) [weblogic.server.merged.jar:12.1.2.0.0]
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) [
weblogic.server.merged.jar:12.1.2.0.0]
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) [com.oracle.css
.weblogic.security.wls_7.0.0.0.jar:CSS 7.0 0.0]
        at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57) [weblogic.server
.merged.jar:12.1.2.0.0]
        at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java
:2220) [weblogic.server.merged.jar:12.1.2.0.0]
        at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2
146) [weblogic.server.merged.jar:12.1.2.0.0]
        at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2124) [w
eblogic.server.merged.jar:12.1.2.0.0]
        at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1564) [weblogic.
server.merged.jar:12.1.2.0.0]
        at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSu
pportProviderImpl.java:254) [weblogic.server.merged.jar:12.1.2.0.0]
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:295) [weblogic.server.merged.jar:1
2.1.2.0.0]
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:254) [weblogic.server.merged.jar:12.1.
2.0.0]
1

1 Answers

0
votes

Made it work. First problem was in

 <package-name>javax.servlet.*</package-name>
    <package-name>javax.servlet.annotation.*</package-name>
    <package-name>javax.servlet.descriptor.*</package-name>
    <package-name>javax.servlet.http.*</package-name>

and that caused

javax.servlet.ServletException: Servlet class: org.apache.cxf.transport.servlet.CXFServlet
 does not implement javax.servlet.Servlet

and that moved me on to second problem :

 javax.xml.soap.SOAPException: Unable to create message factory for SOAP: oracle.j2ee.ws.s
aaj.soap.MessageFactoryImpl cannot be cast to javax.xml.soap.MessageFactory

to resolve this I needed to add two libraries in my POM

 <dependency>
      <groupId>com.sun.xml.messaging.saaj</groupId>
      <artifactId>saaj-impl</artifactId>
      <version>1.3.5</version>
    </dependency>
    <dependency>
      <groupId>javax.xml.soap</groupId>
      <artifactId>saaj-api</artifactId>
      <version>1.3.5</version>
    </dependency>

and then in weblogic-application.xml add

 <package-name>com.sun.xml.messaging.saaj.*</package-name>
 <package-name>javax.xml.soap.*</package-name>

Now it works both on weblogic and glassfish.