Menu

Setting up for Tomcat

Help
Mickey
2006-01-27
2013-04-17
  • Mickey

    Mickey - 2006-01-27

    When I started Tomcat I got the following error.

    Do I need to put the asm jars in the tomcat common\lib directory or add them the a system classpath variable?

    java.lang.IllegalArgumentException: Unknown attribute type: org.aspectj.weaver.WeaverState
            at org.objectweb.asm.Attribute.a(Unknown Source)
            at org.objectweb.asm.ClassWriter.toByteArray(Unknown Source)
            at com.mentorgen.tools.profile.instrument.Transformer.transform(Unknown Source)
            at sun.instrument.TransformerManager.transform(TransformerManager.java:122)
            at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:155)
            at java.lang.ClassLoader.defineClass1(Native Method)
            at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
            at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
            at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1650)
            at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:856)
            at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1305)
            at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1187)
            at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1027)
            at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:925)
            at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3880)
            at org.apache.catalina.core.StandardContext.start(StandardContext.java:4141)
            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:603)
            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:1118)
            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:1020)
            at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
            at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)
            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:680)
            at org.apache.catalina.startup.Catalina.start(Catalina.java:536)
            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:585)
            at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:275)
            at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

    any help would be greatly appreciated.  I am very interested in trying this out.
    I am running Tomcat 5.5.12 with JDK 1.5.0_06 on Windows XP Pro

     
    • Andrew Wilcox

      Andrew Wilcox - 2006-01-29

      Where to put the ASM jars -- excellent question! I found this to be a little confusing myself when I first started to develop JIP. The answer is neither common/lib nor the classpath. The ASM jars need to be kept in the same directory as profile.jar. The manifest in profile.jar contains a Boot-Class-Path which tells the VM where to load dependent jar files (in this case, the three ASM jars). Based on this, the VM will automatically load the ASM jars. So the source for your error is not classpath related.

      It looks like your also using AspectJ. JIP has not been tested with AspectJ and I wonder if there is some kind of conflict. JIP and ApsectJ both rewrite bytecode so maybe there is some incompatibility between the two. I would be very interested to understand more about what is happening here. I'll do some research on potential problems between the two. In the mean time, would it be possible for you to run a test with JIP but without AspectJ? Let me know if it works. This will be a good baseline -- ie, we know JIP works in your environment without AspectJ, but when you add AspectJ it breaks.

      Thanks for your post!

      Andrew.

       
    • Andrew Wilcox

      Andrew Wilcox - 2006-01-30

      JIP uses a byte code manipulation library called ASM to add a profiling "aspect" to the methods that are profiled. It looks like the version of ASM that JIP ships with (2.0) has some problems with the byte code that AspectJ generates. The good news is that it appears that ASM 2.2.1 fixes the problem. I need to do some testing, but I hope to have a new version of JIP with this fix available in the next few days.  If you don't want to wait, you can do a custom build of JIP. Here's what you would need to do:

      0. Get the source distribution of JIP 1.0.1 if you don't already have it.
      1. Download ASM 2.2.1 (from asm.objectweb.org download > ASM Stable Releases > Latest File Releases -- click on View All Project files)
      2. In the JIP project, replace the asm jars in the lib directory.
      3. Update src/manifest to reference the new ASM jars.
      4. Update build.xml to references the new ASM jars.
      5. Run: ant dist

      And you should be in business!

      If you decide to do this, please post your results here on SourceForge.

      Thanks,

      Andrew.

       
      • Mickey

        Mickey - 2006-01-31

        I tried what you suggested and am getting an error.  I placed the JAVA-OPTS variable in my User section of the system variables.  I downloaded the new jars and recompiled JIP.

        Does it matter which version of AspectJ that I am running.  I am running version 1.1.1 .

        java.lang.reflect.InvocationTargetException
                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:585)
                at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java)
                at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java)
                at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java)
                at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java)
                at org.apache.struts.action.ActionServlet.process(ActionServlet.java)
                at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
                at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
                at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
                at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
                at java.lang.Thread.run(Thread.java:595)
        Caused by: java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(ILjava/lang/String;Ljava/lang/String;[Ljava
        /lang/String;Ljava/lang/String;)V
                at net.sf.cglib.core.ClassEmitter.begin_class(ClassEmitter.java)
                at net.sf.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java)
                at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java)
                at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java)
                at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java)
                at net.sf.cglib.core.KeyFactory.create(KeyFactory.java)
                at net.sf.cglib.core.KeyFactory.create(KeyFactory.java)
                at net.sf.hibernate.impl.SessionFactoryImpl.<clinit>(SessionFactoryImpl.java)
                at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java)
                at edu.bcm.hgsc.star.database.DatabaseSessionFactory.makeSession(DatabaseSessionFactory.java)
                at edu.bcm.hgsc.star.actions.LoginAction.makeSession(LoginAction.java)
                at edu.bcm.hgsc.star.actions.LoginAction.performLogin(LoginAction.java)
                at edu.bcm.hgsc.star.actions.LoginAction.login(LoginAction.java)
                ... 26 more
        16   [http-8080-Processor25] WARN  org.apache.struts.action.RequestProcessor : Unhandled Exception thrown: class javax.s
        ervlet.ServletException
        16   [http-8080-Processor25] ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/STAR].[action] : Serv
        let.service() for servlet action threw exception
        java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(ILjava/lang/String;Ljava/lang/String;[Ljava/lang/Strin
        g;Ljava/lang/String;)V
                at net.sf.cglib.core.ClassEmitter.begin_class(ClassEmitter.java)
                at net.sf.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java)
                at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java)
                at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java)
                at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java)
                at net.sf.cglib.core.KeyFactory.create(KeyFactory.java)
                at net.sf.cglib.core.KeyFactory.create(KeyFactory.java)
                at net.sf.hibernate.impl.SessionFactoryImpl.<clinit>(SessionFactoryImpl.java)
                at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java)
                at edu.bcm.hgsc.star.database.DatabaseSessionFactory.makeSession(DatabaseSessionFactory.java)
                at edu.bcm.hgsc.star.actions.LoginAction.makeSession(LoginAction.java)
                at edu.bcm.hgsc.star.actions.LoginAction.performLogin(LoginAction.java)
                at edu.bcm.hgsc.star.actions.LoginAction.login(LoginAction.java)
                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:585)
                at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java)
                at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java)
                at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java)
                at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java)
                at org.apache.struts.action.ActionServlet.process(ActionServlet.java)
                at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
                at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
                at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
                at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
                at java.lang.Thread.run(Thread.java:595)

         
    • Mickey

      Mickey - 2006-01-31

      Update: I actually got the error when I tried to access my webapp.

       
    • Andrew Wilcox

      Andrew Wilcox - 2006-01-31

      Have you ever thought about being a system tester? You'd be awsome -- some people just have a gift for finding bugs!

      First off, there is a new version of JIP (1.0.2) that fixes the first problem you reported. From what you said, you've already rebuilt from the sources with the new version of ASM so effectively you've already upgraded.

      It looks like the error you're reporting here is different that the first one. The stack-trace is different and from what you've said, you're seeing this new problem when you hit Tomcat rather than when you start Tomcat. So we're making progress.

      What it looks like is that you're getting an error when your Struts login action calls Hibernate. Hibernate in turn calls CGLib which uses ASM. From what I can tell, it's using an older version of ASM. I think that there is a problem where Hibernate/CGLib are seeing the newer version of ASM that JIP is using rather than the older version that Hiberate/CGLib ships with. I need to run some tests to confirm this. In the mean time, could you confirm for me that JIP's ASM jars are not in common/lib or the system classpath? If either of those where the case, I can certainly see why you're having a problem.

      Andrew.

       
      • Mickey

        Mickey - 2006-01-31

        JIP's ASM jars are not in common/lib or the system classpath.  but i did put them in an environment variable called JAVA-OPTS as you had suggested.

         
        • Andrew Wilcox

          Andrew Wilcox - 2006-02-01

          I've done a support build with a change that I think will fix the problem you are seeing. You can download it at http://prdownloads.sourceforge.net/jiprof/jip-20060201.zip?download
          It should look just like a standard binary release of JIP except that there are no asm* jar files in  /profile.

          Let me know if this works or not. If it does, I'd like to put it in the next release of JIP.

          Since this bug involves Hiberate, it's pretty important that it gets fixed. Again, I really appreciate you taking the time to post your problems here so that they can get fixed since problems that I don't know about aren't going to fix themselves.

          Thanks,

          Andrew.

           

Log in to post a comment.