[jboss-user] [Beginners Corner] - EJB 3.0 - Throwing Exceptions from Session Beans
RaoulDuke
do-not-reply at jboss.com
Thu Apr 12 15:29:26 EDT 2007
Hello,
I have a stateless Session Bean with a single test method that just throws an exception. I'm accessing the EJB via remote interface, but I'm always getting an exception on the client side that I don't understand:
Exception: [Ljava.lang.StackTraceElement;
| java.lang.ClassNotFoundException: [Ljava.lang.StackTraceElement;
| at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
| at java.security.AccessController.doPrivileged(Native Method)
| at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
| ...
|
The client is doing the following:
| try{
| InitialContext ic = new InitialContext();
| ExSessionRemote remote = (ExSessionRemote) ic.lookup("ExSessionBean/remote");
| remote.doit();
| }
| catch(Exception e){
| System.out.println("Exception: "+e.getMessage());
| e.printStackTrace();
| }
|
The doit() method in the EJB:
| public void doit() throws Exception {
| throw new Exception();
| }
|
The exception is defined in the remote interface as well:
| @Remote
| public interface ExSessionRemote {
| public void doit() throws Exception;
| }
|
I tried throwing my own exception "TestException" (of course I defined this correctly in the method signatures and the interfaces). I tried TestException extending Exception and RemoteException, but whatever I do it always gives me the following exception on the client side:
| java.lang.reflect.UndeclaredThrowableException
| at $Proxy0.doit(Unknown Source)
| at applicationclient1.Main.main(Main.java:32)
| Caused by: java.lang.ClassNotFoundException: [Ljava.lang.StackTraceElement;
| at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
| at java.security.AccessController.doPrivileged(Native Method)
| at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
|
I just can't find anything about this with google.
Regards,
Sven
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4036848#4036848
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4036848
More information about the jboss-user
mailing list