java.io.NotSerializable exception when calling EJB from servlet?

2001-09-27 Thread Andrew Wright

Hi all,

I'm trying to call an EJB method from a servlet. The EJB methods work 
fine when I use a standalone test app, but die when I make the same 
calls from a servlet, throwing:

java.io.NotSerializableException: 
org.apache.catalina.connector.HttpRequestFacade
stack trace snipped

The servlet can create the EJB instance OK, it's not a lookup problem. 
The exception is thrown when I call a custom method in the servlet (it 
doesn't do anything, it's just a test stub). The remote interface method 
looks like:

public void process(HttpServletRequest reqest, HttpServletResponse 
response) throws RemoteException, java.io.NotSerializableException;

I'm currently using Tomcat 4 + JBoss 2.4.1 (seperately, not integrated), 
but had the same problem with Tomcat 3. The only fields in the 
Registration EJB are Strings - nothing fancy. I've stripped the bean 
'bare' to try and isolate the problem, without success.

Despite much net searching I haven't seen any reports of similar 
problems - surely I'm not the only one? I'm running on Mac OS X 10.1 
(Hotspot Java VM 1.3.1 for those who don't know).

Any suggestions/thoughts gratefully received.
Regards,
Andrew Wright




Re: java.io.NotSerializable exception when calling EJB from servlet?

2001-09-27 Thread Dmitri Colebatch

The arguments to the remote metho dmust be serializable at runtime.  The
HttpRequest of Catalina's isn't so you wont be able to do that.  What you
want to do is extract the values you need out of the request, and pass
them to the process method so that the process method is pure business
logic and doesn't care where the request comes from 

cheers
dim

On Thu, 27 Sep 2001, Andrew Wright wrote:

 Hi all,
 
 I'm trying to call an EJB method from a servlet. The EJB methods work 
 fine when I use a standalone test app, but die when I make the same 
 calls from a servlet, throwing:
 
 java.io.NotSerializableException: 
 org.apache.catalina.connector.HttpRequestFacade
 stack trace snipped
 
 The servlet can create the EJB instance OK, it's not a lookup problem. 
 The exception is thrown when I call a custom method in the servlet (it 
 doesn't do anything, it's just a test stub). The remote interface method 
 looks like:
 
 public void process(HttpServletRequest reqest, HttpServletResponse 
 response) throws RemoteException, java.io.NotSerializableException;
 
 I'm currently using Tomcat 4 + JBoss 2.4.1 (seperately, not integrated), 
 but had the same problem with Tomcat 3. The only fields in the 
 Registration EJB are Strings - nothing fancy. I've stripped the bean 
 'bare' to try and isolate the problem, without success.
 
 Despite much net searching I haven't seen any reports of similar 
 problems - surely I'm not the only one? I'm running on Mac OS X 10.1 
 (Hotspot Java VM 1.3.1 for those who don't know).
 
 Any suggestions/thoughts gratefully received.
 Regards,
 Andrew Wright