将托管Bean注入Web服务 [英] Injecting Managed Bean into Webservice

查看:82
本文介绍了将托管Bean注入Web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Web服务中注入托管Bean,但是注入的Bean始终为null.有谁知道为什么,如果可以的话,您能否提供一些提示或解决方法?

I'm trying to inject a Managed Bean within a Webservice but the injected Bean is allways null. Does anybody knows why and if so could you provide some hints or a workaround?

@WebService(targetNamespace = "http://impl.soap.valueservice.drivelog.com/", endpointInterface = "com.drivelog.valueservice.soap.impl.ValueService", portName = "ValueServiceImplPort", serviceName = "ValueServiceImplService")
public class ValueServiceImpl implements ValueService {

    @Inject
    private ValueServiceFacade valueBean;

...
}

@ManagedBean
public class ValueServiceFacadeImpl implements ValueServiceFacade {
...
}

推荐答案

这真令人尴尬.

根据此博客文章( https://weblogs.java.net/blog/jitu/archive/2010/02/19/jax-ws-cdi-java-ee-6-0 )和这篇文章( https://blogs.oracle.com/arungupta/entry/totd_124_using_cdi_jpa ),这应该可以,但是我不能在这里使用TomEE使其工作.

According to this blog post (https://weblogs.java.net/blog/jitu/archive/2010/02/19/jax-ws-cdi-java-ee-6-0) and this post (https://blogs.oracle.com/arungupta/entry/totd_124_using_cdi_jpa), this should work but I can't make it work using TomEE here.

此处还对JSR进行了一些讨论( https://bugzilla.redhat. com/show_bug.cgi?id = 1001610 ),但我不能真正告诉您为什么它不起作用.

There is also some discussion about JSRs here (https://bugzilla.redhat.com/show_bug.cgi?id=1001610) but I can't really tell you why it does not work.

对于TomEE(openEJB),我能找到的所有问题都已关闭(与 https://issues.apache.org/jira/browse/OPENEJB-1592 ),并带有可怕的注释:全部完成了认证工作",也许,JEE Web Profile不需要一起使用,而实现完整EJB Profile的Geronimo可能需要对此进行处理.

For TomEE (openEJB) all I could find was a lot of issues closed (related to https://issues.apache.org/jira/browse/OPENEJB-1592) with a scary comment "All done for certification", and maybe, the JEE Web Profile does not need to make these work together, while Geronimo, that implements the full EJB Profile, may need to work with this.

另请参见 Java EE 6 WebService和CDI注入

所以我不能真正回答这个问题.同时,请您向我们提供有关您所使用的容器的更多信息,以便我们更好地帮助您.

So I can't really answer this. At the same time, I'll ask you to provide us some more information about what container you're using, so we can help you better.

这篇关于将托管Bean注入Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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