Разверните ApacheCXF на weblogic 12.1.2.0.0

Я пытаюсь развернуть мое приложение, которое использует Spring + apache cxf на сервере weblogic. Я продолжаю получать это сообщение об ошибке:

javax.servlet.ServletException: класс сервлета: org.apache.cxf.transport.servlet.CXFServlet 'не реализует javax.servlet.Servlet в weblogic.servlet.internal.StubSecurityHelper $ ServletInitAction.run(StubSecurityHelper.java:330) в weblogic.servlet.internal.StubSecurityHelper $ ServletInitAction.run(StubSecurityHelper.java:288) в weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) в weblogic.security.service.SecurityManager.runAs(SecurityManager.java: 120) в weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57) в weblogic.servlet.internal.StubSecurityHelper.initServletInstance(StubSecurityHelper.java:98) в weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper. java: 86) в weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:74) в weblogic.servlet.internal.StubLifecycleHelper. (StubLifecycleHelper.java:60) в weblogic.servlet.internal.StubLifecycleHelper. (StubLifecycleH elper.java:34) в weblogic.servlet.internal.ServletStubImpl.initStubLifecycleHelper(ServletStubImpl.java:652) в weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:593) в weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1924) в weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1901) в weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1791) в weblogic.servlet.internal.WebAppServletContext. start (WebAppServletContext.java:2807) в weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1661) в weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:822) в weblogic.application.internal.ExtensibleModuleWrapper $ StartStateChange.next(ExtensibleModuleWrapper.java:360) в weblogic.application.internal.ExtensibleModuleWrapper $ StartStateChange.next(ExtensibleModuleWrapper.java:356) в weblogic.application.utils.StateMach ineDriver.nextState(StateMachineDriver.java:42) в weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:138)

В моем 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>

и мой 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>

Я использовал это, чтобы добавить необходимый пакет, а затем запустить инструмент анализа на weblogic, который сказал мне добавить отдых.

На стеклянной рыбке все работает нормально, поэтому само приложение должно быть в порядке. И CXFServlet действительно реализует Servlet (он расширяет GenericServlet).

EDIT: Если я не использую weblogic-application.xml, он развертывается, однако я продолжаю получать

 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]
0
источник поделиться
1 ответ

Сделал работу. Первая проблема заключалась в

 <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>

и это вызвало

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

и это переместило меня на вторую проблему:

 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

для этого мне нужно было добавить две библиотеки в мой 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>

а затем в weblogic-application.xml add

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

Теперь он работает как на weblogic, так и на стеклянной платке.

0
источник

Посмотрите другие вопросы по меткам или Задайте вопрос