jackson throws IllegalAccessError even with the same versions - java

I'm developing a software with jackson, but totally get stuck... When I run the spring-boot program with java -jar <MY_APPLICATION>.jar command, I got the following error:
...
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.fasterxml.jackson.databind.ObjectMapper]: Factory method 'jacksonObjectMapper' threw exception; nested exception is
java.lang.IllegalAccessError: tried to access method com.fasterxml.jackson.databind.ser.std.StdSerializer.<init>(Ljava/lang/Class;)V from class com.fasterxml.jackson.datatype.jsr310.JavaTimeModule
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
... 84 more
Caused by: java.lang.IllegalAccessError: tried to access method com.fasterxml.jackson.databind.ser.std.StdSerializer.<init>(Ljava/lang/Class;)V from class com.fasterxml.jackson.datatype.jsr310.JavaTimeModule
at com.fasterxml.jackson.datatype.jsr310.JavaTimeModule.<init>(JavaTimeModule.java:159)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at org.springframework.beans.BeanUtils.instantiate(BeanUtils.java:78)
at org.springframework.http.converter.json.Jackson2ObjectMapperBuilder.registerWellKnownModulesIfAvailable(Jackson2ObjectMapperBuilder.java:719)
at org.springframework.http.converter.json.Jackson2ObjectMapperBuilder.configure(Jackson2ObjectMapperBuilder.java:572)
at org.springframework.http.converter.json.Jackson2ObjectMapperBuilder.build(Jackson2ObjectMapperBuilder.java:554)
at org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperConfiguration.jacksonObjectMapper(JacksonAutoConfiguration.java:87)
at org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperConfiguration$$EnhancerBySpringCGLIB$$2434a0bb.CGLIB$jacksonObjectMapper$0(<generated>)
at org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperConfiguration$$EnhancerBySpringCGLIB$$2434a0bb$$FastClassBySpringCGLIB$$d685921f.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:356)
at org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperConfiguration$$EnhancerBySpringCGLIB$$2434a0bb.jacksonObjectMapper(<generated>)
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 org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
... 85 more
There are more error messages above the error, but I think the important message is java.lang.IllegalAccessError: tried to access method com.fasterxml.jackson.databind.ser.std.StdSerializer.<init>(Ljava/lang/Class;), which I know it cannot happen generally.
I confirmed that the jackson modules are in the same version(2.6.5 which comes from spring-boot's dependency), and codehaus's jackson is not included:
$ mvn dependency:tree -Dverbose -Dincluces=com.fasterxml.jackson.core | grep -v omitted
...
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # patriot-fdc-web ---
[INFO] <MY_GROUP>:<MY_APPLICATION_A>:war:0.3.9-SNAPSHOT
[INFO] +- <MY_GROUP>:<MY_APPLICATION_B>:jar:0.3.9-SNAPSHOT:compile
[INFO] | \- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.6.5:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-core:jar:2.6.5:compile
[INFO] \- org.springframework.boot:spring-boot-starter-web:jar:1.3.3.RELEASE:compile
[INFO] \- com.fasterxml.jackson.core:jackson-databind:jar:2.6.5:compile (version managed from 2.4.2)
[INFO] +- com.fasterxml.jackson.core:jackson-annotations:jar:2.6.5:compile (version managed from 2.6.0)
Can anybody encounter such a problem? Anyone can suggest any solution or possibility for the error? Thank you in advance.

I've found the cause.
The dependency included calcite-avartica artifact, and it has a shaded jackson in it with version 2.1.1. That's why I cannot find the dependency by mvn dependency:tree. I found it through debugging remotely by seeing where StdSerializer came from.
https://issues.apache.org/jira/browse/CALCITE-1110
Avartica 1.9.0 or later might not bother us. I just excluded calcite-core and calcite-avartica and finally it worked fine.

Had a similar issue in sbt, the fix was also to remove calcita-core and calcite-avatica like so
ExclusionRule(organization = "org.apache.calcite", name = "calcite-core"),
ExclusionRule(organization = "org.apache.calcite", name = "calcite-avatica")

I also had a similar issue, and it was due to transitive dependency of jackson-datatype-jsr310 with lower version coming along with jackson-databind. Got the issue resolved by adding the exclude statement from the first level dependency in build.gradle.
compile (<dependency>){
exclude group: "com.fasterxml.jackson.datatype", module: "jackson-datatype-jsr310"
}

In case if you are using Maven, just identify which dependency is adding this dependency of Jackson with jsr310. To do this,
Open pom in Eclispe and select tab dependency hierarchy and search jsr310
Identify the name of dependency by which it is being added
Add below exclusion into pom.xml
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</exclusion>
</exclusions>

Related

Cannot use XmlMapper (Jackson-dataformat-xml) in Spring boot, error: requiresPropertyOrdering()Z

I've used Spring Boot version 1.5.2 with Maven default pom.xml
...
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.2.RELEASE</version>
</parent>
...
Because Spring Boot does not have XmlMapper from Maven: jackson-dataformat-xml, so I added this dependency in pom.xml
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>2.8.7</version>
</dependency>
and check the Jackson dependencies for project, all of them have same version 2.8.7 (newest).
mvn dependency:tree -Dincludes=com.fasterxml.jackson.core
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) # demo ---
[INFO] com.example:demo:jar:0.0.1-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:1.5.2.RELEASE:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-databind:jar:2.8.7:compile
[INFO] +- com.fasterxml.jackson.dataformat:jackson-dataformat-xml:jar:2.8.7:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-core:jar:2.8.7:compile
[INFO] \- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.7:compile
And when I run the application, it cannot start as there is an error in Spring Boot for NoSuchMethod found.
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.web.filter.OrderedHttpPutFormContentFilter]: Factory method 'httpPutFormContentFilter' threw exception; nested exception is java.lang.NoSuchMethodError: com.fasterxml.jackson.core.JsonFactory.requiresPropertyOrdering()Z
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
... 26 common frames omitted
Caused by: java.lang.NoSuchMethodError: com.fasterxml.jackson.core.JsonFactory.requiresPropertyOrdering()Z
at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:564) ~[jackson-databind-2.8.7.jar:2.8.7]
at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:474) ~[jackson-databind-2.8.7.jar:2.8.7]
at org.springframework.http.converter.json.Jackson2ObjectMapperBuilder.build(Jackson2ObjectMapperBuilder.java:588) ~[spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.http.converter.json.MappingJackson2HttpMessageConverter.<init>(MappingJackson2HttpMessageConverter.java:57) ~[spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter.<init>(AllEncompassingFormHttpMessageConverter.java:61) ~[spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.web.filter.HttpPutFormContentFilter.<init>(HttpPutFormContentFilter.java:63) ~[spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.boot.web.filter.OrderedHttpPutFormContentFilter.<init>(OrderedHttpPutFormContentFilter.java:29) ~[spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
Any idea for this problem? I want to use XmlMapper from Jackson library to deserialize/serialize XML string to object and vice-versa (not from the HTTPRequest but internally).
Here is the full pom.xml for Maven https://pastebin.com/LMujJY7e
I think you have run into a problem of version compatibility of dependencies.
I use spring boot 1.5.2 with jackson-dataformat-xml without any problems.
This is part of my build.gradle
ext {
springBootVersion = '1.5.2.RELEASE'
}
compile 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.8.5'
hope it helps
Please try updating the jackson bom version in parent pom file as 2.10.4. This resolved the issue for me.
<jackson-bom.version>2.10.4</jackson-bom.version>

java.lang.NoSuchMethodError: ch.qos.logback.core.rolling.helper.FileNamePattern.getDateTokenConverter()

I am using the following for my application:-
[INFO] +- ch.qos.logback:logback-core:jar:1.1.7:compile
[INFO] +- ch.qos.logback:logback-classic:jar:1.1.7:compile
[INFO] +- log4j:log4j:jar:1.2.13:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.6.1:compile
[INFO] +- org.slf4j:jcl-over-slf4j:jar:1.6.1:compile
When I start the tomcat with my app. I am getting the following error:-
Failed to instantiate [ch.qos.logback.classic.LoggerContext]
Reported exception:
java.lang.NoSuchMethodError: ch.qos.logback.core.rolling.helper.FileNamePattern.getDateTokenConverter()Lch/qos/logback/core/rolling/helper/DateTokenConverter;
at ch.qos.logback.core.rolling.IntervalledTimeBasedFileNamingAndTriggeringPolicyBase.start(IntervalledTimeBasedFileNamingAndTriggeringPolicyBase.java:24)
at ch.qos.logback.core.rolling.SizeAndIntervalledTimeBasedFNATP.start(SizeAndIntervalledTimeBasedFNATP.java:21)
at ch.qos.logback.core.rolling.TimeBasedRollingPolicy.start(TimeBasedRollingPolicy.java:95)
at ch.qos.logback.core.joran.action.NestedComplexPropertyIA.end(NestedComplexPropertyIA.java:161)
at ch.qos.logback.core.joran.spi.Interpreter.callEndAction(Interpreter.java:309)
at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:193)
at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:179)
at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:62)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:155)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:142)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:103)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:53)
at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:75)
at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:150)
at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:84)
at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:121)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:111)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:268)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:241)
at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:156)
at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:132)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:645)
at org.springframework.core.SpringProperties.<clinit>(SpringProperties.java:51)
at org.springframework.beans.CachedIntrospectionResults.<clinit>(CachedIntrospectionResults.java:97)
at org.springframework.web.util.IntrospectorCleanupListener.contextInitialized(IntrospectorCleanupListener.java:75)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4716)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5178)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:724)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:700)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:952)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1823)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
SLF4J: The requested version 1.7.16 by your slf4j binding is not compatible with [1.6]
When I search for "ch.qos.logback.core.rolling.helper.FileNamePattern.getDateTokenConverter()" in logback. I came to know as this method is not avail in logback newer version.
What is the workaround for it ?
Seems that tomcat loaded more than one version of logback. Code referenced in stacktrace was removed back in 2011 in this commit. So you have to check libraries loaded by tomcat or downgrade your logback version to 1.0.0.
Logback docs will tell, add API and binding to Maven/Gradle. So you have to make two entries in POM. One for API of SLF4j, and one for binding to actual logger, which could be Log4J or Logback or java.util.Logger etc. It seems some other jar is already loading a log binding which is not compatible with what you are loading. So just remove the binding part from POM.

