Announcement Announcement Module
No announcement yet.
Spring 3.1 EclipseLink 2.3.2 Tomcat 7 Load Time Weaving Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring 3.1 EclipseLink 2.3.2 Tomcat 7 Load Time Weaving


    I have been trying to get a new project off the ground using These technologies:

    EclipseLink 2.3.2
    Spring 3.1
    Tomcat 7.0.20
    Servlet 3.0.1
    Java 1.7

    I would like to utilize the OneToOne and OneToMany lazy loading. I have everything setup correctly, as I am not getting any errors at all. However, I never get my entities woven but I see this in the logs for my @Entities:

    registered to be processed by weaver.
    When I access my @Entity that has these mappings, I get this in the logs:

    Reverting the lazy setting on the OneToOne or ManyToOne attribute [(fieldInClass)] for the entity class [class (registered @Entity class] since weaving was not enabled or did not occur.
    I have the <Loader> tag in my context.xml that Tomcat is picking up, along with my JNDI properties. I have the tag <context:load-time-weaver /> in my spring configuration file. I am also taking advantage of the new Spring 3.1 feature that enables me to NOT use a persistence.xml, however one is defined so I can generate my Meta Model classes.

    Like I have said, everything EXCEPT weaving is happening properly; and thus lazy OneToOne associations are not working. Weaving is TRYING to work, as it goes over all the classes defined correctly; as i can persist and find just fine. The problem seems to be that the classloader tries to weave the classes before Spring has been able to define the Application Context, so no ClassFileTransformer's are ever defined. When Spring starts up and initializes the SpringPersistenceUnitInfo and delegates the EclipseLink weaver we get the needed ClassTransformer added. This all happens AFTER the TomcatInstrumentableClassLoader has called findResourceInternal() and tried to weave my POJO's.

    So the problem seems to be the fact that LTW means we weave when the class gets loaded. The class loader loads the class and attempts weaving, when we actually have a transformer that would do the job the classes are already loaded and so not weaved.

    Not sure what the fix for this would be, but it would be nice to be able to utilize this functionality. I would think that we would have to ensure we have added a transformer before being able to attempt the weaving. I agree this still needs to only happen once and at the first load, but getting the right transformer BEFORE we try to transform is a critical part to ensuring the weaving happens correctly.

    If there is a work around that I have not found please let me know, if this is a bug I can file a bug report but wanted to hit the forums first.

    I suppose since there hasn't been any comments on this post I will move forward with submitting a bug to spring. Well, I'll wait a few days first and will update this post with the bug ticket number. At this point lazy loading a OneToOne is impossible with Spring 3.1 and EclipseLink 2.3.2.

    EDITED: Created this Spring JPA ticket, hopefully we can get this squared away for a future release or find a work around.
    Last edited by NickPadilla; Jan 26th, 2012, 11:00 AM. Reason: added bug report ticket link

  • #2
    Any fixes to this, i am having the same issue. Need this to work as lazy loading fixes my performance issues.


    • #3
      Anyone? This is an obvious issue as OneToOne and ManyToOne mappings being eagerly fetched are just unbearable in performance, is there at least a workaround to prevent eager fetching without weaving, LTW or other unknown methods?