I have dependency problems. I have a maven project, with a number of subproject.
- com.mycompany.utility1
- com.mycompany.application1
- com.mycompany.application2
Application1 depends on Utility1 and works perfectly. For Application2 I have added the dependency for a new feature. Using it, gives me...
Exception in thread "main" java.lang.ExceptionInInitializerError
...
at Foo.main(Foo.java:27)
Caused by: com.google.inject.CreationException: Unable to create injector, see the following errors:
1) Error injecting constructor, java.lang.NoSuchMethodError: org.apache.commons.logging.LogFactory.getClassLoader(Ljava/lang/Class;)Ljava/lang/ClassLoader;
at com.google.api.ads.common.lib.soap.axis.conf.AdsAxisEngineConfigurationFactory.<init>(AdsAxisEngineConfigurationFactory.java:37)
while locating com.google.api.ads.common.lib.soap.axis.conf.AdsAxisEngineConfigurationFactory
while locating org.apache.axis.EngineConfigurationFactory
for parameter 0 at com.google.api.ads.common.lib.soap.axis.AxisHandler.<init>(AxisHandler.java:56)
while locating com.google.api.ads.common.lib.soap.axis.AxisHandler
at com.google.api.ads.common.lib.soap.axis.AxisModule.configure(AxisModule.java:59) (via modules: com.google.api.ads.adwords.axis.AdWordsAxisModule -> com.google.api.ads.common.lib.soap.axis.AxisModule)
while locating com.google.api.ads.common.lib.soap.SoapClientHandlerInterface
When I move class Foo to the Application1 subproject, it does run as intended, but emits:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
All the logging and Guice stuff is in subproject Utility1 and both Application1 and Application2 have the same dependency in their pom files.
I have tried to read up on solving dependy issues and I have run mvn enforcer:enforce
on the project. It shows:
[WARNING] Rule 0: org.apache.maven.plugins.enforcer.DependencyConvergence failed with message:
Failed while enforcing releasability the error(s) are [
Dependency convergence error for org.slf4j:slf4j-api:1.7.7 paths to dependency are:
+-com.finnwaa.adwords:googleAdWords:1.0-SNAPSHOT
+-com.google.api-ads:ads-lib:4.1.0
+-org.slf4j:slf4j-api:1.7.7
and
+-com.finnwaa.adwords:googleAdWords:1.0-SNAPSHOT
+-com.pholser:junit-quickcheck-core:0.8.1
+-org.slf4j:slf4j-api:1.7.25
,
Dependency convergence error for commons-codec:commons-codec:1.3 paths to dependency are:
+-com.mycompyany.utility1:1.0-SNAPSHOT
+-com.google.http-client:google-http-client-jackson2:1.23.0
+-com.google.http-client:google-http-client:1.23.0
+-org.apache.httpcomponents:httpclient:4.0.1
+-commons-codec:commons-codec:1.3
and
+-com.mycompyany.utility1:1.0-SNAPSHOT
+-org.apache.poi:poi-ooxml:RELEASE
+-org.apache.poi:poi:4.0.1
+-commons-codec:commons-codec:1.11
,
Dependency convergence error for com.google.guava:guava:20.0 paths to dependency are:
+-com.mycompyany.utility1:1.0-SNAPSHOT
+-com.google.api-ads:ads-lib:4.1.0
+-com.google.guava:guava:20.0
and
+-com.mycompyany.utility1:1.0-SNAPSHOT
+-com.google.api-ads:ads-lib:4.1.0
+-com.google.inject:guice:4.0
+-com.google.guava:guava:16.0.1
,
Dependency convergence error for commons-logging:commons-logging:1.1.1 paths to dependency are:
+-com.finnwaa.adwords:googleAdWords:1.0-SNAPSHOT
+-com.google.api-ads:ads-lib:4.1.0
+-commons-beanutils:commons-beanutils:1.9.2
+-commons-logging:commons-logging:1.1.1
and
+-com.finnwaa.adwords:googleAdWords:1.0-SNAPSHOT
+-com.google.api-ads:ads-lib:4.1.0
+-commons-configuration:commons-configuration:1.10
+-commons-logging:commons-logging:1.1.1
and
+-com.mycompyany.utility1:googleAdWords:1.0-SNAPSHOT
+-com.google.api-ads:adwords-axis:4.1.0
+-com.google.api-ads:ads-lib-axis:4.1.0
+-commons-discovery:commons-discovery:0.4
+-commons-logging:commons-logging:1.0.4
and
+-com.mycompyany.utility1:googleAdWords:1.0-SNAPSHOT
+-com.google.http-client:google-http-client-jackson2:1.23.0
+-com.google.http-client:google-http-client:1.23.0
+-org.apache.httpcomponents:httpclient:4.0.1
+-commons-logging:commons-logging:1.1.1
and
+-com.mycompyany.utility1:googleAdWords:1.0-SNAPSHOT
+-com.finnwaa.adwords:abstractModule:1.0-SNAPSHOT
+-org.apache.commons:commons-configuration2:2.1.1
+-commons-logging:commons-logging:1.2
]
What confuses me most is that the same code runs when part of Application1 but not Application2. What do I do?
Comments
Post a Comment