maven-dependency-plugin not showing test-scoped dependencies - java

I'm attempting to display the full tree of dependencies for a project I'm working on using the maven-dependency-plugin version 3.1.2 from the command line, but the mvn dependency:tree goal (nor any of the other goals from the maven-dependency-plugin) is not showing the test dependencies. The documentation of the plugin (https://maven.apache.org/plugins/maven-dependency-plugin/tree-mojo.html) states that all scopes are included by default, so using the -Dscope=test shouldn't be necessary (but when adding this parameter, the output doesn't change).
I've run this with a clean .m2 repository, using no settings.xml file (to ensure that all artifacts are coming directly from repo.maven.apache.org).
I'm running using maven 3.6.2 on a linux environment (CentOS 7) and using Oracle Java 1.8.0_144
Here's my POM:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.sw-eval</groupId>
<artifactId>cayenne-eval</artifactId>
<version>1.0.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.apache.cayenne</groupId>
<artifactId>cayenne-server</artifactId>
<version>4.2.M2</version>
</dependency>
<dependency>
<groupId>org.apache.cayenne</groupId>
<artifactId>cayenne-di</artifactId>
<version>4.2.M2</version>
</dependency>
<dependency>
<groupId>org.apache.cayenne</groupId>
<artifactId>cayenne-dbsync</artifactId>
<version>4.2.M2</version>
</dependency>
<dependency>
<groupId>org.apache.cayenne</groupId>
<artifactId>cayenne-client</artifactId>
<version>4.2.M2</version>
</dependency>
</dependencies>
</project>
Here's the output I receive from running the command mvn dependency:tree:
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< com.sw-eval:cayenne-eval >----------------------
[INFO] Building cayenne-eval 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # cayenne-eval ---
[INFO] com.sw-eval:cayenne-eval:jar:1.0.0-SNAPSHOT
[INFO] +- org.apache.cayenne:cayenne-server:jar:4.2.M2:compile
[INFO] | \- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] +- org.apache.cayenne:cayenne-di:jar:4.2.M2:compile
[INFO] +- org.apache.cayenne:cayenne-dbsync:jar:4.2.M2:compile
[INFO] | +- org.apache.cayenne:cayenne-project:jar:4.2.M2:compile
[INFO] | \- net.java.dev.inflector:inflector:jar:0.7.0:compile
[INFO] \- org.apache.cayenne:cayenne-client:jar:4.2.M2:compile
[INFO] +- com.caucho:hessian:jar:4.0.63:compile
[INFO] \- org.apache.cayenne:cayenne-rop-server:jar:4.2.M2:compile
[INFO] +- org.apache.cayenne:cayenne-web:jar:4.2.M2:compile
[INFO] \- org.slf4j:slf4j-simple:jar:1.7.25:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.951 s
[INFO] Finished at: 2020-11-25T08:53:17-07:00
[INFO] ------------------------------------------------------------------------
When referring to the cayenne-server pom, however, there are many dependencies marked as test which are not shown in the output (specifically, the following are direct dependencies of cayenne-server, see https://search.maven.org/artifact/org.apache.cayenne/cayenne-server/4.2.M2/jar):
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.cayenne.build-tools</groupId>
<artifactId>cayenne-test-utilities</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-mock</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.mockrunner</groupId>
<artifactId>mockrunner-jdbc</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<!-- this one have old Xerces dependency that clashes with JDK's one -->
<groupId>nekohtml</groupId>
<artifactId>nekohtml</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>xmlunit</groupId>
<artifactId>xmlunit</artifactId>
<scope>test</scope>
</dependency>
So, is there something that I'm missing that needs to be enabled to show these test-scoped dependencies, and / or is this a weird artifact unique to the cayenne-server dependency?
Thanks in advance!

Dependencies of scope test are not transitive.
The test dependencies of your dependencies are not part of your dependency tree. They are ignored by Maven.

Related

MAVEN :- Could not resolve dependencies for project

I hope some one facing the same issue to resolving the dependencies. POM.xml file mentioned below
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4.0.0
<parent>
<groupId>com.shopizer</groupId>
<artifactId>habbit</artifactId>
<version>2.12.0</version>
</parent>
<artifactId>habbit-core</artifactId>
<packaging>jar</packaging>
<name>habbit-core</name>
<url>http://www.shopizer.com</url>
<properties>
<coverage.lines>.00</coverage.lines>
<coverage.branches>.00</coverage.branches>
<google-client-maps-services-version>0.1.6</google-client-maps-services-version>
</properties>
<dependencies>
<!-- jpa, crud repository -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-ehcache -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
</dependency>
<!-- sm-core-model -->
<dependency>
<groupId>com.shopizer</groupId>
<artifactId>habbit-core-model</artifactId>
</dependency>
<!-- sm-core-modules -->
<dependency>
<groupId>com.shopizer</groupId>
<artifactId>habbit-core-modules</artifactId>
</dependency>
<!-- canadapost -->
<dependency>
<groupId>com.shopizer</groupId>
<artifactId>shopizer-shipping-canadapost-module</artifactId>
<version>${shopizer-canadapost.version}</version>
</dependency>
<!-- Google Map API -->
<dependency>
<groupId>com.google.maps</groupId>
<artifactId>google-maps-services</artifactId>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-ci</artifactId>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-decisiontables</artifactId>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
</dependency>
<!--spring integration -->
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-spring</artifactId>
</dependency>
<!-- end rules engine -->
<!-- Infinispan -->
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-core</artifactId>
</dependency>
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-tree</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-collections4 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<!--<version>${commons-collections4.version}</version> -->
</dependency>
<!-- https://mvnrepository.com/artifact/commons-validator/commons-validator -->
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
<!--<version>${commons-validator.version}</version> -->
<exclusions>
<exclusion>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/org.freemarker/freemarker -->
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-context-support -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-s3 -->
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-s3</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-ses -->
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-ses</artifactId>
</dependency>
<!-- google cloud storage -->
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-storage</artifactId>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Payment dependencies -->
<!-- Paypal -->
<dependency>
<groupId>com.paypal.sdk</groupId>
<artifactId>merchantsdk</artifactId>
</dependency>
<!-- Stripe -->
<dependency>
<groupId>com.stripe</groupId>
<artifactId>stripe-java</artifactId>
</dependency>
<!-- Braintree -->
<dependency>
<groupId>com.braintreepayments.gateway</groupId>
<artifactId>braintree-java</artifactId>
</dependency>
<!-- Invoices -->
<!-- <dependency> <groupId>com.itextpdf</groupId> <artifactId>itextpdf</artifactId>
</dependency> <dependency> <groupId>org.jopendocument</groupId> <artifactId>jOpenDocument</artifactId>
</dependency> -->
<!-- https://mvnrepository.com/artifact/com.maxmind.geoip2/geoip2 -->
<dependency>
<groupId>com.maxmind.geoip2</groupId>
<artifactId>geoip2</artifactId>
</dependency>
<!-- google cloud storage -->
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
<!-- Up to date for GCP storage issue -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<!-- tests dependencies -->
<!-- http://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-test -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<!-- H2 DB -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<!-- Elastic search -->
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
</dependency>
<dependency>
<groupId>com.shopizer</groupId>
<artifactId>sm-search</artifactId>
<exclusions>
<exclusion>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
when I run command mvn clean install:-
[INFO] Scanning for projects...
[INFO] Inspecting build with total of 6 modules...
[INFO] Installing Nexus Staging features:
[INFO] ... total of 6 executions of maven-deploy-plugin replaced with nexus-staging-maven-plugin
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] habbit [pom]
[INFO] habbit-core-model [jar]
[INFO] habbit-core-modules [jar]
[INFO] habbit-core [jar]
[INFO] habbit-shop-model [jar]
[INFO] habbit-shop [jar]
[INFO]
[INFO] ------------------------< com.shopizer:habbit >-------------------------
[INFO] Building habbit 2.12.0 [1/6]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) # habbit ---
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.3:prepare-agent (default-prepare-agent) # habbit ---
[INFO] argLine set to -javaagent:C:\\Users\\Hp\\.m2\\repository\\org\\jacoco\\org.jacoco.agent\\0.8.3\\org.jacoco.agent-0.8.3-runtime.jar=destfile=D:\\myProject\\h
abbit\\target\\jacoco.exec
[INFO]
[INFO] -------------------< com.shopizer:habbit-core-model >-------------------
[INFO] Building habbit-core-model 2.12.0 [2/6]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) # habbit-core-model ---
[INFO] Deleting D:\myProject\habbit\habbit-core-model\target
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.3:prepare-agent (default-prepare-agent) # habbit-core-model ---
[INFO] argLine set to -javaagent:C:\\Users\\Hp\\.m2\\repository\\org\\jacoco\\org.jacoco.agent\\0.8.3\\org.jacoco.agent-0.8.3-runtime.jar=destfile=D:\\myProject\\h
abbit\\habbit-core-model\\target\\jacoco.exec
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) # habbit-core-model ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\myProject\habbit\habbit-core-model\src\main\resources
[INFO] skip non existing resourceDirectory D:\myProject\habbit\habbit-core-model\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) # habbit-core-model ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 182 source files to D:\myProject\habbit\habbit-core-model\target\classes
[INFO]
[INFO] ------------------< com.shopizer:habbit-core-modules >------------------
[INFO] Building habbit-core-modules 2.12.0 [3/6]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) # habbit-core-modules ---
[INFO] Deleting D:\myProject\habbit\habbit-core-modules\target
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.3:prepare-agent (default-prepare-agent) # habbit-core-modules ---
[INFO] argLine set to -javaagent:C:\\Users\\Hp\\.m2\\repository\\org\\jacoco\\org.jacoco.agent\\0.8.3\\org.jacoco.agent-0.8.3-runtime.jar=destfile=D:\\myProject\\h
abbit\\habbit-core-modules\\target\\jacoco.exec
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) # habbit-core-modules ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\myProject\habbit\habbit-core-modules\src\main\resources
[INFO] skip non existing resourceDirectory D:\myProject\habbit\habbit-core-modules\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) # habbit-core-modules ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 14 source files to D:\myProject\habbit\habbit-core-modules\target\classes
[INFO]
[INFO] ----------------------< com.shopizer:habbit-core >----------------------
[INFO] Building habbit-core 2.12.0 [4/6]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for habbit 2.12.0:
[INFO]
[INFO] habbit ............................................. SUCCESS [ 2.919 s]
[INFO] habbit-core-model .................................. SUCCESS [ 14.010 s]
[INFO] habbit-core-modules ................................ SUCCESS [ 2.125 s]
[INFO] habbit-core ........................................ FAILURE [ 2.078 s]
[INFO] habbit-shop-model .................................. SKIPPED
[INFO] habbit-shop ........................................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 24.245 s
[INFO] Finished at: 2020-05-22T15:12:57+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project habbit-core: Could not resolve dependencies for project com.shopizer:habbit-core:jar:2.12.0: Failed to collect dependenci
es at com.shopizer:shopizer-shipping-canadapost-module:jar:2.11.0 -> com.shopizer:sm-core-model:jar:2.10.0: Failed to read artifact descriptor for com.shopizer:sm-
core-model:jar:2.10.0: Failure to find com.shopizer:shopizer:pom:2.10.0 in https://oss.sonatype.org/content/repositories/snapshots/ was cached in the local reposit
ory, resolution will not be reattempted until the update interval of oss-sonatype has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <args> -rf :habbit-core
Remove canadapost-module from dependencies.

