You can use the @org.jboss.annotation.ejb.RemoteBinding(jndiBinding = "TravelAtentRemote") @org.jboss.annotation.ejb.LocalBinding(jndiBinding = "TravelAgentLocal") Annotations (at the Bean class) to set your prefered JNDI name.
Instead of your getInitialContext Method you can use a jndi.properties File (placed inside your classpath; IDE source folder). "new InitialContext()" is enough to get your Context object.
Joined: Jul 12, 2002
Thanks for your reply. I'm sure this lookup issue is a minor (common newbie) issue.
Currently, I'm "deploying" this Session Bean as class files using MyEclipse's debug "hot" deployment. No EAR file. I'm not sure if hot deployment (class files and no EAR) is "allowed" with JBOSS. Must I deploy an EJB jar file or can I deploy regular class files?
In any case, if I change my look up to this (or anything else I tried):
I'm still trying to use the JNDI JBOSS code from chapter 4, page 59 of "Enterprise JavaBeans 3". If that doesn't work, I don't see yet the point of using a jndi.properties file to get the same errors. I also tried the annotations mentioned, but these are not in the EJB3 book and give "cannot resolve to a type" error messages.
The best option that you have to figure out the jndi name of the bean, is to follow the steps below:
- Go to http://localhost:8080/jmx-console - Search for service=JNDIView - Click on that link - On the page that comes up click on the Invoke button beside the list() method - The page that comes up will show the contents of the JNDI tree.
On this page, you will be able to find the TravelAgent bean and its jndi name. If you have problems understanding the JNDI tree, just post the above output, here.
Joined: Jul 12, 2002
Hey, this worked!
Thank you so very much!!!
My next step is to get a basic Entity Bean working from Chapter 4 of this book.
Go to http://localhost:8080/jmx-console - Search for service=JNDIView
- Click on that link
- On the page that comes up click on the Invoke button beside the list() method
- The page that comes up will show the contents of the JNDI tree.