I have some missing jar files in my .m2 folder of maven. - maven

Can I download the whole .m2 folder from the internet in place of downloading single jar file?

Remember...
Over the classical way (put a dependency inside a pom and delegate to maven the download)
You have two way to copy a jar into m2
1: The "manual one" just download the jar an put inside the file inside .m2 under the correct path..
2: The official one----> http://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html

I'm not understanding ...
If I've to make Spring application ...
I put all the dependencies inside my pom.xml .... like this:
<?xml version="1.0" encoding="UTF-8"?>
<!-- A project with Spring MVC, JPA and Hibernate SessionFactory -->
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>MavenWeb</groupId>
<artifactId>MavenWeb</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<description></description>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.12.1.GA</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.6.3.Final</version>
</dependency>
<!-- dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId>
<version>1.4.2</version> </dependency -->
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.10</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>20030825.184428</version>
</dependency>
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
<version>20030825.183949</version>
</dependency>
</dependencies>
<properties>
<org.springframework.version>3.0.2.RELEASE</org.springframework.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.1</version>
</plugin>
</plugins>
</build>
</project>
When I run the Maven install, maven downloads from the remote central repository to the jar it needs to run the application...
in this way you've downloaded all the jars you need inside your .m2 folder...
That's the usual use of Maven dependencies management ....
but if it's does not help you, maybe I'm not understanding your problem...

If jars are missing which you placed in pom.xml and you want to download, then Right click on your project and run as "Maven Install" it will download the missing jars.

Maybe the actual JAR file you are looking for is not provided in the release, but the POM file is. In that case, until you explicitly tell Maven to use the BOM file to import the needed library, the former will only set up a correct folder hierarchy in your .m2 repository, but with nothing interesting in it.
See the official documentation for the correct lines of code to do so. Here is an example dealing with the org.codehaus.groovy:groovy-all:2.5.9 library (see the top-right item for the Apache Maven lines of code).

Related

Intellij build artifact configuration for spring boot

We're working in a Spring Boot project. Till now, I used to generate the jar file with IntelliJ (community edition) via Build Artifact, but since few days ago, the generated JAR is no longer having the normal structure of:
/BOOT-INF
/META-INF
/org
but a "normal" java jar structure with all the packages at the root level.
Output is generated in the "out" folder as per my config (see below)
It is obvious that I changed something either because in my team the pom.xml has changed in some way I'm not able to find, or because I changed the IntelliJ config.
The most funny thing is that if I go to CTRL-E -> Maven -> (My Project) -> package, or alternatively I run from the command line "mvn package" this generates a perfectly well formed Spring Boot jar named xxx-0.0.1-SNAPSHOT in the "target" directory
Note the difference between "target" and "out"
In my CTRL-ALT-SHIFT-S -> Artifact config I'm not aware of having changed anything:
The artifact entry, JAR -> From modules with dependencies, the output directory named "out", the manifest selected from the "resources" and not from the "java" dir, etc.
My pom.xml, of course has been modified several times lately, but still has the expected build section with:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
...
Honestly, I don't know where to look at, or even what to look for.
As per the mvn package working it is clearly not a code problem, but a config one, IMHO.
Any idea will be more than welcome.
EDIT: Adding full pom.xml and versions
IntelliJ Community Edition 2020.3.1
JDK v1.8
Maven v3.6.3
4.0.0
pom
test
org.springframework.boot
spring-boot-starter-parent
2.1.4.RELEASE
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.test</groupId>
<artifactId>test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>test</name>
<description>test</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit</artifactId>
<version>4.6.0.201612231935-r</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity5</artifactId>
</dependency>
<!-- For spring aspect oriented logging -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.9.6</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.2</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>23.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-api</artifactId>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-edge-driver</artifactId>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-ie-driver</artifactId>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-opera-driver</artifactId>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-safari-driver</artifactId>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-support</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-exec</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20180813</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-java8time</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
EDIT:
Tried a couple more things, without success
Reinstall IntelliJ, including version 2020.3.2
Reinstall Maven on my Ubuntu 20
Change IntelliJ Maven config at File -> Settings -> Build... -> Build -> Maven -> Runner and forcing JDK 1.8
Adding these lines to the pom.xml (news are only the maven entries)
<properties>
<java.version>1.8</java.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

