2

I am using tomcat as my webserver and would like to use the fetch = FetchType.lazy annotation for all my @OneToOne annotations but spring reverts my lazy settings give me eclipselink warnings :

Reverting the lazy setting on the OneToOne or ManyToOne attribute [student] for the entity class [class org.bixin.dugsi.domain.Registration] since weaving was not enabled or did not occur.

What do i have to do to tomcat to get weaving working so i can use lazy fetching or is there any other alternatives to lazy load relationships. I am having huge performance problems?

I am now attempting to add loadtime weaving, i have added both spring-instruments.jar and spring-aspects.jar to my tomcat/lib and after adding the global <context:load-time-weaver/> to my applicationContext.xml file, i get an

ClassLoader [sun.misc.Launcher$AppClassLoader] does NOT provide an 'addTransformer(ClassFileTransformer)' method. Specify a custom LoadTimeWeaver or start your Java virtual machine with Spring's agent: -javaagent:org.springframework.instrument.jar
Warz
  • 7,386
  • 14
  • 68
  • 120
  • possible duplicate of http://stackoverflow.com/questions/8285684/cant-understand-eclipselink-warning or hitting this bug https://jira.springsource.org/browse/SPR-9081 – Ravi Kadaboina Jul 03 '12 at 00:05
  • That SO question and the eclipselink resource provided give no clear direction as to where things need to go (spring.instruments.jar) and the updates to context.xml? – Warz Jul 03 '12 at 00:15

1 Answers1

1

I would recommend using static weaving instead, see,

http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Advanced_JPA_Development/Performance/Weaving/Static_Weaving

It is possible to get weaving working in Spring. I would recommend starting with one of the Spring tutorials outside of Tomcat, and slowly add complexity until you have it working inside Tomcat.

James
  • 17,965
  • 11
  • 91
  • 146
  • 1
    i have taken a look at this documentation and it is really hard to follow (configure) properly. How do i know i have enabled static weaving properly, is there a github repository example project that has an example using tomcat as the web server? – Warz Jul 03 '12 at 15:59
  • 1
    Do i have to if i use static weaving always run the command line argument when i build and run the project – Warz Jul 04 '12 at 03:02
  • 1
    Yes, you must run the task on your jar and use the weaved jar it outputs. – James Jul 04 '12 at 12:42
  • 1
    cant this be put in my project once to utilize eclipse as my run,build and deploy tool. I tried adding the maven-ant plugin and adding the specified task but nothing seems to work and the lazy settings get reverted – Warz Jul 04 '12 at 16:44