Java Wildfly 8.2@WebServiceRef-在wsdl中找不到名为null的服务

Java Wildfly 8.2@WebServiceRef-在wsdl中找不到名为null的服务,java,web-services,wildfly-8,Java,Web Services,Wildfly 8,我已经创建了一个示例JAX-WSWeb服务,希望与@WebServiceRef一起使用。 服务、接口和客户端都通过Eclipse部署在同一个war中 这里是界面 package com.example.ws; import javax.ejb.Local; import javax.jws.WebService; @Local @WebService public interface TestWSInterface { String test(); } 服务 package com.e

我已经创建了一个示例JAX-WSWeb服务,希望与@WebServiceRef一起使用。 服务、接口和客户端都通过Eclipse部署在同一个war中

这里是界面

package com.example.ws;

import javax.ejb.Local;
import javax.jws.WebService;

@Local
@WebService
public interface TestWSInterface {
  String test();
}
服务

package com.example.ws;

import javax.ejb.Stateless;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.xml.ws.WebServiceRef;

@Stateless
@WebService
public class TestWS implements TestWSInterface {

  @WebMethod
  public String test() {
      return "test";
  }

}
和客户端Servlet

package com.example.ws;

import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.ws.WebServiceRef;

/**
 * Servlet implementation class TestWSClient
 */
@WebServlet("/TestWSClient")
public class TestWSClient extends HttpServlet {
    private static final long serialVersionUID = 1L;

    @WebServiceRef(wsdlLocation="http://localhost:8080/JAX-WS-Wildfly-8.2/TestWS?wsdl")
    private TestWS testService;

    private static final Logger logger = Logger.getLogger(TestWSClient.class.getName());

   /**
    * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
    */
   protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      logger.log(Level.INFO,  testService.test());
   }
}
web服务的部署没有问题,但是我在servlet中的注入上遇到了一个异常

以下是日志、部署+堆栈跟踪:

11:40:19,587 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-1) JBAS017535: Unregistered web context: /JAX-WS-Wildfly-8.2
11:40:19,594 INFO  [org.jboss.as.webservices] (MSC service thread 1-1) JBAS015540: Stopping service jboss.ws.endpoint."JAX-WS-Wildfly-8.2.war".TestWS
11:40:19,594 INFO  [org.jboss.weld.deployer] (MSC service thread 1-1) JBAS016009: Stopping weld service for deployment JAX-WS-Wildfly-8.2.war
11:40:19,594 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015877: Stopped deployment JAX-WS-Wildfly-8.2.war (runtime-name: JAX-WS-Wildfly-8.2.war) in 16ms
11:40:19,594 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015876: Starting deployment of "JAX-WS-Wildfly-8.2.war" (runtime-name: "JAX-WS-Wildfly-8.2.war")
11:40:19,609 INFO  [org.jboss.weld.deployer] (MSC service thread 1-1) JBAS016002: Processing weld deployment JAX-WS-Wildfly-8.2.war
11:40:19,609 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-1) JNDI bindings for session bean named TestWS in deployment unit deployment "JAX-WS-Wildfly-8.2.war" are as follows:

    java:global/JAX-WS-Wildfly-8.2/TestWS!com.example.ws.TestWSInterface
    java:app/JAX-WS-Wildfly-8.2/TestWS!com.example.ws.TestWSInterface
    java:module/TestWS!com.example.ws.TestWSInterface

11:40:19,640 INFO  [org.jboss.weld.deployer] (MSC service thread 1-1) JBAS016005: Starting Services for CDI deployment: JAX-WS-Wildfly-8.2.war
11:40:19,640 INFO  [org.jboss.ws.cxf.metadata] (MSC service thread 1-1) JBWS024061: Adding service endpoint metadata: id=TestWS
 address=http://localhost:8080/JAX-WS-Wildfly-8.2/TestWS
 implementor=com.example.ws.TestWS
 serviceName={http://ws.example.com/}TestWSService
 portName={http://ws.example.com/}TestWSPort
 annotationWsdlLocation=null
 wsdlLocationOverride=null
 mtomEnabled=false
11:40:19,656 INFO  [org.apache.cxf.service.factory.ReflectionServiceFactoryBean] (MSC service thread 1-1) Creating Service {http://ws.example.com/}TestWSService from class com.example.ws.TestWSInterface
11:40:19,672 INFO  [org.apache.cxf.endpoint.ServerImpl] (MSC service thread 1-1) Setting the server's publish address to be http://localhost:8080/JAX-WS-Wildfly-8.2/TestWS
11:40:19,672 INFO  [org.jboss.ws.cxf.deployment] (MSC service thread 1-1) JBWS024074: WSDL published to: file:/C:/wildfly-8.2.0.Final/standalone/data/wsdl/JAX-WS-Wildfly-8.2.war/TestWSService.wsdl
11:40:19,672 INFO  [org.jboss.weld.deployer] (MSC service thread 1-2) JBAS016008: Starting weld service for deployment JAX-WS-Wildfly-8.2.war
11:40:19,672 INFO  [org.jboss.as.webservices] (MSC service thread 1-2) JBAS015539: Starting service jboss.ws.endpoint."JAX-WS-Wildfly-8.2.war".TestWS
11:40:19,750 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-2) JBAS017534: Registered web context: /JAX-WS-Wildfly-8.2
11:40:19,781 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018565: Replaced deployment "JAX-WS-Wildfly-8.2.war" with deployment "JAX-WS-Wildfly-8.2.war"
11:40:23,360 ERROR [io.undertow.request] (default task-8) UT005023: Exception handling request to /JAX-WS-Wildfly-8.2/TestWSClient: javax.servlet.ServletException: UT010013: Could not instantiate com.example.ws.TestWSClient
    at io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:217) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.servlet.core.ManagedServlet.getServlet(ManagedServlet.java:163) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:84) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:63) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
    at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:261) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:247) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:76) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:166) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.server.Connectors.executeRootHandler(Connectors.java:197) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
    at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:759) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_40]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_40]
    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_40]
