Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoClassDefFound exception at water.logging.LoggerFactory #6725

Closed
gjevardat opened this issue Apr 27, 2023 · 3 comments · Fixed by #15918
Closed

NoClassDefFound exception at water.logging.LoggerFactory #6725

gjevardat opened this issue Apr 27, 2023 · 3 comments · Fixed by #15918
Assignees
Milestone

Comments

@gjevardat
Copy link

gjevardat commented Apr 27, 2023

Hello

Upgrading from 3.30.x to 3.40.x raises this exception when initialising the water logging class in my client java application:

Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Priority

I see in the code that only ClassNotFound is caught but not NoClassDefFound

 private boolean isWaterLogAvailable() {
        try {
            Class.forName(waterLogClassName);
            return true;
        } catch (ClassNotFoundException e) {
            return false;
        }
    }

Indeed in my class path I use only log4j2 libraries so I do not have

Probably I missed something while upgrading, but how could I force my client not to use water logging system. I'd like to use only log4j2 as in 3.30x. More precisely I don't want to depend on log4j 1 versions...

Thanks for help

@yazun
Copy link

yazun commented Jul 26, 2023

We have the same issue. Looks like only adding water as dependency could resolve it as long as this bug is not fixed?

@yazun
Copy link

yazun commented Jul 26, 2023

This is happening when we are just trying to load DRF, with no water dependecies needed. It works ok for XGB i.e.

        at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [gaia.cu7.algo.classification.supervised.ClassificationTaker]: Factory method 'classificationTaker' threw exception; nested exception is java.lang.NoClas
sDefFoundError: org/apache/log4j/Priority
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
        ... 47 more
Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Priority
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:375)
        at water.logging.LoggerFactory.isWaterLogAvailable(LoggerFactory.java:79)
        at water.logging.LoggerFactory.<init>(LoggerFactory.java:19)
        at water.logging.LoggerFactory.<clinit>(LoggerFactory.java:7)
        at hex.genmodel.algos.tree.SharedTreeMojoModel.<clinit>(SharedTreeMojoModel.java:30)
        at java.base/java.lang.Class.forName0(Native Method)

yazun added a commit to Sednai/h2o-3 that referenced this issue Jul 27, 2023
Fix the regression that caused DRF loading fail due to spurious dependency on slf4j when log4j2 exists.
Check for water logging availability was throwing exception if slf4j was not used while loading some models. this seems like a regression between 3.30 and 3.40.
h2oai#6725
yazun added a commit to Sednai/h2o-3 that referenced this issue Aug 18, 2023
Fix the regression that caused DRF loading fail due to spurious dependency on slf4j when log4j2 exists.
Check for water logging availability was throwing exception if slf4j was not used while loading some models. this seems like a regression between 3.30 and 3.40.
h2oai#6725
@mn-mikke mn-mikke added this to the 3.44.0.3 milestone Nov 10, 2023
@yazun
Copy link

yazun commented Nov 13, 2023

Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants