Hibernate 5 + Glassfish 4.1.1: java.lang.NoSuchMethodError: org.jboss.logging.Logger.debugf(Ljava/lang/String;I)V
Asked Answered
B

3

5

When I add Hibernate 5 to my website, I can't get it to work in Glassfish 4.1.1. I always get an error

java.lang.NoSuchMethodError: org.jboss.logging.Logger.debugf(Ljava/lang/String;I)V

I've tried to replace the jboss-logging library in Glassfish' modules folder, like I read in an answer to a similar problem, but it didn't change anything. I also tried to use Hibernate 4, but that gave an other error.

Beker answered 15/1, 2016 at 14:53 Comment(2)
Seems jboss-logging jar is not available. Check it in your classpathApocarpous
Possible duplicate of Hibernate 5 java.lang.NoSuchMethodError org.jboss.logging.Logger.debugfMenton
B
2

Try to clean glassfish osgi-cache folder in your domain. You can find details in this Payara github issue: https://github.com/payara/Payara/issues/554 (Payara is a fork of Glassfish with additional features, so basic mechanics remain the same as in Glassfish)

Beware answered 15/1, 2016 at 15:43 Comment(0)
C
6

In my case, I was running the Hibernate 5 with JPA annotations on tomcat and stop working when I changed to glassfish 4.1

The error:

hibernate.properties not found

Make sure: src/main/resources/hibernate.cfg.xml exists

And if you only have the dependency of hibernate-core, I was using hibernate-annotations and hibernate-common-annotations and it was creating conflict. The hibernate 5 doesnt need these two, I had read somewhere.Try to remove ;)

After that a new error appears:

java.lang.NoSuchMethodError: org.jboss.logging.Logger.debugf(Ljava/lang/String;I)V

The reason was the oldest jboss-logging.jar at: "YOUR_GLASSFISH_FOLDER/glassfish/modules"

Why? The hibernate 5 has dependency with the newest version of jboss-logging, and the glassfish 4 uses the oldest version even if you declare inside your POM file the newest version. Actually I'm using:

org.jboss.logging jboss-logging 3.3.0.Final

Then I downloaded it and replace the old .jar inside the modules path and it back to work, I spent 2 days trying to solve that and I hope it helps some future issues =D

I used this link to help me: https://medium.com/@mertcal/using-hibernate-5-on-payara-cc242212a5d6#.npq2hdprz

Another solution, in my case, could be back to the last Hibernate 4 version (4.3.11.Final) but it is already too old in my opinion

Corroboration answered 25/8, 2016 at 10:50 Comment(0)
D
3

I had a similar issue, I was able to fix it by creating a glassfish-web.xml file in the WEB-INF directory. The contents of the file are shown below:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app>
     <class-loader delegate="false"/>
</glassfish-web-app>

This ensures that glassfish does not load it's internal libraries, but libraries from your project..

Duff answered 8/8, 2017 at 15:35 Comment(0)
B
2

Try to clean glassfish osgi-cache folder in your domain. You can find details in this Payara github issue: https://github.com/payara/Payara/issues/554 (Payara is a fork of Glassfish with additional features, so basic mechanics remain the same as in Glassfish)

Beware answered 15/1, 2016 at 15:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.