maven still lists excluded dependency

I have a maven project with these dependencies:
<dependencies>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4-1200-jdbc41</version>
<exclusions>
<exclusion>
<groupId>org.slf4</groupId>
<artifactId>slf4j-simple</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
If I run mvn tree it still shows the excluded artifact:
$ mvn dependency:tree
...
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # testArtifact ---
[INFO] testGroup:testArtifact:jar:1.0-SNAPSHOT
[INFO] \- org.postgresql:postgresql:jar:9.4-1200-jdbc41:compile
[INFO] +- com.github.dblock.waffle:waffle-jna:jar:1.7:runtime
[INFO] | +- net.java.dev.jna:jna:jar:4.1.0:runtime
[INFO] | +- net.java.dev.jna:jna-platform:jar:4.1.0:runtime
[INFO] | +- org.slf4j:slf4j-api:jar:1.7.7:runtime
[INFO] | \- com.google.guava:guava:jar:18.0:runtime
[INFO] \- org.slf4j:slf4j-simple:jar:1.7.7:runtime ** <--- BAD ONE
And if I run things like dependency:copy-dependencies or the shaded jar plugin, they all pull in the unwanted jar.
Am I missing something?
Using maven 3.6.0
The groupId is incorrect. Should be org.slf4j instead of org.slf4 (the j is missing).

