jndi 在 jboss4.2.3 和 ejb3 上的绑定

发布于 2024-10-10 13:05:50 字数 1032 浏览 3 评论 0原文

我正在尝试使用 ejb3 注释在 jboss 4.2.3 上部署无状态 ejb。一切都正确构建和部署,并且当 jboss 启动时我没有收到任何错误。然而,当我查看 jboss 中的绑定时,ejb 并未绑定到任何用于查找的 JNDI 位置。下面是我的 ejb 的内容。

远程

@Remote
public interface TestWebService {

public String TestWebMethod(String param1, String param2);

}

无状态 EJB

@Stateless
@RemoteBinding(jndiBinding="TestWeb")
@Remote(TestWebService.class)

public class TestWebServiceBean implements TestWebService{

public String TestWebMethod(String param1, String param2) {
    System.out.println("HELLO "+param1+" "+param2);
    return "Welcome!!";
}

 }

我尝试过不使用 @Remote 和 @RemoteBinding,但没有什么区别。我还添加了 ejb-jar.xml 文件(ejb3 不需要该文件),但这似乎没有什么区别。下面是我在启动时在 jboss 日志中看到的输出。

installing MBean: jboss.j2ee:ear=ejb_web_service_ear-0.0.1-    SNAPSHOT.ear,jar=ejb_web_service-0.0.1-SNAPSHOT.jar,name=TestWebServiceBean,service=EJB3 with dependencies:
 21:56:00,633 INFO  [EJBContainer] STARTED EJB: com.tomax.ejb.TestWebServiceBean ejbName: TestWebServiceBean

I am trying to deploy a stateless ejb on jboss 4.2.3 using ejb3 annotations. Everything builds and deploys correctly, and I do not get any errors when jboss starts up. However the ejb is not getting bound to any JNDI location for lookup when I look at the bindings in jboss. Below is what I have for my ejb.

Remote

@Remote
public interface TestWebService {

public String TestWebMethod(String param1, String param2);

}

Stateless EJB

@Stateless
@RemoteBinding(jndiBinding="TestWeb")
@Remote(TestWebService.class)

public class TestWebServiceBean implements TestWebService{

public String TestWebMethod(String param1, String param2) {
    System.out.println("HELLO "+param1+" "+param2);
    return "Welcome!!";
}

 }

I have tried not having the @Remote and @RemoteBinding and it doesn't make a difference. I have also added and ejb-jar.xml file (which should not be needed with ejb3) and that does not appear to make a difference. Below is the output I see in the jboss log on startup.

installing MBean: jboss.j2ee:ear=ejb_web_service_ear-0.0.1-    SNAPSHOT.ear,jar=ejb_web_service-0.0.1-SNAPSHOT.jar,name=TestWebServiceBean,service=EJB3 with dependencies:
 21:56:00,633 INFO  [EJBContainer] STARTED EJB: com.tomax.ejb.TestWebServiceBean ejbName: TestWebServiceBean

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鼻尖触碰 2024-10-17 13:05:50

我发现了这一点,所以如果其他人也遇到类似的问题,希望这会有所帮助。首先,我在 jboss 4.2.3 中的注释包不正确,对于这个版本的 jboss,它们应该是 org.jboss.anotation.ejb.*,在 5 及更高版本中,这已经改变了。此外,我的 Ear 文件中还有一些额外的依赖项 jar,这些依赖项不应包含在内,因为它们是由容器提供的。一旦我删除了它们,它就起作用了。

I figured this out, so in case anyone else has similar problems hopefully this will help. First I had the incorrect package for the annotations in jboss 4.2.3, they should be org.jboss.anotation.ejb.* for this version of jboss, in 5 and up this has changed. Also there were some additional dependency jars in my ear file that should not have been included since they are provided by the container. Once I removed those then it worked.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文