[英]ejb 3.1, weblogic 12c, java 1.6 Jndi Lookup issue
I have problem in configuring JNDI lookup for ejb3.1 and weblogic 12c, jdk1.6
@Remote
public interface Bank{
public String accounts();
}
@Stateless(name="BankSession")
public class BankSessionBean implements Bank{
@Override
public String accounts() {
//////// }
ejb-jar.xml:
<enterprise-beans>
<session>
<display-name>BankSession</display-name>
<ejb-name>BankSession</ejb-name>
<business-remote>com.examples.Bank</business-remote>
<ejb-class>com.examples.BankSessionBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
</session>
<enterprise-beans>
weblogic-ejb-jar.xml:
<weblogic-enterprise-bean>
<ejb-name>BankSession</ejb-name>
<jndi-name>BankSession</jndi-name>
</weblogic-enterprise-bean>
client code:
When i start using Jndi Look up using this syntax java:comp/env/ejb/BankSession 当我开始使用Jndi时,请使用以下语法查找java:comp / env / ejb / BankSession
Its giving following error. 其给以下错误。
javax.naming.NameNotFoundException: While trying to lookup 'java:comp/env/ejb/BankSession' didn't find subcontext. javax.naming.NameNotFoundException:尝试查找'java:comp / env / ejb / BankSession'时未找到子上下文。
Here ejbbean and client code runs on different jvm's. 这里,ejbbean和客户端代码在不同的jvm上运行。
Which Jndi look up should i use ? 我应该使用哪个Jndi查找?
java:comp/env/ejb/BankSession is working fine with ejb 3.0 and oc4j server. java:comp / env / ejb / BankSession在ejb 3.0和oc4j服务器上可以正常工作。
When i migrate to ejb3.1 and weblogic 12c, its not working. 当我迁移到ejb3.1和weblogic 12c时,它不起作用。
I even tried without using weblogic deployment xml files. 我什至尝试不使用weblogic部署xml文件。 Same issue encountered.
遇到相同的问题。
How should i configure my Jndi here ? 我应该如何在这里配置我的Jndi? Please help as i am facing this issue since long time.
由于我长期以来一直面对这个问题,请提供帮助。
For a lookup in the form of java:comp/env/... you need an EJB ref in the deployment descriptor of the component that does the lookup! 对于以java:comp / env / ...形式的查找,您需要在进行查找的组件的部署描述符中有一个EJB ref! java:comp/env/... is always relative to the component that does the lookup.
java:comp / env / ...始终相对于执行查找的组件。
A lookup name that is independent of the actual component that does the lookup and works from anywhere inside your application is 4.: java:app/moduleName/... 一个独立于执行该查找并可以在应用程序内部任何地方运行的实际组件的查找名称是4 .: java:app / moduleName / ...
java:global/appName/... will fail if you decide to rename your ear file one day. 如果您有一天决定重命名您的耳文件,则java:global / appName / ...将失败。 java:module/... only works inside a component that is part of the same module.
java:module / ...仅在属于同一模块的组件内部工作。 So 4. is IMO the best alternative.
所以4.是IMO的最佳选择。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.