I have developed a project using jersey 2 and spring 4,but i had to replace jersey 2 with jersey 1.19,when I did this i am getting an exception called "java.lang.ClassNotFoundException: com.sun.jersey.core.util.FeaturesAndProperties", when running on tomcat server.Is the migration from jersey 2 to jersey 1.19 causing this exception?.Thanks
My web.xml
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<!-- Spring Listener -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Jersey Servlet -->
<servlet>
<servlet-name>FITransXT</servlet-name>
<servlet-class>
com.sun.jersey.spi.spring.container.servlet.SpringServlet
</servlet-class>
<!-- Register resources and providers -->
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>com.mobileware.fitransxt</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>FITransXT</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<!-- loading Spring Context for registering beans with ApplicationContext -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>WEB-INF/FITransXT-servlet.xml</param-value>
</context-param>
</web-app>
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>
<!-- <dependencyManagement>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>4.3.1.RELEASE</version>
</dependency>
</dependencyManagement> -->
<parent>
<groupId>com.mobileware.fitransxt</groupId>
<artifactId>FITransXT</artifactId>
<version>0.0.1</version>
</parent>
<artifactId>FITransXT-Impl</artifactId>
<dependencies>
<dependency>
<groupId>com.mobileware.fitransxt</groupId>
<artifactId>FITransXT-Type</artifactId>
<version>0.0.1</version>
</dependency>
<dependency>
<groupId>com.mobileware.fitransxt</groupId>
<artifactId>FITransXT-BOImpl</artifactId>
<version>0.0.1</version>
</dependency>
<!-- <dependency>
<groupId>com.mobileware.fitransxt</groupId>
<artifactId>FITransXT-DaoImpl</artifactId>
<version>0.0.1</version>
</dependency> -->
<!-- Jersey core Servlet 2.x implementation -->
<!-- <dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
<version>${jersey.version}</version>
<scope>compile</scope>
</dependency> -->
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>${jersey.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.sun.jersey/jersey-core -->
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
<version>${jersey.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.sun.jersey/jersey-servlet -->
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-servlet</artifactId>
<version>${jersey.version}</version>
</dependency>
<!-- Jersey JSON Jackson (2.x) entity providers support module -->
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.7.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.7.3</version>
</dependency>
<!-- Jersey extension module providing support for Spring 3 integration -->
<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-spring</artifactId>
<version>${jersey.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-asm</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/org.glassfish.jersey.ext/jersey-bean-validation -->
<!-- Spring Framework-4.x -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</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-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.version>4.3.1.RELEASE</spring.version>
<jersey.version>1.19</jersey.version>
<slf4j.version>1.7.2</slf4j.version>
<jdk.source.version>1.8</jdk.source.version>
<jdk.target.version>1.8</jdk.target.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</project>
Dependency Tree
-- maven-dependency-plugin:2.8:tree (default-cli) # FITransXT-Web ---
[INFO] com.mobileware.fitransxt:FITransXT-Web:war:0.0.1
[INFO] +- com.mobileware.fitransxt:FITransXT-Impl:jar:0.0.1:compile
[INFO] | +- com.mobileware.fitransxt:FITransXT-Type:jar:0.0.1:compile
[INFO] | | +- (org.springframework:spring-context:jar:4.3.1.RELEASE:compile - omitted for duplicate)
[INFO] | | +- (org.springframework:spring-context-support:jar:4.3.1.RELEASE:compile - omitted for duplicate)
[INFO] | | +- (com.google.code.gson:gson:jar:2.3.1:compile - omitted for duplicate)
[INFO] | | +- (org.slf4j:slf4j-api:jar:1.7.6:compile - omitted for duplicate)
[INFO] | | +- (org.slf4j:slf4j-log4j12:jar:1.7.5:compile - omitted for duplicate)
[INFO] | | \- (org.json:json:jar:20160810:compile - omitted for duplicate)
[INFO] | +- com.mobileware.fitransxt:FITransXT-BOImpl:jar:0.0.1:compile
[INFO] | | +- com.mobileware.fitransxt:FITransXT-BOIntf:jar:0.0.1:compile
[INFO] | | | +- (com.mobileware.fitransxt:FITransXT-Type:jar:0.0.1:compile - omitted for duplicate)
[INFO] | | | +- (com.google.code.gson:gson:jar:2.3.1:compile - omitted for duplicate)
[INFO] | | | +- (org.slf4j:slf4j-api:jar:1.7.6:compile - omitted for duplicate)
[INFO] | | | +- (org.slf4j:slf4j-log4j12:jar:1.7.5:compile - omitted for duplicate)
[INFO] | | | \- (org.json:json:jar:20160810:compile - omitted for duplicate)
[INFO] | | +- com.mobileware.fitransxt:FITransXT-DaoImpl:jar:0.0.1:compile
[INFO] | | | +- commons-dbcp:commons-dbcp:jar:1.4:compile
[INFO] | | | | \- commons-pool:commons-pool:jar:1.5.4:compile
[INFO] | | | +- com.mobileware.fitransxt:FITransXT-Dao:jar:0.0.1:compile
[INFO] | | | | +- (com.mobileware.fitransxt:FITransXT-Type:jar:0.0.1:compile - omitted for duplicate)
[INFO] | | | | +- mysql:mysql-connector-java:jar:5.1.6:compile
[INFO] | | | | +- org.apache.commons:commons-dbcp2:jar:2.1:compile
[INFO] | | | | | +- org.apache.commons:commons-pool2:jar:2.3:compile
[INFO] | | | | | \- (commons-logging:commons-logging:jar:1.2:compile - omitted for duplicate)
[INFO] | | | | +- (com.google.code.gson:gson:jar:2.3.1:compile - omitted for duplicate)
[INFO] | | | | +- (org.slf4j:slf4j-api:jar:1.7.6:compile - omitted for duplicate)
[INFO] | | | | +- (org.slf4j:slf4j-log4j12:jar:1.7.5:compile - omitted for duplicate)
[INFO] | | | | \- (org.json:json:jar:20160810:compile - omitted for duplicate)
[INFO] | | | +- com.oracle:ojdbc6:jar:11.2.0:compile
[INFO] | | | +- (com.google.code.gson:gson:jar:2.3.1:compile - omitted for duplicate)
[INFO] | | | +- (org.slf4j:slf4j-api:jar:1.7.6:compile - omitted for duplicate)
[INFO] | | | +- (org.slf4j:slf4j-log4j12:jar:1.7.5:compile - omitted for duplicate)
[INFO] | | | \- (org.json:json:jar:20160810:compile - omitted for duplicate)
[INFO] | | +- (org.json:json:jar:20160810:compile - omitted for duplicate)
[INFO] | | +- (log4j:log4j:jar:1.2.14:compile - omitted for conflict with 1.2.17)
[INFO] | | +- org.apache.httpcomponents:httpclient:jar:4.3.4:compile
[INFO] | | | +- org.apache.httpcomponents:httpcore:jar:4.3.2:compile
[INFO] | | | +- (commons-logging:commons-logging:jar:1.1.3:compile - omitted for conflict with 1.2)
[INFO] | | | \- commons-codec:commons-codec:jar:1.6:compile
[INFO] | | +- (com.google.code.gson:gson:jar:2.3.1:compile - omitted for duplicate)
[INFO] | | +- (org.slf4j:slf4j-api:jar:1.7.6:compile - omitted for duplicate)
[INFO] | | \- (org.slf4j:slf4j-log4j12:jar:1.7.5:compile - omitted for duplicate)
[INFO] | +- com.sun.jersey:jersey-server:jar:1.19:compile
[INFO] | | \- (com.sun.jersey:jersey-core:jar:1.19:compile - omitted for duplicate)
[INFO] | +- com.sun.jersey:jersey-core:jar:1.19:compile
[INFO] | | \- javax.ws.rs:jsr311-api:jar:1.1.1:compile
[INFO] | +- com.sun.jersey:jersey-servlet:jar:1.19:compile
[INFO] | | \- (com.sun.jersey:jersey-server:jar:1.19:compile - omitted for duplicate)
[INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.7.3:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.7.0:compile
[INFO] | | \- (com.fasterxml.jackson.core:jackson-core:jar:2.7.3:compile - omitted for duplicate)
[INFO] | +- com.fasterxml.jackson.core:jackson-core:jar:2.7.3:compile
[INFO] | +- com.sun.jersey.contribs:jersey-spring:jar:1.19:compile
[INFO] | | \- (com.sun.jersey:jersey-servlet:jar:1.19:compile - omitted for duplicate)
[INFO] | +- org.springframework:spring-core:jar:4.3.1.RELEASE:compile
[INFO] | | \- commons-logging:commons-logging:jar:1.2:compile
[INFO] | +- org.springframework:spring-context:jar:4.3.1.RELEASE:compile
[INFO] | | +- (org.springframework:spring-aop:jar:4.3.1.RELEASE:compile - omitted for duplicate)
[INFO] | | +- org.springframework:spring-beans:jar:4.3.1.RELEASE:compile
[INFO] | | | \- (org.springframework:spring-core:jar:4.3.1.RELEASE:compile - omitted for duplicate)
[INFO] | | +- (org.springframework:spring-core:jar:4.3.1.RELEASE:compile - omitted for duplicate)
[INFO] | | \- org.springframework:spring-expression:jar:4.3.1.RELEASE:compile
[INFO] | | \- (org.springframework:spring-core:jar:4.3.1.RELEASE:compile - omitted for duplicate)
[INFO] | +- org.springframework:spring-context-support:jar:4.3.1.RELEASE:compile
[INFO] | | +- (org.springframework:spring-beans:jar:4.3.1.RELEASE:compile - omitted for duplicate)
[INFO] | | +- (org.springframework:spring-context:jar:4.3.1.RELEASE:compile - omitted for duplicate)
[INFO] | | \- (org.springframework:spring-core:jar:4.3.1.RELEASE:compile - omitted for duplicate)
[INFO] | +- org.springframework:spring-web:jar:4.3.1.RELEASE:compile
[INFO] | | +- (org.springframework:spring-aop:jar:4.3.1.RELEASE:compile - omitted for duplicate)
[INFO] | | +- (org.springframework:spring-beans:jar:4.3.1.RELEASE:compile - omitted for duplicate)
[INFO] | | +- (org.springframework:spring-context:jar:4.3.1.RELEASE:compile - omitted for duplicate)
[INFO] | | \- (org.springframework:spring-core:jar:4.3.1.RELEASE:compile - omitted for duplicate)
[INFO] | +- org.springframework:spring-aop:jar:4.3.1.RELEASE:compile
[INFO] | | +- (org.springframework:spring-beans:jar:4.3.1.RELEASE:compile - omitted for duplicate)
[INFO] | | \- (org.springframework:spring-core:jar:4.3.1.RELEASE:compile - omitted for duplicate)
[INFO] | +- org.springframework:spring-webmvc:jar:4.3.1.RELEASE:compile
[INFO] | | +- (org.springframework:spring-aop:jar:4.3.1.RELEASE:compile - omitted for duplicate)
[INFO] | | +- (org.springframework:spring-beans:jar:4.3.1.RELEASE:compile - omitted for duplicate)
[INFO] | | +- (org.springframework:spring-context:jar:4.3.1.RELEASE:compile - omitted for duplicate)
[INFO] | | +- (org.springframework:spring-core:jar:4.3.1.RELEASE:compile - omitted for duplicate)
[INFO] | | +- (org.springframework:spring-expression:jar:4.3.1.RELEASE:compile - omitted for duplicate)
[INFO] | | \- (org.springframework:spring-web:jar:4.3.1.RELEASE:compile - omitted for duplicate)
[INFO] | +- (com.google.code.gson:gson:jar:2.3.1:compile - omitted for duplicate)
[INFO] | +- (org.slf4j:slf4j-api:jar:1.7.6:compile - omitted for duplicate)
[INFO] | +- (org.slf4j:slf4j-log4j12:jar:1.7.5:compile - omitted for duplicate)
[INFO] | \- (org.json:json:jar:20160810:compile - omitted for duplicate)
[INFO] +- junit:junit:jar:3.8.1:test
[INFO] +- com.google.code.gson:gson:jar:2.3.1:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.7.6:compile
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.7.5:compile
[INFO] | +- (org.slf4j:slf4j-api:jar:1.7.5:compile - omitted for conflict with 1.7.6)
[INFO] | \- log4j:log4j:jar:1.2.17:compile
[INFO] \- org.json:json:jar:20160810:compile
Edited:
on console:
java.lang.ClassNotFoundException: com.sun.jersey.core.util.FeaturesAndProperties
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1141)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1612)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1141)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1612)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1141)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1612)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
at java.lang.Class.getConstructor0(Class.java:3075)
at java.lang.Class.newInstance(Class.java:412)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1116)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4350)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4659)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
at org.apache.catalina.startup.Embedded.start(Embedded.java:825)
at org.codehaus.mojo.tomcat.AbstractRunMojo.startContainer(AbstractRunMojo.java:558)
at org.codehaus.mojo.tomcat.AbstractRunMojo.execute(AbstractRunMojo.java:255)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Ways to handle these kind of problem-
First close your IDE and remove target, .setting and .classpath from your project directory.
1) Double check if you have multiple dependency of same with different version in pom.xml, if yes remove it and run command mvn clean install -U. If it's not work then
2) Find .m2 directory and inside this directory search for lastupdate file and remove all these files and run command mvn clean install -U. If it's not work then
3) Remove .m2 direcory and clean and install maven.
Related
Can anyone help me with this one? I already tried different solutions posted here but nothing works.
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.hibernate.cfg.annotations.EntityBinder.processComplementaryTableDefinitions(EntityBinder.java:1239)
The following method did not exist:
javax.persistence.Table.indexes()[Ljavax/persistence/Index;
The calling method's class, org.hibernate.cfg.annotations.EntityBinder, was loaded from the following location:
jar:file:/C:/Users/csatl/.m2/repository/org/hibernate/hibernate-core/5.6.5.Final/hibernate-core-5.6.5.Final.jar!/org/hibernate/cfg/annotations/EntityBinder.class
The called method's class, javax.persistence.Table, is available from the following locations:
jar:file:/C:/Users/csatl/Desktop/Facultate/An%203-sem2/SD/labs/lab2/lib/javax.persistence.jar!/javax/persistence/Table.class
jar:file:/C:/Users/csatl/.m2/repository/jakarta/persistence/jakarta.persistence-api/2.2.3/jakarta.persistence-api-2.2.3.jar!/javax/persistence/Table.class
jar:file:/C:/Users/csatl/.m2/repository/javax/persistence/javax.persistence-api/2.2/javax.persistence-api-2.2.jar!/javax/persistence/Table.class
jar:file:/C:/Users/csatl/.m2/repository/org/hibernate/javax/persistence/hibernate-jpa-2.1-api/1.0.0.Final/hibernate-jpa-2.1-api-1.0.0.Final.jar!/javax/persistence/Table.class
The called method's class hierarchy was loaded from the following locations:
javax.persistence.Table: file:/C:/Users/csatl/Desktop/Facultate/An%203-sem2/SD/labs/lab2/lib/javax.persistence.jar
Action:
Correct the classpath of your application so that it contains compatible versions of the classes org.hibernate.cfg.annotations.EntityBinder and javax.persistence.Table
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: javax.persistence.Table.indexes()[Ljavax/persistence/Index;
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1154)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:908)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:740)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:415)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1312)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301)
at ro.sd.firstapp.FirstAppApplication.main(FirstAppApplication.java:11)
Caused by: java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index;
at org.hibernate.cfg.annotations.EntityBinder.processComplementaryTableDefinitions(EntityBinder.java:1239)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:826)
at org.hibernate.boot.model.source.internal.annotations.AnnotationMetadataSourceProcessorImpl.processEntityHierarchies(AnnotationMetadataSourceProcessorImpl.java:225)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.processEntityHierarchies(MetadataBuildingProcess.java:239)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:282)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1460)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1494)
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:58)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800)
... 16 more
Here 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 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.6.4</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>ro.sd</groupId>
<artifactId>first-app</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>first-app</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
<frontend-maven-plugin.version>1.6</frontend-maven-plugin.version>
<node.version>v14.8.0</node.version>
<yarn.version>v1.12.1</yarn.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-crypto</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.22</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.6.5.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.6.5.Final</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.hibernate</groupId>-->
<!-- <artifactId>hibernate-core</artifactId>-->
<!-- <version>4.1.4.Final</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.hibernate</groupId>-->
<!-- <artifactId>hibernate-entitymanager</artifactId>-->
<!-- <version>5.2.3.Final</version>-->
<!-- </dependency>-->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0.2</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>javax.persistence</groupId>-->
<!-- <artifactId>javax.persistence-api</artifactId>-->
<!-- <version>2.1</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.hibernate.javax.persistence</groupId>-->
<!-- <artifactId>hibernate-jpa-2.1-api</artifactId>-->
<!-- <version>1.0.0.Final</version>-->
<!-- </dependency>-->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${project.parent.version}</version>
</plugin>
</plugins>
</build>
</project>
The BeanCreationException is from my main class. I used a try catch.
package ro.sd.firstapp;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
public class FirstAppApplication {
public static void main(String[] args) {
try{
SpringApplication.run(FirstAppApplication.class, args);
}catch (Exception e)
{
e.printStackTrace();
}
}
I tried changing the env variables. I tried including more dependencies, delete dependencies. I don't know what's wrong.
Here is my mvn dependency:tree
[INFO] --- maven-dependency-plugin:3.2.0:tree (default-cli) # first-app ---
[INFO] ro.sd:first-app:jar:0.0.1-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:2.6.4:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-aop:jar:2.6.4:compile
[INFO] | | +- org.springframework:spring-aop:jar:5.3.16:compile
[INFO] | | \- org.aspectj:aspectjweaver:jar:1.9.7:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-jdbc:jar:2.6.4:compile
[INFO] | | +- com.zaxxer:HikariCP:jar:4.0.3:compile
[INFO] | | \- org.springframework:spring-jdbc:jar:5.3.16:compile
[INFO] | +- jakarta.transaction:jakarta.transaction-api:jar:1.3.3:compile
[INFO] | +- jakarta.persistence:jakarta.persistence-api:jar:2.2.3:compile
[INFO] | +- org.springframework.data:spring-data-jpa:jar:2.6.2:compile
[INFO] | | +- org.springframework.data:spring-data-commons:jar:2.6.2:compile
[INFO] | | +- org.springframework:spring-orm:jar:5.3.16:compile
[INFO] | | +- org.springframework:spring-context:jar:5.3.16:compile
[INFO] | | +- org.springframework:spring-tx:jar:5.3.16:compile
[INFO] | | +- org.springframework:spring-beans:jar:5.3.16:compile
[INFO] | | \- org.slf4j:slf4j-api:jar:1.7.36:compile
[INFO] | \- org.springframework:spring-aspects:jar:5.3.16:compile
[INFO] +- org.springframework.boot:spring-boot-starter:jar:2.6.4:compile
[INFO] | +- org.springframework.boot:spring-boot:jar:2.6.4:compile
[INFO] | +- org.springframework.boot:spring-boot-autoconfigure:jar:2.6.4:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-logging:jar:2.6.4:compile
[INFO] | | +- ch.qos.logback:logback-classic:jar:1.2.10:compile
[INFO] | | | \- ch.qos.logback:logback-core:jar:1.2.10:compile
[INFO] | | +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.17.1:compile
[INFO] | | | \- org.apache.logging.log4j:log4j-api:jar:2.17.1:compile
[INFO] | | \- org.slf4j:jul-to-slf4j:jar:1.7.36:compile
[INFO] | +- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile
[INFO] | +- org.springframework:spring-core:jar:5.3.16:compile
[INFO] | | \- org.springframework:spring-jcl:jar:5.3.16:compile
[INFO] | \- org.yaml:snakeyaml:jar:1.29:compile
[INFO] +- org.springframework.security:spring-security-crypto:jar:5.6.2:compile
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:2.6.4:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-json:jar:2.6.4:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-databind:jar:2.13.1:compile
[INFO] | | | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.13.1:compile
[INFO] | | | \- com.fasterxml.jackson.core:jackson-core:jar:2.13.1:compile
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.13.1:compile
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.13.1:compile
[INFO] | | \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.13.1:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.6.4:compile
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.58:compile
[INFO] | | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:9.0.58:compile
[INFO] | +- org.springframework:spring-web:jar:5.3.16:compile
[INFO] | \- org.springframework:spring-webmvc:jar:5.3.16:compile
[INFO] | \- org.springframework:spring-expression:jar:5.3.16:compile
[INFO] +- org.springframework.boot:spring-boot-starter-validation:jar:2.6.4:compile
[INFO] | +- org.apache.tomcat.embed:tomcat-embed-el:jar:9.0.58:compile
[INFO] | \- org.hibernate.validator:hibernate-validator:jar:6.2.2.Final:compile
[INFO] | \- jakarta.validation:jakarta.validation-api:jar:2.0.2:compile
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.6.4:test
[INFO] | +- org.springframework.boot:spring-boot-test:jar:2.6.4:test
[INFO] | +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.6.4:test
[INFO] | +- com.jayway.jsonpath:json-path:jar:2.6.0:test
[INFO] | | \- net.minidev:json-smart:jar:2.4.8:test
[INFO] | | \- net.minidev:accessors-smart:jar:2.4.8:test
[INFO] | | \- org.ow2.asm:asm:jar:9.1:test
[INFO] | +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.3:compile
[INFO] | | \- jakarta.activation:jakarta.activation-api:jar:1.2.2:compile
[INFO] | +- org.assertj:assertj-core:jar:3.21.0:test
[INFO] | +- org.hamcrest:hamcrest:jar:2.2:test
[INFO] | +- org.junit.jupiter:junit-jupiter:jar:5.8.2:test
[INFO] | | +- org.junit.jupiter:junit-jupiter-api:jar:5.8.2:test
[INFO] | | | +- org.opentest4j:opentest4j:jar:1.2.0:test
[INFO] | | | +- org.junit.platform:junit-platform-commons:jar:1.8.2:test
[INFO] | | | \- org.apiguardian:apiguardian-api:jar:1.1.2:test
[INFO] | | +- org.junit.jupiter:junit-jupiter-params:jar:5.8.2:test
[INFO] | | \- org.junit.jupiter:junit-jupiter-engine:jar:5.8.2:test
[INFO] | | \- org.junit.platform:junit-platform-engine:jar:1.8.2:test
[INFO] | +- org.mockito:mockito-core:jar:4.0.0:test
[INFO] | | +- net.bytebuddy:byte-buddy-agent:jar:1.11.22:test
[INFO] | | \- org.objenesis:objenesis:jar:3.2:test
[INFO] | +- org.mockito:mockito-junit-jupiter:jar:4.0.0:test
[INFO] | +- org.skyscreamer:jsonassert:jar:1.5.0:test
[INFO] | | \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO] | +- org.springframework:spring-test:jar:5.3.16:test
[INFO] | \- org.xmlunit:xmlunit-core:jar:2.8.4:test
[INFO] +- org.projectlombok:lombok:jar:1.18.22:compile
[INFO] +- mysql:mysql-connector-java:jar:8.0.28:runtime
[INFO] +- org.hibernate:hibernate-core:jar:5.6.5.Final:compile
[INFO] | +- org.jboss.logging:jboss-logging:jar:3.4.3.Final:compile
[INFO] | +- javax.persistence:javax.persistence-api:jar:2.2:compile
[INFO] | +- net.bytebuddy:byte-buddy:jar:1.11.22:compile
[INFO] | +- antlr:antlr:jar:2.7.7:compile
[INFO] | +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.1.1.Final:compile
[INFO] | +- org.jboss:jandex:jar:2.4.2.Final:compile
[INFO] | +- com.fasterxml:classmate:jar:1.5.1:compile
[INFO] | +- javax.activation:javax.activation-api:jar:1.2.0:compile
[INFO] | +- org.hibernate.common:hibernate-commons-annotations:jar:5.1.2.Final:compile
[INFO] | \- org.glassfish.jaxb:jaxb-runtime:jar:2.3.6:compile
[INFO] | +- org.glassfish.jaxb:txw2:jar:2.3.6:compile
[INFO] | +- com.sun.istack:istack-commons-runtime:jar:3.0.12:compile
[INFO] | \- com.sun.activation:jakarta.activation:jar:1.2.2:runtime
[INFO] +- org.hibernate:hibernate-entitymanager:jar:5.6.5.Final:compile
[INFO] +- javax.xml.bind:jaxb-api:jar:2.3.0:compile
[INFO] \- javax.persistence:persistence-api:jar:1.0.2:compile
I have a Spring boot application with hibernate. Spring boot 2.13, Java 11.
When I start the application, I get an exception :
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xxxEntityManagerFactory' defined in class path resource [fr/yyy/xx/config/DbConfig.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/cache/access/AccessType
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1762) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1105) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at fr.yyy.xxx.xxxliApplication.main(xxxApplication.java:26) ~[classes/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
at com.intellij.rt.execution.application.AppMainV2.main(AppMainV2.java:131) ~[idea_rt.jar:na]
Caused by: java.lang.NoClassDefFoundError: org/hibernate/cache/access/AccessType
at java.base/java.lang.Class.getDeclaredMethods0(Native Method) ~[na:na]
at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3167) ~[na:na]
at java.base/java.lang.Class.privateGetPublicMethods(Class.java:3192) ~[na:na]
at java.base/java.lang.Class.getMethods(Class.java:1905) ~[na:na]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.applyInjections(AbstractServiceRegistryImpl.java:292) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.injectDependencies(AbstractServiceRegistryImpl.java:283) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:243) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.boot.internal.MetadataBuilderImpl$MetadataBuildingOptionsImpl.<init>(MetadataBuilderImpl.java:688) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.boot.internal.MetadataBuilderImpl.<init>(MetadataBuilderImpl.java:123) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.boot.MetadataSources.getMetadataBuilder(MetadataSources.java:136) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:218) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:167) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:51) ~[spring-orm-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365) ~[spring-orm-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:390) ~[spring-orm-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:377) ~[spring-orm-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341) ~[spring-orm-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1821) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1758) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
... 21 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.hibernate.cache.access.AccessType
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583) ~[na:na]
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) ~[na:na]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[na:na]
... 41 common frames omitted
Process finished with exit code 1
Here's 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>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>fr.yyy</groupId>
<artifactId>xxx-backend</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<java.version>1.11</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.2</version>
</dependency>
<dependency>
<groupId>com.vladmihalcea.flexy-pool</groupId>
<artifactId>flexy-hikaricp</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.7.0</version>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
<dependency>
<groupId>org.tuckey</groupId>
<artifactId>urlrewritefilter</artifactId>
<version>4.0.3</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
</dependency>
<dependency>
<groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
</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>
<configuration>
<release>11</release>
</configuration>
</plugin>
</plugins>
</build>
</project>
I've tried a lot of things :
Spring boot data jpa multiple datasources entityManagerFactory error
Error creating bean with name 'entityManagerFactory' defined in class path resource : Invocation of init method failed
Edit :
My dependency tree :
[INFO] fr.yyy:xxx-backend:jar:0.0.1-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:2.1.3.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-aop:jar:2.1.3.RELEASE:compile
[INFO] | | \- org.aspectj:aspectjweaver:jar:1.9.2:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-jdbc:jar:2.1.3.RELEASE:compile
[INFO] | | +- com.zaxxer:HikariCP:jar:3.2.0:compile
[INFO] | | \- org.springframework:spring-jdbc:jar:5.1.5.RELEASE:compile
[INFO] | +- javax.transaction:javax.transaction-api:jar:1.3:compile
[INFO] | +- javax.xml.bind:jaxb-api:jar:2.3.1:compile
[INFO] | +- org.springframework.data:spring-data-jpa:jar:2.1.5.RELEASE:compile
[INFO] | | +- org.springframework.data:spring-data-commons:jar:2.1.5.RELEASE:compile
[INFO] | | +- org.springframework:spring-orm:jar:5.1.5.RELEASE:compile
[INFO] | | \- org.springframework:spring-tx:jar:5.1.5.RELEASE:compile
[INFO] | \- org.springframework:spring-aspects:jar:5.1.5.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-data-rest:jar:2.1.3.RELEASE:compile
[INFO] | \- org.springframework.data:spring-data-rest-webmvc:jar:3.1.5.RELEASE:compile
[INFO] | +- org.springframework.data:spring-data-rest-core:jar:3.1.5.RELEASE:compile
[INFO] | | +- org.springframework.hateoas:spring-hateoas:jar:0.25.1.RELEASE:compile
[INFO] | | +- org.springframework.plugin:spring-plugin-core:jar:1.2.0.RELEASE:compile
[INFO] | | \- org.atteo:evo-inflector:jar:1.2.2:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0:compile
[INFO] +- org.springframework:spring-context-support:jar:5.1.5.RELEASE:compile
[INFO] | +- org.springframework:spring-beans:jar:5.1.5.RELEASE:compile
[INFO] | +- org.springframework:spring-context:jar:5.1.5.RELEASE:compile
[INFO] | | \- org.springframework:spring-expression:jar:5.1.5.RELEASE:compile
[INFO] | \- org.springframework:spring-core:jar:5.1.5.RELEASE:compile
[INFO] | \- org.springframework:spring-jcl:jar:5.1.5.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:2.1.3.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter:jar:2.1.3.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot:jar:2.1.3.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-autoconfigure:jar:2.1.3.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:2.1.3.RELEASE:compile
[INFO] | | | +- ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO] | | | | \- ch.qos.logback:logback-core:jar:1.2.3:compile
[INFO] | | | +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.11.2:compile
[INFO] | | | | \- org.apache.logging.log4j:log4j-api:jar:2.11.2:compile
[INFO] | | | \- org.slf4j:jul-to-slf4j:jar:1.7.25:compile
[INFO] | | +- javax.annotation:javax.annotation-api:jar:1.3.2:compile
[INFO] | | \- org.yaml:snakeyaml:jar:1.23:runtime
[INFO] | +- org.springframework.boot:spring-boot-starter-json:jar:2.1.3.RELEASE:compile
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.9.8:compile
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.9.8:compile
[INFO] | | \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.9.8:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.1.3.RELEASE:compile
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.16:compile
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-el:jar:9.0.16:compile
[INFO] | | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:9.0.16:compile
[INFO] | +- org.hibernate.validator:hibernate-validator:jar:6.0.14.Final:compile
[INFO] | | \- javax.validation:validation-api:jar:2.0.1.Final:compile
[INFO] | +- org.springframework:spring-web:jar:5.1.5.RELEASE:compile
[INFO] | \- org.springframework:spring-webmvc:jar:5.1.5.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-security:jar:2.1.3.RELEASE:compile
[INFO] | +- org.springframework:spring-aop:jar:5.1.5.RELEASE:compile
[INFO] | +- org.springframework.security:spring-security-config:jar:5.1.4.RELEASE:compile
[INFO] | | \- org.springframework.security:spring-security-core:jar:5.1.4.RELEASE:compile
[INFO] | \- org.springframework.security:spring-security-web:jar:5.1.4.RELEASE:compile
[INFO] +- org.projectlombok:lombok:jar:1.18.6:compile (optional)
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.1.3.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test:jar:2.1.3.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.1.3.RELEASE:test
[INFO] | +- com.jayway.jsonpath:json-path:jar:2.4.0:test
[INFO] | | \- net.minidev:json-smart:jar:2.3:test
[INFO] | | \- net.minidev:accessors-smart:jar:1.2:test
[INFO] | | \- org.ow2.asm:asm:jar:5.0.4:test
[INFO] | +- junit:junit:jar:4.12:test
[INFO] | +- org.assertj:assertj-core:jar:3.11.1:test
[INFO] | +- org.mockito:mockito-core:jar:2.23.4:test
[INFO] | | +- net.bytebuddy:byte-buddy-agent:jar:1.9.10:test
[INFO] | | \- org.objenesis:objenesis:jar:2.6:test
[INFO] | +- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] | +- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO] | +- org.skyscreamer:jsonassert:jar:1.5.0:test
[INFO] | | \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO] | +- org.springframework:spring-test:jar:5.1.5.RELEASE:test
[INFO] | \- org.xmlunit:xmlunit-core:jar:2.6.2:test
[INFO] +- com.oracle:ojdbc7:jar:12.1.0.2:compile
[INFO] +- com.vladmihalcea.flexy-pool:flexy-hikaricp:jar:2.0.0:compile
[INFO] | +- com.vladmihalcea.flexy-pool:flexy-pool-core:jar:2.0.0:compile
[INFO] | +- com.vladmihalcea.flexy-pool:flexy-dropwizard-metrics:jar:2.0.0:compile
[INFO] | | +- io.dropwizard.metrics:metrics-core:jar:4.0.5:compile
[INFO] | | \- io.dropwizard.metrics:metrics-jmx:jar:4.0.5:compile
[INFO] | \- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] +- io.jsonwebtoken:jjwt:jar:0.7.0:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-databind:jar:2.9.8:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-core:jar:2.9.8:compile
[INFO] +- javax.inject:javax.inject:jar:1:compile
[INFO] +- org.tuckey:urlrewritefilter:jar:4.0.3:compile
[INFO] +- commons-lang:commons-lang:jar:2.5:compile
[INFO] +- org.hibernate:hibernate-core:jar:5.3.7.Final:compile
[INFO] | +- org.jboss.logging:jboss-logging:jar:3.3.2.Final:compile
[INFO] | +- javax.persistence:javax.persistence-api:jar:2.2:compile
[INFO] | +- org.javassist:javassist:jar:3.23.1-GA:compile
[INFO] | +- net.bytebuddy:byte-buddy:jar:1.9.10:compile
[INFO] | +- antlr:antlr:jar:2.7.7:compile
[INFO] | +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.1.1.Final:compile
[INFO] | +- org.jboss:jandex:jar:2.0.5.Final:compile
[INFO] | +- com.fasterxml:classmate:jar:1.4.0:compile
[INFO] | +- javax.activation:javax.activation-api:jar:1.2.0:compile
[INFO] | +- org.dom4j:dom4j:jar:2.1.1:compile
[INFO] | \- org.hibernate.common:hibernate-commons-annotations:jar:5.0.4.Final:compile
[INFO] +- org.hibernate:hibernate-ehcache:jar:5.3.7.Final:compile
[INFO] | \- net.sf.ehcache:ehcache:jar:2.10.6:compile
[INFO] \- org.ehcache:ehcache:jar:3.6.3:compile
Edit2 :
When I run with mvn spring-boot:run, it's still an exception on creating bean xxxEntityManagerFactory but the problem seems to be with the cache Region factory :
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xxxEntityManagerFactory' defined in class path resource [fr/yyy/xxx/config/DbConfig.class]: Invocation of init method failed; nested exception is org.hibernate.service
.spi.ServiceException: Unable to create requested service [org.hibernate.cache.spi.RegionFactory]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1762) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1105) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at fr.yyy.xxx.xxxApplication.main(xxxApplication.java:26) ~[classes/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run(AbstractRunMojo.java:558) ~[na:na]
at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]
Thank you very much
Clément
Your first exception is the result of miss-configured IntelliJ project. Reimport the Maven project to ensure that the IntelliJ setup is up to date. The IntelliJ runner behavior should be the same as mvn spring-boot:run.
The root cause is hibernate-ehcache 5.3.7.Final dependency which provides integration with Ehcache 2.X. As per the dependency pom.xml:
Integration for using Ehcache 2.x as a Hibernate second-level-cache provider
You are attempting to use it with Ehcache 3.X. This is not a supported setup, downgrade to Ehcache 2.X e.g.net.sf.ehcache:ehcache:2.10.6 if you plan to use hibernate-ehcache.
I'm migrating a project from spring boot 1.5.10 to spring boot 2.0.3, I installed the dependency "spring-boot-properties-migrator", it told me that properties change and everything is fine, but now I have this error and I do not know how fix it, I tried everything.
Exception encountered during context initialization - cancelling refresh attempt: 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.hibernate.engine.spi.SessionFactoryImplementor.getProperties()Ljava/util/Properties;
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.hibernate.engine.spi.SessionFactoryImplementor.getProperties()Ljava/util/Properties;
Caused by: java.lang.NoSuchMethodError: org.hibernate.engine.spi.SessionFactoryImplementor.getProperties()Ljava/util/Properties;
config.properties
spring.datasource.url=jdbc:mysql://localhost:3306/test
spring.datasource.username=test
spring.datasource.password=test
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.initialization-mode=always
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
spring.jpa.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
spring.jpa.hibernate.naming_strategy=org.hibernate.cfg.ImprovedNamingStrategy
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>com.example</groupId>
<artifactId>hello</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>hello</name>
<description>hello website</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-properties-migrator</artifactId>
<scope>runtime</scope>
</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-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<!-- hot swapping, disable cache for template, enable live reload -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time-jsptags</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time-hibernate</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.jadira.usertype</groupId>
<artifactId>usertype.core</artifactId>
<version>5.0.0.GA</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity4</artifactId>
</dependency>
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>2.0.9</version>
</dependency>
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox-tools</artifactId>
<version>2.0.9</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.bytedeco.javacpp-presets</groupId>
<artifactId>tesseract-platform</artifactId>
<version>3.05.01-1.4.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>com.mailjet</groupId>
<artifactId>mailjet-client</artifactId>
<version>4.1.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
[INFO] com.example:hello:jar:0.0.1-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-properties-migrator:jar:2.0.3.RELEASE:runtime
[INFO] | +- org.springframework.boot:spring-boot:jar:2.0.3.RELEASE:compile
[INFO] | \- org.springframework.boot:spring-boot-configuration-metadata:jar:2.0.3.RELEASE:runtime
[INFO] | \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:runtime
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:2.0.3.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter:jar:2.0.3.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:2.0.3.RELEASE:compile
[INFO] | | | +- ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO] | | | | \- ch.qos.logback:logback-core:jar:1.2.3:compile
[INFO] | | | +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.10.0:compile
[INFO] | | | | \- org.apache.logging.log4j:log4j-api:jar:2.10.0:compile
[INFO] | | | \- org.slf4j:jul-to-slf4j:jar:1.7.25:compile
[INFO] | | +- javax.annotation:javax.annotation-api:jar:1.3.2:compile
[INFO] | | \- org.yaml:snakeyaml:jar:1.19:runtime
[INFO] | +- org.springframework.boot:spring-boot-starter-jdbc:jar:2.0.3.RELEASE:compile
[INFO] | | +- com.zaxxer:HikariCP:jar:2.7.9:compile
[INFO] | | \- org.springframework:spring-jdbc:jar:5.0.7.RELEASE:compile
[INFO] | +- org.hibernate:hibernate-core:jar:5.2.17.Final:compile
[INFO] | | +- org.jboss.logging:jboss-logging:jar:3.3.2.Final:compile
[INFO] | | +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.2.Final:compile
[INFO] | | +- org.javassist:javassist:jar:3.22.0-GA:compile
[INFO] | | +- antlr:antlr:jar:2.7.7:compile
[INFO] | | +- org.jboss:jandex:jar:2.0.3.Final:compile
[INFO] | | +- com.fasterxml:classmate:jar:1.3.4:compile
[INFO] | | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | | \- org.hibernate.common:hibernate-commons-annotations:jar:5.0.1.Final:compile
[INFO] | +- javax.transaction:javax.transaction-api:jar:1.2:compile
[INFO] | +- org.springframework.data:spring-data-jpa:jar:2.0.8.RELEASE:compile
[INFO] | | +- org.springframework.data:spring-data-commons:jar:2.0.8.RELEASE:compile
[INFO] | | +- org.springframework:spring-orm:jar:5.0.7.RELEASE:compile
[INFO] | | +- org.springframework:spring-tx:jar:5.0.7.RELEASE:compile
[INFO] | | \- org.springframework:spring-beans:jar:5.0.7.RELEASE:compile
[INFO] | \- org.springframework:spring-aspects:jar:5.0.7.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-thymeleaf:jar:2.0.3.RELEASE:compile
[INFO] | +- org.thymeleaf:thymeleaf-spring5:jar:3.0.9.RELEASE:compile
[INFO] | | \- org.thymeleaf:thymeleaf:jar:3.0.9.RELEASE:compile
[INFO] | | +- org.attoparser:attoparser:jar:2.0.4.RELEASE:compile
[INFO] | | \- org.unbescape:unbescape:jar:1.1.5.RELEASE:compile
[INFO] | \- org.thymeleaf.extras:thymeleaf-extras-java8time:jar:3.0.1.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-security:jar:2.0.3.RELEASE:compile
[INFO] | +- org.springframework:spring-aop:jar:5.0.7.RELEASE:compile
[INFO] | +- org.springframework.security:spring-security-config:jar:5.0.6.RELEASE:compile
[INFO] | | \- org.springframework.security:spring-security-core:jar:5.0.6.RELEASE:compile
[INFO] | \- org.springframework.security:spring-security-web:jar:5.0.6.RELEASE:compile
[INFO] | \- org.springframework:spring-expression:jar:5.0.7.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-devtools:jar:2.0.3.RELEASE:compile (optional)
[INFO] | \- org.springframework.boot:spring-boot-autoconfigure:jar:2.0.3.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:2.0.3.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-json:jar:2.0.3.RELEASE:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-databind:jar:2.9.6:compile
[INFO] | | | \- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0:compile
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.9.6:compile
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.9.6:compile
[INFO] | | \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.9.6:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.0.3.RELEASE:compile
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.31:compile
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.31:compile
[INFO] | | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.31:compile
[INFO] | +- org.hibernate.validator:hibernate-validator:jar:6.0.10.Final:compile
[INFO] | | \- javax.validation:validation-api:jar:2.0.1.Final:compile
[INFO] | +- org.springframework:spring-web:jar:5.0.7.RELEASE:compile
[INFO] | \- org.springframework:spring-webmvc:jar:5.0.7.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-mail:jar:2.0.3.RELEASE:compile
[INFO] | +- org.springframework:spring-context:jar:5.0.7.RELEASE:compile
[INFO] | +- org.springframework:spring-context-support:jar:5.0.7.RELEASE:compile
[INFO] | \- com.sun.mail:javax.mail:jar:1.6.1:compile
[INFO] | \- javax.activation:activation:jar:1.1:compile
[INFO] +- joda-time:joda-time:jar:2.9.9:compile
[INFO] +- joda-time:joda-time-jsptags:jar:1.1.1:compile
[INFO] +- joda-time:joda-time-hibernate:jar:1.4:compile
[INFO] +- org.jadira.usertype:usertype.core:jar:5.0.0.GA:compile
[INFO] | +- org.hibernate:hibernate-entitymanager:jar:5.2.17.Final:compile
[INFO] | | +- net.bytebuddy:byte-buddy:jar:1.7.11:compile
[INFO] | | \- org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.0.1.Final:compile
[INFO] | +- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] | \- org.jadira.usertype:usertype.spi:jar:5.0.0.GA:compile
[INFO] +- org.apache.commons:commons-lang3:jar:3.4:compile
[INFO] +- mysql:mysql-connector-java:jar:5.1.46:runtime
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.0.3.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test:jar:2.0.3.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.0.3.RELEASE:test
[INFO] | +- com.jayway.jsonpath:json-path:jar:2.4.0:test
[INFO] | | \- net.minidev:json-smart:jar:2.3:test
[INFO] | | \- net.minidev:accessors-smart:jar:1.2:test
[INFO] | | \- org.ow2.asm:asm:jar:5.0.4:test
[INFO] | +- junit:junit:jar:4.12:compile
[INFO] | +- org.assertj:assertj-core:jar:3.9.1:test
[INFO] | +- org.mockito:mockito-core:jar:2.15.0:test
[INFO] | | +- net.bytebuddy:byte-buddy-agent:jar:1.7.11:test
[INFO] | | \- org.objenesis:objenesis:jar:2.6:test
[INFO] | +- org.hamcrest:hamcrest-core:jar:1.3:compile
[INFO] | +- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO] | +- org.skyscreamer:jsonassert:jar:1.5.0:test
[INFO] | +- org.springframework:spring-core:jar:5.0.7.RELEASE:compile
[INFO] | | \- org.springframework:spring-jcl:jar:5.0.7.RELEASE:compile
[INFO] | +- org.springframework:spring-test:jar:5.0.7.RELEASE:test
[INFO] | \- org.xmlunit:xmlunit-core:jar:2.5.1:test
[INFO] +- org.thymeleaf.extras:thymeleaf-extras-springsecurity4:jar:3.0.2.RELEASE:compile
[INFO] +- org.apache.pdfbox:pdfbox:jar:2.0.9:compile
[INFO] | +- org.apache.pdfbox:fontbox:jar:2.0.9:compile
[INFO] | \- commons-logging:commons-logging:jar:1.2:compile
[INFO] +- org.apache.pdfbox:pdfbox-tools:jar:2.0.9:compile
[INFO] | \- org.apache.pdfbox:pdfbox-debugger:jar:2.0.9:compile
[INFO] +- commons-io:commons-io:jar:2.6:compile
[INFO] +- org.bytedeco.javacpp-presets:tesseract-platform:jar:3.05.01-1.4.1:compile
[INFO] | +- org.bytedeco.javacpp-presets:leptonica-platform:jar:1.75.3-1.4.1:compile
[INFO] | | +- org.bytedeco.javacpp-presets:leptonica:jar:1.75.3-1.4.1:compile
[INFO] | | +- org.bytedeco.javacpp-presets:leptonica:jar:android-arm:1.75.3-1.4.1:compile
[INFO] | | +- org.bytedeco.javacpp-presets:leptonica:jar:android-arm64:1.75.3-1.4.1:compile
[INFO] | | +- org.bytedeco.javacpp-presets:leptonica:jar:android-x86:1.75.3-1.4.1:compile
[INFO] | | +- org.bytedeco.javacpp-presets:leptonica:jar:android-x86_64:1.75.3-1.4.1:compile
[INFO] | | +- org.bytedeco.javacpp-presets:leptonica:jar:linux-x86:1.75.3-1.4.1:compile
[INFO] | | +- org.bytedeco.javacpp-presets:leptonica:jar:linux-x86_64:1.75.3-1.4.1:compile
[INFO] | | +- org.bytedeco.javacpp-presets:leptonica:jar:linux-armhf:1.75.3-1.4.1:compile
[INFO] | | +- org.bytedeco.javacpp-presets:leptonica:jar:linux-ppc64le:1.75.3-1.4.1:compile
[INFO] | | +- org.bytedeco.javacpp-presets:leptonica:jar:macosx-x86_64:1.75.3-1.4.1:compile
[INFO] | | +- org.bytedeco.javacpp-presets:leptonica:jar:windows-x86:1.75.3-1.4.1:compile
[INFO] | | \- org.bytedeco.javacpp-presets:leptonica:jar:windows-x86_64:1.75.3-1.4.1:compile
[INFO] | +- org.bytedeco.javacpp-presets:tesseract:jar:3.05.01-1.4.1:compile
[INFO] | | \- org.bytedeco:javacpp:jar:1.4.1:compile
[INFO] | +- org.bytedeco.javacpp-presets:tesseract:jar:android-arm:3.05.01-1.4.1:compile
[INFO] | +- org.bytedeco.javacpp-presets:tesseract:jar:android-arm64:3.05.01-1.4.1:compile
[INFO] | +- org.bytedeco.javacpp-presets:tesseract:jar:android-x86:3.05.01-1.4.1:compile
[INFO] | +- org.bytedeco.javacpp-presets:tesseract:jar:android-x86_64:3.05.01-1.4.1:compile
[INFO] | +- org.bytedeco.javacpp-presets:tesseract:jar:linux-x86:3.05.01-1.4.1:compile
[INFO] | +- org.bytedeco.javacpp-presets:tesseract:jar:linux-x86_64:3.05.01-1.4.1:compile
[INFO] | +- org.bytedeco.javacpp-presets:tesseract:jar:linux-armhf:3.05.01-1.4.1:compile
[INFO] | +- org.bytedeco.javacpp-presets:tesseract:jar:linux-ppc64le:3.05.01-1.4.1:compile
[INFO] | +- org.bytedeco.javacpp-presets:tesseract:jar:macosx-x86_64:3.05.01-1.4.1:compile
[INFO] | +- org.bytedeco.javacpp-presets:tesseract:jar:windows-x86:3.05.01-1.4.1:compile
[INFO] | \- org.bytedeco.javacpp-presets:tesseract:jar:windows-x86_64:3.05.01-1.4.1:compile
[INFO] +- org.springframework.boot:spring-boot-starter-aop:jar:2.0.3.RELEASE:compile
[INFO] | \- org.aspectj:aspectjweaver:jar:1.8.13:compile
[INFO] +- com.mailjet:mailjet-client:jar:4.1.1:compile
[INFO] | +- com.turbomanage.basic-http-client:http-client-java:jar:0.89:compile
[INFO] | | \- com.fasterxml.jackson.core:jackson-core:jar:2.9.6:compile
[INFO] | \- org.json:json:jar:20140107:compile
[INFO] +- org.springframework.boot:spring-boot-starter-amqp:jar:2.0.3.RELEASE:compile
[INFO] | +- org.springframework:spring-messaging:jar:5.0.7.RELEASE:compile
[INFO] | \- org.springframework.amqp:spring-rabbit:jar:2.0.4.RELEASE:compile
[INFO] | +- org.springframework.amqp:spring-amqp:jar:2.0.4.RELEASE:compile
[INFO] | +- com.rabbitmq:amqp-client:jar:5.1.2:compile
[INFO] | \- org.springframework.retry:spring-retry:jar:1.2.2.RELEASE:compile
[INFO] \- com.google.code.gson:gson:jar:2.8.5:compile
I am using Jadira 5.0 which, AFAIK, only supports Hibernate 5.0. Boot 2.0 requires Hibernate 5.2.
Every thing seems to be perfect until i launch all project unit tests.
After upgrade my project to struts 2.3.15.1 from 2.2.1.1 I got these errors :
java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(Z)V
at net.sf.cglib.core.DebuggingClassWriter.<init>(DebuggingClassWriter.java:47)
at net.sf.cglib.core.DefaultGeneratorStrategy.getClassWriter(DefaultGeneratorStrategy.java:30)
at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:24)
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)
at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:145)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:117)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:108)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:104)
at net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java:69)
The problem was in fact struts 2.3.15.1 use another version of asm framework which is different from the previous one . here the result of mvn tree
[INFO] | +- com.holly.project:ejbMex:ejb-client:client:8.13.0-SNAPSHOT:compile
[INFO] | | +- com.holly.project:commons-care:jar:8.13.0-SNAPSHOT:compile
[INFO] | | | +- org.hibernate:hibernate:jar:3.2.5.ga:compile
[INFO] | | | | +- net.sf.ehcache:ehcache:jar:1.2.3:compile
[INFO] | | | | +- asm:asm-attrs:jar:1.5.3:compile
[INFO] | | | | +- antlr:antlr:jar:2.7.6:compile
[INFO] | | | | \- cglib:cglib:jar:2.1_3:compile
+- org.apache.struts:struts2-core:jar:2.3.15.1:compile
[INFO] | +- org.apache.struts.xwork:xwork-core:jar:2.3.15.1:compile
[INFO] | | +- org.apache.commons:commons-lang3:jar:3.1:compile
[INFO] | | +- asm:asm:jar:3.3:compile
[INFO] | | \- asm:asm-commons:jar:3.3:compile
[INFO] | | \- asm:asm-tree:jar:3.3:compile
[INFO] | +- org.freemarker:freemarker:jar:2.3.19:compile
[INFO] | +- ognl:ognl:jar:3.0.6:compile
[INFO] | | \- javassist:javassist:jar:3.11.0.GA:compile
[INFO] | +- commons-fileupload:commons-fileupload:jar:1.3:compile
[INFO] | \- commons-io:commons-io:jar:1.4:compile
as you can see struts use asm 3.3 which is not the one defined in hibernate transitive dependency . i solution i excluded this dependency from my struts declaration
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>2.3.15.1</version>
<exclusions>
<exclusion>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
</exclusion>
</exclusions>
</dependency>
The problem was solved but i'm getting now new errors which i can't figure out about what .?
java.lang.VerifyError: Instruction type does not match stack map in method holly.commons.ihm.utils.ServiceLocator.getMePage()Lcom.holly.project/service/IMEPage; at offset 959
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2442)
at java.lang.Class.getMethod0(Class.java:2685)
at java.lang.Class.getMethod(Class.java:1620)
at org.easymock.internal.ObjectMethodsFilter.<init>(ObjectMethodsFilter.java:55)
at org.easymock.internal.MocksControl.createMock(MocksControl.java:59)
at org.easymock.EasyMock.createMock(EasyMock.java:103)
at holly.commons.ihm.remote.TemplMePageTest.<init>(TemplMePageTest.java:63)
#AleksandrM as Always, Thank You for your cooperation :)
In fact the problem was resolved after the exclusion also of the ognl artifact from struts core transitive dependency. it seems the version which is used to compile all the Unit Test was different from the one used to run theses ones.
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>2.3.15.1</version>
<exclusions>
<exclusion>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
</exclusion>
<exclusion>
<groupId>ognl</groupId>
<artifactId>ognl</artifactId>
</exclusion>
</exclusions>
</dependency>
I have a EAR with a number of EJB dependencies. 1 of these have a provided scope dependency:
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
<scope>provided</scope>
</dependency>
but inside the jar there is the jar mail-1.4.3.jar (I dependency i previously deleted)
I've tried with:
mvn eclipse:clean
mvn dependency:tree
mvn dependency:analyze-only
but there is no way to get rid if this jar, that cause me a `java.lang.ClassCastException: javax.mail.Session cannot be cast to javax.mail.Session in the server
Here the full pom.xml:
<!--
~ Copyright 2010-2012, CloudBees Inc.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>localdomain.localhost</groupId>
<artifactId>myApp</artifactId>
<packaging>war</packaging>
<version>1.0.2-SNAPSHOT</version>
<name>conFloorApp</name>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.8.4</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>3.2.8.RELEASE</version>
<type>jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>javax.servlet.jsp.jstl-api</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<!-- Apache JSTL implementation -->
<groupId>org.glassfish.web</groupId>
<artifactId>javax.servlet.jsp.jstl</artifactId>
<version>1.2.2</version>
<exclusions>
<exclusion>
<!--
use javax.servlet.jsp.jstl:javax.servlet.jsp.jstl-api, exclude this one
-->
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>jstl-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<!-- used for the troubleshooting jsp datasource-mysql.jsp -->
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.27</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.2.8.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.2.8.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.2.8.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.2.8.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>3.2.8.RELEASE</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.6.3.Final</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>3.2.8.RELEASE</version>
</dependency>
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.12.1.GA</version>
</dependency>
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.8.4.5</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>3.2.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>3.2.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-aspects</artifactId>
<version>3.2.3.RELEASE</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.maxmind.geoip</groupId>
<artifactId>geoip-api</artifactId>
<version>1.2.11</version>
</dependency>
<dependency>
<groupId>com.github.dandelion</groupId>
<artifactId>datatables-jsp</artifactId>
<version>0.9.3</version>
</dependency>
</dependencies>
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-webdav</artifactId>
<version>1.0-beta-2</version>
</extension>
</extensions>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<scm>
<connection>scm:git:https://github.com/CloudBees-community/tomcat7-maven-clickstart.git</connection>
<tag>HEAD</tag>
</scm>
<distributionManagement>
<repository>
<id>community-release</id>
<url>dav:https://repository-community.forge.cloudbees.com/release/</url>
</repository>
<snapshotRepository>
<id>community-snapshot</id>
<url>dav:https://repository-community.forge.cloudbees.com/snapshot/</url>
</snapshotRepository>
</distributionManagement>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
</project>
You are looking in the wrong spot. Here is the dependency tree for your pom. As per the dependency tree this pom is not pulling mail.jar you need to elsewhere. look at some other projects that may be pulling mail.jar as their dependency.
Command to check dependency tree
mvn dependency:tree -Dverbose
Note there is only one entry of mail.jar that is marked as provided so this pom is not a issue
[INFO] +- javax.mail:mail:jar:1.4:provided
[INFO] | \- javax.activation:activation:jar:1.1:provided
Complete Output of dependency tree
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building conFloorApp 1.0.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) # myApp ---
[INFO] localdomain.localhost:myApp:war:1.0.2-SNAPSHOT
[INFO] +- junit:junit:jar:4.8.1:test (scope not updated to compile)
[INFO] +- org.mockito:mockito-all:jar:1.8.4:compile
[INFO] +- org.springframework:spring-test:jar:3.2.8.RELEASE:test
[INFO] | \- (org.springframework:spring-core:jar:3.2.8.RELEASE:compile - scope updated from test; omitted for duplicate)
[INFO] +- javax.servlet:javax.servlet-api:jar:3.0.1:provided
[INFO] +- javax.servlet.jsp:javax.servlet.jsp-api:jar:2.2.1:provided
[INFO] +- javax.servlet.jsp.jstl:javax.servlet.jsp.jstl-api:jar:1.2.1:compile
[INFO] +- org.glassfish.web:javax.servlet.jsp.jstl:jar:1.2.2:compile
[INFO] +- mysql:mysql-connector-java:jar:5.1.27:provided
[INFO] +- org.springframework:spring-context:jar:3.2.8.RELEASE:compile
[INFO] | +- org.springframework:spring-aop:jar:3.2.8.RELEASE:compile
[INFO] | | +- (aopalliance:aopalliance:jar:1.0:compile - omitted for duplicate)
[INFO] | | +- (org.springframework:spring-beans:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] | | \- (org.springframework:spring-core:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] | +- org.springframework:spring-beans:jar:3.2.8.RELEASE:compile
[INFO] | | \- (org.springframework:spring-core:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-core:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] | \- org.springframework:spring-expression:jar:3.2.8.RELEASE:compile
[INFO] | \- (org.springframework:spring-core:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] +- org.springframework:spring-core:jar:3.2.8.RELEASE:compile
[INFO] | \- commons-logging:commons-logging:jar:1.1.3:compile
[INFO] +- org.springframework:spring-web:jar:3.2.8.RELEASE:compile
[INFO] | +- (org.springframework:spring-aop:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-beans:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-context:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] | \- (org.springframework:spring-core:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] +- org.springframework:spring-webmvc:jar:3.2.8.RELEASE:compile
[INFO] | +- (org.springframework:spring-beans:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-context:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-core:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-expression:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] | \- (org.springframework:spring-web:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] +- org.springframework:spring-orm:jar:3.2.8.RELEASE:compile
[INFO] | +- (org.springframework:spring-beans:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-core:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-jdbc:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] | \- org.springframework:spring-tx:jar:3.2.8.RELEASE:compile
[INFO] | +- (org.springframework:spring-beans:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] | \- (org.springframework:spring-core:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] +- org.hibernate:hibernate-core:jar:3.6.3.Final:compile
[INFO] | +- antlr:antlr:jar:2.7.6:compile
[INFO] | +- commons-collections:commons-collections:jar:3.1:compile
[INFO] | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | +- org.hibernate:hibernate-commons-annotations:jar:3.2.0.Final:compile
[INFO] | | \- (org.slf4j:slf4j-api:jar:1.5.8:compile - omitted for conflict with 1.6.1)
[INFO] | +- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.0.Final:compile
[INFO] | +- javax.transaction:jta:jar:1.1:compile
[INFO] | \- org.slf4j:slf4j-api:jar:1.6.1:compile
[INFO] +- org.springframework:spring-jdbc:jar:3.2.8.RELEASE:compile
[INFO] | +- (org.springframework:spring-beans:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-core:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] | \- (org.springframework:spring-tx:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] +- javassist:javassist:jar:3.12.1.GA:compile
[INFO] +- c3p0:c3p0:jar:0.8.4.5:compile
[INFO] +- cglib:cglib:jar:2.2:compile
[INFO] | \- asm:asm:jar:3.1:compile
[INFO] +- org.springframework.security:spring-security-web:jar:3.2.3.RELEASE:compile
[INFO] | +- aopalliance:aopalliance:jar:1.0:compile
[INFO] | +- org.springframework.security:spring-security-core:jar:3.2.3.RELEASE:compile
[INFO] | | +- (aopalliance:aopalliance:jar:1.0:compile - omitted for duplicate)
[INFO] | | +- (org.springframework:spring-aop:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] | | +- (org.springframework:spring-beans:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] | | +- (org.springframework:spring-context:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] | | +- (org.springframework:spring-core:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] | | \- (org.springframework:spring-expression:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-beans:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-context:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-core:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-expression:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] | \- (org.springframework:spring-web:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] +- org.springframework.security:spring-security-config:jar:3.2.3.RELEASE:compile
[INFO] | +- (aopalliance:aopalliance:jar:1.0:compile - omitted for duplicate)
[INFO] | +- (org.springframework.security:spring-security-core:jar:3.2.3.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-aop:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-beans:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-context:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] | \- (org.springframework:spring-core:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] +- org.springframework.security:spring-security-aspects:jar:3.2.3.RELEASE:compile
[INFO] | +- (org.springframework.security:spring-security-core:jar:3.2.3.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-beans:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-context:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] | \- (org.springframework:spring-core:jar:3.2.8.RELEASE:compile - omitted for duplicate)
[INFO] +- javax.mail:mail:jar:1.4:provided
[INFO] | \- javax.activation:activation:jar:1.1:provided
[INFO] +- com.maxmind.geoip:geoip-api:jar:1.2.11:compile
[INFO] \- com.github.dandelion:datatables-jsp:jar:0.9.3:compile
[INFO] +- com.github.dandelion:datatables-core:jar:0.9.3:compile
[INFO] | +- com.googlecode.json-simple:json-simple:jar:1.1.1:compile
[INFO] | | \- (junit:junit:jar:4.10:compile - omitted for conflict with 4.8.1)
[INFO] | +- commons-beanutils:commons-beanutils:jar:1.8.3:compile
[INFO] | \- (org.slf4j:slf4j-api:jar:1.7.5:compile - omitted for conflict with 1.6.1)
[INFO] \- (org.slf4j:slf4j-api:jar:1.7.5:compile - omitted for conflict with 1.6.1)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.611s
[INFO] Finished at: Fri May 23 21:55:07 EDT 2014
[INFO] Final Memory: 10M/245M
[INFO] ------------------------------------------------------------------------