views:

48

answers:

2

I am getting the following exception when I tried to execute one my service in my server which is deployed as EJB2.0 stateless session bean.

Error executing services::error marshalling return; nested exception is: 
 java.io.NotSerializableException: xxx.xxx.xxx.PmsService

here xxx.xxx.xxx.PmsService is my class which is already implementing java.io.Serializable interface

can you please help me in getting this resolved.

MUR

+2  A: 

Chances are, one of your (non-transient) fields in PmsService does not itself implement Serializable.

Serializability is a recursive property; a class is not, and cannot be serialised unless all of its fields can be serialised too. Check your fields for classes that cannot be serialised, and either make that class serializable (if it's your own class), switch to a serializable alternative, or declare the field transient (only do this latter case if it isn't really part of the object's state; e.g. the thread your task is currently running in).

Andrzej Doyle
Hi thanks for the quick reply but I forgot one thing is that it is woking fine in normal console deployment but I am trying for open directory deployment i.e. putting all the jars/wars/lib as open folder structure..then in this case I am getting the exception..
mur
A: 

Could it be that one of your service's fields is of a type which is declared in one of your referenced library JARs?

It is possible that there's a problem with your classpath when using open directory deployment. Deployment via EARs or JARs has the big advantage that the classpath search order is pre-determined in that it always starts within the EAR or JAR, respectively. This way, the specific version of a referenced JAR is always found first.

Now, when using "open deployment", it is possible that one of your library JARs conflicts with the versions your application server uses and that (A) those are found first and (B) are not serializable.

torbengee