异常即将发生:java.util.ServiceConfigurationError [英] Exception coming: java.util.ServiceConfigurationError

查看:162
本文介绍了异常即将发生:java.util.ServiceConfigurationError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在运行我的应用程序时获得以下异常:

Getting below exception while running my application :

我使用的是jboss:5.1.1和jdk 1.6。

I am using jboss : 5.1.1 and jdk 1.6.

01:50:04,828 ERROR [[HelloWorld]] Servlet.service() for servlet HelloWorld threw exception
java.util.ServiceConfigurationError: javax.xml.ws.spi.Provider: Provider org.jboss.ws.core.jaxws.spi.ProviderImpl not a subtype
    at java.util.ServiceLoader.fail(Unknown Source)
    at java.util.ServiceLoader.access$300(Unknown Source)
    at java.util.ServiceLoader$LazyIterator.next(Unknown Source)
    at java.util.ServiceLoader$1.next(Unknown Source)
    at javax.xml.ws.spi.Provider.getProviderUsingServiceLoader(Provider.java:146)
    at javax.xml.ws.spi.Provider.provider(Provider.java:106)
    at javax.xml.ws.Service.<init>(Service.java:57)
    at com.service_instance.ServiceInstance.<init>(ServiceInstance.java:50)
    at com.getBusinessApp(CMDB.java:239)
    at com.test.HelloWorld.doGet(HelloWorld.java:51)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
    at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
    at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Unknown Source)

让我知道。如何解决这个问题。这似乎是一些lib问题。

Let m know. How to resolve this. It seems like some lib issue.

推荐答案

我在使用 Mobicents Jain Slee ,运行在JBoss AS 5.1.0 GA之上。网关必须通过SOAP连接到服务器,所以我选择了JAX-WS并使用 wsimport
那么,我使用类似的程序来这个用于创建子Maven项目并为JAX-WS生成java文件。

I had the same problem deploying a USSD gateway with Mobicents Jain Slee, that runs on top of a JBoss AS 5.1.0 GA. The gateway has to connect to a server via SOAP, so I chose JAX-WS and generated the source code from a WSDL with wsimport. By the way, I used a similar procedure to this one to create a child Maven project and generate the java files for JAX-WS.

我的第一种方法是将所有依赖项包含在部署的.war文件中JBoss的。
我认为这是默认在Maven中实现的,而 mvn install 会这样做。
从长远来看,这种方法失败了,但至少我需要知道.war文件中包含的jar文件列表,稍后将它们复制到JBoss目录中。

My first approach was to include all the dependencies in the .war file that is deployed in JBoss. I think this is achieved by default in Maven, and mvn install will do it. In the long run, this approach failed, but at least I needed to know the list of jar files that were included in the .war file, to copy them later in a JBoss directory.

我用这种方法进行了很多故障排除,并且有许多不同的日志错误,但主要的是这个:

I made a lot of troubleshooting with this approach, and had many different log errors, though the main one was this:

java.util.ServiceConfigurationError: javax.xml.ws.spi.Provider: Provider org.jboss.ws.core.jaxws.spi.ProviderImpl not a subtype






无依赖性部署



Maven tweak



因此,我将< scope>< / scope> 添加到JAX-WS依赖项中。类似于:


Deploy without dependencies

Maven tweak

So insted, I added <scope>provided</scope> to the JAX-WS dependencies. Something like:

<dependency>
    <groupId>com.sun.xml.ws</groupId>
    <artifactId>jaxws-rt</artifactId>
    <version>2.2</version>
    <scope>provided</scope>
</dependency>
<dependency>
    <groupId>com.sun.istack</groupId>
    <artifactId>istack-commons-runtime</artifactId>
    <version>2.2</version>
    <scope>provided</scope>
</dependency>

这产生了一个更轻的.war文件。

This produced a much lighter .war file.

现在,在部署.war文件后,当我的SOAP客户端尝试连接到Web服务时,它抛出异常:

Now, after deploying the .war file, when my SOAP client tried to connect to the Web Service, and it throwed the exception:

org.jboss.ws.metadata.wsdl.WSDLException: Invalid default namespace: null
at org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory.parse(WSDLDefinitionsFactory.java:134)
at org.jboss.ws.metadata.umdm.ServiceMetaData.getWsdlDefinitions(ServiceMetaData.java:293)
at org.jboss.ws.metadata.builder.jaxws.JAXWSClientMetaDataBuilder.buildMetaData(JAXWSClientMetaDataBuilder.java:84)
at org.jboss.ws.core.jaxws.spi.ServiceDelegateImpl.<init>(ServiceDelegateImpl.java:138)
at org.jboss.ws.core.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:63)
at javax.xml.ws.Service.<init>(Service.java:79)
at org.ortelius.UssdServiceImplementation.<init>(UssdServiceImplementation.java:42)
at org.ortelius.OrteliusClient.sendUssdRequestToWs(OrteliusClient.java:28)

似乎 javax.xml.ws.Service 调用 org.jboss.ws.core.jaxws.spi.ProviderImpl ,但它应该调用 com.sun.xml.ws .spi.ProviderImpl ,所以似乎与jar依赖项存在冲突。

It seems that javax.xml.ws.Service calls org.jboss.ws.core.jaxws.spi.ProviderImpl, but it should be calling com.sun.xml.ws.spi.ProviderImpl, so it seems there is a conflict with jar dependencies.

为了避免这个问题,有必要:

To avoid this problem, it was necessary to:


  1. 移动或删除在 $ JBOSS_HOME / lib / endorsed / 目录中找到的所有JBoss jar文件。

  2. 将我最初的.war文件(失败的部署之一)中捆绑的jar复制到 $ JBOSS_HOME / lib / endorsed / 目录。
    捆绑在我.war文件中的所有罐子。

  1. Move or delete all JBoss jar files found in $JBOSS_HOME/lib/endorsed/ directory.
  2. Copy the jars bundled in my initial .war file (the one of the failed deploy) to $JBOSS_HOME/lib/endorsed/ directory. all the jars bundled in my .war file.

这基本上就是它。

我必须承认,发现这是真实的痛苦,我花了大约四天的时间来解决这个问题。运行。
我对jar依赖项进行了大量的故障排除,检查JBoss日志,远程调试,比较Java包和&类版本,在线搜索jar并阅读JBoss手册,博客,StackOverflow,JavaRanch等许多文章...

I have to confess that to find this out was a real pain, and it took me about four days to get this up & running. I made a lot of troubleshooting with the jar dependencies, checking JBoss logs, remote debugging, comparing Java packages & classes versions, searching for jars online and reading many articles from JBoss manuals, blogs, StackOverflow, JavaRanch, etc...

SOAP客户端非常简单,但<强大>在JBoss中部署非常有问题。
我的解决方案不是很正统,因为它在很大程度上取决于jar文件的依赖性。
所以我不确定它是否适合所有人。

The SOAP client was really simple, but the deployment in JBoss was pretty problematic. My solution is not very orthodox, since it depends greatly on the jar files dependencies. So I'm not sure if it will work for everyone.

问候。

这篇关于异常即将发生:java.util.ServiceConfigurationError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