Junit test cases are not running when i do mvn clean install

I have written a spring boot application. I have written Junit test cases as well for that. When i run mvn clean install command, test cases are not running as part of that mvn build. But when i just right click and run as Junit test case all my test cases execute. I believe there is some configuration error.
Am using spring-boot, maven as build and Eclipse ide.
My test class name is TestService.java and it is in src/test folder
public class TestService {
JsonUtil jsonUtil;
String jsonString;
#Before
public void setData() {
jsonString = "{\"id\":\"one\"}";
jsonUtil = new JsonUtil(new ObjectMapper());
}
#Test
public void testGetStringAsJson() {
JsonNode node = jsonUtil.getStringAsJson(jsonString);
Assert.assertEquals("one", node.get("id").textValue());
}
}
Below is my pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.xyz</groupId>
<artifactId>xyz</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>xyz</name>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<!-- dependency versions -->
<com.google.guava.guava.version>22.0</com.google.guava.guava.version>
<io.springfox.springfox-swagger2>2.7.0</io.springfox.springfox-swagger2>
<io.springfox.springfox-swagger-ui>2.7.0</io.springfox.springfox-swagger-ui>
</properties>
<dependencies>
<!-- For default Spring Boot utilities -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<!-- For testing possibility -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- For all mvc and web functions -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-hateoas</artifactId>
</dependency>
<!-- Spring security related dependencies
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
</dependency>-->
<!-- Default persistence functions -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-java8</artifactId>
<version>5.0.5.Final</version>
</dependency>
<!-- In-Memory DB -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<!-- Java Utilities from google -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${com.google.guava.guava.version}</version>
</dependency>
<!-- Include swagger for API description -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${io.springfox.springfox-swagger2}</version>
</dependency>
<!-- Include swagger for API description UI -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${io.springfox.springfox-swagger-ui}</version>
</dependency>
<!-- Common libraries -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-lang/commons-lang -->
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Maven output
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building xyz 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.6.1:clean (default-clean) # xyz ---
[INFO] Deleting C:\Users\rk\Documents\WS\xyz\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # xyz ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # xyz ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 17 source files to C:\Users\rk\Documents\WS\xyz\target\classes
[WARNING] /C:/Users/rk/Documents/WS/xyz/src/main/java/com/weather/xyzTestApplication.java: C:\Users\rk\Documents\WS\xyz\src\main\java\com\weather\xyzTestApplication.java uses or overrides a deprecated API.
[WARNING] /C:/Users/rk/Documents/WS/xyz/src/main/java/com/weather/xyzTestApplication.java: Recompile with -Xlint:deprecation for details.
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # xyz ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # xyz ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 4 source files to C:\Users\rk\Documents\WS\xyz\target\test-classes
[WARNING] /C:/Users/rk/Documents/WS/xyz/src/test/java/com/weather/controller/TestxyzController.java: C:\Users\rk\Documents\WS\xyz\src\test\java\com\weather\controller\TestxyzController.java uses unchecked or unsafe operations.
[WARNING] /C:/Users/rk/Documents/WS/xyz/src/test/java/com/weather/controller/TestxyzController.java: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- maven-surefire-plugin:2.18.1:test (default-test) # xyz ---
[INFO]
[INFO] --- maven-jar-plugin:2.6:jar (default-jar) # xyz ---
[INFO] Building jar: C:\Users\rk\Documents\WS\xyz\target\xyz-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] --- spring-boot-maven-plugin:1.5.4.RELEASE:repackage (default) # xyz ---
[INFO]
[INFO] --- maven-install-plugin:2.5.2:install (default-install) # xyz ---
[INFO] Installing C:\Users\rk\Documents\WS\xyz\target\xyz-0.0.1-SNAPSHOT.jar to C:\Users\rk\.m2\repository\com\weather\xyz\0.0.1-SNAPSHOT\xyz-0.0.1-SNAPSHOT.jar
[INFO] Installing C:\Users\rk\Documents\WS\xyz\pom.xml to C:\Users\rk\.m2\repository\com\weather\xyz\0.0.1-SNAPSHOT\xyz-0.0.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.643 s
[INFO] Finished at: 2018-09-24T22:44:24+05:30
[INFO] Final Memory: 34M/248M
[INFO] ------------------------------------------------------------------------
Check pom.xml go to 'Effective POM' view.
Check the value for tag under . It seems like it is not pointing to the proper location. You may override the property in pom.xml if it is pointing to a different location.
How would you have created the pom through spring initializer or manually? Most likely build path issue causing plugin not to execute. Can you check which version is being used once run through eclipse later verify through mvn dependency: tree just to know the same version is also available from cmd.