wildfly 10: java.lang.ClassCastException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory

I have a maven application that works fine in wildfly 8.2, but when Ideployed it in wildfly 10 this error happened:
[2016-02-21 11:22:08,411] Artifact SaramadIssueTracking:war exploded: Error during artifact deployment. See server log for details.
[2016-02-21 11:22:08,411] Artifact SaramadIssueTracking:war exploded: java.lang.Exception: {"WFLYCTL0080: Failed services" =>
{"jboss.persistenceunit.SaramadIssueTracking-1#SaramadIssueTracking" => "org.jboss.msc.service.StartException in service
jboss.persistenceunit.SaramadIssueTracking-1#SaramadIssueTracking: java.lang.ClassCastException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory
Caused by: java.lang.ClassCastException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory"}}
I read this and there was no other dom4j library. I also read this and did it, but after removing dom4j, I got this error:
[2016-02-21 01:46:38,384] Artifact SaramadIssueTracking:war exploded: Error during artifact deployment. See server log for details.
[2016-02-21 01:46:38,385] Artifact SaramadIssueTracking:war exploded: java.lang.Exception: {"WFLYCTL0080: Failed services" => {"jboss.undertow.deployment.default-server.default-host./" => "org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./: java.lang.RuntimeException: java.lang.NullPointerException
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
Caused by: java.lang.NullPointerException"}}
here is my pom.xml
<?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>ir.farzanehfar</groupId>
<artifactId>SaramadIssueTracking</artifactId>
<version>1</version>
<packaging>war</packaging>
<name>SaramadIssueTracking</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>SimpleCaptchaRepository</id>
<url>http://repo.jfrog.org/artifactory/libs-releases/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>5.2</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>all-themes</artifactId>
<version>1.0.10</version>
</dependency>
<dependency>
<groupId>org.primefaces.extensions</groupId>
<artifactId>primefaces-extensions</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.primefaces.extensions</groupId>
<artifactId>resources-ckeditor</artifactId>
<version>3.1.0</version>
</dependency>
<!-- for JPA, use hibernate-entitymanager instead of hibernate-core -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.1.0.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
<version>5.1.0.Final</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>12.0</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.13</version>
</dependency>
<dependency>
<groupId>com.jhlabs</groupId>
<artifactId>imaging</artifactId>
<version>01012005</version>
</dependency>
<dependency>
<groupId>axis</groupId>
<artifactId>axis</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis-jaxrpc</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.11</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.11</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webXml>src\main\webapp\WEB-INF\web.xml</webXml>
</configuration>
</plugin>
</plugins>
</build>
</project>
I just made all hibernate dependencies provided scope and problem solved!
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.1.0.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>5.2.4.Final</version>
<scope>provided</scope>
</dependency>
<!-- for JPA, use hibernate-entitymanager instead of hibernate-core -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.1.0.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
<version>5.1.0.Final</version>
<scope>provided</scope>
</dependency>
add dependency dom4j to pom with scope provided
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
<scope>provided</scope>
</dependency>
I had recently the same problem with the dom4j library and Wildfly 10. I found this post (in portuguese) and replaced the dom4j library that comes with Wildfly with the one downloaded from the Maven Central, and that solved the problem.
The jar is located in $JBOSS_HOME/modules/system/layers/base/org/dom4j/main, you just replace it with the downloaded file, in my case the file was dom4j-1.6.1.jar. I suppose that if you change the version (at the time of this post this is the last version) you should also modify the module.xml file in the same folder, but I've not tried.
Previously I also tried the self-answer from h.f but didn't solved my problem.
Hope this contributes to someone with the same problem. Best regards
If you are using hibernate-core as a dependency, you should make sure the scope is provided. The hibernate artifact has a version of dom4j as a dependency, by making changing the <scope> to provided resolves the conflict.
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.3.1.Final</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
I hope this makes you smile :)
I had the same problem but finally what I did is to remove (redundant) Hibernate libraries from pom.
As Wildfly is already using Hibernate as JPA provider (https://docs.jboss.org/author/display/WFLY10/JPA+Reference+Guide#JPAReferenceGuide-Introduction), you do not need to provide such classes at all (unless you are directly using Hibernate classes).
So the minimal config is working fine:
<project>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
And persistence.xml
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="mysql_hbm" transaction-type="JTA">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<jta-data-source>java:/jdbc/MySqlDS</jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect"/>
<property name="hibernate.show_sql" value="true"/>
</properties>
</persistence-unit>
Tested on Wildfly 10.
The other suggestions here either did not work for me or did not apply to my project. I found a possible solution in this blog. Basically it says to add Dependencies: org.dom4j export to {your war}/META-INF/MANIFEST.MF. I'm running Wildfly 10 and doing so in both my ear and ejb project seems to have worked.
Exclude dependency dom4j out of hibernate ones.
Check in resulting acme.war/WEB-INF/lib that there is no dom***.jar
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.3.8.Final</version>
<exclusions>
<exclusion>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.3.8.Final</version>
<exclusions>
<exclusion>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
</exclusion>
</exclusions>
</dependency>
adding below in 'jboss-deployment-structure.xml' under META-INF of my ear file resolved the issue and working in both weblogic & wildfly
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.dom4j" export="true"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
In my case helped remove files from /data and /tmp
Had the same problem, but I solved it using the hibernate5 official quick start available here https://github.com/wildfly/quickstart/tree/11.x/hibernate5
Try the hibernate5 quick start, it should work.
Have a look at the pom.xml, it contains
<!-- Import the JPA API, we use provided scope as the API is included in WildFly -->
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<scope>provided</scope>
</dependency>
<!-- Bean Validation Implementation -->
<!-- Provides portable constraints such as #Email -->
<!-- Hibernate Validator is shipped in WildFly -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--Import dependencies to hibernate packages(eg. hibernate-core)
depending on features you want to use like Hibernate Session used in the
quickstart -->
<!--please note that scope is provided as these jars are shipped
with as7 -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<scope>provided</scope>
</dependency>
Include that and it will work. I had to undeploy my app and restart wildfly.
If you need to use another Hibernate version than the one provided in Wildfly, follow the official procedure to update the Hibernate version in Wildly, section Replacing the current Hibernate 5.x jars with a newer version.
There are two ways.
1
You create a META-INF folder in webapp folder. Later create jboss-deployment-structure.xml in META-INF folder.
jboss-deployment-structure.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.dom4j"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
or
2 if you added hibernate-core in pom xml then you edit this.
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.3.1.Final</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
I am working with Eclipse Neon.3 (4.6.3) and Wildfly 10.1.0.
What worked for me, was to restore an older standalone.xml file from the <wildfly>\standalone\configuration\standalone_xml_history directory. I shut down the server and then replaced the current configuration file with an older backup.
I have no idea what changed in the configuration (I did not alter it manually), but it seems like the error message can be caused by changes in standalone.xml as well.
Maybe this information is helpful, in case none of the other solutions works for you.
Your EAR may contain the duplicate spring jpa configuration file, check and remove the duplicate file
I had the same problem. I followed this instruction and it worked. http://blog.triona.de/development/java/org-dom4j-documentfactory-classcastexception-on-hudson.html
According to this post https://issues.jboss.org/browse/WFLY-5549 we need to create a file named boss-deployment-structure.xml with the content
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.dom4j"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
Then place it into ../wildfly/modules/system/layers/base/org/jboss/as/product/wildfly-full/dir/META-INF
I hope this would help.

How to deal with "omitted for conflict with.." message in pom.xml?

I have this situation:
I know that "Maven resolves version conflicts with a nearest-wins strategy". So here wins the aop 3.0.7 based on this rule. But i also define a dependencyManagement section in my pom and it seems like this:
<properties>
<org.springframework.version>3.2.4.RELEASE</org.springframework.version>
<org.springframework.security.version>3.1.4.RELEASE</org.springframework.security.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${org.springframework.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${org.springframework.security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${org.springframework.security.version}</version>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.7.1</version>
</dependency>
</dependencies>
</project>
And this is what it all looks like on the dependencies tab:
So i expect the spring-aop to use the 3.2.4.RELEASE version instead of 3.0.7 like the webmvc, as i define this in the dependeny management.. Why is there still being used the older version 3.0.7?
Your dependency management declaration has a typo (com.springframework instead of org.springframework).
This is the correct pom entry:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>3.2.4.RELEASE</version>
</dependency>
Unfortunately, since the dependency is not being used, Maven (or Eclipse) will not flag as a missing artifact.

Maven dependency exclusion doesn't seem to work

I have a Maven project depending on couple other Maven projects. I am using Spring 3.1.1 in my project and dependent projects have 3.0.6. I am trying to exclude Spring 3.0.6 when deploying since having both isn't possible. I have added an explicit exclusion in my POM for that but for some reason I still see old version of spring core jars in the WEB-INF/lib folder when I start the Tomcat server. Can someone point me out where I am going wrong. Here is my pom.xml:
<project>
....
<properties>
<org.springframework-version>3.1.1.RELEASE</org.springframework-version>
</properties>
<dependency>
<groupId>com.test.abc</groupId>
<artifactId>abc</artifactId>
<version>1.0</version>
<type>war</type>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${org.springframework-version}</version>
<exclusions>
<!-- Exclude Commons Logging in favor of SLF4j -->
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>3.0.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-xml</artifactId>
<version>1.0-m2</version>
</dependency>
....
</project>
Your dependency type is war so there is no resolution happening here. Maven overlays the war contents over your project.
When the war is published to repository, the artifact will contain dependent libraries in WEB-INF lib folder. During overlay it does not treat lib folder any different from any static resource unless you tell it to exclude in different way.Check 'overlay' property here
In my case I thought I excluded the right dependency. With eclipse, on dependency hierarchy tab you can right click on it and click exclude artifact and it excluded the right dependency (they both had the same artifactId but different groupId)

Spring MVC Hibernate - Build path is incomplete

I was working on a spring mvc maven project and in initial stage I can across this error.
in my servlet-context.xml, I am trying to generate "HibernateTransactionManager" bean which throws me this errr :
error: "Build path is incomplete. Cannot find class file for org/hibernate/HibernateException"
as this being a maven project I have added the following dependency in pom.xml
<!-- Dependency added for spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<!-- Dependency added for Spring Security -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<!-- Dependency added for AOP -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.2</version>
</dependency>
<!-- Dependency for Hibernate -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${org.hibernate-version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.2.0.Final</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${com.mysql-version}</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>20030825.184428</version>
</dependency>
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
<version>20030825.183949</version>
</dependency>
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.12.1.GA</version>
</dependency>
<!-- Dependency for Http Client -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.1.1</version>
</dependency>
<dependency>
<groupId>jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>rome</groupId>
<artifactId>rome</artifactId>
<version>0.5</version>
</dependency>
I can even locate all my classes in my Maven dependency tree.
I have also tried to externally add a new .jar for spring-orm but that didnt work as well. I have tried to clean build and re-compile several times but that didn't work out.
I would really appreciate any of your inputs.
This is my first SO answer, so please bear with me.
The error generated is “Cannot find class file for org/hibernate/HibernateException”. The POM you have provided lists all the dependencies your project and including a reference to the hibernate-validator jar.
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.2.0.Final</version>
</dependency>
If you extract this jar file and search its contents, no class file named HibernateException can be found. This is the root cause of the error and you a repository that contain the HibernateException class file.
As you are using maven, you can see all the repositories related to Hibernate here
http://mvnrepository.com/artifact/org.hibernate
I’ve selected the hibernate-core-4.2.0.Final as core would suggest it has most of the main class files hibernate requires. Downloading and extracting the jar shows that the HibernateException class file exists here.
Therefore, if you update your POM.xml with the following entry
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.2.0.Final</version>
</dependency>
Now you have to make Maven download the repository to your local machine if it doesn’t exist and use it for your project. If you are running the project from Elcipse, do this by right-clicking the project->Run As-> Maven Clean.
Hope this helps.
if you are sure that maven has downloaded the hibernate jar's and are available in/to the jar/war file generated from the build then the issue could be as follows.
sometimes Maven fails to download the complete JAR file from the server, a class not found exception can occur in those cases as well.
to fix this goto .m2 folder in your home directory, delete the hibernate jar's and make a clean install. this will download the new set of files and things should start to work.
you can check if the files were downloaded correctly by opening them as a zip file jar tf jar-file.jar

Resources