NoSuchMethodError using spring-boot - java

I haven't changed its pom.xml for this project, but when I started the project recently, it reported this error: java.lang.NoSuchMethodError.
Seeing the error, it seems that it can't find the interface method I wrote.
2020-07-21 10:23:05.212 ERROR [main] ApiDescriptionReader::read[#87] : Skipping process path[/projects], method[addProject] as it has an error.java.lang.NoSuchMethodError: org.springframework.http.MediaType.equalsTypeAndSubtype(Lorg/springframework/util/MimeType;)Z
at springfox.documentation.builders.BodyParameterSpecificationProvider.lambda$create$0(BodyParameterSpecificationProvider.java:37)
... ...
I tried mvn clean install, it still doesn't work. This is the io.springfox dependency tree:
[INFO] +- org.springframework.retry:spring-retry:jar:1.2.4.RELEASE:compile
[INFO] | \- org.springframework:spring-core:jar:5.0.7.RELEASE:compile
[INFO] | \- org.springframework:spring-jcl:jar:5.0.7.RELEASE:compile
[INFO] +- org.mybatis.spring.boot:mybatis-spring-boot-starter:jar:2.0.0:compile
[INFO] | \- org.springframework.boot:spring-boot-starter-jdbc:jar:2.0.3.RELEASE:compile
[INFO] | \- org.springframework:spring-jdbc:jar:5.0.7.RELEASE:compile
[INFO] | \- org.springframework:spring-tx:jar:5.0.7.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-webflux:jar:2.0.3.RELEASE:compile
[INFO] | +- org.springframework:spring-web:jar:5.0.7.RELEASE:compile
[INFO] | \- org.springframework:spring-webflux:jar:5.0.7.RELEASE:compile
[INFO] \- org.springframework.plugin:spring-plugin-core:jar:2.0.0.RELEASE:compile
[INFO] +- org.springframework:spring-beans:jar:5.0.7.RELEASE:compile
[INFO] +- org.springframework:spring-context:jar:5.0.7.RELEASE:compile
[INFO] | \- org.springframework:spring-expression:jar:5.0.7.RELEASE:compile
[INFO] \- org.springframework:spring-aop:jar:5.0.7.RELEASE:compile
[INFO] +- io.springfox:springfox-swagger2:jar:3.0.0-SNAPSHOT:compile
[INFO] | +- io.springfox:springfox-spi:jar:3.0.0-SNAPSHOT:compile
[INFO] | +- io.springfox:springfox-schema:jar:3.0.0-SNAPSHOT:compile
[INFO] | +- io.springfox:springfox-swagger-common:jar:3.0.0-SNAPSHOT:compile
[INFO] | +- io.springfox:springfox-spring-web:jar:3.0.0-SNAPSHOT:compile
[INFO] | \- io.springfox:springfox-spring-webmvc:jar:3.0.0-SNAPSHOT:compile
[INFO] +- io.springfox:springfox-swagger-ui:jar:3.0.0-SNAPSHOT:compile
[INFO] \- io.springfox:springfox-spring-webflux:jar:3.0.0-SNAPSHOT:compile
[INFO] \- io.springfox:springfox-core:jar:3.0.0-SNAPSHOT:compile

According to the documentation this method exists since spring 5.1.4
https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/util/MimeType.html#equalsTypeAndSubtype-org.springframework.util.MimeType-
You can update the version of spring that you use or decrease the version of spring-fox

Related

modular java project (IntelliJ IDEA): Module 'com.test' reads package 'javax.xml.bind' from both 'java.xml.bind' and 'java.xml.bind'

I'm facing a really frustrating issue related to modules. Can't figure out why I'm getting
Module 'com.test' reads package 'javax.xml.bind' from both 'java.xml.bind' and 'java.xml.bind'
How to solve it?
Module list
module com.test {
requires java.activation;
requires slf4j.api;
requires spring.context;
requires java.persistence;
requires spring.beans;
requires org.apache.cxf.core;
requires java.xml;
requires java.xml.bind;
}
My environment
IntelliJ IDEA 2020.3.1 (Community Edition)
JAVA JDK 11
Update no.1
found a post on stackoverflow.com that has a very similar issue I'm facing
Package 'com.example' reads package 'javafx.beans' from both 'javafx.base' and 'javafx.base'
Update no.2
[INFO] +- org.hibernate:hibernate-core:jar:5.4.23.Final:provided
[INFO] | +- org.jboss.logging:jboss-logging:jar:3.4.1.Final:provided
[INFO] | +- javax.persistence:javax.persistence-api:jar:2.2:provided
[INFO] | +- org.javassist:javassist:jar:3.24.0-GA:provided
[INFO] | +- net.bytebuddy:byte-buddy:jar:1.10.17:provided
[INFO] | +- antlr:antlr:jar:2.7.7:provided
[INFO] | +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.1.1.Final:provided
[INFO] | +- org.jboss:jandex:jar:2.1.3.Final:provided
[INFO] | +- com.fasterxml:classmate:jar:1.5.1:provided
[INFO] | +- javax.activation:javax.activation-api:jar:1.2.0:compile
[INFO] | +- org.dom4j:dom4j:jar:2.1.3:provided
[INFO] | +- org.hibernate.common:hibernate-commons-annotations:jar:5.1.2.Final:provided
[INFO] | +- javax.xml.bind:jaxb-api:jar:2.3.1:compile
[INFO] | \- org.glassfish.jaxb:jaxb-runtime:jar:2.3.1:compile
[INFO] | +- org.glassfish.jaxb:txw2:jar:2.3.1:compile
[INFO] | \- com.sun.istack:istack-commons-runtime:jar:3.0.7:compile
[INFO] +- org.springframework:spring-context:jar:5.3.1:provided
[INFO] | +- org.springframework:spring-aop:jar:5.3.1:provided
[INFO] | +- org.springframework:spring-beans:jar:5.3.1:provided
[INFO] | +- org.springframework:spring-core:jar:5.3.1:provided
[INFO] | | \- org.springframework:spring-jcl:jar:5.3.1:provided
[INFO] | \- org.springframework:spring-expression:jar:5.3.1:provided
[INFO] +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.3:compile
[INFO] | \- jakarta.activation:jakarta.activation-api:jar:1.2.2:compile
[INFO] +- org.apache.cxf:cxf-core:jar:3.4.1:compile
[INFO] | +- com.fasterxml.woodstox:woodstox-core:jar:6.2.1:compile
[INFO] | +- org.apache.ws.xmlschema:xmlschema-core:jar:2.2.5:compile
[INFO] | +- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile
[INFO] | +- jakarta.jws:jakarta.jws-api:jar:2.1.0:compile
[INFO] | +- jakarta.xml.soap:jakarta.xml.soap-api:jar:1.4.2:compile
[INFO] | +- com.sun.activation:jakarta.activation:jar:1.2.2:compile
[INFO] | +- com.sun.xml.messaging.saaj:saaj-impl:jar:1.5.2:runtime
[INFO] | +- org.apache.geronimo.specs:geronimo-jta_1.1_spec:jar:1.1.1:compile
[INFO] | \- org.jboss.spec.javax.rmi:jboss-rmi-api_1.0_spec:jar:1.0.6.Final:compile
[INFO] +- com.sun.xml.bind:jaxb-impl:jar:2.3.3:runtime
[INFO] +- jakarta.xml.ws:jakarta.xml.ws-api:jar:2.3.3:compile
[INFO] +- com.sun.xml.ws:jaxws-rt:jar:2.3.3:compile
[INFO] | +- com.sun.xml.ws:policy:jar:2.7.10:compile
[INFO] | +- org.glassfish.ha:ha-api:jar:3.1.12:compile
[INFO] | +- org.glassfish.external:management-api:jar:3.2.2:compile
[INFO] | +- org.glassfish.gmbal:gmbal:jar:4.0.1:compile
[INFO] | +- org.glassfish.pfl:pfl-tf:jar:4.1.0:compile
[INFO] | +- org.glassfish.pfl:pfl-basic:jar:4.1.0:compile
[INFO] | +- org.jvnet.staxex:stax-ex:jar:1.8.3:compile
[INFO] | +- com.sun.xml.stream.buffer:streambuffer:jar:1.5.9:compile
[INFO] | +- org.jvnet.mimepull:mimepull:jar:1.9.13:compile
[INFO] | +- com.sun.xml.fastinfoset:FastInfoset:jar:1.2.18:compile
[INFO] | \- org.codehaus.woodstox:stax2-api:jar:4.1:compile
[INFO] +- org.apache.logging.log4j:log4j-api:jar:2.13.3:compile
[INFO] +- org.apache.logging.log4j:log4j-core:jar:2.13.3:compile
[INFO] +- org.apache.logging.log4j:log4j-slf4j-impl:jar:2.13.3:compile
[INFO] | \- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] +- org.junit.jupiter:junit-jupiter-params:jar:5.7.0:test
[INFO] | \- org.apiguardian:apiguardian-api:jar:1.1.0:test
[INFO] +- org.junit.jupiter:junit-jupiter-api:jar:5.7.0:test
[INFO] | +- org.opentest4j:opentest4j:jar:1.2.0:test
[INFO] | \- org.junit.platform:junit-platform-commons:jar:1.7.0:test
[INFO] \- org.mockito:mockito-junit-jupiter:jar:3.5.10:test
[INFO] \- org.mockito:mockito-core:jar:3.5.10:test
[INFO] +- net.bytebuddy:byte-buddy-agent:jar:1.10.13:test
[INFO] \- org.objenesis:objenesis:jar:3.1:test
Thanks to Naman and the link provided in original post I found out that I was mixing jakarta.activation and javax.activation while using cxf.
And, because cxf-xjc-plugin:3.3.1 generates code from xsd files using javax.activation I had to exclude
everywhere in a pom jakarta.activation
Update No.1
to be precise I had to replace javax dependencies with jakarta dependencies
that have javax package naming structure (i.e javax.activation and not jakarta.activation), i.e
<has javax packaging structure>
<dependency>
<groupId>jakarta.jws</groupId>
<artifactId>jakarta.jws-api</artifactId>
<version>2.1.0</version>
</dependency>
but not
<has jakarta packaging structure>
<dependency>
<groupId>jakarta.jws</groupId>
<artifactId>jakarta.jws-api</artifactId>
<version>3.0.0</version>
</dependency>

