-
1. Re: SLSB throws CreateException, client doesn't see it
adrian.brock Mar 21, 2003 2:23 PM (in response to andyfyfe)You haven't declared "throws CreateException"
on the home interface's "void create()" method? -
2. Re: SLSB throws CreateException, client doesn't see it
andyfyfe Mar 23, 2003 8:50 PM (in response to andyfyfe)XDoclet created the home interface, and create() throws both javax.ejb.CreateException and java.rmi.RemoteException.
-
3. Re: SLSB throws CreateException, client doesn't see it
adrian.brock Mar 24, 2003 1:42 PM (in response to andyfyfe)Ok,
Post the relevent section of the server.log
and the full client side exception trace.
Regards,
Adrian -
4. Re: SLSB throws CreateException, client doesn't see it
andyfyfe Apr 14, 2003 3:36 AM (in response to andyfyfe)I took an example from Apple -- http://developer.apple.com/internet/java/enterprisejava.tar.gz --
and modified it slightly -- to always throw an exception in ejbCreate, and to better check for exceptions.
From the jboss log:
00:21:38,309 ERROR [STDERR] Caught class java.lang.reflect.UndeclaredThrowableException: null
00:21:38,310 ERROR [STDERR] java.lang.reflect.UndeclaredThrowableException
00:21:38,310 ERROR [STDERR] at $Proxy24.hi(Unknown Source)
00:21:38,311 ERROR [STDERR] at HelloWorldServlet.doGet(HelloWorldServlet.java:48)
00:21:38,311 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
00:21:38,311 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
(and more stack trace) followed by
00:21:38,323 ERROR [STDERR] Caused by: javax.ejb.CreateException: always throw an exception
00:21:38,324 ERROR [STDERR] at HelloWorldEJB.ejbCreate(HelloWorldEJB.java:19)
00:21:38,324 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
00:21:38,324 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
(and again more stack trace).
So the create exception is in there.
I've made a zip file containing my changes -- it can be found at http://homepage.mac.com/afyfe/
I've tried this both under Solaris as well as Mac OSX. -
5. Re: SLSB throws CreateException, client doesn't see it
adrian.brock Apr 14, 2003 6:58 AM (in response to andyfyfe)Ok,
I see what the problem is.
For a stateless session bean the
create() operations just creates the local
proxy, it does not invoke ejbCreate()
This is done by pool as real requests come in,
in your case hi().
The pool couldn't create an instance to process
hi() because you threw the CreateException
which isn't on the definition of hi()
Regards,
Adrian -
6. Re: SLSB throws CreateException, client doesn't see it
andyfyfe Apr 14, 2003 4:58 PM (in response to andyfyfe)I changed the remote interface to throw both RemoteException and CreateException. The call to the remote interface method in the servlet will now catch a CreateException with the appropriate message.
I understood that a remote interface method should only have to deal with a RemoteException. Should the container be catching the CreateException and throwing a RemoteException in its place?