Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Trouble upgrading from EclipseLink 1.1.2 to 2.1.1 in Spring 2.5
Trouble upgrading from EclipseLink 1.1.2 to 2.1.1 in Spring 2.5 [message #560222] Tue, 21 September 2010 11:20 Go to next message
Matti Hansson is currently offline Matti Hansson
Messages: 68
Registered: July 2009
Member
Hi!
The time has come to step up the version of EclipseLink in my Spring project. Unit tests and everything works great, but when I try to deploy it on a JBoss I get this stack trace:
ERROR Context initialization failed at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:215)
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManager' defined in class path resource [META-INF/jpaContext.xml]: Invocation of init method failed; nested exception is java.lang.LinkageError: loader constraint violation: loader (instance of org/jboss/web/tomcat/service/WebCtxLoader$ENCLoader) previously initiated loading for a different type with name "javax/persistence/LockModeType"


I haven't changed anything except the EclipseLink dependency. This is the jpaContext.xml that is mentioned:
<jee:jndi-lookup id="dataSource" jndi-name="java:jdbc/sigmaFaDataSource"/>

  <!-- JPA EntityManagerFactory -->
  <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="dataSource" ref="dataSource"/>
    <property name="jpaVendorAdapter">
      <bean class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">
        <property name="databasePlatform" value="org.eclipse.persistence.platform.database.oracle.Oracle9Platform"/>
        <property name="showSql" value="true"/>
      </bean>
    </property>
    <property name="jpaProperties">
      <props>
        <prop key="eclipselink.target-server">org.eclipse.persistence.platform.server.jboss.JBossPlatform</prop>
        <prop key="eclipselink.logging.level">ALL</prop>
        <prop key="eclipselink.logging.logger">com.foo.SLF4JSessionLogger</prop>
        <prop key="eclipselink.logging.timestamp">false</prop>
        <prop key="eclipselink.logging.thread">false</prop>
        <prop key="eclipselink.logging.session">false</prop>
        <prop key="eclipselink.jdbc.native-sql">true</prop>
        <prop key="eclipselink.jdbc.cache-statements">false</prop>
        <prop key="eclipselink.weaving">false</prop>
        <prop key="eclipselink.ddl-generation">none</prop>
      </props>
    </property>
    <property name="persistenceXmlLocation" value="${persistence.xml.location}" />
  </bean>

  <bean id="entityManager" class="org.springframework.orm.jpa.support.SharedEntityManagerBean">
    <property name="entityManagerFactory" ref="entityManagerFactory"/>
  </bean>

  <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
    <property name="transactionManagerName" value="java:/TransactionManager"/>
  </bean>

  <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/>
  
  <tx:annotation-driven mode="proxy"/>


Ideas? Thanks!
/Matti

[Updated on: Tue, 21 September 2010 11:21]

Report message to a moderator

Re: Trouble upgrading from EclipseLink 1.1.2 to 2.1.1 in Spring 2.5 [message #626139 is a reply to message #560222] Wed, 22 September 2010 08:23 Go to previous messageGo to next message
Matti Hansson is currently offline Matti Hansson
Messages: 68
Registered: July 2009
Member
Further testing shows that stepping up the version to 1.1.4 is OK but 1.2.0 is not. Also, the JBoss version is 4.2.3
Re: Trouble upgrading from EclipseLink 1.1.2 to 2.1.1 in Spring 2.5 [message #628646 is a reply to message #560222] Thu, 23 September 2010 10:23 Go to previous messageGo to next message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Seems to be related to JPA 2.0 class/dependencies from EclipseLink >=1.2.

You could try replacing the JPA persistence.jar in JBoss with the JPA 2.0 one from EclipseLink.

It may be related to the eclipselink.jar having some JPA 2.0 classes inside the jar, you could try deleting these, or using the osgi bundle jars that do not have these classes in it.


James : Wiki : Book : Blog : Twitter
Re: Trouble upgrading from EclipseLink 1.1.2 to 2.1.1 in Spring 2.5 [message #628679 is a reply to message #628646] Thu, 23 September 2010 12:14 Go to previous message
Matti Hansson is currently offline Matti Hansson
Messages: 68
Registered: July 2009
Member
Thank you, James!

It seems an enum by the name of javax.persistence.LockModeType exists in the eclipselink jar, as well as in an ejb3-persistence.jar in the JBoss server lib. I also notice a few other classes whose names clash. The thing is that the enum in ejp3-persistence.jar only has the values READ and WRITE, while the one in eclipselink-2.1.1.jar also has a bunch of other values, like OPTIMISTIC and PESSIMISTIC_READ. With that in mind, it wouldn't be wise to remove the JPA classes. I'm also reluctant to remove anything from ejb3-persistence.jar, since I'm not sure if other projects are using it.

Thoughts?
/Matti
Previous Topic:OneToOne lazy relationship was already fetched?
Next Topic:Cache replication problem with UpdateAllQuery
Goto Forum:
  


Current Time: Wed Aug 27 21:12:19 EDT 2014

Powered by FUDForum. Page generated in 0.01705 seconds