java.lang.ClassNotFoundException: org.threeten.bp.temporal.TemporalAccessor

I am using threetenbp version 1.4.4 in my maven project. On deploying my JAR in a tomcat container, I get the exception below:
java.lang.NoClassDefFoundError:
"org/threeten/bp/temporal/TemporalAccessor" Caused by:
"java.lang.ClassNotFoundException:
org.threeten.bp.temporal.TemporalAccessor".
... What is the root cause and solution to this issue?
(Note: Suggested solutions currently published on this platform concerning the same issue, have not resolved mine).
I even tried bumping up or down the version for JAR and its not resolving the issue
My maven dependency tree is below ( I do not see any transitive dependency) linked to this dependency
[INFO] aa.aa.aaa.aaa.hass:hass-consumer:jar:1.0
[INFO] +- junit:junit:jar:4.11:test
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- javax.servlet:javax.servlet-api:jar:3.1.0:provided
[INFO] +- org.glassfish.jersey.core:jersey-server:jar:2.26:compile
[INFO] | +- org.glassfish.jersey.core:jersey-common:jar:2.26:compile
[INFO] | | \- org.glassfish.hk2:osgi-resource-locator:jar:1.0.1:compile
[INFO] | +- javax.ws.rs:javax.ws.rs-api:jar:2.1:compile
[INFO] | +- org.glassfish.jersey.media:jersey-media-jaxb:jar:2.26:compile
[INFO] | +- javax.annotation:javax.annotation-api:jar:1.2:compile
[INFO] | +- org.glassfish.hk2.external:javax.inject:jar:2.5.0-b42:compile
[INFO] | \- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] +- org.glassfish.jersey.containers:jersey-container-servlet:jar:2.26:compile
[INFO] | \- org.glassfish.jersey.containers:jersey-container-servlet-core:jar:2.26:compile
[INFO] +- org.glassfish.jersey.media:jersey-media-moxy:jar:2.26:compile
[INFO] | +- org.glassfish.jersey.ext:jersey-entity-filtering:jar:2.26:compile
[INFO] | \- org.eclipse.persistence:org.eclipse.persistence.moxy:jar:2.6.4:compile
[INFO] | +- org.eclipse.persistence:org.eclipse.persistence.core:jar:2.6.4:compile
[INFO] | | \- org.eclipse.persistence:org.eclipse.persistence.asm:jar:2.6.4:compile
[INFO] | \- org.glassfish:javax.json:jar:1.0.4:compile
[INFO] +- org.glassfish.jersey.inject:jersey-hk2:jar:2.26:compile
[INFO] | \- org.glassfish.hk2:hk2-locator:jar:2.5.0-b42:compile
[INFO] | +- org.glassfish.hk2.external:aopalliance-repackaged:jar:2.5.0-b42:compile
[INFO] | +- org.glassfish.hk2:hk2-api:jar:2.5.0-b42:compile
[INFO] | | \- javax.inject:javax.inject:jar:1:compile
[INFO] | +- org.glassfish.hk2:hk2-utils:jar:2.5.0-b42:compile
[INFO] | \- org.javassist:javassist:jar:3.22.0-CR2:compile
[INFO] +- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.8:compile
[INFO] +- org.glassfish.jersey.core:jersey-client:jar:2.26:compile
[INFO] +- io.jsonwebtoken:jjwt:jar:0.9.1:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-databind:jar:2.9.6:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-core:jar:2.9.6:compile
[INFO] +- javax.xml.bind:jaxb-api:jar:2.3.1:compile
[INFO] | \- javax.activation:javax.activation-api:jar:1.2.0:compile
[INFO] +- com.google.code.gson:gson:jar:2.8.1:compile
[INFO] +- io.gsonfire:gson-fire:jar:1.8.3:compile
[INFO] +- com.auth0:java-jwt:jar:3.9.0:compile
[INFO] | \- commons-codec:commons-codec:jar:1.12:runtime
[INFO] +- org.bouncycastle:bcprov-jdk15on:jar:1.53:compile
[INFO] +- org.bouncycastle:bcpkix-jdk15on:jar:1.53:compile
[INFO] +- commons-io:commons-io:jar:2.6:compile
[INFO] +- io.swagger:swagger-annotations:jar:1.5.18:compile
[INFO] +- com.squareup.okhttp:okhttp:jar:2.7.5:compile
[INFO] | \- com.squareup.okio:okio:jar:1.6.0:compile
[INFO] +- com.squareup.okhttp:logging-interceptor:jar:2.7.5:compile
[INFO] +- org.threeten:threetenbp:jar:1.3.5:compile
[INFO] +- org.aspectj:aspectjrt:jar:1.9.0:compile
[INFO] +- openconnector:openconnector:jar:1.0:compile
[INFO] +- commons-logging:commons-logging:jar:1.2:compile
[INFO] +- net.sf.flexjson:flexjson:jar:3.3:compile
[INFO] +- sailpoint.integration:iiqIntegration-1.0:jar:1.0:compile
[INFO] +- sailpoint.identityiq:identityiq:jar:1.0:compile
[INFO] \- log4j:log4j:jar:1.2.17:compile"
Please add threetenbp-1.3.5.jar in the Tomcat server class path or Tomcat's libraries folder