Web script groovy - Alfresco

I'm trying to make a web script in groovy and run that web script on Alfresco. But, i don't know how to. I read tutorials but I haven't come to any conclusion...
Anyone knows all steps to run a web script in groovy ? Which files I need?
My idea is to make a integration of one application groovy on Alfresco.
For example, i'm trying to test one of this web scripts: https://github.com/pmonks/alfresco-groovy-webscripts
But i got the error :
$ mvn clean package
[INFO] Scanning for projects...
Downloading: http://repo1.maven.org/maven2/org/alfresco/extension/alfresco-groovy-webscripts-parent/1.3/alfresco-groovy-webscripts-parent-1.3.pom
[INFO] Unable to find resource 'org.alfresco.extension:alfresco-groovy-webscripts-parent:pom:1.3' in repository central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Project ID: null:alfresco-groovy-webscripts-webscripts:amp:null
Reason: Cannot find parent: org.alfresco.extension:alfresco-groovy-webscripts-parent for project: null:alfresco-groovy-webscripts-webscripts:amp:null for project null:alfresco-groovy-webscripts-webscripts:amp:null
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.reactor.MavenExecutionException: Cannot find parent: org.alfresco.extension:alfresco-groovy-webscripts-parent for project: null:alfresco-groovy-webscripts-webscripts:amp:null for project null:alfresco-groovy-webscripts-webscripts:amp:null
at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:404)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:272)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.project.ProjectBuildingException: Cannot find parent: org.alfresco.extension:alfresco-groovy-webscripts-parent for project: null:alfresco-groovy-webscripts-webscripts:amp:null for project null:alfresco-groovy-webscripts-webscripts:amp:null
at org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(DefaultMavenProjectBuilder.java:1396)
at org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(DefaultMavenProjectBuilder.java:823)
at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFileInternal(DefaultMavenProjectBuilder.java:508)
at org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMavenProjectBuilder.java:200)
at org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:604)
at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:487)
at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:391)
... 12 more
Caused by: org.apache.maven.project.ProjectBuildingException: POM 'org.alfresco.extension:alfresco-groovy-webscripts-parent' not found in repository: Unable to download the artifact from any repository
org.alfresco.extension:alfresco-groovy-webscripts-parent:pom:1.3
from the specified remote repositories:
central (http://repo1.maven.org/maven2)
for project org.alfresco.extension:alfresco-groovy-webscripts-parent
at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepository(DefaultMavenProjectBuilder.java:605)
at org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(DefaultMavenProjectBuilder.java:1392)
... 18 more
Caused by: org.apache.maven.artifact.resolver.ArtifactNotFoundException: Unable to download the artifact from any repository
org.alfresco.extension:alfresco-groovy-webscripts-parent:pom:1.3
from the specified remote repositories:
central (http://repo1.maven.org/maven2)
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:228)
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:90)
at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepository(DefaultMavenProjectBuilder.java:558)
... 19 more
Caused by: org.apache.maven.wagon.ResourceDoesNotExistException: Unable to download the artifact from any repository
at org.apache.maven.artifact.manager.DefaultWagonManager.getArtifact(DefaultWagonManager.java:404)
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:216)
... 21 more
I try too the web scripts already in Alfresco examples, but i got error, for example:
The Web Script /alfresco/s/default/surfbug has responded with a status of 500 - Internal Error.
This looks like strictly a maven problem to me. The exception states that Unable to download the artifact from any repository. This means that you've got a dependency on something that can't be found in either your local repository or any of the default or configured remote repository.
The missing dependency is stated as org.alfresco.extension:alfresco-groovy-webscripts-parent:pom:1.3. To get this to work, this artifact needs to be in your local repository. I couldn't find any reference to this in the common remote repositories, so it might be something you need to build from source.
The link you provided in your question is for a github project with the following code in its pom.xml file:
<groupId>org.alfresco.extension</groupId>
<artifactId>alfresco-groovy-webscripts-parent</artifactId>
<packaging>pom</packaging>
<version>1.4-SNAPSHOT</version>
Notice that the groupId and artifactId match your missing dependency, but the version is different. If you've installed this sample, using mvn install, then version 1.4-SNAPSHOT of this dependency should already be in your local repository. You could search your pom files for the dependency on alfresco-groovy-webscripts-parent v1.3, and change it to 1.4-SNAPSHOT and try again.

