我尝试在Wildfly 10中使用CXF
实现更改默认(JAX-WS Metro
)实现。我必须执行大量步骤(遵循此link)并适应Wildfly 10
但是在服务器启动时,初始化时会出现异常。这是堆栈跟踪。看起来jboss __XMLInputFactory
仍然被实例化而不是Metro
。
任何想法?我试着用下面的类添加一个文件服务/ javax.xml.stream.XMLInputFactory,但没有运气。
com.sun.xml.internal.stream.XMLInputFactoryImpl
栈跟踪
com.sun.xml.ws.transport.http.servlet.WSServletException: WSSERVLET11: failed to parse runtime descriptor: java.lang.ExceptionInInitializerError
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:85)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Caused by: java.lang.RuntimeException: javax.servlet.ServletException: com.sun.xml.ws.transport.http.servlet.WSServletException: WSSERVLET11: failed to parse runtime descriptor: java.lang.ExceptionInInitializerError
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:231)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:100)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:82)
... 6 more
Caused by: javax.servlet.ServletException: com.sun.xml.ws.transport.http.servlet.WSServletException: WSSERVLET11: failed to parse runtime descriptor: java.lang.ExceptionInInitializerError
at com.sun.xml.ws.transport.http.servlet.WSServletContainerInitializer.onStartup(WSServletContainerInitializer.java:66)
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:184)
... 8 more
Caused by: com.sun.xml.ws.transport.http.servlet.WSServletException: WSSERVLET11: failed to parse runtime descriptor: java.lang.ExceptionInInitializerError
at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.parseAdaptersAndCreateDelegate(WSServletContextListener.java:137)
at com.sun.xml.ws.transport.http.servlet.WSServletContainerInitializer.onStartup(WSServletContainerInitializer.java:61)
... 9 more
Caused by: java.lang.ExceptionInInitializerError
at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parse(DeploymentDescriptorParser.java:144)
at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.parseAdaptersAndCreateDelegate(WSServletContextListener.java:127)
... 10 more
Caused by: java.lang.ClassCastException: __redirected.__XMLInputFactory cannot be cast to javax.xml.stream.XMLInputFactory
at javax.xml.stream.XMLInputFactory.newInstance(XMLInputFactory.java:136)
at com.sun.xml.ws.api.streaming.XMLStreamReaderFactory.getXMLInputFactory(XMLStreamReaderFactory.java:109)
at com.sun.xml.ws.api.streaming.XMLStreamReaderFactory.<clinit>(XMLStreamReaderFactory.java:78)
... 12 more
答案 0 :(得分:0)
我发现这是由classloader
问题导致XMLInputFactoryImpl
加载到多个类加载器中。我的问题中提到的步骤在wildfly
版本中不起作用,因为它与其前身不同。
我已设法找到自己的方式Metro
wildfly 10
如下工作。
- 将地铁实施打包在耳中。并且不需要其他模块破解。 (参考pom.xml)
- 删除了默认的webservice模块(请参阅jboss-deployment-structure.xml)
- 为每个EJB添加了JNDI查找以在WAR中引用它们。因此,由于此过程,CDI注入
@EJB
看起来不起作用 将不得不使用JNDI。
<强>的JBoss部署-structure.xml 强>
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<!-- This means that the sub deployments of the EAR will have automatic
dependencies on each other except for WAR sub deployments. -->
<ear-subdeployments-isolated>false</ear-subdeployments-isolated>
<deployment>
<exclude-subsystems>
<subsystem name="webservices" />
<subsystem name="jaxrs" />
</exclude-subsystems>
<!-- needed for SOAPHandler otherwise not required. -->
<dependencies>
<module name="com.sun.xml.messaging.saaj" export="true" services="export" />
</dependencies>
</deployment>
</jboss-deployment-structure>
<强>的pom.xml 强>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>webservices-rt</artifactId>
<version>2.1-b16</version>
</dependency>
<dependency>
<groupId>javax.xml</groupId>
<artifactId>webservices-api</artifactId>
<version>2.1-b16</version>
</dependency>
<dependency>
<groupId>com.sun.tools.ws</groupId>
<artifactId>webservices-tools</artifactId>
<version>2.1-b16</version>
</dependency>
<dependency>
<groupId>javax.xml</groupId>
<artifactId>webservices-extra-api</artifactId>
<version>2.1-b16</version>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>webservices-extra</artifactId>
<version>2.1-b16</version>
</dependency>
JNDI查找
// get the deployed name from startup log for each EJBs deployed
deployedName = "java:global/example-ear-2.0-SNAPSHOT/logic/ExampleBean!org.example.com.ExampleBean";
T ejb = (T) initialContext.lookup(deployedName);