我在尝试注入与我的 JVM 完全分离的 Web 服务时遇到异常。
我的环境是 TomEE v1.0.0,它是一个 JEE6 webprofile 容器。
ThemeQueryService 是一个带有 JAXWS 注释的接口。
@SessionScoped
@Named("managedBeanMB")
public class ManagedBeanMB implements Serializable {
private static final long serialVersionUID = 1L;
@WebServiceRef(
wsdlLocation = "http://localhost:8777/services/queryService?wsdl")
private QueryService queryService;
....
}
后来,在尝试使用注入服务时,我得到了一个 NPE:
Caused by: java.lang.NullPointerException
at org.apache.openejb.core.ivm.naming.JaxWsServiceReference.getObject(JaxWsServiceReference.java:73)
at org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:173)
at org.apache.openejb.cdi.CdiResourceInjectionService.lookup(CdiResourceInjectionService.java:134)
at org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties(CdiResourceInjectionService.java:112)
at org.apache.openejb.cdi.CdiResourceInjectionService.injectJavaEEResources(CdiResourceInjectionService.java:96)
at org.apache.webbeans.component.AbstractInjectionTargetBean.injectResources(AbstractInjectionTargetBean.java:432)
at org.apache.webbeans.portable.creation.InjectionTargetProducer.inject(InjectionTargetProducer.java:91)
at org.apache.webbeans.component.InjectionTargetWrapper.inject(InjectionTargetWrapper.java:79)
at org.apache.webbeans.component.AbstractOwbBean.create(AbstractOwbBean.java:182)
我觉得我不理解 WebServiceRef... 它仅用于 JNDI 传输吗?