Reputation: 2983
I'm trying to deploy my spring application on Tomcat 8.0.3. The servlet container uses a jdk 1.0.7_51. I'm able to do the deploy through
mvn tomcat7:plugin
but when Tomcat tries to run the application. In the log file i get this exception:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in URL [file:/home/myApp/apache-tomcat-8.0.3/webapps/myApp/WEB-INF/classes/database.xml]: Invocation of init method failed; nested exception is java.lang.SecurityException: class "org.eclipse.persistence.sessions.coordination.CommandProcessor"'s signer information does not match signer information of other classes in the same package
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:420)
at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:277)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.detectPersistenceExceptionTranslators(PersistenceExceptionTranslationInterceptor.java:139)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.<init>(PersistenceExceptionTranslationInterceptor.java:79)
at org.springframework.dao.annotation.PersistenceExceptionTranslationAdvisor.<init>(PersistenceExceptionTranslationAdvisor.java:70)
at org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor.setBeanFactory(PersistenceExceptionTranslationPostProcessor.java:103)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeAwareMethods(AbstractAutowireCapableBeanFactory.java:1475)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1443)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
... 55 more
I have also run
mvn dependency:tree|findstr eclipse
and i get this result
[INFO] | | +- org.eclipse.persistence:org.eclipse.persistence.jpa:jar:2.5.1:compile
[INFO] | | | +- org.eclipse.persistence:javax.persistence:jar:2.1.0:compile
[INFO] | | | +- org.eclipse.persistence:org.eclipse.persistence.asm:jar:2.5.1:compile
[INFO] | | | +- org.eclipse.persistence:org.eclipse.persistence.antlr:jar:2.5.1:compile
[INFO] | | | +- org.eclipse.persistence:org.eclipse.persistence.jpa.jpql:jar:2.5.1:compile
[INFO] | | | \- org.eclipse.persistence:org.eclipse.persistence.core:jar:2.5.1:compile
[INFO] | | \- org.eclipse.persistence:eclipselink:jar:2.3.2:compile
[INFO] | | +- eclipse:jdtcore:jar:3.1.0:compile
How can I do to fix it?
Upvotes: 0
Views: 350
Reputation: 2983
I solved changed my pom from:
<dependencies>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa</artifactId>
<version>2.5.1</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.3.2</version>
</dependency>
</dependencies>
to:
<dependencies>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa</artifactId>
<version>2.5.1</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.5.1</version>
</dependency>
</dependencies>
I modified only the version of eclipseLink
Upvotes: 0
Reputation: 16615
You have multiple JARs providing classes from the package org.eclipse.persistence.sessions.coordination
but some of those JARs are signed and some are unsigned. The Java class loader does not permit this.
How easy this is to fix depends on the exact circumstances.
If the classes provided by the signed JAR(s) are also provided by unsigned JAR(s) AND the application CAN run without the signed JAR(s) then just delete the signed JAR(s).
If the classes provided by the unsigned JAR(s) are also provided by signed JAR(s) AND the application CAN run without the unsigned JAR(s) then just delete the unsigned JAR(s).
If the classes provided by the signed JAR(s) are also provided by an unsigned JAR(s) BUT the application CAN NOT run without the signed JAR(s) then you'll need to force Tomcat to load the unsigned JAR(s) first. Here is how the ASF does this with Jira to work around this issue with Jira 6.2 running on Tomcat 8. This needs to be added to the context.xml of the web application.
<Resources>
<!-- Trick to force this JAR to be searched for classes before all others
to work around a Jira bug -->
<PreResources className="org.apache.catalina.webresources.FileResourceSet"
base="${catalina.base}/webapps/jira/WEB-INF/lib/jira-api-6.2.jar"
webAppMount="/WEB-INF/lib/jira-api-6.2.jar" />
</Resources>
Like with the deletion, you can flip this around to cause the signed JAR(s) to be loaded first.
If none of the above work, you could unpackage the signed JAR(s) and repackage them without the signatures but that may break something if a signed JAR is expected anywhere.
Upvotes: 1