Maven seems to be using an older version than the one I expect

I'm having a strange problem with maven. I'm not sure yet what it is but it seems that when compiling my project (with mvn clean compile) somehow a wrong version of a dependency seems to be included.
The library I want to include is commons-io version 2.4. When I check my IDE it looks like the correct version is loaded. Compiling in my IDE works fine.
However when I compile the project with maven this line of code fails:
FileUtils.write(new File(propertyService.getStatusPageLocation()), "Some string value");
Because of the error:
[ERROR] /C:/projects/my-project/client-externalclient/src/main/java/be/roots/myproject/client/externalclient/jobs/WriteStatusPageJob.java:[60,22] cannot find symbol
[ERROR] symbol: method write(java.io.File,java.lang.String)
As far as I can tell the class does have the method with that signature.
The problem seems to happen only on my pc.
A dependency:tree command shows the following info:
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # shared-internal ---
[INFO] be.roots.myproject:shared-internal:bundle:3.40-SNAPSHOT
[INFO] +- be.roots.myproject:shared-external:jar:3.40-SNAPSHOT:compile
[INFO] | +- org.slf4j:slf4j-log4j12:jar:1.7.7:runtime
[INFO] | \- log4j:log4j:jar:1.2.17:runtime
[INFO] +- org.apache.cxf:cxf-rt-frontend-jaxrs:jar:3.0.4.redhat-621107:compile
[INFO] | +- org.apache.cxf:cxf-core:jar:3.0.4.redhat-621107:compile
[INFO] | | +- org.codehaus.woodstox:woodstox-core-asl:jar:4.4.1:compile
[INFO] | | \- org.apache.ws.xmlschema:xmlschema-core:jar:2.2.1:compile
[INFO] | +- javax.ws.rs:javax.ws.rs-api:jar:2.0.1:compile
[INFO] | +- javax.annotation:javax.annotation-api:jar:1.2:compile
[INFO] | \- org.apache.cxf:cxf-rt-transports-http:jar:3.0.4.redhat-621107:compile
[INFO] +- joda-time:joda-time:jar:2.5:compile
[INFO] +- junit:junit:jar:4.12:test
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- org.mockito:mockito-core:jar:1.10.19:test
[INFO] | \- org.objenesis:objenesis:jar:2.1:test
[INFO] +- org.powermock:powermock-api-mockito:jar:1.6.2:test
[INFO] | +- org.mockito:mockito-all:jar:1.10.19:test
[INFO] | \- org.powermock:powermock-api-support:jar:1.6.2:test
[INFO] | +- org.powermock:powermock-core:jar:1.6.2:test
[INFO] | | \- org.javassist:javassist:jar:3.19.0-GA:test
[INFO] | \- org.powermock:powermock-reflect:jar:1.6.2:test
[INFO] +- org.powermock:powermock-module-junit4:jar:1.6.2:test
[INFO] | \- org.powermock:powermock-module-junit4-common:jar:1.6.2:test
[INFO] +- commons-lang:commons-lang:jar:2.6:compile
[INFO] +- org.apache.camel:camel-sql:jar:2.15.1.redhat-621107:compile
[INFO] | +- org.apache.camel:camel-core:jar:2.15.1.redhat-621107:compile
[INFO] | +- org.springframework:spring-jdbc:jar:3.2.12.RELEASE:compile
[INFO] | | \- org.springframework:spring-tx:jar:3.2.12.RELEASE:compile
[INFO] | +- com.sun.xml.bind:jaxb-core:jar:2.2.11:compile
[INFO] | \- com.sun.xml.bind:jaxb-impl:jar:2.2.11:compile
[INFO] +- commons-codec:commons-codec:jar:1.10:compile
[INFO] +- commons-io:commons-io:jar:2.4:compile
[INFO] +- commons-collections:commons-collections:jar:3.2.1.redhat-7:test
[INFO] +- org.slf4j:slf4j-api:jar:1.7.7:compile
[INFO] +- com.jcraft:jsch:jar:0.1.51:compile
[INFO] +- org.springframework:spring-core:jar:3.2.12.RELEASE:compile
[INFO] | \- commons-logging:commons-logging:jar:1.1.3:compile
[INFO] +- org.springframework:spring-context-support:jar:3.2.12.RELEASE:compile
[INFO] | +- org.springframework:spring-beans:jar:3.2.12.RELEASE:compile
[INFO] | \- org.springframework:spring-context:jar:3.2.12.RELEASE:compile
[INFO] | +- org.springframework:spring-aop:jar:3.2.12.RELEASE:compile
[INFO] | | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] | \- org.springframework:spring-expression:jar:4.1.6.RELEASE:compile
[INFO] +- commons-net:commons-net:jar:3.3:compile
[INFO] +- com.google.guava:guava:jar:18.0:compile
[INFO] +- com.fasterxml.jackson.dataformat:jackson-dataformat-xml:jar:2.6.3:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-core:jar:2.6.3:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.6.3:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.6.3:compile
[INFO] | +- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.6.3:compile
[INFO] | \- org.codehaus.woodstox:stax2-api:jar:3.1.4:compile
[INFO] +- javax:javaee-web-api:jar:6.0:provided
[INFO] \- be.roots:zxing-osgi:jar:1.0:compile
[INFO] +- com.google.zxing:javase:jar:2.3.0:compile
[INFO] \- com.google.zxing:core:jar:2.3.0:compile
which also shows the correct library being loaded.
the dependency:build-classpath command gives this list:
C:\Users\MyName\.m2\repository\be\roots\myproject\shared-external\3.40-SNAPSHOT\shared-external-3.40-SNAPSHOT.jar;C:\Users\MyName\.m2\repository\org\slf4j\slf4j-log4j12\1.7.7\slf4j-log4j12-1.7.7.jar;C:\Users\MyName\.m2\repository\log4j\log4j\1.2.17\log4j-1.2.17.jar;C:\Users\MyName\.m2\repository\org\apache\cxf\cxf-rt-frontend-jaxrs\3.0.4.redhat-621107\cxf-rt-frontend-jaxrs-3.0.4.redhat-621107.jar;C:\Users\MyName\.m2\repository\org\apache\cxf\cxf-core\3.0.4.redhat-621107\cxf-core-3.0.4.redhat-621107.jar;C:\Users\MyName\.m2\repository\org\codehaus\woodstox\woodstox-core-asl\4.4.1\woodstox-core-asl-4.4.1.jar;C:\Users\MyName\.m2\repository\org\apache\ws\xmlschema\xmlschema-core\2.2.1\xmlschema-core-2.2.1.jar;C:\Users\MyName\.m2\repository\javax\ws\rs\javax.ws.rs-api\2.0.1\javax.ws.rs-api-2.0.1.jar;C:\Users\MyName\.m2\repository\javax\annotation\javax.annotation-api\1.2\javax.annotation-api-1.2.jar;C:\Users\MyName\.m2\repository\org\apache\cxf\cxf-rt-transports-http\3.0.4.redhat-621107\cxf-rt-transports-http-3.0.4.redhat-621107.jar;C:\Users\MyName\.m2\repository\joda-time\joda-time\2.5\joda-time-2.5.jar;C:\Users\MyName\.m2\repository\junit\junit\4.12\junit-4.12.jar;C:\Users\MyName\.m2\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;C:\Users\MyName\.m2\repository\org\mockito\mockito-core\1.10.19\mockito-core-1.10.19.jar;C:\Users\MyName\.m2\repository\org\objenesis\objenesis\2.1\objenesis-2.1.jar;C:\Users\MyName\.m2\repository\org\powermock\powermock-api-mockito\1.6.2\powermock-api-mockito-1.6.2.jar;C:\Users\MyName\.m2\repository\org\mockito\mockito-all\1.10.19\mockito-all-1.10.19.jar;C:\Users\MyName\.m2\repository\org\powermock\powermock-api-support\1.6.2\powermock-api-support-1.6.2.jar;C:\Users\MyName\.m2\repository\org\powermock\powermock-core\1.6.2\powermock-core-1.6.2.jar;C:\Users\MyName\.m2\repository\org\javassist\javassist\3.19.0-GA\javassist-3.19.0-GA.jar;C:\Users\MyName\.m2\repository\org\powermock\powermock-reflect\1.6.2\powermock-reflect-1.6.2.jar;C:\Users\MyName\.m2\repository\org\powermock\powermock-module-junit4\1.6.2\powermock-module-junit4-1.6.2.jar;C:\Users\MyName\.m2\repository\org\powermock\powermock-module-junit4-common\1.6.2\powermock-module-junit4-common-1.6.2.jar;C:\Users\MyName\.m2\repository\commons-lang\commons-lang\2.6\commons-lang-2.6.jar;C:\Users\MyName\.m2\repository\org\apache\camel\camel-sql\2.15.1.redhat-621107\camel-sql-2.15.1.redhat-621107.jar;C:\Users\MyName\.m2\repository\org\apache\camel\camel-core\2.15.1.redhat-621107\camel-core-2.15.1.redhat-621107.jar;C:\Users\MyName\.m2\repository\org\springframework\spring-jdbc\3.2.12.RELEASE\spring-jdbc-3.2.12.RELEASE.jar;C:\Users\MyName\.m2\repository\org\springframework\spring-tx\3.2.12.RELEASE\spring-tx-3.2.12.RELEASE.jar;C:\Users\MyName\.m2\repository\com\sun\xml\bind\jaxb-core\2.2.11\jaxb-core-2.2.11.jar;C:\Users\MyName\.m2\repository\com\sun\xml\bind\jaxb-impl\2.2.11\jaxb-impl-2.2.11.jar;C:\Users\MyName\.m2\repository\commons-codec\commons-codec\1.10\commons-codec-1.10.jar;C:\Users\MyName\.m2\repository\commons-io\commons-io\2.4\commons-io-2.4.jar;C:\Users\MyName\.m2\repository\commons-collections\commons-collections\3.2.1.redhat-7\commons-collections-3.2.1.redhat-7.jar;C:\Users\MyName\.m2\repository\org\slf4j\slf4j-api\1.7.7\slf4j-api-1.7.7.jar;C:\Users\MyName\.m2\repository\com\jcraft\jsch\0.1.51\jsch-0.1.51.jar;C:\Users\MyName\.m2\repository\org\springframework\spring-core\3.2.12.RELEASE\spring-core-3.2.12.RELEASE.jar;C:\Users\MyName\.m2\repository\commons-logging\commons-logging\1.1.3\commons-logging-1.1.3.jar;C:\Users\MyName\.m2\repository\org\springframework\spring-context-support\3.2.12.RELEASE\spring-context-support-3.2.12.RELEASE.jar;C:\Users\MyName\.m2\repository\org\springframework\spring-beans\3.2.12.RELEASE\spring-beans-3.2.12.RELEASE.jar;C:\Users\MyName\.m2\repository\org\springframework\spring-context\3.2.12.RELEASE\spring-context-3.2.12.RELEASE.jar;C:\Users\MyName\.m2\repository\org\springframework\spring-aop\3.2.12.RELEASE\spring-aop-3.2.12.RELEASE.jar;C:\Users\MyName\.m2\repository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar;C:\Users\MyName\.m2\repository\org\springframework\spring-expression\4.1.6.RELEASE\spring-expression-4.1.6.RELEASE.jar;C:\Users\MyName\.m2\repository\commons-net\commons-net\3.3\commons-net-3.3.jar;C:\Users\MyName\.m2\repository\com\google\guava\guava\18.0\guava-18.0.jar;C:\Users\MyName\.m2\repository\com\fasterxml\jackson\dataformat\jackson-dataformat-xml\2.6.3\jackson-dataformat-xml-2.6.3.jar;C:\Users\MyName\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.6.3\jackson-core-2.6.3.jar;C:\Users\MyName\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.6.3\jackson-annotations-2.6.3.jar;C:\Users\MyName\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.6.3\jackson-databind-2.6.3.jar;C:\Users\MyName\.m2\repository\com\fasterxml\jackson\module\jackson-module-jaxb-annotations\2.6.3\jackson-module-jaxb-annotations-2.6.3.jar;C:\Users\MyName\.m2\repository\org\codehaus\woodstox\stax2-api\3.1.4\stax2-api-3.1.4.jar;C:\Users\MyName\.m2\repository\javax\javaee-web-api\6.0\javaee-web-api-6.0.jar;C:\Users\MyName\.m2\repository\be\roots\zxing-osgi\1.0\zxing-osgi-1.0.jar;C:\Users\MyName\.m2\repository\com\google\zxing\javase\2.3.0\javase-2.3.0.jar;C:\Users\MyName\.m2\repository\com\google\zxing\core\2.3.0\core-2.3.0.jar
Does anyone know what else I can try to debug this issue?
Something that can be different between your IDE and the mvn command is the Java version employed. Please check your PATH
Check your maven settings in your ide.
It is possible to have a different maven path and a custom settings.xml in the IDE selected.
I have found what was wrong, it turned out to be a rather exotic problem.
For another project I have installed the advanced image API (http://www.oracle.com/technetwork/java/javase/tech/jai-142803.html) which involves adding extra .jar files to your java sdk that will be included in your core java installation.
Among all the libary's .jar files was an older version of commons-io as well, which was included as the default.
Once I removed that library everything went well.

NamedEntityGraph cannot be resolved to a type

In an eclipse project that uses maven, jpa, and hibernate, I am getting the following two compilation errors:
NamedEntityGraph cannot be resolved to a type
and
NamedAttributeNode cannot be resolved to a type
How can I resolve these compilation errors?
Here is the line of code that is showing the compilation errors:
#Entity(name="someclass")
#NamedEntityGraph(name="includeOther", attributeNodes={#NamedAttributeNode("other")})
#Table(name="sometable")
public class SomeClass {
//lots of stuff
}
I think the problem is that eclipse is not seeing that I have JPA 2.1 configured. But I have tried to install and configure JPA 2.1. You can read the entire code of my pom.xml at a file sharing site by clicking on this link. I set up JPA 2.1 in the eclipse project facets, which you can see by clicking on this link. Also, I ran mvn dependency:tree on the root folder of the eclipse project from the windows command line, and I got the following output:
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building MyApp 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The artifact org.apache.commons:commons-io:jar:1.3.2 has been relocated to commons-io:commons-io:jar:1.3.2
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # MyApp ---
[WARNING] The artifact org.apache.commons:commons-io:jar:1.3.2 has been relocated to commons-io:commons-io:jar:1.3.2
[INFO] org.springframework.samples:MyApp:war:1.0.0-SNAPSHOT
[INFO] +- org.jvnet.hyperjaxb3:hyperjaxb3-ejb-runtime:jar:0.6.0:compile
[INFO] | +- org.apache.commons:commons-lang3:jar:3.2.1:compile
[INFO] | \- org.jvnet.jaxb2_commons:jaxb2-basics-runtime:jar:0.8.2:compile
[INFO] +- org.jvnet.hyperjaxb3:hyperjaxb3-ejb-roundtrip:jar:0.6.0:compile
[INFO] | +- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.0.Final:compile
[INFO] | +- org.jvnet.jaxb2_commons:jaxb2-basics-testing:jar:0.8.2:compile
[INFO] | | +- xmlunit:xmlunit:jar:1.0:compile
[INFO] | | \- org.jvnet.jaxb2_commons:jaxb2-basics-tools:jar:0.8.2:compile
[INFO] | | \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] | \- org.slf4j:slf4j-log4j12:jar:1.6.1:compile
[INFO] | \- log4j:log4j:jar:1.2.16:compile
[INFO] +- org.jadira.usertype:usertype.core:jar:3.1.0.CR8:compile
[INFO] | \- org.jadira.usertype:usertype.spi:jar:3.1.0.CR8:compile
[INFO] +- javax.servlet:jstl:jar:1.2:compile
[INFO] +- javax.servlet:servlet-api:jar:2.5:provided
[INFO] +- javax.servlet.jsp:jsp-api:jar:2.2:provided
[INFO] +- org.springframework.data:spring-data-jpa:jar:1.6.4.RELEASE:compile
[INFO] | +- org.springframework.data:spring-data-commons:jar:1.8.4.RELEASE:compile
[INFO] | +- org.springframework:spring-context:jar:4.0.6.RELEASE:compile
[INFO] | +- org.springframework:spring-beans:jar:4.0.6.RELEASE:compile
[INFO] | +- org.springframework:spring-core:jar:4.0.6.RELEASE:compile
[INFO] | \- org.slf4j:jcl-over-slf4j:jar:1.7.7:runtime
[INFO] +- org.springframework:spring-jdbc:jar:4.0.6.RELEASE:compile
[INFO] +- org.springframework:spring-aop:jar:4.0.6.RELEASE:compile
[INFO] | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.springframework:spring-webmvc:jar:4.0.6.RELEASE:compile
[INFO] | +- org.springframework:spring-expression:jar:4.0.6.RELEASE:compile
[INFO] | \- org.springframework:spring-web:jar:4.0.6.RELEASE:compile
[INFO] +- org.springframework:spring-tx:jar:4.0.6.RELEASE:compile
[INFO] +- org.springframework:spring-context-support:jar:4.0.6.RELEASE:compile
[INFO] +- org.springframework:spring-orm:jar:4.0.6.RELEASE:compile
[INFO] +- org.springframework:spring-oxm:jar:4.0.6.RELEASE:compile
[INFO] +- org.springframework:spring-jms:jar:4.0.6.RELEASE:compile
[INFO] +- org.apache.tomcat:tomcat-jdbc:jar:7.0.42:runtime
[INFO] | \- org.apache.tomcat:tomcat-juli:jar:7.0.42:runtime
[INFO] +- org.slf4j:slf4j-api:jar:1.7.5:compile
[INFO] +- ch.qos.logback:logback-classic:jar:1.0.13:runtime
[INFO] | \- ch.qos.logback:logback-core:jar:1.0.13:runtime
[INFO] +- joda-time:joda-time:jar:2.3:compile
[INFO] +- joda-time:joda-time-hibernate:jar:1.3:compile
[INFO] +- joda-time:joda-time-jsptags:jar:1.1.1:compile
[INFO] +- org.jadira.usertype:usertype.jodatime:jar:2.0.1:compile
[INFO] +- mysql:mysql-connector-java:jar:5.1.27:compile
[INFO] +- org.hibernate:hibernate-entitymanager:jar:4.2.1.Final:compile
[INFO] | +- org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile
[INFO] | +- org.hibernate:hibernate-core:jar:4.2.1.Final:compile
[INFO] | | \- antlr:antlr:jar:2.7.7:compile
[INFO] | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | +- org.jboss.spec.javax.transaction:jboss-transaction api_1.1_spec:jar:1.0.1.Final:compile
[INFO] | +- org.javassist:javassist:jar:3.15.0-GA:compile
[INFO] | \- org.hibernate.common:hibernate-commons-annotations:jar:4.0.1.Final:compile
[INFO] +- org.hibernate:hibernate-validator:jar:5.1.1.Final:compile
[INFO] | +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] | \- com.fasterxml:classmate:jar:1.0.0:compile
[INFO] +- org.hibernate:hibernate-ehcache:jar:4.2.1.Final:compile
[INFO] +- net.sf.ehcache:ehcache-core:jar:2.6.6:compile
[INFO] +- org.webjars:bootstrap:jar:2.3.0:compile
[INFO] +- org.webjars:jquery-ui:jar:1.10.3:compile
[INFO] +- org.webjars:jquery:jar:2.0.3-1:compile
[INFO] +- org.springframework:spring-test:jar:4.0.6.RELEASE:test
[INFO] +- junit:junit:jar:4.11:test
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO] +- org.aspectj:aspectjrt:jar:1.7.4:compile
[INFO] +- org.aspectj:aspectjweaver:jar:1.7.4:runtime
[INFO] +- com.github.dandelion:datatables-jsp:jar:0.9.2:compile
[INFO] | \- com.github.dandelion:datatables-core:jar:0.9.2:compile
[INFO] | +- com.googlecode.json-simple:json-simple:jar:1.1.1:compile
[INFO] | \- commons-beanutils:commons-beanutils:jar:1.8.3:compile
[INFO] +- com.github.dandelion:datatables-export-itext:jar:0.9.2:compile
[INFO] | \- com.itextpdf:itextpdf:jar:5.3.4:compile
[INFO] +- com.github.dandelion:datatables-servlet2:jar:0.9.2:compile
[INFO] +- commons-fileupload:commons-fileupload:jar:1.2:compile
[INFO] +- commons-io:commons-io:jar:1.3.2:compile
[INFO] +- commons-lang:commons-lang:jar:2.6:compile
[INFO] +- org.apache.tiles:tiles-jsp:jar:2.1.3:compile
[INFO] | \- org.apache.tiles:tiles-servlet:jar:2.1.3:compile
[INFO] | \- org.apache.tiles:tiles-core:jar:2.1.3:compile
[INFO] | +- org.apache.tiles:tiles-api:jar:2.1.3:compile
[INFO] | \- commons-digester:commons-digester:jar:1.8.1:compile
[INFO] +- org.springframework.security:spring-security-core:jar:3.2.2.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-web:jar:3.2.2.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-config:jar:3.2.2.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-taglibs:jar:3.2.2.RELEASE:compile
[INFO] | \- org.springframework.security:spring-security-acl:jar:3.2.2.RELEASE:compile
[INFO] +- org.eclipse.emf:ecore:jar:2.2.3:compile
[INFO] \- org.eclipse.emf:common:jar:2.2.3:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.805s
[INFO] Finished at: Thu Nov 06 12:32:32 PST 2014
[INFO] Final Memory: 14M/124M
[INFO] ------------------------------------------------------------------------
From your dependency tree:
org.hibernate:hibernate-entitymanager:jar:4.2.1.Final:compile
I don't think Hibernate 4.2.1 supports JPA 2.1. You may need to upgrade to Hibernate 4.3.
You may also want to add this dependency if your application container doesn't provide it:
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.0.Final</version>
</dependency>

