Announcement Announcement Module
Collapse
No announcement yet.
Problem : Load time weaving and Tomcat 5.5.20 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem : Load time weaving and Tomcat 5.5.20

    Dear All -

    I am trying to deploy an application in Tomcat 5.5.20 with Spring 2.5 RC1 and Hibernate 3.x. Things look ok till I introduce load time weaving through <context:load-time-weaver/> in applicationContext.xml. The xml file is as follows :

    HTML Code:
    <?xml version="1.0" encoding="UTF-8"?>
                             
    ...
       
       <context:annotation-config />
       <context:spring-configured/>
       <tx:annotation-driven transaction-manager="transactionManager"/>
       
       <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/>
       
       <bean id="repoImpl"
             class="org.dg.inf.persistence.impl.jpa.hibernate.PlainJpaRepository">
       </bean>
       
       <bean id="organizationRepository"
             class="org.dg.domain.repository.impl.jpa.hibernate.OrganizationRepository"
             lazy-init="true"
             p:repositoryImpl-ref="repoImpl"/>
    
    <bean id="employeeRepository"
             class="org.dg.domain.repository.impl.jpa.hibernate.EmployeeRepository"
             lazy-init="true"
             p:repositoryImpl-ref="repoImpl"/>
             
       <bean id="projectRepository"
             class="org.dg.domain.repository.impl.jpa.hibernate.ProjectRepository"
             lazy-init="true"
             p:repositoryImpl-ref="repoImpl"/>
             
         
       <bean id="entityManagerFactory" 
             class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
             p:dataSource-ref="dataSource">
             <property name="jpaVendorAdapter">
               <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"
                     p:showSql="true"
                     p:generateDdl="false"/>
             </property>
       </bean>
       
       
       <bean id="dataSource" 
             class="org.springframework.jdbc.datasource.DriverManagerDataSource"
             p:driverClassName="com.mysql.jdbc.Driver"
             p:url="jdbc:mysql://localhost:3306/hr_anshin"
             p:username="root"
             p:password="admin" />
    
       <bean id="transactionManager" 
             class="org.springframework.orm.jpa.JpaTransactionManager"
             p:entityManagerFactory-ref="entityManagerFactory"
             p:dataSource-ref="dataSource" />
             
       <!-- this switches on the load-time weaving -->
       <!-- <context:load-time-weaver/>	 -->
       <bean class="org.dg.domain.entity.Project" 
             scope="prototype"
             p:organizationRepository-ref="organizationRepository" />
       
       <bean id="allocationService"
             class="org.dg.domain.service.impl.AllocationService"
             p:employeeRepository-ref="employeeRepository"
             p:projectRepository-ref="projectRepository" />
             
             
       <!-- the transactional advice (what 'happens'; see the <aop:advisor/> bean below) -->
       <tx:advice id="txAdvice" transaction-manager="transactionManager">
           <!-- the transactional semantics -->
           <tx:attributes>
               <!-- all methods starting with 'get' are read-only -->
               <tx:method name="get*" read-only="true"/>
               <!-- other methods use the default transaction settings (see below) -->
               <tx:method name="*"/>
           </tx:attributes>
       </tx:advice>
       
       <!-- ensure that the above transactional advice runs for any execution
            of an operation defined by the FooService interface -->
       <aop:config>
           <aop:pointcut id="allocationServiceOperation" 
                         expression="execution(* org.dg.domain.service.impl.AllocationService.*(..))"/>
           <aop:advisor advice-ref="txAdvice" 
                        pointcut-ref="allocationServiceOperation"/>
       </aop:config>
    </beans>
    and here is a partial snapshot of the stack trace from the catalina log :

    Code:
    SEVERE: org/aspectj/weaver/loadtime/Aj$WeaverContainer
    java.lang.LinkageError: org/aspectj/weaver/loadtime/Aj$WeaverContainer
    	at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:73)
    	at org.aspectj.weaver.loadtime.ClassPreProcessorAgentAdapter.transform(ClassPreProcessorAgentAdapter.java:55)
    	at org.springframework.instrument.classloading.WeavingTransformer.transformIfNecessary(WeavingTransformer.java:102)
    	at org.springframework.instrument.classloading.WeavingTransformer.transformIfNecessary(WeavingTransformer.java:83)
    	at org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader.findResourceInternal(TomcatInstrumentableClassLoader.java:113)
    	at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1752)
    	at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:869)
    	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1322)
    	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1201)
    	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    	at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:73)
    	at org.aspectj.weaver.loadtime.ClassPreProcessorAgentAdapter.transform(ClassPreProcessorAgentAdapter.java:55)
    	at org.springframework.instrument.classloading.WeavingTransformer.transformIfNecessary(WeavingTransformer.java:102)
    	at org.springframework.instrument.classloading.WeavingTransformer.transformIfNecessary(WeavingTransformer.java:83)
    	at org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader.findResourceInternal(TomcatInstrumentableClassLoader.java:113)
    	at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1752)
    	at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:869)
    	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1322)
    	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1201)
    	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    	at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:552)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:351)
    	at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:245)
    	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:188)
    	at org.springframework.web.context.ContextLoaderServlet.init(ContextLoaderServlet.java:81)
    	at javax.servlet.GenericServlet.init(GenericServlet.java:211)
    	at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1105)
    	at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:932)
    	at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3951)
    	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4225)
    	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
    	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
    	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
    	at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:608)
    	at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:535)
    	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:470)
    	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1122)
    	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
    	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1021)
    	at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
    	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
    	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
    	at org.apache.catalina.core.StandardService.start(StandardService.java:450)
    	at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
    	at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
    	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
    Oct 13, 2007 11:47:06 PM org.aspectj.weaver.tools.Jdk14Trace error
    SEVERE: org/aspectj/weaver/Dump
    java.lang.LinkageError: org/aspectj/weaver/loadtime/Aj$WeaverContainer
    	at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:73)
    	at org.aspectj.weaver.loadtime.ClassPreProcessorAgentAdapter.transform(ClassPreProcessorAgentAdapter.java:55)
    ....
    I also have the following context.xml as part of JPA class instrumentation in Tomcat ..

    HTML Code:
    <Context path="/dg-hr" reloadable="false">
       <!-- please note that useSystemClassLoaderAsParent is available since Tomcat 5.5.20 / remove if previous versions are being used -->
       <Loader loaderClass="org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader" useSystemClassLoaderAsParent="false"/>
    </Context>
    Any help will be appreciated.

    Cheers.
    - Debasish

  • #2
    Hi,
    I have the same problem. Also cannot find any solution yet
    K.

    Comment


    • #3
      It seems that Spring 2.5 RC1 snapshot solves this problem, at least in my case.

      Comment


      • #4
        Here is the related JIRA issue http://opensource.atlassian.com/proj...rowse/SPR-3873 .

        Comment

        Working...
        X