-
1. Re: javax.naming.NameNotFoundException: greetJndi not bound
wdfink Oct 13, 2010 10:23 AM (in response to jyotsana)It depends,
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:
@EJB
<GreetBeanLocal> greet;
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.
-
2. Re: Error: java.lang.reflect.UndeclaredThrowableException
jyotsana Oct 13, 2010 10:32 AM (in response to wdfink)Thanks for the reply.
My servlet is in the outside Tomcat, and I copied this code from the net.
I am using ejb2.
Thanks
-
3. Re: Error: java.lang.reflect.UndeclaredThrowableException
wdfink Oct 14, 2010 7:01 AM (in response to jyotsana)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) -
4. Re: Error: java.lang.reflect.UndeclaredThrowableException
jyotsana Oct 14, 2010 9:08 AM (in response to wdfink)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?
-
5. Re: Error: java.lang.reflect.UndeclaredThrowableException
wdfink Oct 14, 2010 10:13 AM (in response to jyotsana)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 ;-)
-
6. Re: Error: java.lang.reflect.UndeclaredThrowableException
jyotsana Oct 14, 2010 10:31 AM (in response to wdfink)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.
Thanks.
-
javaFiles.txt.zip 510 bytes
-
-
7. Re: Error: java.lang.reflect.UndeclaredThrowableException
wdfink Oct 14, 2010 11:29 AM (in response to jyotsana)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?
-
8. Re: Error: java.lang.reflect.UndeclaredThrowableException
wdfink Oct 14, 2010 12:00 PM (in response to jyotsana)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.
-
9. Re: Error: java.lang.reflect.UndeclaredThrowableException
wdfink Oct 14, 2010 3:10 PM (in response to jyotsana)Here I'll attach a simple EJB3 Example with a JUnit Test case for you ;-)
The included EAR can be deployed in a standard fresh JBoss5.0.0.GA.
-
test.zip 5.4 KB
-