4 Replies Latest reply on Oct 13, 2009 9:02 PM by Jean Luc

    Failed to replicate session + entity hashCode NullPointer exception

    gdfgd eqwe Novice
      Hi!

      I Would like to setup http session replication on Seam 2.2.0GA + JBoss 5.1 environment and
      I get the following exception:



      Failed to replicate session s5hL7mXiY499rXdsivCdTA__.node007
      java.lang.NullPointerException
           at clustertest.entity.Person.hashCode(Person.java:78)
           at java.util.HashMap$Entry.hashCode(HashMap.java:720)
           at java.util.AbstractMap.hashCode(AbstractMap.java:461)
           at org.jboss.ha.framework.server.SimpleCachableMarshalledValue.<init>(SimpleCachableMarshalledValue.java:74)
           at org.jboss.ha.framework.server.SimpleCachableMarshalledValue.<init>(SimpleCachableMarshalledValue.java:80)
           at org.jboss.web.tomcat.service.session.distributedcache.spi.SessionSerializationFactory.createMarshalledValue(SessionSerializationFactory.java:74)
           at org.jboss.web.tomcat.service.session.distributedcache.impl.jbc.AbstractJBossCacheService.getMarshalledValue(AbstractJBossCacheService.java:635)
           at org.jboss.web.tomcat.service.session.distributedcache.impl.jbc.SessionBasedJBossCacheService.storeSessionAttributes(SessionBasedJBossCacheService.java:124)
           at org.jboss.web.tomcat.service.session.distributedcache.impl.jbc.SessionBasedJBossCacheService.storeSessionAttributes(SessionBasedJBossCacheService.java:37)
           at org.jboss.web.tomcat.service.session.distributedcache.impl.jbc.AbstractJBossCacheService.storeSessionData(AbstractJBossCacheService.java:403)
           at org.jboss.web.tomcat.service.session.ClusteredSession.processSessionReplication(ClusteredSession.java:1166)
           at org.jboss.web.tomcat.service.session.JBossCacheManager.processSessionRepl(JBossCacheManager.java:1937)
           at org.jboss.web.tomcat.service.session.JBossCacheManager.storeSession(JBossCacheManager.java:309)
           at org.jboss.web.tomcat.service.session.InstantSnapshotManager.snapshot(InstantSnapshotManager.java:51)
           at org.jboss.web.tomcat.service.session.ClusteredSessionValve.handleRequest(ClusteredSessionValve.java:147)
           at org.jboss.web.tomcat.service.session.ClusteredSessionValve.invoke(ClusteredSessionValve.java:94)
           at org.jboss.web.tomcat.service.session.JvmRouteValve.invoke(JvmRouteValve.java:88)
           at org.jboss.web.tomcat.service.session.LockingValve.invoke(LockingValve.java:62)
           at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
           at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
           at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
           at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
           at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
           at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:436)
           at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:384)
           at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
           at java.lang.Thread.run(Thread.java:619)



      and Person entity:


      @Roles( { @Role(name = "sessionPerson", scope = ScopeType.SESSION) })
      @Name("person")
      @Entity
      public class Person implements Serializable {

           private static final long serialVersionUID = 5L;

           @Id
           @GeneratedValue
           private Long id;

           private String name;


           public Long getId() {
                return id;
           }

           public void setId(Long id) {
                this.id = id;
           }

           public String getName() {
                return name;
           }

           public void setName(String name) {
                this.name = name;
           }

           
           @Override
           public boolean equals(Object other) {
                if ((this == other))
                     return true;
                if ((other == null))
                     return false;
                if (!(other instanceof Person))
                     return false;

                return this.getId().equals(((Person) other).getId());
           }

           @BypassInterceptors
           @Override
           public int hashCode() {
                
                     int result = 17;
                     result = 37 * result + (int) this.getId().intValue();
                     return result;

           }
           

      }