ClassNotFoundException: org.aopalliance.intercept.MethodInterceptor

I am working on Hibernate3 Spring3 project starter with Tomcat 7,
I am struggling with this ClassNotFoundException - of aopalliance interceptor Jar (is this AspectJ??)
This despite the fact that the Jar exist is in the class-path.
What I don't understand from maven is, where do I use this Jar - who is dependent on this Jar?
[INFO] +- org.hibernate:hibernate-core:jar:3.3.2.GA:compile
[INFO] | +- antlr:antlr:jar:2.7.6:compile
[INFO] | +- javax.transaction:jta:jar:1.1:compile
[INFO] | \- org.slf4j:slf4j-api:jar:1.5.8:compile
[INFO] +- org.hibernate:hibernate-entitymanager:jar:3.3.2.GA:compile
[INFO] | +- org.hibernate:hibernate:jar:3.2.6.ga:compile
[INFO] | | +- net.sf.ehcache:ehcache:jar:1.2.3:compile
[INFO] | | \- asm:asm-attrs:jar:1.5.3:compile
[INFO] | +- org.hibernate:hibernate-annotations:jar:3.3.1.GA:compile
[INFO] | +- org.hibernate:hibernate-commons-annotations:jar:3.0.0.ga:compile
[INFO] | +- org.hibernate:ejb3-persistence:jar:1.0.1.GA:compile
[INFO] | \- javassist:javassist:jar:3.4.GA:compile
[INFO] +- junit:junit:jar:4.8.1:test
[INFO] +- org.springframework:spring-core:jar:3.0.5.RELEASE:compile
[INFO] | \- org.springframework:spring-asm:jar:3.0.5.RELEASE:compile
[INFO] +- javax.servlet:servlet-api:jar:2.4:compile
Here is the problematic jar:
[INFO] +- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.springframework:spring-expression:jar:3.0.5.RELEASE:compile
[INFO] +- org.springframework:spring-web:jar:3.0.5.RELEASE:compile
[INFO] +- org.springframework:spring-beans:jar:3.0.5.RELEASE:compile
[INFO] +- org.springframework:spring-context:jar:3.0.5.RELEASE:compile
[INFO] +- org.springframework:spring-aop:jar:3.0.5.RELEASE:compile
[INFO] +- org.springframework:spring-context-support:jar:3.0.5.RELEASE:compile
[INFO] +- org.springframework:spring-tx:jar:3.0.5.RELEASE:compile
[INFO] +- org.springframework:spring-orm:jar:3.0.5.RELEASE:compile
[INFO] +- org.springframework:spring-jdbc:jar:3.0.5.RELEASE:compile
[INFO] +- org.springframework:spring-test:jar:3.0.5.RELEASE:test
[INFO] +- org.springframework:spring-webmvc:jar:3.0.5.RELEASE:compile
...
who is dependent on this Jar?
The Spring framework needs it for Spring AOP. Stand-alone AspectJ does not need it.

Categories