8 Replies Latest reply on Nov 22, 2008 5:20 AM by jaikiran pai

    JBoss 5 CR2 - Serialization error

    Chiradeep Das Newbie

      I am using JBoss 5 CR2 version with OpenJPA v1.2. The application has a custom JAAS login module that looks up user service (stateless ejb3) and remotely invokes findUser(userId) method to retrieve user information. JBoss runs into an infinite error loop while serializing user information after completing findUser method in user service.

      If I lookup user service ejb3 and remotely invoke findUser method from standalone jdk client, the method runs successfully. Problem arises only when the customlogin module tries to invoke the findUser method remotely.

      Has anyone experienced similar error with JBoss CR2? Appreciate any help.

      Following is the stack trace
      ------------------------------------------------------------------------------------------------------------------------
      [org.jboss.serial.persister.RegularObjectPersister] (http-127.0.0.1-8080-4) error
      java.lang.reflect.InvocationTargetException
      at sun.reflect.GeneratedMethodAccessor202.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithMethod(RegularObjectPersister.java:120)
      at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:86)
      at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:188)
      at org.jboss.serial.objectmetamodel.DataContainer$DataContainerOutput.writeObject(DataContainer.java:390)
      at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithFields(RegularObjectPersister.java:182)
      at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:90)
      at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:188)
      at org.jboss.serial.objectmetamodel.DataContainer$DataContainerOutput.writeObject(DataContainer.java:390)
      at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithFields(RegularObjectPersister.java:182)
      at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:90)
      at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:188)
      at org.jboss.serial.objectmetamodel.DataContainer$DataContainerOutput.writeObject(DataContainer.java:390)
      at org.jboss.serial.persister.ObjectOutputStreamProxy.writeObjectOverride(ObjectOutputStreamProxy.java:60)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:298)
      at java.util.ArrayList.writeObject(ArrayList.java:569)
      at sun.reflect.GeneratedMethodAccessor202.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithMethod(RegularObjectPersister.java:120)
      at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:86)
      at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:188)
      at org.jboss.serial.objectmetamodel.DataContainer$DataContainerOutput.writeObject(DataContainer.java:390)
      at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithFields(RegularObjectPersister.java:182)
      at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:90)
      at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:188)
      at org.jboss.serial.objectmetamodel.DataContainer$DataContainerOutput.writeObject(DataContainer.java:390)
      at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithFields(RegularObjectPersister.java:182)
      at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:90)
      at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:188)
      at org.jboss.serial.objectmetamodel.DataContainer$DataContainerOutput.writeObject(DataContainer.java:390)
      at org.jboss.serial.persister.ObjectOutputStreamProxy.writeObjectOverride(ObjectOutputStreamProxy.java:60)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:298)
      at java.util.ArrayList.writeObject(ArrayList.java:569)
      at sun.reflect.GeneratedMethodAccessor202.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithMethod(RegularObjectPersister.java:120)
      at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:86)
      at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:188)
      at org.jboss.serial.objectmetamodel.DataContainer$DataContainerOutput.writeObject(DataContainer.java:390)
      at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithFields(RegularObjectPersister.java:182)
      at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:90)
      at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:188)
      at org.jboss.serial.objectmetamodel.DataContainer$DataContainerOutput.writeObject(DataContainer.java:390)
      at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithFields(RegularObjectPersister.java:182)
      at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:90)
      at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:188)
      at org.jboss.serial.objectmetamodel.DataContainer$DataContainerOutput.writeObject(DataContainer.java:390)
      at org.jboss.serial.persister.ObjectOutputStreamProxy.writeObjectOverride(ObjectOutputStreamProxy.java:60)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:298)
      at java.util.ArrayList.writeObject(ArrayList.java:569)
      at sun.reflect.GeneratedMethodAccessor202.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      -----------------------------------------------------------------------------------------------------------------

        • 1. Re: JBoss 5 CR2 - Serialization error
          jaikiran pai Master

          Please post the relevant code. And also, which version of JDK do you use?

          While posting the logs or xml content or code, remember to wrap it in a code block using the Code button in the message editor window and please hit the Preview button to make sure your post is correctly formatted

          • 2. Re: JBoss 5 CR2 - Serialization error
            Chiradeep Das Newbie

            Following is the relevant code in the application custom JAAS Lgoin Module, login() method. The highlighted line retrieves the user info from remote user service. The error occurs at this line. If I write a JDK client (normal Java class run at command prompt) to lookup remote user service and invoke same findUser method I do not get any errors.

            I am using Sun JDK version 1.5.0_14-b03

            public boolean login() throws LoginException {
             LOG.logMessage("login() - enter");
            
             String[] credentials = null;
            
             /* get user credentials */
             credentials = this.getUserCredentials();
            
             /* setup service parameters */
             this.user = new User();
             user.setId(credentials[0]);
            
             /* lookup service */
             InitialContext ic;
             try {
             ic = new InitialContext();
             userSvc = (IUserServiceRemote)
             ic.lookup(IBusServiceLookup.USER);
             } catch (NamingException e) {
             throw new
             LoginException(ILoginServiceErrorCodes.NAMING_ERROR);
             }
             /* invoke service */
             try {
            **********ERROR happens at below method call
             this.user = userSvc.findUser(user.getId());
             } catch (ServiceException sve) {
             LOG.logMessage("login() - service execption occurred");
             throw new
             LoginException(sve.getErrors().get(0).getErrorCode());
             }
            
             ...............................................................................
             ...............................................................................
            }
            


            • 3. Re: JBoss 5 CR2 - Serialization error
              jaikiran pai Master

               

              JBoss runs into an infinite error loop while serializing user information


              When you say infinite error loop what exactly happens? These exceptions keep repeating without any end?

              • 4. Re: JBoss 5 CR2 - Serialization error
                jaikiran pai Master

                Also can you please post the User entity code, including import statements and any annotations?

                • 5. Re: JBoss 5 CR2 - Serialization error
                  Chiradeep Das Newbie

                  User entity

                  import java.io.Serializable;
                  import java.util.ArrayList;
                  import java.util.Date;
                  import java.util.List;
                  
                  import javax.persistence.CascadeType;
                  import javax.persistence.Column;
                  import javax.persistence.Entity;
                  import javax.persistence.FetchType;
                  import javax.persistence.Id;
                  import javax.persistence.JoinColumn;
                  import javax.persistence.JoinTable;
                  import javax.persistence.ManyToMany;
                  import javax.persistence.ManyToOne;
                  import javax.persistence.OrderBy;
                  import javax.persistence.Table;
                  import javax.persistence.Temporal;
                  import javax.persistence.TemporalType;
                  
                  @Entity
                  @Table(name = "USER")
                  public class User implements Serializable{
                  
                   private static final long serialVersionUID = -8928287817601838878L;
                   private String id;
                   private String pwd;
                   private String name;
                   private String type;
                   private boolean active;
                   private List<Group> groups = new ArrayList<Group>(0);
                   private SectionGroup sectionGroup;
                   private Department dept;
                  
                   @Id
                   @Column(name = "USER_ID")
                   public String getId() {
                   return this.id;
                   }
                  
                   public void setId(String id) {
                   this.id = id;
                   }
                  
                   @Column(name = "PASSWORD")
                   public String getPwd() {
                   return this.pwd;
                   }
                  
                   public void setPwd(String pwd) {
                   this.pwd = pwd;
                   }
                  
                   @Column(name = "USER_NAME")
                   public String getName() {
                   return this.name;
                   }
                  
                   public void setName(String name) {
                   this.name = name;
                   }
                  
                   @Column(name = "USER_TYPE")
                   public String getType() {
                   return this.type;
                   }
                  
                   public void setType(String type) {
                   this.type = type;
                   }
                  
                   @Column(name = "ACTIVE_IND")
                   public boolean isActive() {
                   return this.active;
                   }
                  
                   public void setActive(boolean active) {
                   this.active = active;
                   }
                  
                   @ManyToMany(cascade = { CascadeType.ALL }, fetch = FetchType.EAGER)
                   @OrderBy("code ASC")
                   @JoinTable(name = "ROLEGROUP_XREF", joinColumns = @JoinColumn(name = "USER_ID", referencedColumnName = "USER_ID"), inverseJoinColumns = @JoinColumn(name = "ROLEGROUP_CODE", referencedColumnName = "ROLEGROUP_CODE"))
                   public List<Group> getGroups() {
                   return groups;
                   }
                  
                   public void setGroups(List<Group> groups) {
                   this.groups = groups;
                   }
                  
                  
                   @ManyToOne(fetch = FetchType.EAGER)
                   @JoinColumn(name = "SECTION_GROUP_ID")
                   public SectionGroup getSectionGroup() {
                   return sectionGroup;
                   }
                  
                  
                   public void setSectionGroup(SectionGroup sectionGroup) {
                   this.sectionGroup = sectionGroup;
                   }
                  
                   @ManyToOne(fetch = FetchType.LAZY)
                   @JoinColumn(name = "DEPT_ID")
                   public Department getDepartment() {
                   return this.dept;
                   }
                  
                   public void setDepartment(Department dept) {
                   this.dept = dept;
                   }
                  
                   @Override
                   public String toString() {
                   return getClass().getName() + "[id=" + getId() + "]";
                   }
                  }
                  


                  • 6. Re: JBoss 5 CR2 - Serialization error
                    Chiradeep Das Newbie

                     

                    When you say infinite error loop what exactly happens? These exceptions keep repeating without any end?


                    Yes the exceptions keep repeating without any end.

                    • 7. Re: JBoss 5 CR2 - Serialization error
                      jaikiran pai Master

                      Going by the exception stacktrace, it seems to be failing (going into indefinite loop) while serializing this list contents:

                      private List<Group> groups = new ArrayList<Group>(0);


                      Try playing around with the list contents or by commenting out this list from the user and see if there is any difference.
                      Irrespective of the outcome, there shouldn't have been an indefinite loop in first place. Since the stacktrace shows the org.jboss.serial.persister.RegularObjectPersister, i think you should report this in the "Design of JBoss Serialization" forum http://www.jboss.com/index.html?module=bb&op=viewforum&f=233. I know its a design forum meant for design discussions, but i could not find a user forum where you could open a new thread.




                      • 8. Re: JBoss 5 CR2 - Serialization error
                        jaikiran pai Master

                        And i don't know if this is the same issue as http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4163835#4163835, but they look similar.