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.
Related
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.
I'm aware that there are multiple threads going around in regards to this I have tried for up to 3 hours so I apologise for the repetition.
All I want to do is run mvn test to have it run the Junit 5 Tests. Pressing Run on IntelliJ works but mvn test in the terminal does not.
File structure is below -
https://user-images.githubusercontent.com/37623164/64642711-53cf1d80-d452-11e9-9764-849d73fcc5c9.png
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.8.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.petrego</groupId>
<artifactId>PetRego</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>PetRego</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.4.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-commons</artifactId>
<version>1.4.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.0</version>
</plugin>
</plugins>
</build>
</project>
Returned Result in Logs -
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------< com.petrego:PetRego >-------------------------
[INFO] Building PetRego 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) # PetRego ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) # PetRego ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) # PetRego ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/639603/projects/PetRego/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) # PetRego ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.22.0:test (default-test) # PetRego ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.704 s
[INFO] Finished at: 2019-09-11T05:02:30+10:00
[INFO] ------------------------------------------------------------------------
In general, the first thing you should do is check if there are newer versions of plugins.
Upgrading surefire should fix your issue, see https://maven.apache.org/surefire/maven-surefire-plugin/
As #AKSW suggested in the questions there is an incorrect import.
I was importing org.junit.Test (Junit4) when I should been importing JUnit5 org.junit.jupiter.api.Test (JUnit5)
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.
I have one application based on Maven + Spring.
It's a Java web application using java.
this is the pom.xml i'm using:
<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.alfred</groupId>
<artifactId>alfred</artifactId>
<version>v.0.1-CID.Fase.II.Edesk-SNAPSHOT</version>
<packaging>war</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.7.RELEASE</version>
</parent>
<name>ALFRED</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.4.0</version>
</dependency>
<!-- Dependencia para Spring DATA JPA con base de datos -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<!-- Para implementar las conexiones a la base de datos MySQL -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<!-- version>5.1.35</version -->
</dependency>
<!-- Para implementar el servicio REST -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>
<!-- http://mvnrepository.com/artifact/com.google.code.gson/gson -->
<!-- Paquete que permite convertir el contenido de una respuesta en texto
plano JSON a objetos Java. -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<!-- Para implementar cliente REST con Template -->
<!-- dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId>
</dependency -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<!-- Para implementar las plantillas HTML con thymeleaf -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.thymeleaf.extras/thymeleaf-extras-springsecurity3 -->
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity3</artifactId>
</dependency>
<!-- Para poder implementar los clientes de los servicios REST -->
<dependency>
<groupId>com.squareup.retrofit</groupId>
<artifactId>retrofit</artifactId>
<version>1.7.1</version>
</dependency>
<!-- Para escapar HTML en las llamadas a la API de IMDB -->
<!-- http://mvnrepository.com/artifact/commons-httpclient/commons-httpclient -->
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.0</version>
</dependency>
<!-- Spring Security -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<!-- Java Mail API -->
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.security/spring-security-ldap -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-ldap</artifactId>
<version>4.2.0.RELEASE</version>
</dependency>
<!-- LibrerÃa para tratar con excels -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.16</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!--<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId>
<configuration> DO NOT include log4j.properties file in your Jar <excludes>
<exclude>**/log4j.properties</exclude> </excludes> <archive> </archive> </configuration>
</plugin> -->
</plugins>
</build>
</project>
When I do the clean, generate resources and install appear this error and not start working
"C:\Program Files\Java\jdk1.8.0_151\bin\java"
-Dmaven.multiModuleProjectDirectory=C:\Users\spainasg\Documents\CID_UAT
-Dmaven.home=C:\Users\spainasg\Downloads\apache-maven-3.5.2-bin\apache-maven-3.5.2 -Dclassworlds.conf=C:\Users\spainasg\Downloads\apache-maven-3.5.2-bin\apache-maven-3.5.2\bin\m2.conf
-Dfile.encoding=UTF-8 -classpath C:\Users\spainasg\Downloads\apache-maven-3.5.2-bin\apache-maven-3.5.2\boot\plexus-classworlds-2.5.2.jar
org.codehaus.classworlds.Launcher -Didea.version=2017.2.6 --offline -s
C:\Users\spainasg.m2\settings.xml
-Dmaven.repo.local=C:\Users\spainasg.m2\repository clean generate-resources install
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for
com.alfred:alfred:war:v.0.1-CID.Fase.II.Edesk-SNAPSHOT
[WARNING] Detected profiles.xml alongside com.alfred:alfred:v.0.1-CID.Fase.II.Edesk-SNAPSHOT, this file is no
longer supported and was ignored, please use the settings.xml instead
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building ALFRED v.0.1-CID.Fase.II.Edesk-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.apache.maven.plugins:maven-install-plugin:jar:2.5.2 is missing, no
dependency information available
[WARNING] The POM for com.oracle:ojdbc14:jar:10.2.0.4.0 is missing, no dependency information available
[WARNING] The POM for org.thymeleaf.extras:thymeleaf-extras-springsecurity3:jar:2.1.2.RELEASE
is missing, no dependency information available
[WARNING] The POM for org.apache.poi:poi:jar:3.16 is missing, no dependency information available
[WARNING] The POM for org.apache.poi:poi-ooxml-schemas:jar:3.16 is missing, no dependency information available
[WARNING] The POM for com.github.virtuald:curvesapi:jar:1.04 is missing, no dependency information available
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # alfred ---
[INFO] Deleting C:\Users\spainasg\Documents\CID_UAT\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # alfred ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 90 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # alfred ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 174 source files to C:\Users\spainasg\Documents\CID_UAT\target\classes
[WARNING] /C:/Users/spainasg/Documents/CID_UAT/src/main/java/com/edesk/controladorGUI/GestionServicioAprobadorController.java:
C:\Users\spainasg\Documents\CID_UAT\src\main\java\com\edesk\controladorGUI\GestionServicioAprobadorController.java
uses unchecked or unsafe operations.
[WARNING] /C:/Users/spainasg/Documents/CID_UAT/src/main/java/com/edesk/controladorGUI/GestionServicioAprobadorController.java:
Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # alfred ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\spainasg\Documents\CID_UAT\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # alfred ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.17:test (default-test) # alfred ---
[WARNING] The POM for org.apache.maven.surefire:maven-surefire-common:jar:2.17 is missing,
no dependency information available
[WARNING] The POM for org.apache.maven.surefire:surefire-api:jar:2.17 is missing, no
dependency information available
[WARNING] The POM for org.apache.maven:maven-toolchain:jar:2.0.9 is missing, no dependency information available
[WARNING] The POM for org.apache.maven.plugin-tools:maven-plugin-annotations:jar:3.2 is
missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.961 s
[INFO] Finished at: 2017-11-30T09:45:30+01:00
[INFO] Final Memory: 29M/233M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test
(default-test) on project alfred: Execution default-test of goal
org.apache.maven.plugins:maven-surefire-plugin:2.17:test failed:
Plugin org.apache.maven.plugins:maven-surefire-plugin:2.17 or one of
its dependencies could not be resolved: The following artifacts could
not be resolved:
org.apache.maven.surefire:maven-surefire-common:jar:2.17,
org.apache.maven.surefire:surefire-api:jar:2.17,
org.apache.maven:maven-toolchain:jar:2.0.9,
org.apache.maven.plugin-tools:maven-plugin-annotations:jar:3.2,
org.codehaus.plexus:plexus-utils:jar:1.1: Cannot access central
(https://repo.maven.apache.org/maven2) in offline mode and the
artifact org.apache.maven.surefire:maven-surefire-common:jar:2.17 has
not been downloaded from it before. -> [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/PluginResolutionException
[ERROR] Maven execution terminated abnormally (exit code 1)
I'm using IntelliJ, but have the same error using Eclipse.
The aplications are working offline.
Any idea for this solution?
Try to add all your missing dependencies.
[WARNING] The POM for org.apache.maven.surefire:maven-surefire-common:jar:2.17 is missing, no dependency information available
[WARNING] The POM for org.apache.maven.surefire:surefire-api:jar:2.17 is missing, no dependency information available
[WARNING] The POM for org.apache.maven:maven-toolchain:jar:2.0.9 is missing, no dependency information available
[WARNING] The POM for org.apache.maven.plugin-tools:maven-plugin-annotations:jar:3.2 is missing, no dependency information available
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 ?