Maven, Vert.x and JodaTime library - NoSuchMethodError

I have a maven project that uses Vert.x library - http://vertx.io/ (but I doubt this has any meaning).
When I try run my app by using vert.x command:
vertx runzip target/service-1.0.0-mod.zip -conf config.json
I'm getting following stacktrace:
Exception in Java verticle
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.mycompany.myproject.vertx.Verticle.createConfig(Verticle.java:116)
...
Caused by: java.lang.NoSuchMethodError: org.joda.time.format.DateTimeFormatter.withZoneUTC()Lorg/joda/time/format/DateTimeFormatter;
at com.mycompany.myproject.mypackage.dao.MyDAO.<clinit>(MyDAO.java:30)
...
JodaTime part of pom.xml:
<dependencies>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.3</version>
<scope>compile</scope>
</dependency>
</dependencies>
I tried running:
mvn dependency:tree -Dverbose -Dincludes=joda-time
to see if an old version of JodaTime library is loaded as a dependency but all looks OK:
[INFO] --- maven-dependency-plugin:2.7:tree (default-cli) # matching-service ---
[INFO] com.mycompany.myproject:service:jar:1.0.0
[INFO] \- joda-time:joda-time:jar:2.3:compile
It looks like you compiled your MyDAO against a different version of JodaTime than you use when running it.
I.e. there must be two different joda-time jars in your workspace and a static block in MyDAO calling withZoneUTC - unless you only posted half the stack trace and the problem is in a compiled class from the vertx project. In that case you need to get the joda version that vertx was compiled for.

