Announcement Announcement Module
No announcement yet.
What happen in SimpleLoadTimeWeaver class?(Spring + EclipseLink) Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • What happen in SimpleLoadTimeWeaver class?(Spring + EclipseLink)

    I encounter a problem, the problem had happend by annother person, i don't understand what reason result in exception. If i rewrite SimpleLoadTimeWeaver, problem will resolved.

    [EL Config]: 2011-06-09 00:15:24.061--ServerSession(2050312009)--Connection(473155160)--Thread(Thread[main,5,main])--Connected: jdbc:derby://localhost:1527/springhib;create=true User: app Database: Apache Derby Version: - (999685) Driver: Apache Derby Network Client JDBC Driver Version: - (1040133) [EL Severe]: 2011-06-09 00:15:24.127--ServerSession(2050312009)--Thread(Thread[main,5,main])--Local Exception Stack: Exception [EclipseLink-0] (Eclipse Persistence Services - 2.2.0.v20110202-r8913): org.eclipse.persistence.exceptions.IntegrityException Descriptor Exceptions:
    Exception [EclipseLink-148] (Eclipse Persistence Services - 2.2.0.v20110202-r8913): org.eclipse.persistence.exceptions.DescriptorException Exception Description: The container policy [CollectionContainerPolicy(class org.eclipse.persistence.indirection.IndirectSet)] is not compatible with transparent indirection. Mapping: org.eclipse.persistence.mappings.ManyToManyMapping[comments] Descriptor: RelationalDescriptor(pl.adaknet.hibspring.domain.ArtEntity --> [DatabaseTable(ARTENTITY)])
    <import resource="data-source.xml" />
    <tx:annotation-driven mode="proxy"
        transaction-manager="transactionManager" />
    <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"
        p:entityManagerFactory-ref="entityManagerFactory" />
    <!-- Entity manager -->
    <bean id="entityManagerFactory"
        <property name="dataSource" ref="dataSource" />
        <property name="persistenceUnitName" value="unit1" />
        <property name="loadTimeWeaver">
            <bean class="org.springframework.instrument.classloading.SimpleLoadTimeWeaver"/>
        <property name="jpaVendorAdapter">
                <property name="databasePlatform" value="org.eclipse.persistence.platform.database.DerbyPlatform" />
                <property name="showSql" value="true" />
                <property name="generateDdl" value="true" />
            <!-- <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> -->
            <!-- <property name="databasePlatform" value="org.hibernate.dialect.DerbyDialect" 
                /> -->
            <!-- <property name="showSql" value="true" /> -->
            <!-- <property name="generateDdl" value="true" /> -->
            <!-- </bean> -->
    <bean id="jpaTemplate" class="org.springframework.orm.jpa.JpaTemplate">
        <property name="entityManagerFactory" ref="entityManagerFactory" />
    new Weave class:
    package net.palesz.util;
    import org.springframework.instrument.classloading.SimpleLoadTimeWeaver;
    public class JpaAwareLoadTimeWeaver extends SimpleLoadTimeWeaver {
        public ClassLoader getInstrumentableClassLoader() {
            ClassLoader instrumentableClassLoader = super.getInstrumentableClassLoader();
            if (instrumentableClassLoader.getClass().getName().endsWith("SimpleInstrumentableClassLoader")) {
                return instrumentableClassLoader.getParent();
            } else {
                return instrumentableClassLoader;

  • #2
    somebody give me a answer,please.


    • #3
      I'm not an expert in EclipseLink weaving issues and I have no specific explanation as to what's happening, but I suspect that Spring's simple load time weaver is just that, "simple". It would be interesting to put a breakpoint on the line if (instrumentableClassLoader.getClass().getName().en dsWith("SimpleInstrumentableClassLoader")) { in the class JpaAwareLoadTimeWeaver to see which way the conditional branches. That may tell you something.

      EclipseLink weaving and such is complicated. Just take a look at the EclipseLink docs on the subject (you may want to take some anti-dizziness medication prior to doing so):

      And I have a sneaking suspicion that SimpleLoadTimeWeaver hasn't been thoroughly tested against EclipseLink -- the Spring folks probably keep their collective eyes on Hibernate since it is the elephant in the ORM business.

      [Update: I don't know why the formatter for these forums insists upon putting a space in "endsWith" so that it becomes "en dsWith" above, but it does.]
      Last edited by pfurbacher; May 1st, 2013, 11:38 AM.


      • #4
        yes,you think as i think, spring hasn't been tested.

        i will ignore the exception, and i don't research what happen in SimpleLoadTimeWeaver .

        whatever, i thank you.


        • #5
          Originally posted by iyuandejun View Post
          yes,you think as i think, spring hasn't been tested....
          Oh, I'd say that Spring is very well-tested: just take a look at the number of tests in the Spring repository at GitHub. I want to be clear that I said that I had a sneaking suspicion that it may not have been so well-tested against EclipseLink which is not the major player in the ORM space. I'm not sure where EclipseLink ranks in usage but I bet it's a distant second or third to Hibernate. At least that is what job trends would seem to indicate.

          Anyway, if you are going to be using EclipseLink in production, I think it is a good idea to delve into the docs and become well-versed with the concepts and practices of weaving, or have someone in your group do so.


          • #6
            Thank you.