3 Replies Latest reply on Feb 23, 2010 10:41 AM by adamw

    Jboss 4.2.2.GA could not start deployment of a .war because a java.lang.ArrayStoreException

      Hi everybody!

       

      I have deployed one of my apps with the audit capability provided by the envers project. Everything was going fine until I tried to develop a listener of my own.

       

      I have these configuration for my event listeners:

       

      <

       

      property name="eventListeners">

       

      <map>

       

      <entry key="post-insert">

       

      <bean class="es.tragsatec.ait.oviedo.audit.AuditRevisionListener"></bean>

       

      </entry>

       

      <entry key="post-update">

       

      <bean class="org.hibernate.envers.event.AuditEventListener"></bean>

       

      </entry>

       

      <entry key="post-delete">

       

      <bean class="org.hibernate.envers.event.AuditEventListener"></bean>

       

      </entry>

       

      </map>

       

      </property>

       

      I'm using the next libraries:

       

      <

       

      dependency>

       

      <groupId>org.springframework</groupId>

       

      <artifactId>spring-core</artifactId>

       

      <version>2.5.6</version>

       

      </dependency>

       

      <

       

      dependency>

       

      <groupId>javax.annotation</groupId>

       

      <artifactId>jsr250-api</artifactId>

       

      <version>1.0</version>

       

      </dependency>

       

       

       

      <dependency>

       

      <groupId>javax.persistence</groupId>

       

      <artifactId>persistence-api</artifactId>

       

      <version>1.0</version>

       

      </dependency>

       

       

      <dependency>

       

      <groupId>org.jboss.envers</groupId>

       

      <artifactId>jboss-envers</artifactId>

       

      <version>1.2.2.GA</version>

       

      </dependency>

      <

       

      dependency>

       

      <groupId>org.hibernate</groupId>

       

      <artifactId>hibernate-core</artifactId>

       

      <version>3.3.1.GA</version>

       

      </dependency>

       

      The source code of my listener is:

       

      package

       

       

      es.tragsatec.ait.oviedo.audit;

       

      import

       

       

      org.hibernate.envers.RevisionListener;

       

      import

       

       

      org.springframework.security.Authentication;

      import

       

       

      org.springframework.security.context.SecurityContextHolder;

       

      public

       

       

      class AuditRevisionListener implements RevisionListener {

       

       

      public void newRevision(Object revisionEntity) {

      AuditRevisionEntity are = (AuditRevisionEntity) revisionEntity;

      Authentication authentication = SecurityContextHolder.getContext().getAuthentication();

      are.setUsername(authentication.getName());

      }

       

      }

       

       

      And the cource code of my entity:

       

      package

       

       

      es.tragsatec.ait.oviedo.audit;

       

      import

       

       

      java.util.Date;

       

      import

       

       

      javax.persistence.Entity;

      import

       

       

      javax.persistence.GeneratedValue;

      import

       

       

      javax.persistence.Id;

      import

       

       

      javax.persistence.Transient;

       

      import

       

       

      org.hibernate.envers.RevisionEntity;

      import

       

       

      org.hibernate.envers.RevisionNumber;

      import

       

       

      org.hibernate.envers.RevisionTimestamp;

       

       

      @

       

      Entity

      @

       

      RevisionEntity(AuditRevisionListener.class)

      public

       

       

      class AuditRevisionEntity {

       

       

      @Id

       

      @GeneratedValue

       

      @RevisionNumber

       

      private int id;

       

       

      @RevisionTimestamp

       

      private long timestamp;

       

       

      private String username;

       

       

      public String getUsername() { return username; }

       

      public void setUsername(String username) { this.username = username; }

       

      public int getId() {

       

      return id;

      }

       

      public void setId(int id) {

       

      this.id = id;

      }

       

      public long getTimestamp() {

       

      return timestamp;

      }

       

      public void setTimestamp(long timestamp) {

       

      this.timestamp = timestamp;

      }

       

       

      @Transient

       

      public Date getDate() {

       

      return new Date(this.getTimestamp());

      }

       

      ...equals(Object), hahscode()...

      }

       

       

      The problem is when Jboss (4.2.2.GA) tried to deployed the app it can't because is getting a

      java.lang.ArrayStoreException:

       

       

       

       

      Configuration.java:1678)

       

       

      Could anybody give me any suggestion?

       

      Thank's in advance,

       

      Luis

        • 1. Re: Jboss 4.2.2.GA could not start deployment of a .war because a java.lang.ArrayStoreException
          adamw

          Hello,

           

          could you re-post the stack trace beacuse it's not visible?

           

          I suspect that you have multiple versions of hibernate/annotations/entitymanager/search in jboss - probably one bundled with your application, and one provided by jboss (in the lib directory). Try deploying the app in a scoped classloader or updating the jboss libraries.

           

          Adam

          • 2. Re: Jboss 4.2.2.GA could not start deployment of a .war because a java.lang.ArrayStoreException

            Hi Adam, this is part of the stacktrace:

             

            Error creating bean with name 'org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor#0': Cannot create inner bean '(inner bean)' of type [org.springframework.transaction.interceptor.TransactionInterceptor] while setting bean property 'transactionInterceptor'; nested exception is

            org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Cannot resolve reference to bean 'txManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'txManager' defined in file [C:\tragsatec-fw\jboss\server\default\tmp\deploy\tmp6289398249984974503Admin-exp.war\WEB-INF\classes\beans\service-beans.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [C:\tragsatec-fw\jboss\server\default\tmp\deploy\tmp6289398249984974503Admin-exp.war\WEB-INF\classes\beans\conection-beans.xml]: Invocation of init method failed; nested exception is java.lang.ArrayStoreException: es.tragsatec.ait.oviedo.audit.AuditRevisionListener

             

            I'm going to take a look of the dependencies of my projects. But the strange thing it's that the deployment error only happens when I declared my own listener (es.tragsatec.ait.oviedo.audit.AuditRevisionListener)

             

            Thanks a lot for answering!

             

            Regards,

             

            Luis

            • 3. Re: Jboss 4.2.2.GA could not start deployment of a .war because a java.lang.ArrayStoreException
              adamw

              Well, the most interesting bit is missing: what is the part of the stack trace causing java.lang.ArrayStoreException: es.tragsatec.ait.oviedo.audit.AuditRevisionListener?

               

              Adam