Application migration error, ANTLR and Wildfly incompatibility 8

Asked

Viewed 615 times

0

I have a legacy application developed in Java web, and would like to put it in a new production environment. Java 8 and the latest version of Wildfly are installed in this environment. Today this application runs on a Java 7 server in Glassfish (I don’t remember the version, but it’s not so outdated) no problem.

The problem that is occurring is this, when I try to deploy the application in Wildfly it gives the following error:

"{\"JBAS014671: Failed services\" => {
\"jboss.persistenceunit.\\\"Projeto.war#ProjetoBasePU\\\"\" => \"org.jboss.msc.service.StartException in service jboss.persistenceunit.\\\"Projeto.war#ProjetoBasePU\\\": javax.persistence.PersistenceException: [PersistenceUnit: ProjetoBasePU] Unable to build Hibernate SessionFactory
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: ProjetoBasePU] Unable to build Hibernate SessionFactory
Caused by: org.hibernate.MappingException: Could not get constructor for org.hibernate.persister.collection.OneToManyPersister
Caused by: org.hibernate.HibernateException: Unable to parse order-by fragment
Caused by: java.lang.ClassCastException: antlr.CommonToken cannot be cast to antlr.Token\",
\"jboss.persistenceunit.\\\"Projeto.war#ProjetoBaseTestPU\\\"\" => \"org.jboss.msc.service.StartException in service jboss.persistenceunit.\\\"Projeto.war#ProjetoBaseTestPU\\\": javax.persistence.PersistenceException: [PersistenceUnit: ProjetoBaseTestPU] Unable to build Hibernate SessionFactory
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: ProjetoBaseTestPU] Unable to build Hibernate SessionFactory
Caused by: org.hibernate.MappingException: Could not get constructor for org.hibernate.persister.collection.OneToManyPersister
Caused by: org.hibernate.HibernateException: Unable to parse order-by fragment
Caused by: java.lang.ClassCastException: antlr.CommonToken cannot be cast to antlr.Token\"

Performing some tests, I removed from the project’s libraries the jar from ANTLR, this made this error disappear, the application makes the deploy normally, but then the following error happens when I try to access the first screen of the system:

14:11:41,484 ERROR [stderr] (default task-6) javax.servlet.ServletException: java.lang.NoSuchMethodError: org.hibernate.SessionFactory.openSession()Lorg/hibernate/classic/Session;

14:11:41,484 ERROR [stderr] (default task-6)    at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848)

14:11:41,484 ERROR [stderr] (default task-6)    at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:777)

14:11:41,485 ERROR [stderr] (default task-6)    at org.apache.jsp.login_jsp._jspService(login_jsp.java:193)

14:11:41,485 ERROR [stderr] (default task-6)    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:69)

14:11:41,485 ERROR [stderr] (default task-6)    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)

14:11:41,485 ERROR [stderr] (default task-6)    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:366)

14:11:41,485 ERROR [stderr] (default task-6)    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326)

14:11:41,485 ERROR [stderr] (default task-6)    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:259)

14:11:41,485 ERROR [stderr] (default task-6)    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)

14:11:41,486 ERROR [stderr] (default task-6)    at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)

14:11:41,486 ERROR [stderr] (default task-6)    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:130)

14:11:41,486 ERROR [stderr] (default task-6)    at br.edu.unifeob.sguprofessor.filtros.FiltroHibernate.doFilter(FiltroHibernate.java:51)

14:11:41,486 ERROR [stderr] (default task-6)    at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)

14:11:41,486 ERROR [stderr] (default task-6)    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132)

14:11:41,486 ERROR [stderr] (default task-6)    at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:85)

14:11:41,486 ERROR [stderr] (default task-6)    at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61)

14:11:41,486 ERROR [stderr] (default task-6)    at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)

14:11:41,487 ERROR [stderr] (default task-6)    at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)

14:11:41,487 ERROR [stderr] (default task-6)    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)

14:11:41,487 ERROR [stderr] (default task-6)    at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113)

14:11:41,487 ERROR [stderr] (default task-6)    at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56)

14:11:41,487 ERROR [stderr] (default task-6)    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)

14:11:41,487 ERROR [stderr] (default task-6)    at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45)

14:11:41,488 ERROR [stderr] (default task-6)    at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61)

14:11:41,488 ERROR [stderr] (default task-6)    at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58)