Spring class-loading issues while deploying EAR application on WebSphere 9 [duplicate]

I got several IllegalStateException,CannotCompileException and LinkageError at the time of application running on WebSphere 9.0 java 8 . These this is stack trace of error :
Caused by: java.lang.IllegalStateException: javassist.CannotCompileException: by java.lang.LinkageError: org.springframework.aop.framework.ProxyCreatorSupport
at org.springframework.aop.framework.JavassistApplicationContext.<clinit>(JavassistApplicationContext.java:61)
... 114 more
Caused by: javassist.CannotCompileException: by java.lang.LinkageError: org.springframework.aop.framework.ProxyCreatorSupport
at javassist.ClassPool.toClass(ClassPool.java:1120)
at javassist.ClassPool.toClass(ClassPool.java:1063)
at javassist.ClassPool.toClass(ClassPool.java:1021)
at javassist.CtClass.toClass(CtClass.java:1259)
at org.springframework.aop.framework.JavassistApplicationContext.<clinit>(JavassistApplicationContext.java:59)
... 114 more
Caused by: java.lang.LinkageError: org.springframework.aop.framework.ProxyCreatorSupport
at java.lang.ClassLoader.defineClassImpl(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:346)
at java.lang.ClassLoader.defineClass(ClassLoader.java:283)
at sun.reflect.GeneratedMethodAccessor17.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:508)
at javassist.ClassPool.toClass2(ClassPool.java:1133)
at javassist.ClassPool.toClass(ClassPool.java:1114)
... 118 more
and also i am getting java.lang.ExceptionInInitializerError :
com.ibm.ws.webcontainer.webapp.WebApp notifyServletContextCreated SRVE0283E:
Exception caught while initializing context: {0} java.lang.ExceptionInInitializerError
at java.lang.J9VMInternals.ensureError(J9VMInternals.java:141)
at java.lang.J9VMInternals.recordInitializationFailure(J9VMInternals.java:130)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:88)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:57)
at java.lang.reflect.Constructor.newInstance(Constructor.java:437)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:104)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:258)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:204)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
And in pom.xml File, I have following dependency.
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.16</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.2</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.5</version>
</dependency>
<!-- Javassist -->
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.19.0-GA</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>[1.1.1,)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging-api</artifactId>
<version>[1.0.3,)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4jVersion}</version>
<!--<scope>provided</scope>-->
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4jVersion}</version>
<!--<scope>provided</scope>-->
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4jVersion}</version>
<!--<scope>provided</scope>-->
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
<!--<scope>provided</scope>-->
</dependency>
<!-- Global Test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ibm</groupId>
<artifactId>ibmpkcs</artifactId>
<version>8.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<showDeprecation>${maven.compiler.showDeprecation}</showDeprecation>
<showWarnings>${maven.compiler.showWarnings}</showWarnings>
<encoding>UTF-8</encoding>
<debug>${maven.compiler.debug}</debug>
<optimize>${maven.compiler.optimize}</optimize>
</configuration>
</plugin>
</build>
<properties>
<spring.version>4.2.5.RELEASE</spring.version>
<spring-ws.version>2.4.0.RELEASE</spring-ws.version>
<spring-security.version>4.0.0.RELEASE</spring-security.version>
<slf4jVersion>1.6.1</slf4jVersion>
<maven.test.skip>true</maven.test.skip>
<junit.version>4.8.2</junit.version>
<hibernate.version>3.5.6-Final</hibernate.version>
</properties>
i am using spring 4.2.5.RELEASE version and javassist 3.19.0-GA version .
and in the web app, I can see following jar files after installing the application on WebSphere /WEB-INF/lib
aopalliance-1.0.jar
commons-io-1.4.jar
jcl-over-slf4j-1.6.1.jar
spring-aop-4.2.5.RELEASE.jar
spring-expression-4.2.5.RELEASE.jar
bcprov-jdk16-1.46.jar
freemarker-2.3.16.jar
log4j-1.2.14.jar
spring-beans-4.2.5.RELEASE.jar
spring-web-4.2.5.RELEASE.jar
commons-codec-1.4.jar
ibmpkcs-8.0.jar
slf4j-api-1.6.1.jar
spring-context-4.2.5.RELEASE.jar
spring-webmvc-4.2.5.RELEASE.jar
commons-fileupload-1.2.2.jar
javassist-3.19.0-GA.jar
slf4j-log4j12-1.6.1.jar
spring-core-4.2.5.RELEASE.jar
also in web.xml i am using org.springframework.aop.framework.JavassistApplicationContext
<context-param>
<param-name>contextClass</param-name>
<param-value>org.springframework.aop.framework.JavassistApplicationContext</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listenerclass>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
and in class path /WEB-INF/classes/org/springframework/aop/framework i have some javassist classes .
JavassistAopProxy$1.class
JavassistAopProxy$EqualsInterceptor.class
JavassistAopProxy$JavassistMethodInvocation.class
JavassistAopProxy.class JavassistAopProxy$AdvisedDispatcher.class
JavassistAopProxy$ExProxyFactory.class JavassistAopProxy$MethodInterceptor.class
JavassistAopProxyFactory.class JavassistAopProxy$CompositeInterceptor.class
JavassistAopProxy$FixedChainStaticTargetInterceptor.class
JavassistAopProxy$StaticDispatcher.class JavassistApplicationContext.class JavassistAopProxy$DynamicAdvisedInterceptor.class
JavassistAopProxy$HashCodeInterceptor.class
JavassistAopProxy$UnadvisedInterceptor.class
Any suggestions on this error? I have tried following methods to
class loader parent last method on server and application
Update spring to latest version
removed javascript jar files from /WEB-INF/lib path
I can't understand what is this error means. Any explanations and suggestions to solve this error. It was working fine in WebSphere 6 with Java 1.6
update :
mvn dependency:tree
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # myapp-parent ---
[INFO] com.test:myapp-parent:pom:6.2.0
[INFO] +- commons-logging:commons-logging:jar:1.2:provided
[INFO] +- commons-logging:commons-logging-api:jar:1.1:provided
[INFO] +- org.slf4j:slf4j-api:jar:1.6.1:compile
[INFO] +- org.slf4j:jcl-over-slf4j:jar:1.6.1:compile
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.6.1:compile
[INFO] +- log4j:log4j:jar:1.2.14:compile
[INFO] +- junit:junit:jar:4.8.2:test
[INFO] \- com.ibm:ibmpkcs:jar:8.0:compile
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Web Application Package 6.2.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # myapp-webapp ---
[INFO] com.test:myapp-webapp:war:6.2.0
[INFO] +- org.springframework:spring-webmvc:jar:4.2.5.RELEASE:compile
[INFO] | +- org.springframework:spring-beans:jar:4.2.5.RELEASE:compile
[INFO] | +- org.springframework:spring-context:jar:4.2.5.RELEASE:compile
[INFO] | | \- org.springframework:spring-aop:jar:4.2.5.RELEASE:compile
[INFO] | | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] | +- org.springframework:spring-core:jar:4.2.5.RELEASE:compile
[INFO] | +- org.springframework:spring-expression:jar:4.2.5.RELEASE:compile
[INFO] | \- org.springframework:spring-web:jar:4.2.5.RELEASE:compile
[INFO] +- commons-codec:commons-codec:jar:1.4:compile
[INFO] +- commons-io:commons-io:jar:1.4:compile
[INFO] +- commons-fileupload:commons-fileupload:jar:1.2.2:compile
[INFO] +- javax.servlet:servlet-api:jar:2.5:provided
[INFO] +- org.freemarker:freemarker:jar:2.3.16:compile
[INFO] +- org.springframework:spring-test:jar:4.2.5.RELEASE:test
[INFO] +- org.javassist:javassist:jar:3.21.0-GA:compile
[INFO] +- org.bouncycastle:bcprov-jdk16:jar:1.46:compile
[INFO] +- commons-logging:commons-logging:jar:1.2:provided
[INFO] +- commons-logging:commons-logging-api:jar:1.1:provided
[INFO] +- org.slf4j:slf4j-api:jar:1.6.1:compile
[INFO] +- org.slf4j:jcl-over-slf4j:jar:1.6.1:compile
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.6.1:compile
[INFO] +- log4j:log4j:jar:1.2.14:compile
[INFO] +- junit:junit:jar:4.8.2:test
[INFO] \- com.ibm:ibmpkcs:jar:8.0:compile
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Enterprise Application Package 6.2.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # myapp-ear ---
[INFO] com.test:myapp-ear:ear:6.2.0
[INFO] +- com.test:myapp-webapp:war:6.2.0:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.6.1:provided
[INFO] +- org.slf4j:jcl-over-slf4j:jar:1.6.1:provided
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.6.1:provided
[INFO] +- log4j:log4j:jar:1.2.14:provided
[INFO] +- commons-logging:commons-logging:jar:1.2:provided
[INFO] +- commons-logging:commons-logging-api:jar:1.1:provided
[INFO] +- junit:junit:jar:4.8.2:test
[INFO] \- com.ibm:ibmpkcs:jar:8.0:compile
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] my application...................................... SUCCESS [ 9.465 s]
[INFO] Web Application Package ............................ SUCCESS [ 0.104 s]
[INFO] Enterprise Application Package ..................... SUCCESS [ 0.044 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.721 s
[INFO] Finished at: 2017-09-18T13:33:51+05:30
[INFO] Final Memory: 13M/245M
[INFO] ------------------------------------------------------------------------
Update
And now i think the problem due to javassist file . I am loading a specific class using javassist in my code .org.spring.aop.framework.ProxyCreatorSupport is a class that will be loaded by the class loader . But i am getting some IllegalStateException , cannot compile exceptions when i deploy .EAR file to WebSphere .
Using ClassPool.getDefault(), I am looking up information from the system class path . Added the class loader that is handed over by the transformation method as an argument. I have appended class loader to Javassist's search path .
package org.spring.aop.framework;
import javassist.ClassPool;
import javassist.CtClass;
import javassist.CtConstructor;
import javassist.LoaderClassPath;
import org.springframework.web.context.support.XmlWebApplicationContext;
public class JavassistApplicationContext extends XmlWebApplicationContext {
static {
ClassPool classPool = ClassPool.getDefault();
try {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
classPool.appendClassPath(new LoaderClassPath(classLoader));
CtClass cc = classPool.get("org.spring.aop.framework.ProxyCreatorSupport");
CtConstructor c = cc.getConstructors()[0];
c.insertAfter("$0.aopProxyFactory = new org.spring.aop.framework.JavassistAopProxyFactory();");
cc.toClass();
} catch (Exception e) {
throw new IllegalStateException(e);
}
}
}
It was working fine with java 1.6 WebSphere 8 . After update to java 8 WebSphere 9 , i am getting these kind of exceptions .I think Javassist toClass() causing exceptions in websphere . Also CtClass cc = classPool.get("org.spring.aop.framework.ProxyCreatorSupport");making some linkage issues . Any suggestion now ?

Hibernate 5 java.lang.NoSuchMethodError org.jboss.logging.Logger.debugf

I have a problem when I deploy a webapp with hibernate 5
Caused by: java.lang.NoSuchMethodError: org.jboss.logging.Logger.debugf(Ljava/lang/String;I)V
at org.hibernate.internal.NamedQueryRepository.checkNamedQueries(NamedQueryRepository.java:149) [hibernate-core-5.0.0.CR2.jar:5.0.0.CR2]
at org.hibernate.internal.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:759) [hibernate-core-5.0.0.CR2.jar:5.0.0.CR2]
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:490) [hibernate-core-5.0.0.CR2.jar:5.0.0.CR2]
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444) [hibernate-core-5.0.0.CR2.jar:5.0.0.CR2]
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:708) [hibernate-core-5.0.0.CR2.jar:5.0.0.CR2]
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:724) [hibernate-core-5.0.0.CR2.jar:5.0.0.CR2]
at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:372) [spring-orm-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:454) [spring-orm-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:439) [spring-orm-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1633) [spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1570) [spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
... 23 more
With Hibernate 4 everything is OK.
I had a look at the class NamedQueryRepository at line 149. That class is calling the method debugf in this way
log.debugf( "Checking %s named HQL queries", namedQueryDefinitionMap.size() );
I can not see the problem
Here is my dependency tree
[INFO] ------------------------------------------------------------------------
[INFO] Building app Maven Webapp 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # app---
[INFO] +- org.springframework:spring-aspects:jar:4.1.7.RELEASE:compile
[INFO] | \- org.aspectj:aspectjweaver:jar:1.8.6:compile
[INFO] +- org.springframework:spring-tx:jar:4.1.7.RELEASE:compile
[INFO] +- org.springframework:spring-beans:jar:4.1.7.RELEASE:compile
[INFO] +- org.springframework:spring-context-support:jar:4.1.7.RELEASE:compile
[INFO] +- org.springframework:spring-context:jar:4.1.7.RELEASE:compile
[INFO] | \- org.springframework:spring-expression:jar:4.1.7.RELEASE:compile
[INFO] +- org.springframework:spring-core:jar:4.1.7.RELEASE:compile
[INFO] | \- commons-logging:commons-logging:jar:1.2:compile
[INFO] +- org.springframework:spring-orm:jar:4.1.7.RELEASE:compile
[INFO] +- org.springframework:spring-web:jar:4.1.7.RELEASE:compile
[INFO] +- org.springframework:spring-aop:jar:4.1.7.RELEASE:compile
[INFO] | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.springframework:spring-jdbc:jar:4.1.7.RELEASE:compile
[INFO] +- org.springframework:spring-test:jar:4.1.7.RELEASE:test
[INFO] +- junit:junit:jar:4.12:test
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- org.hibernate:hibernate-entitymanager:jar:5.0.0.CR2:compile
[INFO] | +- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile
[INFO] | +- org.hibernate:hibernate-core:jar:5.0.0.CR2:compile
[INFO] | | +- antlr:antlr:jar:2.7.7:compile
[INFO] | | \- org.jboss:jandex:jar:1.2.2.Final:compile
[INFO] | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | | \- xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] | +- org.hibernate.common:hibernate-commons-annotations:jar:5.0.0.Final:compile
[INFO] | +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
[INFO] | +- org.apache.geronimo.specs:geronimo-jta_1.1_spec:jar:1.1.1:compile
[INFO] | \- org.javassist:javassist:jar:3.18.1-GA:compile
[INFO] +- org.hibernate:hibernate-c3p0:jar:5.0.0.CR2:compile
[INFO] | \- com.mchange:c3p0:jar:0.9.2.1:compile
[INFO] | \- com.mchange:mchange-commons-java:jar:0.2.3.4:compile
[INFO] +- org.primefaces:primefaces:jar:5.2.RC3:compile
[INFO] +- org.apache.logging.log4j:log4j-api:jar:2.2:compile
[INFO] +- org.apache.logging.log4j:log4j-core:jar:2.2:compile
[INFO] \- net.sourceforge.jtds:jtds:jar:1.2.8:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
In glass fish This problem is caused by collision with dependencies of glassfish modules. If you check lib list in glassfishdir/modules you would see boss-logging.jar. You can delete it and replace with latest such as org.jboss.logging:jboss-logging:jar:3.3.0.Final. It worked for me.
In my case the culprit was the Jersey bean validator artifact.
One of its dependencies, bean-validation-2.4.0-b06.jar contains Jboss logging classes, for some reason.
I had to exclude the jersey-bean-validation and bean-validator artifacts from the spring-boot-starter-jersey dependency:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jersey</artifactId>
<exclusions>
<exclusion>
<artifactId>jersey-bean-validation</artifactId>
<groupId>org.glassfish.jersey.ext</groupId>
</exclusion>
<exclusion>
<artifactId>bean-validator</artifactId>
<groupId>org.glassfish.hk2.external</groupId>
</exclusion>
</exclusions>
</dependency>
EDIT: As of spring-boot 1.3.0, this is fixed and the exclusions above are not necessary anymore.
Try upgrading jboss-logging.jar to a more recent version. The one you are using does not seem to be compatible with Hibernate 5.
I also faced with such kind of problem when deployed ear on weblogic server.
Apparently, weblogic also use jboss logging system, and use old version of it.
My fix:
Add "weblogic-application.xml" to META-INF folder with this content:
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-application>
<prefer-application-packages>
<package-name>org.jboss.logging.*</package-name>
</prefer-application-packages>
<prefer-application-resources>
<resource-name>org/jboss/logging/Logger.class</resource-name>
</prefer-application-resources>
</weblogic-application>
I was getting the same error using jersey-spring-3 and hibernate 5.0.1.Final.Excluding org.glassfish.hk2.external:bean-validator from jersy-spring-3 and adding org.glassfish.jersey.ext:jersey-bean-validation worked for me.Here is my final dependency.
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-spring3</artifactId>
<version>2.22.2</version>
<exclusions>
<exclusion>
<groupId>org.glassfish.hk2.external</groupId>
<artifactId>bean-validator</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-bean-validation</artifactId>
<version>2.22.2</version>
</dependency>
from :
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-spring3</artifactId>
<version>2.22.2</version>
</dependency>
In all probability you've got an outdated JBoss Logging JAR on the application's classpath. The ...f methods are a relatively new addition to the Logger API. Hibernate 5 directly depends on Logging version 3.3.0, but it is possible that somehwere in your pom.xml you have an overriding dependency to an earlier version. Another possibility is that you are deploying to a JBoss container where the logging API is container-provided. Then you may need to upgrade the JBoss server, or introduce a workaround to prefer classes contributed by your application.
Check my answer at NoSuchMethodError: org.jboss.logging.Logger.debugf
Even I was having issues after upgrading to Hibernate 5.2 , and the culprit was "jboss-logging 3.3.0.Final" which I see present in your dependencies too.
Following the steps on the link shared in the answer, you can reduce the dependency jboss-logging to 3.2 level which has the required function.
In my case the issue was caused by an older version of jboss-logging coming as transitive dependency from hibernate-ehcache, which I found by looking into the maven dependencies tree. I solved it by adding the exclusion:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
<version>${hibernate.version}</version>
<exclusions>
<exclusion>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
I had the same error, it is solved by
First add the dependency of jboss logging jar as follows
<!-- https://mvnrepository.com/artifact/org.jboss.logging/jboss-logging -->
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
<version>3.3.0.Final</version>
</dependency>
And if the error still exists then add following exlcusion to the maven dependency.
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-spring3</artifactId>
<version>2.12</version>
<exclusions>
<exclusion>
<groupId>org.glassfish.hk2</groupId>
<artifactId>hk2</artifactId>
</exclusion>
</exclusions>
</dependency>
After doing these two things, it is working fine for me.I hope it will work for
you also.
Error that i got was "
Application run failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.jboss.logging.Logger.debugf(Ljava/lang/String;I)V
:::
:::
Caused by: java.lang.NoSuchMethodError: org.jboss.logging.Logger.debugf(Ljava/lang/String;I)V"
i deleted the jboss-logging folder <.m2\repository\org\jboss\logging\jboss-logging> and restarted the jboss server.
The jars got addedback and the error was gone. (i got some other error after that, but atleast this error was gone)
I too faced this issue. This is what fixed it for me
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.2.1.RELEASE</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
I have the same problen with spring4.2.1+hibernate5.0.2+jersey2.23.1.
My solution is the same: Excluding org.glassfish.hk2.external:bean-validator from jersy-spring-3 and adding org.glassfish.jersey.ext:jersey-bean-validation.
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-spring3</artifactId>
<version>2.23.1</version>
<exclusions>
<exclusion>
<groupId>org.glassfish.hk2.external</groupId>
<artifactId>bean-validator</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-bean-validation</artifactId>
<version>2.23.1</version>
</dependency>
In my product environment, just delete bean-validator-2.4.0-b34.jar and add jersey-bean-validation-2.23.1.jar
This can be caused if a dependency includes
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.6.2</version>
</dependency>
Exclude it using an exclusions element in dependency.
JBoss 6.1+??
I set org.jboss.logging for jboss-logging-3.3.0.Final-redhat-1.jar in modules of jboss.
Its works for me.
Att.,
You can use Eclipse to find out which jar is causing the problem:
Setup a project with all your jars on the classpath
Navigate -> Open Type...
Type in org.jboss.logging.Logger
This will give you a list of jars which include the class. One of these is out of date and needs to be excluded (refer to other answers for variations on this).
My error was caused by GlassFish and I fixed it by configuring glassfish-web.xml:
The Java Servlet specification recommends that a web module's class loader look in the local class loader before delegating to its parent. You can make this class loader follow the delegation inversion model in the Servlet specification by setting delegate="false" in the class-loader element of the glassfish-web.xml file.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app error-url="">
<context-root>/myContext</context-root>
<!–– Change this line "true" to "false" -->
<class-loader delegate="false"/>
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class' java code.</description>
</property>
</jsp-config>
</glassfish-web-app>

Categories

Resources