I developed a web project with servlet/jsp and hibernate. It works well on Apache Tomcat 8 but when changing to JBoss 7 server, the following error has occurred and can't run my project with JBoss server
Can anyone explain what is happening ?
java.lang.ExceptionInInitializerError
com.auction.persistence.HibernateUtil.buildSessionFactory(HibernateUtil.java:15)
com.auction.persistence.HibernateUtil.<clinit>(HibernateUtil.java:7)
com.auction.dao.daoimpl.UserDaoimpl.<init>(UserDaoimpl.java:17)
com.auction.servlet.TestThree.<init>(TestThree.java:17)
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
java.lang.reflect.Constructor.newInstance(Constructor.java:526)
org.jboss.msc.value.ConstructedValue.getValue(ConstructedValue.java:61)
org.jboss.as.naming.ValueManagedReferenceFactory$1.getInstance(ValueManagedReferenceFactory.java:63)
org.jboss.as.ee.component.ManagedReferenceInterceptor.processInvocation(ManagedReferenceInterceptor.java:52)
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:151)
org.jboss.as.ee.component.BasicComponent.createInstance(BasicComponent.java:76)
org.jboss.as.web.deployment.component.WebComponentInstantiator$1.<init> (WebComponentInstantiator.java:57)
org.jboss.as.web.deployment.component.WebComponentInstantiator.getReference(WebComponentInstantiator.java:55)
org.jboss.as.web.deployment.WebInjectionContainer.instantiate(WebInjectionContainer.java:99)
org.jboss.as.web.deployment.WebInjectionContainer.newInstance(WebInjectionContainer.java:78)
org.jboss.as.web.deployment.WebInjectionContainer.newInstance(WebInjectionContainer.java:72)
org.jboss.as.web.NamingValve.invoke(NamingValve.java:57)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951)
java.lang.Thread.run(Thread.java:724)
java.lang.NoSuchMethodError:
javax.persistence.Table.indexes()[Ljavax/persistence/Index;
org.hibernate.cfg.annotations.EntityBinder.processComplementaryTableDefinitions(EntityBinder.java:936)
org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:824)
org.hibernate.cfg.Configuration$MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:3788)
org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3742)
org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1410)
org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1844)
org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1928)
com.auction.persistence.HibernateUtil.buildSessionFactory(HibernateUtil.java:12)
com.auction.persistence.HibernateUtil.<clinit>(HibernateUtil.java:7)
com.auction.dao.daoimpl.UserDaoimpl.<init>(UserDaoimpl.java:17)
com.auction.servlet.TestThree.<init>(TestThree.java:17)
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
java.lang.reflect.Constructor.newInstance(Constructor.java:526)
org.jboss.msc.value.ConstructedValue.getValue(ConstructedValue.java:61)
org.jboss.as.naming.ValueManagedReferenceFactory$1.getInstance(ValueManagedReferenceFactory.java:63)
org.jboss.as.ee.component.ManagedReferenceInterceptor.processInvocation(ManagedReferenceInterceptor.java:52)
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:151)
org.jboss.as.ee.component.BasicComponent.createInstance(BasicComponent.java:76)
org.jboss.as.web.deployment.component.WebComponentInstantiator$1.<init> (WebComponentInstantiator.java:57)
org.jboss.as.web.deployment.component.WebComponentInstantiator.getReference(WebComponentInstantiator.java:55)
org.jboss.as.web.deployment.WebInjectionContainer.instantiate(WebInjectionContainer.java:99)
org.jboss.as.web.deployment.WebInjectionContainer.newInstance(WebInjectionContainer.java:78)
org.jboss.as.web.deployment.WebInjectionContainer.newInstance(WebInjectionContainer.java:72)
org.jboss.as.web.NamingValve.invoke(NamingValve.java:57)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951)
java.lang.Thread.run(Thread.java:724)
(Note: The full stack trace of the root cause is available in the JBoss Web/7.0.0.CR4 logs.)
This is maven dependency
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- hibernate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.3.5.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.3.5.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.5.6-Final</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.30</version>
</dependency>