5 Replies Latest reply on Dec 21, 2004 6:54 AM by Felipe Leite

    Failed to aspectize class

    Felipe Leite Newbie

      Hi all,

      I origanally posted this topic on the begginers corner, but it seems that this can be a more appropriate forum to post this topic. If you know a better forum to post this, tell me and I will post there.

      I am using JBossCache as hibernate's 2nd level cache for my application. Actually I am trying to use TreeCacheAOP, but without success.

      I am using the JBossAOP class loader (-Djava.system.class.loader=org.jboss.aop.standalone.SystemClassLoader) to make the AOP magic, but the application fails while trying to aspectize some classes that I thought would not be touched.

      The error message is:
      [error] Failed to aspectize class oracle.sql.converter.CharacterConverterFactoryOGS. Could not find class it references oracle.i18n.text.converter.CharacterConverterOGS.. Do verbose mode if you want full stack trace.
      java.lang.Error: Error transforming the class oracle.sql.converter.CharacterConverterFactoryOGS: org.jboss.aop.instrument.TransformationException: Failed to aspectize class oracle.sql.converter.CharacterConverterFactoryOGS. Could not find class it references oracle.i18n.text.converter.CharacterConverterOGS
      at org.jboss.aop.standalone.SystemClassLoader.loadClass(SystemClassLoader.java:191)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:141)
      at net.sf.hibernate.connection.DBCPConnectionProvider.configure(DBCPConnectionProvider.java:64)

      Now I don't know what to do. I would like a lot to use TreeCacheAOP, because it seems to be significantly faster than TreeCache for my cluster enviroment.

      I don't know if it is possible, but can I make jboss-aop only play with the classes whose instances will be cached, or it has to aspectize every class that the classloader loads? Sorry if this is a silly question, but I am a begginer with either JBossCache, JBossAOP and AOP in general and I couldn't find much help in the documentation.

      I'm not running JBoss server, but i think that all needed jars are in the JARs in classpath:

      hibernate2.jar
      jboss-cache.jar
      jboss-common.jar
      jboss-jmx.jar
      jboss-system.jar
      concurrent.jar
      jboss-remoting.jar
      log4j.jar
      jboss-minimal.jar
      jboss-aop.jar
      javassist.jar
      trove.jar

      All these jars came with hibernate 2.1.6 or with jboss-cache 1.2.

      Thanks in advance,
      Felipe Leite

        • 1. Re: Failed to aspectize class
          Ben Wang Master

          It is not recommended to use TreeCacheAop inside Hibernate. Reason is simple. Hibernate is managing the object graph and relationship, already. So TreeCacheAop is redundant. Use TreeCache instead.

          -Ben

          • 2. Re: Failed to aspectize class
            Felipe Leite Newbie

            Hi Ben,

            Ok I will give up on TreeCacheAOP.

            I tryed to use TreeCache, but some error messages were showed. TreeCache was trying to remove an object that was not in the cache, and these objects were meant to be in the cache. These objects were joined-subclasses, and TreeCache was not putting them on any node, and was trying to remove from the superclass node.

            If this information is not enough for you, tell me and I will try to create a simple test case for this.

            Thanks for your answer,
            Felipe Leite

            • 3. Re: Failed to aspectize class
              Felipe Leite Newbie

              Investigating more, I have found what seems to be the real problem.

              I have a class B that is a subclass (joined-subclass) of A.

              If I load B with id 1, then update it, and then update it again, the following message is showed:

              ERROR: 2004-12-20 16:23:10 org.jboss.cache.TreeCache: node //com/test/A/1 not found

              When I update B the first time, its cache is removed (is this a wrong behaviour?). If B is not a joined-subclass, everything seems to be ok. Its cache entry is not removed and the second update goes ok.

              I don't know if this is the right place to post this, or if this is more Hibernate related. If so, let me know and I will post this on the Hibernate forum.

              Thanks in advance,
              Felipe Leite

              • 4. Re: Failed to aspectize class
                Ben Wang Master

                It's difficult to say now. Which version of JBossCache is that? Or which version of Hibernate? Maybe you can post more details of the log.

                -Ben

                • 5. 3785706
                  Felipe Leite Newbie

                  Hi Ben,

                  I made a simple test case and posted it on the Hibernate forum. The link to that post is http://forum.hibernate.org/viewtopic.php?t=937210

                  If you prefer that I post it here, let me know. By the way, I am using Hibernate 2.1.6 and JBossCache 1.2.

                  Thanks,
                  Felipe Leite