当前位置: 首页 > 知识库问答 >
问题:

在weblogic12.1.2.0.0上部署ApacheCXF

秦鸿羽
2023-03-14

我尝试在weblogic服务器上部署使用Spring apache cxf的应用程序。我一直收到这条错误消息:

javax。servlet。ServletException:Servlet类:org。阿帕奇。cxf。运输servlet。CXFServlet’不实现javax。servlet。weblogic上的Servlet。servlet。内部的StubSecurityHelper$ServletInitAction。在weblogic上运行(StubSecurityHelper.java:330)。servlet。内部的StubSecurityHelper$ServletInitAction。在weblogic上运行(StubSecurityHelper.java:288)。安全国际计算语言学协会。内部的认证的主题。weblogic上的doAs(AuthenticatedSubject.java:321)。安全服务安全经理。weblogic上的runAs(SecurityManager.java:120)。servlet。提供商。WlsObject句柄。在weblogic上运行(wlssObjectHandle.java:57)。servlet。内部的StubSecurityHelper。weblogic上的initServletInstance(StubSecurityHelper.java:98)。servlet。内部的StubSecurityHelper。weblogic上的createServlet(StubSecurityHelper.java:86)。servlet。内部的StubLifecycleHelper。weblogic上的createOneInstance(StubLifecycleHelper.java:74)。servlet。内部的StubLifecycleHelper。(StubLifecycleHelper.java:60)在weblogic。servlet。内部的StubLifecycleHelper。(StubLifecycleHelper.java:34)在weblogic。servlet。内部的ServletStubImpl。weblogic上的initStubLifecycleHelper(ServletStubImpl.java:652)。servlet。内部的ServletStubImpl。prepareservat(java.com)webletlogic。servlet。内部的WebAppServletContext。weblogic上的Preload Servlet(WebAppServletContext.java:1924)。servlet。内部的WebAppServletContext。在weblogic上加载ServletsOnStartup(WebAppServletContext.java:1901)。servlet。内部的WebAppServletContext。在weblogic上预装资源(WebAppServletContext.java:1791)。servlet。内部的WebAppServletContext。在weblogic上启动(WebAppServletContext.java:2807)。servlet。内部的WebAppModule。weblogic上的startContexts(WebAppModule.java:1661)。servlet。内部的WebAppModule。在weblogic上启动(WebAppModule.java:822)。应用内部的ExtensibleModuleWrapper$StartStateChange。下一步(ExtensibleModuleWrapper.java:360)在weblogic。应用内部的ExtensibleModuleWrapper$StartStateChange。下一步(ExtensibleModuleWrapper.java:356)在weblogic。应用乌提尔斯。国家机器驾驶员。weblogic上的nextState(StateMachineDriver.java:42)。应用内部的可扩展模块包装器。开始(ExtensibleModuleWrapper.java:138)

在我的网上。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应用程序。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上运行分析工具,告诉我添加Rest。

在glassfish上一切正常,所以应用程序本身应该是可以的。CXFServlet确实实现了Servlet(它扩展了GenericServlet)。

编辑:如果我不使用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]

共有1个答案

南门建章
2023-03-14

成功了。第一个问题是在

 <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应用程序中。xml添加

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

现在它适用于weblogic和glassfish。

 类似资料:
  • 我有个问题。我试图在WildFly服务器上部署一个应用程序。在尝试这样做时,我得到了一个错误,如下所示: 我搜索了一个解决方案,我找到了一个--我应该将jar添加到...但这无济于事!Wildfly正在尝试(当然没有任何努力)部署,但它失败了。然后我试图部署我的应用程序--同样的错误出现了:/ 干杯并感谢你事先给出的任何答案。

  • 当我试图在带有Jenkins和maven的weblogic 12c集群上重新部署EAR时,总是会出现以下错误: 我已经添加了

  • Python 2.7 64bit Django 1.3 WAMP 2.2(Apache 2.2.22)64位 mod_wsgi3.4 64位 Windows 7 64bit 由Django的start项目生成。位于默认 /myapp/myapp/wsgi.py 鉴于上述上下文,无法在WAMP上部署Django应用程序。 “Hello World”测试wsgi应用程序运行良好,因此我已确认mod_w

  • 我最近完成了我的第一个laravel站点,但现在我被部署卡住了。这对我来说是一个全新的概念。我的网络空间是由1 我尝试过几次教程,但似乎都不管用。基于此处的教程:将Laravel项目上载到Web服务器 我的服务器文件夹结构如下: (注意当第一次FTping我的服务器,没有www或html_docs,只有一个日志文件夹)。 在www上,我的索引。php更改为: 在laravel/引导/路径中。我更改

  • 当我试图将我的流星应用程序部署到Heroku时,它在引导时崩溃了。

  • TiCDC 是一款 TiDB 增量数据同步工具,本文介绍如何使用 TiDB Operator 在 Kubernetes 上部署 TiCDC。 前置条件 TiDB Operator 部署完成。 全新部署 TiDB 集群同时部署 TiCDC 参考 在标准 Kubernetes 上部署 TiDB 集群进行部署。 在现有 TiDB 集群上新增 TiCDC 组件 编辑 TidbCluster Custom