简体   繁体   English

在tomcat下的web应用程序中运行webservice jax-ws客户端

[英]run webservice jax-ws client in a web app under tomcat

All service classes in my case extend javax.xml.ws.Service. 在我的例子中,所有服务类都扩展了javax.xml.ws.Service。

But real invocations as I see work through 3-rd party libraries under the hood. 但真正的调用,因为我看到通过引擎盖下的第三方库工作。 In my case tomcat uses Axis2. 在我的情况下,tomcat使用Axis2。

First I should ask, what jars Tomcat uses to run a web-service ? 首先我要问一下, Tomcat用来运行Web服务的jar是什么

Second, is there a way to change them? 第二,有没有办法改变它们?

Third, what does this exception mean? 第三, 这个例外是什么意思? It needs another jar file in Tomcat/lib directory ? 它需要Tomcat / lib目录中的另一个jar文件吗?

got this stack trace when trying to invoke a web-service client generated: 在尝试调用生成的Web服务客户端时获得此堆栈跟踪:

17:23:21    12.05.2010      caused by: java.lang.NoClassDefFoundError: org/apache/axiom/om/OMNode
17:23:21    12.05.2010      at org.apache.axis2.deployment.DescriptionBuilder.buildOM(DescriptionBuilder.java:96)
17:23:21    12.05.2010      at org.apache.axis2.deployment.AxisConfigBuilder.populateConfig(AxisConfigBuilder.java:79)
17:23:21    12.05.2010      at org.apache.axis2.deployment.DeploymentEngine.populateAxisConfiguration(DeploymentEngine.java:615)
17:23:21    12.05.2010      at org.apache.axis2.deployment.FileSystemConfigurator.getAxisConfiguration(FileSystemConfigurator.java:115)
17:23:21    12.05.2010      at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:64)
17:23:21    12.05.2010      at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem(ConfigurationContextFactory.java:180)
17:23:21    12.05.2010      at org.apache.axis2.jaxws.ClientConfigurationFactory.getClientConfigurationContext(ClientConfigurationFactory.java:51)
17:23:21    12.05.2010      at org.apache.axis2.jaxws.description.impl.DescriptionFactoryImpl.createServiceDescription(DescriptionFactoryImpl.java:74)
17:23:21    12.05.2010      at org.apache.axis2.jaxws.description.DescriptionFactory.createServiceDescription(DescriptionFactory.java:67)
17:23:21    12.05.2010      at org.apache.axis2.jaxws.spi.ServiceDelegate.(ServiceDelegate.java:84)
17:23:21    12.05.2010      at org.apache.axis2.jaxws.spi.Provider.createServiceDelegate(Provider.java:45)
17:23:21    12.05.2010      at javax.xml.ws.Service.(Service.java:56)

1/ Tomcat does not come with a default Web service implementation. 1 / Tomcat没有默认的Web服务实现。 Axis2 has been placed either in the webapp you deployed in Tomcat, or directly in the Tomcat lib directory. Axis2已放置在您在Tomcat中部署的webapp中,或直接放在Tomcat lib目录中。 This second option is generally not suggested. 通常不建议使用第二种选择。

Let's imagine you have webapp1 which uses Axis2 version 1.4 and webapp2 which uses Axis2 version 1.5. 让我们假设你有使用Axis2版本1.4的webapp1和使用Axis2版本1.5的webapp2。 Version 1.4 and 1.5 have different dependencies, so you'll end up having class loading errors when Tomcat starts if you mix the dependencies up. 版本1.4和1.5具有不同的依赖关系,因此如果混合依赖项,Tomcat启动时最终会出现类加载错误。

Please refer to Tomcat documentation about class loading for more details. 有关更多详细信息,请参阅有关类加载的Tomcat文档

2/ Let's consider you've placed the Axis2 libraries in the webapp you've deployed within Tomcat. 2 /让我们考虑您已将Axis2库放置在Tomcat中部署的webapp中。 You could use Apache CXF or Sun JAX-WS RI in place of Axis2. 您可以使用Apache CXF或Sun JAX-WS RI代替Axis2。

If you want to use Sun JAX-WS RI, make sure you place all the libraries and all their dependencies in your webapp. 如果要使用Sun JAX-WS RI,请确保将所有库及其所有依赖项放在Web应用程序中。 Tomcat will use the implementation he loads in the webapp context. Tomcat将使用他在webapp上下文中加载的实现。 If tomcat/lib has Axis2 libraries, it might create class loading issues (see 1/). 如果tomcat / lib具有Axis2库,则可能会产生类加载问题(请参阅1 /)。

3/ Axis2 1.5 has some dependencies. 3 / Axis2 1.5有一些依赖性。 It seems the library axiom-api-1.2.8.jar is missing from your classpath. 似乎你的类路径中缺少库axiom-api-1.2.8.jar

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM