Reputation: 111
After J. Roberson kindly asked me to create a new answer because my code changed but didnt got fixed. First code and problem, I checked all answers at Thread, but they didnt helped me, I stil get an error and cant use
SessionFactory factory = new Configuration();
Problem :
0 [main] DEBUG org.jboss.logging - Logging Provider: org.jboss.logging.Log4jLoggerProvider
16 [main] DEBUG org.hibernate.integrator.internal.IntegratorServiceImpl - Adding Integrator [org.hibernate.cfg.beanvalidation.BeanValidationIntegrator].
21 [main] DEBUG org.hibernate.integrator.internal.IntegratorServiceImpl - Adding Integrator [org.hibernate.secure.spi.JaccIntegrator].
40 [main] DEBUG org.hibernate.integrator.internal.IntegratorServiceImpl - Adding Integrator [org.hibernate.cache.internal.CollectionCacheInvalidator].
Exception in thread "main" java.lang.NoSuchFieldError: TRACE
at org.jboss.logging.Log4jLogger.translate(Log4jLogger.java:60)
at org.jboss.logging.Log4jLogger.doLog(Log4jLogger.java:40)
at org.jboss.logging.Logger.trace(Logger.java:107)
at org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.registerStrategyImplementor(StrategySelectorImpl.java:66)
at org.hibernate.boot.registry.selector.internal.StrategySelectorBuilder.addDialect(StrategySelectorBuilder.java:237)
at org.hibernate.boot.registry.selector.internal.StrategySelectorBuilder.addDialects(StrategySelectorBuilder.java:188)
at org.hibernate.boot.registry.selector.internal.StrategySelectorBuilder.buildSelector(StrategySelectorBuilder.java:154)
at org.hibernate.boot.registry.BootstrapServiceRegistryBuilder.build(BootstrapServiceRegistryBuilder.java:222)
at org.hibernate.cfg.Configuration.<init>(Configuration.java:118)
at main.java.Main.main(Main.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Upvotes: 1
Views: 3988
Reputation: 1555
You can use log4j.1.2.12 or a higher version to fix this issue. log4j 1.2.17 can be downloaded from here.
Upvotes: 2
Reputation: 3914
You are getting java.lang.NoSuchFieldError: TRACE
exception.
The TRACE level is available in the log4j jar of version 1.2.12 or higher.
please check which version are you using? Also, check for conflicting version of class org.apache.log4j.Level in your classpath.
remove the log4j-boot.jar from your client's classpath if it exists and include a log4j jar of version 1.2.12 or higher.
Upvotes: 4