-
1. Re: Jboss As 7 JNDI binding for EJB
jaikiran Apr 22, 2013 7:51 AM (in response to lalitawasthi007)1 of 1 people found this helpfulLalit Awasthi wrote:
According to the JIRA (https://issues.jboss.org/browse/AS7-3015?focusedCommentId=12651177&page=com.atlassian.jira.plugin.system.issuetabpanels%3acomment-tabpanel) I came to know that ejb-jar.xml is no longer work in jboss AS 7.1.
That's not true. That JIRA talks of jboss.xml (which was a JBoss specific deployment descriptor) and not about ejb-jar.xml.
Lalit Awasthi wrote:
Hello All
Now my question is if I have a bean e.g. ConfigData and I want to bind it to the JNDI name java:comp/env/ejb/ConfigData .Kinldy let me know what changes needs to be done in the jboss-ejb3.xml file.
You don't need jboss-ejb3.xml for that. Binding to environment naming context (ENC) - java:comp is one such namespace - can be done via EJB spec specified ejb-jar.xml. You'll have to take a look at the ejb-jar xsd for the right elements or someone who has a ready example, might be able to point you to it.
-
2. Re: Jboss As 7 JNDI binding for EJB
lalitawasthi007 Apr 23, 2013 5:35 AM (in response to jaikiran)Thank you Jaikiran
Let me explain the problem I am facing .
Suppose I have a bean named ConfigDataBean and mentioned it in ejb-jar.xml and I am looking up it in the code .First thing that is confusing me is below output
[org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-1) JNDI bindings for session bean named ConfigData in deployment unit subdeployment "abcEJB.jar" of deployment "abc.ear" are as follows:
java:global/abc/abcEJB/ConfigDataBean!com.test.IT.abc.ejb.session.ConfigDataHome
java:app/abcEJB/ConfigDataBean!com.test.IT.abc.ejb.session.ConfigDataHome
java:module/ConfigDataBean!com.test.IT.abc.ejb.session.ConfigDataHome
java:jboss/exported/abc/abcEJB/ConfigDataBean!com.test.IT.abc.ejb.session.ConfigDataHome
java:global/abc/abcEJB/ConfigDataBean!com.test.IT.abc.ejb.session.ConfigDataHome
java:app/abcEJB/ConfigDataBean!com.test.IT.abc.ejb.session.ConfigDataHome
java:module/ConfigDataBean!com.test.IT.abc.ejb.session.ConfigDataHome
java:jboss/exported/abc/abcEJB/ConfigDataBean!com.test.IT.abc.ejb.session.ConfigDataHomeNext thing when I am passing this (java:comp/env/ejb/ConfigDataBean) in the code and trying to look it up using below code
InitialContext ctx = new InitialContext();
Object ref = ctx.lookup(ejbName);System.out.println(ctx.lookup(ejbName));
It is giving me output "Proxy for remote EJB EJBHomeLocator{appName='abc', moduleName='abcEJB', distinctName='', beanName='ConfigDataBean', view='interface com.test.regit.abc.ejb.session.ConfigDataBeanHome'" it is cofusing me while the output should be ConfigDataBeanHome .
Kindly suggest.
Thanks!!
-
3. Re: Jboss As 7 JNDI binding for EJB
sfcoy Apr 23, 2013 8:51 AM (in response to lalitawasthi007)This looks like code that has been around for a while.
In the "old" days, you looked up a "home" interface in JNDI and then use it's "create" method to get an instance of an EJB.
In your case, you would invoking com.test.IT.abc.ejb.session.ConfigDataHome.create(...) to get your EJB.
These "home" interfaces are not required in JEE5 or JEE6 compatible containers, but they are still supported.
-
4. Re: Jboss As 7 JNDI binding for EJB
lalitawasthi007 Apr 23, 2013 9:37 AM (in response to sfcoy)Okay but now when I am trying to lookup it is giving me below output
System.out.println(ctx.lookup(ejbName));
output "Proxy for remote EJB EJBHomeLocator{appName='abc', moduleName='abcEJB', distinctName='', beanName='ConfigDataBean', view='interface com.test.regit.abc.ejb.session.ConfigDataBeanHome'" it is cofusing me while the output should be ConfigDataBeanHome .
Kindly suggest if I am doing anything wrong.
Actually I have the earlier code on JRE 6 and Jboss 5.1 and it is running fine
-
5. Re: Jboss As 7 JNDI binding for EJB
sfcoy Apr 23, 2013 9:49 AM (in response to lalitawasthi007)If you mean "why the output should be ConfigDataBeanHome", then that is what I tried to explain above.
Otherwise, I don't understand what you're trying to say.
-
6. Re: Jboss As 7 JNDI binding for EJB
lalitawasthi007 Apr 23, 2013 10:50 AM (in response to sfcoy)May be I could not understand.
Actually I want the output as ConfigDataBeanHome in place of " Proxy for remote EJB EJBHomeLocator{appName='abc', moduleName='abcEJB', distinctName='', beanName='ConfigDataBean', view='interface com.test.regit.abc.ejb.session.ConfigDataBeanHome" in Jboss 7.1.
Kindly suggest