部署描述符中的 ejb 引用(无注释)
我尝试仅使用部署描述符在 EJB 3.0 中注入依赖项。当我将应用程序部署到 Glassfish (v3.1) 时,我收到此异常:
java.lang.RuntimeException: Warning : Unable to determine local business vs. remote business designation for EJB 3.0 ref Local ejb-ref name=ejb/Test2,Local 3.x interface =pl.Test2Local,ejb-link=Test2,lookup=,mappedName=,jndi-name=,refType=Session
我不知道我做错了什么。有人可以帮我吗?
ejb-jar.xml 描述符是:
<session>
<ejb-name>Test2</ejb-name>
<remote>pl.Test2Remote</remote>
<local>pl.Test2Local</local>
<ejb-class>pl.Test2</ejb-class>
<session-type>Stateless</session-type>
</session>
<session>
<ejb-name>Test</ejb-name>
<remote>pl.TestRemote</remote>
<local>pl.TestLocal</local>
<ejb-class>pl.Test</ejb-class>
<session-type>Stateless</session-type>
<ejb-local-ref>
<ejb-ref-name>ejb/Test2</ejb-ref-name>
<local>pl.Test2Local</local>
<ejb-link>Test2</ejb-link>
<injection-target>
<injection-target-class>pl.Test</injection-target-class>
<injection-target-name>test2</injection-target-name>
</injection-target>
</ejb-local-ref>
</session>
Class pl.Test:
public class Test implements TestRemote, TestLocal {
private Test2Local test2;
public Test() {
}
}
I try to inject dependency in EJB 3.0 using only deployment descriptor. When I deploy my app to Glassfish (v3.1) I get this exception:
java.lang.RuntimeException: Warning : Unable to determine local business vs. remote business designation for EJB 3.0 ref Local ejb-ref name=ejb/Test2,Local 3.x interface =pl.Test2Local,ejb-link=Test2,lookup=,mappedName=,jndi-name=,refType=Session
I have no idea what I do wrong. Can anybody help me, please?
The ejb-jar.xml descriptor is:
<session>
<ejb-name>Test2</ejb-name>
<remote>pl.Test2Remote</remote>
<local>pl.Test2Local</local>
<ejb-class>pl.Test2</ejb-class>
<session-type>Stateless</session-type>
</session>
<session>
<ejb-name>Test</ejb-name>
<remote>pl.TestRemote</remote>
<local>pl.TestLocal</local>
<ejb-class>pl.Test</ejb-class>
<session-type>Stateless</session-type>
<ejb-local-ref>
<ejb-ref-name>ejb/Test2</ejb-ref-name>
<local>pl.Test2Local</local>
<ejb-link>Test2</ejb-link>
<injection-target>
<injection-target-class>pl.Test</injection-target-class>
<injection-target-name>test2</injection-target-name>
</injection-target>
</ejb-local-ref>
</session>
Class pl.Test:
public class Test implements TestRemote, TestLocal {
private Test2Local test2;
public Test() {
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
解决办法是:
The solution is:
您需要替换 XML 中的以下标签:
remote = Business-remote
本地 = 商业本地
you need to replace below tags in the XML:
remote = business-remote
local = business-local