Caused by: java.lang.IllegalStateException: JBAS011048: Failed to construct component instance
    at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:162)
    at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:133)
    at org.jboss.as.ee.component.BasicComponent.createInstance(BasicComponent.java:89)
    at org.jboss.as.ee.component.ComponentRegistry$ComponentManagedReferenceFactory.getReference(ComponentRegistry.java:149)
    at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$5.createInstance(UndertowDeploymentInfoService.java:1233)
    at io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:215) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
    ... 27 more
Caused by: java.lang.RuntimeException: JBAS011875: Resource lookup for injection failed: env/com.example.ws.TestWSClient/testService
    at org.jboss.as.naming.deployment.ContextNames$BindInfo$1$1.getReference(ContextNames.java:313)
    at org.jboss.as.ee.component.ManagedReferenceFieldInjectionInterceptorFactory$ManagedReferenceFieldInjectionInterceptor.processInvocation(ManagedReferenceFieldInjectionInterceptorFactory.java:99)
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
    at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
    at org.jboss.as.ee.component.AroundConstructInterceptorFactory$1.processInvocation(AroundConstructInterceptorFactory.java:28)
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
    at org.jboss.as.weld.injection.WeldInterceptorInjectionInterceptor.processInvocation(WeldInterceptorInjectionInterceptor.java:56) [wildfly-weld-8.2.0.Final.jar:8.2.0.Final]
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
    at org.jboss.as.weld.injection.WeldInjectionContextInterceptor.processInvocation(WeldInjectionContextInterceptor.java:43) [wildfly-weld-8.2.0.Final.jar:8.2.0.Final]
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
    at org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45) [wildfly-ee-8.2.0.Final.jar:8.2.0.Final]
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
    at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64)
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
    at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:326)
    at org.jboss.invocation.PrivilegedWithCombinerInterceptor.processInvocation(PrivilegedWithCombinerInterceptor.java:80)
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
    at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
    at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:160)
    ... 32 more
Caused by: javax.naming.NamingException: JBAS011878: Failed to lookup env/com.example.ws.TestWSClient/testService [Root exception is org.jboss.wsf.spi.WSFException: Cannot create service]
    at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:144)
    at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:81)
    at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:202)
    at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:188)
    at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:184)
    at org.jboss.as.naming.deployment.ContextNames$BindInfo$1$1.getReference(ContextNames.java:310)
    ... 51 more
Caused by: org.jboss.wsf.spi.WSFException: Cannot create service
    at org.jboss.wsf.spi.WSFException.rethrow(WSFException.java:55) [jbossws-spi-2.3.1.Final.jar:2.3.1.Final]
    at org.jboss.wsf.stack.cxf.client.serviceref.CXFServiceObjectFactoryJAXWS.getObjectInstance(CXFServiceObjectFactoryJAXWS.java:123)
    at org.jboss.wsf.stack.cxf.client.serviceref.CXFServiceRefFactoryImpl.newServiceRef(CXFServiceRefFactoryImpl.java:38)
    at org.jboss.as.webservices.webserviceref.WebServiceManagedReferenceFactory.getReference(WebServiceManagedReferenceFactory.java:37)
    at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:131)
    ... 56 more
Caused by: javax.xml.ws.WebServiceException: Could not find service named null in wsdl http://localhost:8080/JAX-WS-Wildfly-8.2/TestWS?wsdl
    at org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:161)
    at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:149)
    at org.jboss.wsf.stack.cxf.client.ProviderImpl$JBossWSServiceImpl.<init>(ProviderImpl.java:552)
    at org.jboss.wsf.stack.cxf.client.ProviderImpl.createServiceDelegate(ProviderImpl.java:247)
    at javax.xml.ws.Service.<init>(Service.java:57) [jboss-jaxws-api_2.2_spec-2.0.2.Final.jar:2.0.2.Final]
    at javax.xml.ws.Service.create(Service.java:687) [jboss-jaxws-api_2.2_spec-2.0.2.Final.jar:2.0.2.Final]
    at org.jboss.wsf.stack.cxf.client.serviceref.CXFServiceObjectFactoryJAXWS.instantiateService(CXFServiceObjectFactoryJAXWS.java:279)
    at org.jboss.wsf.stack.cxf.client.serviceref.CXFServiceObjectFactoryJAXWS.getObjectInstance(CXFServiceObjectFactoryJAXWS.java:89)
    ... 59 more

我是做错了什么,还是一个bug?

你找到了答案吗?遗憾的是,没有,我在developer.jboss.org上的帖子也没有回答:-还没有尝试过狂野9。在Wildfly上,我通过在web.xml上设置所有服务引用信息来实现这一点,但这感觉不对劲。。。weblogic只是在没有任何web.xml内容的情况下工作。是的,它看起来像wildfly中的一个bug