8 Replies Latest reply: Jul 3, 2012 4:27 AM by sudhananthan B RSS

    Issue when accessing nonserialized java object in stateless session bean

    sudhananthan B Newbie

      I'm using JBOSS AS 7 and jdk 1.7. In which i created a simple ejb project with session bean(BookCatalogBean) and a local plain java object(SimpleClass.java) which is not serialized. When i tried to call a method by invoking session bean it throws an exception  ::::: java.io.NotSerializableException(The full trace has been attached in this thread ). The exception is due to my SimpleClass.java is not serialized But i don't want it to be serialized.

       

      My class defenition as follows:

       

      Session Bean:

      @Stateless

      @Remote(BookCatalogInterface.class)

      public class BookCatalogBean implements  BookCatalogInterface{

       

                 @PersistenceContext(unitName = "EntityBean")

                    private EntityManager em;

       

      public SimpleClass checkforDatabaseConnection() {

             SimpleClass simpleclassl= new SimpleClass() ;

             ......

             ......

             return simpleclassl;

          }

      }

       

       

      Simple Non Serialized java class:

       

      public class SimpleClass {

            long id;

       

          public long getId() {

              return id;

          }

       

          public void setId(long id) {

              this.id = id;

          }  

      }

       

       

      Please any one give me the solution for the above issue.

      Thanks in advance.