I have just started studying Spring framework. My current goal is to access database from my bean through JPA (TopLink** provider) on Geronimo server. But I can't overcome the problem of getting entityManagerFactory.
The exception I get:
java.lang.IllegalStateException: ClassLoader [org.apache.geronimo.kernel.config.MultiParentClassLoader] does NOT provide an 'addTransformer(ClassFileTransformer)' method. Specify a custom LoadTimeWeaver or start your Java virtual machine with Spring's agent: -javaagent:spring-agent.jar
The way I access it:
<context:load-time-weaver />
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceXmlLocation" value="classpath:/META-INF/persistence.xml" />
</bean>
<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
<bean name="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<tx:annotation-driven />
I will be very grateful if anyone can help me without using "-javaagent:spring-agent.jar" option.
Searching a solution. First attempt.
Following "axtavt" advice, I found example of specifying special class loader for your web application on Tomcat. It uses context.xml file for that purpose. Although my Geronimo uses Tomcat, I didn't succeed implementing context.xml. As is said in the next manual the alternative for context.xml for Geronimo is geronimo-tomcat.xml, but it's syntax doesn't provide any possibilities for changing classloader. I still need help!