Invalid URI with Maven

I am new to maven, while using mvn install I've got this error, any idea?
thanks in advance
java.lang.IllegalArgumentException: Invalid uri 'http://maven.mysite.com:9999/repository/npg/data-recovery/${applicationVersion}/data-recovery-${applicationVersion}.pom': escaped absolute path not valid
at hidden.org.apache.commons.httpclient.HttpMethodBase.(HttpMethodBase.java:222)
at hidden.org.apache.commons.httpclient.methods.GetMethod.(GetMethod.java:89)
at org.apache.maven.wagon.shared.http.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:547)
at org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:116)
at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88)
at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61)
at org.apache.maven.artifact.manager.DefaultWagonManager.getRemoteFile(DefaultWagonManager.java:491)
at org.apache.maven.artifact.manager.DefaultWagonManager.getArtifact(DefaultWagonManager.java:372)
at org.apache.maven.artifact.manager.DefaultWagonManager.getArtifact(DefaultWagonManager.java:327)
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:216)
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:90)
at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepository(DefaultMavenProjectBuilder.java:558)
at org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(DefaultMavenProjectBuilder.java:1392)
at org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(DefaultMavenProjectBuilder.java:823)
at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromRepository(DefaultMavenProjectBuilder.java:255)
at org.apache.maven.project.artifact.MavenMetadataSource.retrieveRelocatedProject(MavenMetadataSource.java:163)
at org.apache.maven.project.artifact.MavenMetadataSource.retrieveRelocatedArtifact(MavenMetadataSource.java:94)
at org.apache.maven.artifact.resolver.DefaultArtifactCollector.recurse(DefaultArtifactCollector.java:388)
at org.apache.maven.artifact.resolver.DefaultArtifactCollector.collect(DefaultArtifactCollector.java:74)
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveTransitively(DefaultArtifactResolver.java:316)
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveTransitively(DefaultArtifactResolver.java:304)
at org.apache.maven.plugin.DefaultPluginManager.resolveTransitiveDependencies(DefaultPluginManager.java:1492)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:435)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:678)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:540)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:519)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:371)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:332)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:181)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:356)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:41)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6 seconds
[INFO] Finished at: Thu Mar 04 15:12:56 EET 2010
[INFO] Final Memory: 19M/35M
You are using <version>${applicationVersion}</version> somewhere (maybe in this POM or maybe in a parent POM if the version is inherited) but this property is not resolved. You need to define something like this:
<project>
<properties>
<applicationVersion>x.y.z</applicationVersion>
</properties>
...
</project>
Note that I don't really see the point of using such a property, there is a built in ${project.version} property that refers to the version of the project (that you can use in dependencies for example). Check the MavenPropertiesGuide for more details on available properties.
The property ${applicationVersion} is not resolved in the URI path shown:
'http://maven.mysite.com:9999/repository/npg/data-recovery/${applicationVersion}/data-recovery-${applicationVersion}.pom'
I guess this is a dependency configured in your pom. You should locate "data-recovery" among the dependencies in your pom.xml - my bet is that its <version> property is set to ${applicationVersion}. If so, you should set the concrete version for it.
I have the same issue while using a property to set parent pom version in my child module.
You can use maven release plugin to achieve this. Just update version in your parent pom file and run this command to update version in your child module from parent folder:
mvn -N versions:update-child-modules

Categories