1
resposta

Erro no TestaJPA (class org.hibernate.ejb.HibernatePersistence)

Coloquei no provider o Hibernate como aparece no vídeo:

org.hibernate.jpa.HibernatePersistenceProvider

e recebi o seguinte erro:

Exception in thread "main" java.lang.IncompatibleClassChangeError: class org.hibernate.ejb.HibernatePersistence has interface org.hibernate.ejb.AvailableSettings as super class at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:763) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) at java.net.URLClassLoader.access$100(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:368) at java.net.URLClassLoader$1.run(URLClassLoader.java:362) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:361) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at javax.persistence.spi.PersistenceProviderResolverHolder$PersistenceProviderResolverPerClassLoader$CachingPersistenceProviderResolver.loadResolverClasses(PersistenceProviderResolverHolder.java:142) at javax.persistence.spi.PersistenceProviderResolverHolder$PersistenceProviderResolverPerClassLoader$CachingPersistenceProviderResolver.(PersistenceProviderResolverHolder.java:122) at javax.persistence.spi.PersistenceProviderResolverHolder$PersistenceProviderResolverPerClassLoader.getPersistenceProviders(PersistenceProviderResolverHolder.java:80) at javax.persistence.Persistence.getProviders(Persistence.java:69) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:53) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39) at teste.TesteJPA.main(TesteJPA.java:27)

Quando coloco como está no arquivo:

org.hibernate.ejb.HibernatePersistence

Também dá erro:

Exception in thread "main" java.lang.IncompatibleClassChangeError: class org.hibernate.ejb.HibernatePersistence has interface org.hibernate.ejb.AvailableSettings as super class at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:763) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) at java.net.URLClassLoader.access$100(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:368) at java.net.URLClassLoader$1.run(URLClassLoader.java:362) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:361) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at javax.persistence.spi.PersistenceProviderResolverHolder$PersistenceProviderResolverPerClassLoader$CachingPersistenceProviderResolver.loadResolverClasses(PersistenceProviderResolverHolder.java:142) at javax.persistence.spi.PersistenceProviderResolverHolder$PersistenceProviderResolverPerClassLoader$CachingPersistenceProviderResolver.(PersistenceProviderResolverHolder.java:122) at javax.persistence.spi.PersistenceProviderResolverHolder$PersistenceProviderResolverPerClassLoader.getPersistenceProviders(PersistenceProviderResolverHolder.java:80) at javax.persistence.Persistence.getProviders(Persistence.java:69) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:53) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39) at teste.TesteJPA.main(TesteJPA.java:27)

Alguém poderia me ajudar?

1 resposta

Olá Claúdia, tudo bem ?

Você tem todos os jar ?

antlr-2.7.7
dom4j-1.6.1
hibernate-commons-annotations-4.0.1.Final
hibernate-core-4.2.0.Final
hibernate-entitymanager-4.2.0.Final
hibernate-jpa-2.0-api-1.0.1.Final
hibernate-validator-4.3.1.Final
javassist-3.15.0-GA
jboss-logging-3.1.2.GA
jboss-logmanager-1.4.0.Final
jboss-transaction-api_1.1_spec-1.0.1.Final
log4j-jboss-logmanager-1.0.1.Final