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

java.lang.NoSuchMethodError: ch.qos.logback.classic.util.ContextInitializer.<init>(Lch/qos/logback/classic/LoggerContext;)V #184

Open
GoogleCodeExporter opened this issue Jan 1, 2016 · 1 comment

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Create a simple Orika example project.
2. Import 3rd party dependencies including logback and sl4j jars.
3. Run the program as Java Application.

What is the expected output? What do you see instead?
I get the expected output as value is correctly mapped in destination bean.
But, I also get following exception:
Failed to instantiate [ch.qos.logback.classic.LoggerContext]
Reported exception:
java.lang.NoSuchMethodError: 
ch.qos.logback.classic.util.ContextInitializer.<init>(Lch/qos/logback/classic/Lo
ggerContext;)V
    at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:85)
    at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:56)
    at org.slf4j.LoggerFactory.getSingleton(LoggerFactory.java:189)
    at org.slf4j.LoggerFactory.bind(LoggerFactory.java:112)
    at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:105)
    at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:235)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:208)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:221)
    at ma.glasnost.orika.impl.generator.JavassistCompilerStrategy.<clinit>(JavassistCompilerStrategy.java:56)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at java.lang.Class.newInstance0(Class.java:355)
    at java.lang.Class.newInstance(Class.java:308)
    at ma.glasnost.orika.impl.UtilityResolver.resolveUtility(UtilityResolver.java:131)
    at ma.glasnost.orika.impl.UtilityResolver.getDefaultCompilerStrategy(UtilityResolver.java:51)
    at ma.glasnost.orika.impl.DefaultMapperFactory$MapperFactoryBuilder.<init>(DefaultMapperFactory.java:310)
    at ma.glasnost.orika.impl.DefaultMapperFactory$Builder.<init>(DefaultMapperFactory.java:587)
    at com.test.orika.TestOrika.main(TestOrika.java:12)
Values set..100.0

What version of the product are you using? On what operating system?
I am using logback-classic-0.9 jar, on windows 7, 32-bit.

Please provide any additional information below.
When I changed to logback-classic-1.0.13, I got following exception:
Exception in thread "main" java.lang.IllegalAccessError: tried to access field 
org.slf4j.impl.StaticLoggerBinder.SINGLETON from class org.slf4j.LoggerFactory
    at org.slf4j.LoggerFactory.getSingleton(LoggerFactory.java:194)
    at org.slf4j.LoggerFactory.bind(LoggerFactory.java:112)
    at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:105)
    at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:235)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:208)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:221)
    at ma.glasnost.orika.impl.generator.JavassistCompilerStrategy.<clinit>(JavassistCompilerStrategy.java:56)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at java.lang.Class.newInstance0(Class.java:355)
    at java.lang.Class.newInstance(Class.java:308)
    at ma.glasnost.orika.impl.UtilityResolver.resolveUtility(UtilityResolver.java:131)
    at ma.glasnost.orika.impl.UtilityResolver.getDefaultCompilerStrategy(UtilityResolver.java:51)
    at ma.glasnost.orika.impl.DefaultMapperFactory$MapperFactoryBuilder.<init>(DefaultMapperFactory.java:310)
    at ma.glasnost.orika.impl.DefaultMapperFactory$Builder.<init>(DefaultMapperFactory.java:587)
    at com.test.orika.TestOrika.main(TestOrika.java:12).

Note that in this case, my sysout message didn't appear.

Original issue reported on code.google.com by [email protected] on 7 Dec 2014 at 6:41

@GoogleCodeExporter
Copy link
Author

This seems to be a conflict of slf4j versions in your classpath ?

Original comment by [email protected] on 20 Dec 2014 at 5:36

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

No branches or pull requests

1 participant