java .lang.AbstractMethodError
org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:278)
org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444)
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:802)
org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:58)
javax.persistence. Persistence.createEntityManagerFactory(Persistence.java:55)
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39)
controller.dao.GenericDAO.(GenericDAO.java:28)
com.mycompany.mazkrest.UsuarioResource.login(UsuarioResource.java:89)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62 )
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:483)
org.glassfish.jersey.server.model.internal .ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)
org.glassfish.jersey.server .model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161)
org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:205)
org.glassfish .jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)
org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)
org.glassfish .jersey.server.model.R esourceMethodInvoker.apply(ResourceMethodInvoker.java:347)
org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)
org.glassfish.jersey.server.ServerRuntime$2.run (ServerRuntime.java:309)
org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
org.glassfish.jersey.internal.Errors$1.call(Errors.java :267)
org.glassfish.jersey.internal.Errors.process(Errors.java:315)
org.glassfish.jersey.internal.Errors.process(Errors.java:297)
org.glassfish.jersey.internal.Errors.process(Errors.java:267)
org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
org.glassfish .jersey.server.ServerRuntime.process(ServerRuntime.java:292)
org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1139)
org.glassfish.jersey.servlet.WebComponent .service(WebComponent.java:460)
org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:386)
org.g lassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:334)
org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:221)
org.apache.tomcat.websocket. server.WsFilter.doFilter(WsFilter.java:52)
I am using JPA 2.1 and I deleted any old jpa version of the jar.
This is my pom.xml Dependencies:
org.glassfish.jersey.containers
jersey-container-servlet-core
org.apache.maven.plugins
maven-war-plugin
2.6
mysql
mysql-connector-java
5.1.36
com.fasterxml.jackson.core
jackson-core
2.6.1
com.fasterxml.jackson.core
jackson-databind
2.6.1
com.fasterxml.jackson.jaxrs < br />jackson-jaxrs-json-provider
2.6.1
com.voodoodyne.jackson.jsog
jackson-jsog
1.1
compile
com.fasterxml.jackson.core
jackson-annotations
2.6.1
org.glassfish.jersey.media
jersey-media-json-jackson< /artifactId>
org.hibernate
hibernate-search
5.3.0.Final
org.apache.lucene
lucene-core
5.3.0< /version>
org.hibernate
hibernate-entitymanager
5.0.1.Final
javax
javaee-web-api
7.0< /version>
jar
When I execute the code that throws the exception for the second time , I get a NoDefClassFoundError.
Hibernate seems to start in the log, but it is not creating an entity manager.
How to solve this?
http://docs.oracle.com/javase/7/docs/api/java/lang/AbstractMethodError.html
“When the application Thrown when the program tries to call an abstract method. Normally, the compiler will catch this error; if the definition of some class has changed incompatible since the last time the currently executing method was compiled, this error can only occur at runtime .
This may be due to the version of hibernate-search&. Hibernate Entity Manager
Hibernate search seems to be using hibernate-commons-annotations 4.0.5 final
< p>http://mvnrepository.com/artifact/org.hibernate/hibernate-search-engine/5.3.0.Final
and
Hibernate entity manager seems to be using hibernate -commons-annotation-5.0.0.Final
http://mvnrepository.com/artifact/org.hibernate/hibernate-entitymanager/5.0.1.Final
Check in eclipse Dependency Hierarchy tab of pom.xml to find out which jar version is being used. Used to exclude incompatible versions. Usually this is done automatically by pom. You can also check WEB-INF/lib folder to see what is being downloaded jar file.
I also see that you are using this jar. If you use tomcat 7 better use it and make its scope “provided” because the web application references the tomcat servlet api jar at runtime .
org.apache.tomcat
tomcat-servl et-api
7.0.21
provided
< /p>
I am trying to use hibernate 5 in Java EE in tomcat 7, and I receive this error:
java.lang.AbstractMethodError< br />org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:278)
org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444)
org.hibernate .jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:802)
org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:58)
javax.persistence.Persistence.createEntityManagerFactory(Persistence .java:55)
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39)
controller.dao.GenericDAO.(GenericDAO.java:28)
com.mycompany .mazkrest.UsuarioResource.login(UsuarioResource.java:89)
sun.reflect.NativeMethodAccessorImpl.invoke0(Nat ive Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method .invoke(Method.java:483)
org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
org.glassfish.jersey.server.model. internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)
org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161)
org.glassfish.jersey.server .model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:205)
org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)
org.glassfish .jersey.server.model.Re sourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)
org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)
org.glassfish.jersey.server.model.ResourceMethodInvoker. apply(ResourceMethodInvoker.java:102)
org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:309)
org.glassfish.jersey.internal.Errors$1.call(Errors. java:271)
org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
org.glassfish.jersey.internal.Errors.process(Errors.java:315)< br />org.glassfish.jersey.internal.Errors.process(Errors.java:297)
org.glassfish.jersey.internal.Errors.process(Errors.java:267)
org.glassfish .jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:292)
org.glassfish.jersey.server .ApplicationHandler.handle(ApplicationHandler.java:1139)
org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:46 0)
org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:386)
org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:334)
org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:221)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
Me I am using JPA 2.1 and I deleted any jar of the old jpa version.
This is my dependency in pom.xml:
org.glassfish.jersey.containers
jersey-container-servlet-core
${jersey.version}-->
jersey-container-servlet
org.apache.maven.plugins groupId>
maven-war-plugin
2.6< /version>
mysql
mysql-connector-java
5.1.36
com.fasterxml.jackson.core
jackson-core
2.6.1
com.fasterxml.jackson.core
jackson-databind
2.6.1
dependency>
com.fasterxml.jackson.jaxrs
jackson-jaxrs-json-provider < br />2.6.1
com.voodoodyne.jackson.jsog
jackson-jsog
1. 1
compile
com.fasterxml.jackson.core
jackson-annotations
2.6.1
org.glassfish.jersey.media
jersey-media-json-jackson
org.hibernate
hibernate-search
5.3.0.Final
org.apache.lucene
lucene-core
5.3.0
< br />
org.hibernate
hibern ate-entitymanager
5.0.1.Final
javax
javaee-web-api
7.0
jar
dependency>
When I execute the code that throws the exception for the second time, I get a NoDefClassFoundError.
hibernate seems to start in the log, but Not to create an entity manager.
How to solve this?
When the jar you use for compilation is incompatible with the jar referenced when the server runs the code, an AbstractMethodError is thrown.
http://docs.oracle.com/javase/7/docs/api/java/lang/AbstractMethodError.html
“Thrown when an application tries to call an abstract method. Normally, compile This error will be caught by the browser; if incompatible changes have occurred in the definition of certain classes since the last time the currently executing method was compiled, this error can only occur at runtime.
This may be due to hibernate-search& hibernate entity manager
hibernate search seems to be using hibernate-commons-annotations 4.0.5 final
http://mvnrepository.com/artifact/ org.hibernate/hibernate-search-engine/5.3.0.Final
and
Hibernate entity manager seems to be using hibernate-commons-annotation-5.0.0.Final
p>
http://mvnrepository.com/artifact/org.hibernate/hibernate-entitymanager/5.0.1.Final
Check the Dependency Hierarchy tab of pom.xml in eclipse to find out The jar version used. Used to exclude incompatible versions. Usually this is done automatically by the pom. You can also check the WEB-INF/lib folder to see the jar file being downloaded.
Me too See that you are using this jar. If you use tomcat 7 better use it and make its scope “provided” because the web application references the tomcat servlet api jar at runtime.
org.apache.tomcat
tomcat-servlet-api
7.0.21 version>
provided