首页 文章

weblogic上的@Webservice注释异常

提问于
浏览
5

我正在尝试使用JDK 1.6.0_31-b05中的JDeveloper 11g R2(11.1.2.3.0)运行包含JAX WS(2.1)Webservice的应用程序 . 该错误来自该类中存在的@WebService注释 .
当我运行应用程序时,我收到以下错误,

java.lang.IllegalArgumentException:Argument(s)“type”不能为null .
在com.sun.xml.bind.api.TypeReference . <init>(TypeReference.java:89)
at com.sun.xml.ws.model.RuntimeModeler.processDocWrappedMethod(RuntimeModeler.java:758)
在com.sun.xml.ws.model.RuntimeModeler.processMethod(RuntimeModeler.java:678)
at com.sun.xml.ws.model.RuntimeModeler.processClass(RuntimeModeler.java:428)
at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:277)
at com.sun.xml.ws.server.EndpointFactory.createSEIModel(EndpointFactory.java:363)
at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:202)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:496)
在com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:539)
在weblogic.wsee.jaxws.JAXWSDeployedServlet.getEndpoint(JAXWSDeployedServlet.java:183)

嵌入式Web Logic似乎使用内部库而不是JDK提供的库 . JDK rt.jar中的类 RuntimeModelerTypeReference 以包com.sun.xml.ws.internal开头 . Weblogic正在从glassfish.jaxb_1.0.0.0_2-1-12.jar和glassfish.jaxws.rt_1.2.0.0_2-1-5.jar中选择这些类,但这些jar不是我的应用程序的一部分 .

  • 我已经在weblogic.xml中使用了以下标记,
<prefer-web-inf-classes>true</prefer-web-inf-classes>
  • 我尝试在DefaultDomain / lib目录中添加jaxws-api.jar和jws-api.jar,但这不起作用

任何线索如何解决此异常或如何强制weblogic使用jdk运行时类?相同的应用程序在独立的weblogic上正常工作 .

3 回答

  • 1

    我有同样的问题,在这里找到答案:http://www.intropro.com/resources/blog/66-argument-s-type-can-t-be-null

    简而言之 - 问题出现是因为你在类路径中有jaxb-impl,它覆盖了WebLogics自己的jaxb,你可能没有从pom.xml中显式引用这个依赖项,但是你的其他一些依赖项也是如此 . 在我的情况下,我有apache-cxf作为maven依赖,它有jaxb 2.1.13作为子依赖与范围“编译” . 我所要做的就是排除这个apach jaxb,并使用范围“提供”添加我自己的依赖项,以显式使用WebLogics jaxb .

    在pom.xml中它看起来像这样:

    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-frontend-jaxws</artifactId>
        <version>2.7.2</version>
        <exclusions>
            <exclusion>
                <artifactId>jaxb-impl</artifactId>
                <groupId>com.sun.xml.bind</groupId>
            </exclusion>
        </exclusions>
    </dependency>
    
    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-impl</artifactId>
        <scope>provided</scope>
        <version>2.1.13</version>
    </dependency>
    

    您可以在pom.xml视图中使用eclipses“Dependency Hierarchy”选项卡,或者只是命令行“mvn dependency:tree”来了解jaxb-impl如何将其添加到类路径中 .

  • 0

    您是否尝试在清单class-path:属性中列出正确的jar?您还可以将jdk类放在应用程序中,并尝试使用FilteringClassLoader指定要从应用程序而不是系统类加载器中使用哪些类 .

    http://docs.oracle.com/cd/E15051_01/wls/docs103/programming/classloading.html#wp1097263

  • 0

    在我的例子中,我在操作的参数中有一个拼写错误,其中两个参数具有相同的webParam名称 . 修改并部署,问题得到解决 .

相关问题