I have been striving to run my first Session bean but all in vain. I searched for tutorials for EJB3 + JBoss + Eclipse but didn't get helpful links, so from the code snippets of different tutorials & books, I tried to setup development environment and run my first Bean. Here is what I did for this.
Installed JDK 1.6, set JAVA_HOME.
Installed JBoss 5.0, set environment variable JBOSS_HOME.
Configured JBoss in Eclipse 3.4.
In eclipse, created new EJB project with client. Code is shown below.
Added jar with session beans in the build path of Client application. [Is this what I should be doing?]
Started JBoss, published my application and tried to run file-with-main from Right Click->Run As Java Application.
JBoss gives you a view of JNDI via its jmx-console. Try going to http://localhost:8080/jmx-console and running the JNDI service list view. This will let you see what and where things are bound in JNDI.
Thanks for prompt reply. I tried to do as per you suggested. I found HelloUserBean at couple of places. I don't exactly know where should I be searching for entry of HelloUserBean. One is under jboss.deployment which is id="jboss.j2ee:ear=EjbWithClient1EAR.ear,jar=EjbWithClient1.jar,name=HelloUserBean,service=EJB3",type=Component and the other is under jboss.j2ee which is ear=EjbWithClient1EAR.ear,jar=EjbWithClient1.jar,name=HelloUserBean,service=EJB3.
I guess bean is properly being registered with JNDI but still not getting any clue whats going wrong.
Try running the JNDI service's list function (look for the JNDI service first in jmx-console) rather than looking at the deployer service.
Joined: Oct 12, 2008
I think I am too new to EJB & JBoss to completely understand what you said. I checked out service=JNDIView link in the jmx-console but don't know how to interpret it. This is showing attribute details like State, StateString, HANamingService etc.
Is that what you wanted me to check out?
I also checked details in jboss.j2ee which is ear=EjbWithClient1EAR.ear,jar=EjbWithClient1.jar,name=HelloUserBean,service=EJB3. Its showing
CreateCount & CurrentCount = 0. Is this expected or count should be positive before the lookup takes place?
Joined: Oct 12, 2008
I checked out other threads for viewing JNDI namespace. Here I am copying Global JNDI Namespace I got in jmx-console. Paul or someone else please help to interpret it and get to the next step in solving my issue.
Global JNDI Namespace
Its really frustrating that I am not even being able to run Helloworld program for EJB3.
you are bang on... Its works fine now..... Thanks for getting it solved.
But there is other issue right after that when I tried to use my servlet as java client with same EJB deployed. I used the same code for getting reference of remote interface but I get following exception.
For Standalone remote EJB java client use the InitialContext(prop) constructor and for EJB Client running under JBoss Application Server we can use default InitialContext() constructor. Using default constructor it does local lookup and for remote lookup we need to set the initial context parameters using constructor InitialContext(prop). Hope this will resolve the EJB lookup issue.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Can't run first Session Bean : NameNotFoundException