简体   繁体   English

在 Websphere 7 上作为 EJB 和 web 服务访问 EJB 3.0

[英]Access EJB 3.0 as an EJB and as a web service on Websphere 7

I want to deploy an EJB 3.0 stateless bean to WAS7 so I can access it as an EJB through a local interface and also as a jax-ws web service.我想将 EJB 3.0 无状态 bean 部署到 WAS7,这样我就可以通过本地接口将其作为 EJB 访问,也可以作为 jax-ws web 服务访问。

My bean looks as following:我的豆看起来如下:

@Stateless
@WebService
public class UserManagerImpl implements UserManager {
    public UserManagerImpl() {
    }
    @WebMethod
    public String getName(){
        return "UserName";
    }
}

The problem is that if I package it into an EJB-JAR and deploy, it doesn't work as a web service on WAS-7.问题是,如果我将它 package 放入 EJB-JAR 中并进行部署,它就不能作为 WAS-7 上的 web 服务工作。

The only working configuration for me is if I put the EJB-JAR into a EAR and put this EJB-JAR to a WAR that is also in the EAR, like this:对我来说唯一可行的配置是,如果我将 EJB-JAR 放入 EAR 并将此 EJB-JAR 放入也在 EAR 中的 WAR,如下所示:

EAR/
   |--EJB-JAR
   |--WAR/
         |WEB-INF/lib/
                     |EJB-JAR 

So my bean is duplicated.所以我的 bean 是重复的。

Is there any problem with this design?这个设计有什么问题吗? If so, is there a better solution?如果是这样,是否有更好的解决方案?

If your application contains @WebService annotated EJBs, then you need to process the EAR with the endptEnabler tool shipped with WebSphere before deploying it.如果您的应用程序包含带@WebService注释的 EJB,那么您需要在部署 EAR 之前使用 WebSphere 附带的endptEnabler工具对其进行处理。 Note that this doesn't apply to @WebService annotated classes in Web modules.请注意,这不适用于 Web 模块中的@WebService注释类。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM