if I look to your tags it sounds like you use EJB3, why you wrote a ejb-jar.xml? It looks like default.
If you use EJB3 and your servlet within the same JBoss the following code will make it easy:
Also with EJB3 no Home interface is necessary!
Maybe it helps if you use localhost:8080/jmx-console in your browser, look after JNDIView and invoke the String-view.
Here you should find your greet... and the complete JNDI path for it.
So please post what EJB version you use.
Thanks for the reply.
My servlet is in the outside Tomcat, and I copied this code from the net.
I am using ejb2.
In this case your lookup should be "ejb/greetBean" because the global JNDI namespace add the prefix 'ejb'.
If you have started your JBoss, browse to host:8080/jmx-console.
Search 'service=JNDIview' (see jboss section)
here invoke the list() method.
Look for 'Global JNDI Namespace' and find greetBean
you will find somethink like
+- ejb (class: org.jnp.interfaces.NamingContext)
| +- greetBean (proxy: $Proxy0815 implements interface com.xy.GreetRemoteHome,interface javax.ejb.Handle)
I did not find what you have mentioned But I found something like +- greetJndi (proxy: $Proxy192 implements interface greetHome,interface javax.ejb.Handle)
Is this the problem?
looks like, do you can call your SLSB via lookup("greetJndi")?
If yes something in your configuration might not like what I expect.
Do you wrote by hand?
But do you have a reason why you use EJB2?
I would prefere EJB3 for a new implementation for make coding easier ;-)
Actually I am new to ejb and I copied the code from the net.
Here I am atteching a file which will have all the classes. Please see it if you can find the problem It will be a great help to me.
javaFiles.txt.zip 510 bytes
How do you create your ejb-jar.xml and jboss.xml? Looks like self written!
Could you attach source files as is and the two xml's?
Do you have tested with the replaced lookup("greetJndi") in your code?
But if you are new to EJB (and use NetBeans, seen in another thread)
Try EJB3, more easy and NetBeans 6.7 will create the stuff for you.