5 Replies Latest reply on Jan 28, 2013 10:55 PM by Josh Broadway

    org.jboss.serial.exception.SerializationException: Object reference 3 was not found when trying to access entities List

    M Z Newbie

      Hello.

      I have a problem when i am trying to access antities list in my http servlet.

       

      There is Entity:

       

      package Entities;
      
      
      import java.io.Serializable;
      import javax.persistence.*;
      import java.util.Set;
      
      
      
      
      /**
       * The persistent class for the CATEGORIES database table.
       * 
       */
      @Entity
      @Table(name="CATEGORIES")
      public class Category implements Serializable {
                private static final long serialVersionUID = 1L;
      
      
                @Id
                @GeneratedValue(strategy=GenerationType.IDENTITY)
                @Column(name="cat_id")
                private int catId;
      
      
                @Column(name="cat_name")
                private String catName;
      
      
                //bi-directional many-to-one association to Auction
                @OneToMany(mappedBy="category")
                private Set<Auction> auctions;
      
      
          public Category() {
          }
      
      
                public int getCatId() {
                          return this.catId;
                }
      
      
                public void setCatId(int catId) {
                          this.catId = catId;
                }
      
      
                public String getCatName() {
                          return this.catName;
                }
      
      
                public void setCatName(String catName) {
                          this.catName = catName;
                }
      
      
                public Set<Auction> getAuctions() {
                          return this.auctions;
                }
      
      
                public void setAuctions(Set<Auction> auctions) {
                          this.auctions = auctions;
                }
        
      }
      
      

       

      There is code in EJB Bean:

       

          public List<Category> getItemCategories() {
          
                    try {
                              Query q = em.createQuery("select c from Category c");
                              List<Category> resultList = q.getResultList();
                              return resultList;
                    }
                    catch (IllegalStateException e) {
                              System.out.println("BLAD: " + e.getMessage());
                    }
                    //Category a = resultList.get(0);
                    //System.out.println("Sprawdzenie pobrania: " + a.getCatName());
                          return null;
          }
      
      

       

      End there i am trying to get this list by InitialContext:

       

      
      
      
      
      
      
      InitialContext ctx2 = new InitialContext();
      
      
      
      
      
      
      GuestRemote gg = (GuestRemote) ctx2.lookup("Calosc/GuestBean/remote");
      
      
      
      
      
      
      List<Category> resultList = gg.getItemCategories(); // THere is a problem
      
      
      
      

       

      Error occurs on third line. I think there is some serialization issue.

       

      10:58:46,722 ERROR [STDERR] java.lang.reflect.UndeclaredThrowableException
      10:58:46,722 ERROR [STDERR]           at $Proxy71.getItemCategories(Unknown Source)
      10:58:46,722 ERROR [STDERR]           at www.UserHttp.getItemCategories(UserHttp.java:15)
      10:58:46,722 ERROR [STDERR]           at org.apache.jsp.index_jsp._jspService(index_jsp.java:98)
      10:58:46,722 ERROR [STDERR]           at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      10:58:46,722 ERROR [STDERR]           at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      10:58:46,722 ERROR [STDERR]           at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
      10:58:46,722 ERROR [STDERR]           at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
      10:58:46,722 ERROR [STDERR]           at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
      10:58:46,723 ERROR [STDERR]           at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      10:58:46,723 ERROR [STDERR]           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      10:58:46,723 ERROR [STDERR]           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      10:58:46,723 ERROR [STDERR]           at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      10:58:46,723 ERROR [STDERR]           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      10:58:46,723 ERROR [STDERR]           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      10:58:46,723 ERROR [STDERR]           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
      10:58:46,723 ERROR [STDERR]           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      10:58:46,723 ERROR [STDERR]           at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
      10:58:46,723 ERROR [STDERR]           at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
      10:58:46,723 ERROR [STDERR]           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      10:58:46,723 ERROR [STDERR]           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      10:58:46,723 ERROR [STDERR]           at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
      10:58:46,723 ERROR [STDERR]           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      10:58:46,723 ERROR [STDERR]           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
      10:58:46,723 ERROR [STDERR]           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      10:58:46,723 ERROR [STDERR]           at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      10:58:46,724 ERROR [STDERR]           at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
      10:58:46,724 ERROR [STDERR]           at java.lang.Thread.run(Thread.java:679)
      10:58:46,724 ERROR [STDERR] Caused by: org.jboss.serial.exception.SerializationException: Object reference 3 was not found
      10:58:46,724 ERROR [STDERR]           at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.objectFromDescription(ObjectDescriptorFactory.java:118)
      10:58:46,724 ERROR [STDERR]           at org.jboss.serial.objectmetamodel.DataContainer$DataContainerInput.readObject(DataContainer.java:845)
      10:58:46,724 ERROR [STDERR]           at org.jboss.serial.persister.RegularObjectPersister.readSlotWithFields(RegularObjectPersister.java:353)
      10:58:46,724 ERROR [STDERR]           at org.jboss.serial.persister.RegularObjectPersister.defaultRead(RegularObjectPersister.java:273)
      10:58:46,724 ERROR [STDERR]           at org.jboss.serial.persister.RegularObjectPersister.readData(RegularObjectPersister.java:241)
      10:58:46,724 ERROR [STDERR]           at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.readObjectDescriptionFromStreaming(ObjectDescriptorFactory.java:412)
      10:58:46,724 ERROR [STDERR]           at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.objectFromDescription(ObjectDescriptorFactory.java:82)
      10:58:46,724 ERROR [STDERR]           at org.jboss.serial.objectmetamodel.DataContainer$DataContainerInput.readObject(DataContainer.java:845)
      10:58:46,724 ERROR [STDERR]           at org.jboss.serial.io.MarshalledObjectForLocalCalls.get(MarshalledObjectForLocalCalls.java:60)
      10:58:46,725 ERROR [STDERR]           at org.jboss.ejb3.remoting.IsLocalInterceptor.invokeLocal(IsLocalInterceptor.java:96)
      10:58:46,725 ERROR [STDERR]           at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:72)
      10:58:46,725 ERROR [STDERR]           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      10:58:46,725 ERROR [STDERR]           at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:107)
      10:58:46,725 ERROR [STDERR]           ... 27 more