14:11:41,488 ERROR [stderr] (default task-6)    at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70)

14:11:41,488 ERROR [stderr] (default task-6)    at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)

14:11:41,488 ERROR [stderr] (default task-6)    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)

14:11:41,524 ERROR [stderr] (default task-6)    at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)

14:11:41,524 ERROR [stderr] (default task-6)    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)

14:11:41,524 ERROR [stderr] (default task-6)    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)

14:11:41,524 ERROR [stderr] (default task-6)    at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240)

14:11:41,524 ERROR [stderr] (default task-6)    at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227)

14:11:41,525 ERROR [stderr] (default task-6)    at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73)

14:11:41,525 ERROR [stderr] (default task-6)    at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146)

14:11:41,525 ERROR [stderr] (default task-6)    at io.undertow.server.Connectors.executeRootHandler(Connectors.java:177)

14:11:41,525 ERROR [stderr] (default task-6)    at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:727)

14:11:41,525 ERROR [stderr] (default task-6)    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

14:11:41,525 ERROR [stderr] (default task-6)    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

14:11:41,525 ERROR [stderr] (default task-6)    at java.lang.Thread.run(Thread.java:724)

14:11:41,526 ERROR [stderr] (default task-6) Caused by: java.lang.NoSuchMethodError: org.hibernate.SessionFactory.openSession()Lorg/hibernate/classic/Session;

14:11:41,526 ERROR [stderr] (default task-6)    at br.edu.unifeob.sgu.uteis.HibernateConnection.getSession(HibernateConnection.java:56)

14:11:41,526 ERROR [stderr] (default task-6)    at br.edu.unifeob.sgu.uteis.HibernateConnection.beginTransaction(HibernateConnection.java:107)

14:11:41,526 ERROR [stderr] (default task-6)    at br.edu.unifeob.sguprofessor.taglibs.hibernatetag.HibernateQuery.doEndTag(HibernateQuery.java:65)

14:11:41,526 ERROR [stderr] (default task-6)    at org.apache.jsp.login_jsp._jspx_meth_hibernate_005fquery_005f0(login_jsp.java:326)

14:11:41,526 ERROR [stderr] (default task-6)    at org.apache.jsp.login_jsp._jspService(login_jsp.java:141)

14:11:41,527 ERROR [stderr] (default task-6)    ... 37 more

Someone’s been through it?

  • Before deploying you should migrate your entire application backend to wildfly. Apparently you didn’t do this with Hibernate.

  • What do you mean? What did you mean by that?

  • Dude, it’s not just about taking Ar, deploying, and that’s it. I wish it was. Jboss, like glassfish, is a container and will provide a basic infrastructure for your application. You have a lot of libraries and jar’s that will run on your jboss, that’s what I call infrastructure. You should make sure your jboss has all this working before deploying.

  • I already have two applications running there without any problem, the problem is with the doubt.

  • Does your implementation use pure JPA ? or does it have Hibernate-specific features ? What @Edgarmunizberlinck makes perfect sense, it’s not just changing environment, another detail is related to Java 8, Wildfly only has support for Java 7, never tried to run in this environment, but I advise you to migrate carefully and preferably on top of jdk 1.7 same.

  • There are some things of Hibernate in the middle too, and about the support for Java 8, in the final release of Wildfly 8 according to their own site he already had a certain compatibility with Java 8, which was being improved, and we are already in Wildfly 8.1.

Show 1 more comment

1 answer

1

I wanted to put as a comment but I’m not getting.

14:11:41,484 ERROR [stderr] (default task-6) javax.servlet.Servletexception: java.lang.Nosuchmethoderror: org.hibernate.Sessionfactory.openSession()Lorg/Hibernate/classic/Session;

You’re probably having a version incompatibility in the meantime. This usually occurs when you compile in one version and the execution environment is in another.

Ex: Compiled location as Hiberant 3 and in your Jboss has Hibernate 4, and the openSession() method is not available in Hibernate 4’s Sessionfactory object.

Javadoc:

Thrown if an application tries to call a specified method of a class (either Static or instance), and that class no longer has a Definition of that method. Normally, this error is Caught by the Compiler; this error can only occur at run time if the Definition of a class has incompatibly changed.


Additional suggestion

Inside Jboss is already available a version of Hibernate 4, be sure to remove from your application any other version of Hibernate.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.