3 Replies Latest reply on Dec 2, 2009 8:17 AM by seancronin

    java.lang.NoClassDefFoundError: org/jaxen/VariableContext ex

    seancronin

      Hi,

      I am getting a java.lang.NoClassDefFoundError: org/jaxen/VariableContext exception when using JBoss Cache after a period of inactivity. I hope you can help me.

      Regards,

      Sean.


      Here is the problem in detail:

      The scenario is as follows:

      1. - create cache

      private MBeanServer server = MBeanServerLocator.locateJBoss();

      private TreeCacheMBean cache = (TreeCacheMBean) MBeanProxyExt.create(TreeCacheMBean.class, "jboss.cache:service=TreeCache", server);

      2. Load various data into the cache

      3. Access Seam based web application that reads some of these data.

      4. Leave webpage inactive, at 5 minute intervals the exception message at the end of this post is created.

      - I'm aware that the root exception (Caused by: java.lang.NoClassDefFoundError: org/jaxen/VariableContext) may be a red herring/not really the problem judging by this issue report:

      https://jira.jboss.org/jira/browse/EJBTHREE-1297.

      Jaxen.jar is definately in my classpath.

      - My environment is:
      JBoss Cache 1.4.1
      JBoss 4.3
      Seam 2.1.2
      Windows XP

      - I have configured a cache loader to use a data source for a MYSQL database (MYSQL 5.0)

      - I am not using a clustered environment at present, and have therefore set attribute name="cacheMode" to equal "LOCAL" in my JBoss cache configuration file (jboss-service.xml)

      - The problem occurs whether or not I set passivation to false in my Jboss-service.xml

      - Here is some debug information about my cache:


      eviction policy class = null
      eviction thread wakeup interval = 0
      FetchInMemoryState = true
      NumberOfAttributes = 37
      NumberOfNodes = 14
      isUsingEviction = false
      isUsingMultiplexer = false


      HERE IS MY JBOSS-SERVICE.XML


      <?xml version="1.0" encoding="UTF-8"?>

      <!-- ===================================================================== -->
      <!-- -->
      <!-- Sample TreeCache Service Configuration -->
      <!-- -->
      <!-- ===================================================================== -->






      <!-- ==================================================================== -->
      <!-- Defines TreeCache configuration -->
      <!-- ==================================================================== -->



      jboss:service=Naming
      jboss:service=TransactionManager
      jboss.jca:service=DataSourceBinding,name=SAPDatasource



      <!--
      Configure the TransactionManager
      -->
      org.jboss.cache.JBossTransactionManagerLookup


      <!--
      Node locking level : SERIALIZABLE
      REPEATABLE_READ (default)
      READ_COMMITTED
      READ_UNCOMMITTED
      NONE
      -->
      REPEATABLE_READ

      <!--
      Valid modes are LOCAL
      REPL_ASYNC
      REPL_SYNC
      INVALIDATION_ASYNC
      INVALIDATION_SYNC
      -->
      LOCAL

      <!-- Name of cluster. Needs to be the same for all clusters, in order
      to find each other
      -->


      TreeCache-Cluster

      <!-- JGroups protocol stack properties. Can also be a URL,
      e.g. file:/home/bela/default.xml

      -->




      <!-- UDP: if you have a multihomed machine,
      set the bind_addr attribute to the appropriate NIC IP address -->
      <!-- UDP: On Windows machines, because of the media sense feature
      being broken with multicast (even after disabling media sense)
      set the loopback attribute to true -->
      <UDP mcast_addr="228.1.2.5" mcast_port="45577"
      ip_ttl="64" ip_mcast="true"
      mcast_send_buf_size="150000" mcast_recv_buf_size="80000"
      ucast_send_buf_size="150000" ucast_recv_buf_size="80000"
      loopback="false"/>
      <PING timeout="2000" num_initial_members="3"
      up_thread="false" down_thread="false"/>
      <MERGE2 min_interval="10000" max_interval="20000"/>
      <FD shun="true" up_thread="true" down_thread="true"/>
      <VERIFY_SUSPECT timeout="1500"
      up_thread="false" down_thread="false"/>
      <pbcast.NAKACK gc_lag="50" retransmit_timeout="600,1200,2400,4800"
      up_thread="false" down_thread="false"/>
      <pbcast.STABLE desired_avg_gossip="20000"
      up_thread="false" down_thread="false"/>
      <UNICAST timeout="600,1200,2400" window_size="100" min_threshold="10"
      down_thread="false"/>
      <FRAG frag_size="8192"
      down_thread="false" up_thread="false"/>
      <pbcast.GMS join_timeout="5000" join_retry_timeout="2000"
      shun="true" print_local_addr="true"/>
      <pbcast.STATE_TRANSFER up_thread="false" down_thread="false"/>




      <!--
      The max amount of time (in milliseconds) we wait until the
      initial state (ie. the contents of the cache) are retrieved from
      existing members in a clustered environment
      -->

      20000


      <!--
      Number of milliseconds to wait until all responses for a
      synchronous call have been received.
      -->
      15000

      <!-- Max number of milliseconds to wait for a lock acquisition -->
      10000


      <!-- Name of the eviction policy class. Not supported now. -->





      false
      <!-- not sure if this means everything or nothing is preloaded -->
      /selectionCriteriaResults


      org.jboss.cache.loader.JDBCCacheLoader

      <!-- same as the old CacheLoaderConfig attribute -->

      cache.jdbc.datasource=java:/SAPDatasource


      <!-- whether the cache loader writes are asynchronous -->
      false

      <!-- only one cache loader in the chain may set fetchPersistentState to true.
      An exception is thrown if more than one cache loader sets this to true. -->
      true

      <!-- determines whether this cache loader ignores writes - defaults to false. -->
      false

      <!-- if set to true, purges the contents of this cache loader when the cache starts up.
      Defaults to false. -->
      true












      HERE IS THE EXCEPTION

      2009-11-09 15:19:23,251 FATAL [org.jboss.serial.persister.RegularObjectPersister writeSlotWithMethod] error
      java.lang.reflect.InvocationTargetException
      at sun.reflect.GeneratedMethodAccessor731.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithMethod(RegularObjectPersister.java:120)
      at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:86)
      at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
      at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206)
      at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithFields(RegularObjectPersister.java:182)
      at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:90)
      at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
      at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206)
      at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithFields(RegularObjectPersister.java:182)
      at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:90)
      at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
      at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206)
      at org.jboss.serial.persister.ObjectOutputStreamProxy.writeObjectOverride(ObjectOutputStreamProxy.java:60)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:298)
      at EDU.oswego.cs.dl.util.concurrent.CopyOnWriteArrayList.writeObject(CopyOnWriteArrayList.java:772)
      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.jboss.serial.persister.RegularObjectPersister.writeSlotWithMethod(RegularObjectPersister.java:120)
      at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:86)
      at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
      at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206)
      at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithFields(RegularObjectPersister.java:182)
      at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:90)
      at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
      at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206)
      at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithFields(RegularObjectPersister.java:182)
      at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:90)
      at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
      at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206)
      at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithFields(RegularObjectPersister.java:182)
      at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:90)
      at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
      at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206)
      at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithFields(RegularObjectPersister.java:182)
      at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:90)
      at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
      at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206)
      at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithFields(RegularObjectPersister.java:182)
      at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:90)
      at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
      at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206)
      at org.jboss.serial.persister.ObjectOutputStreamProxy.writeObjectOverride(ObjectOutputStreamProxy.java:60)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:298)
      at EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap.writeObject(ConcurrentReaderHashMap.java:1230)
      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.jboss.serial.persister.RegularObjectPersister.writeSlotWithMethod(RegularObjectPersister.java:120)
      at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:86)
      at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
      at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206)
      at org.jboss.serial.persister.ObjectOutputStreamProxy.writeObjectOverride(ObjectOutputStreamProxy.java:60)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:298)
      at EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap.writeObject(ConcurrentReaderHashMap.java:1230)
      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.jboss.serial.persister.RegularObjectPersister.writeSlotWithMethod(RegularObjectPersister.java:120)
      at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:86)
      at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
      at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206)
      at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithFields(RegularObjectPersister.java:182)
      at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:90)
      at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
      at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206)
      at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithFields(RegularObjectPersister.java:182)
      at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:90)
      at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
      at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206)
      at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithFields(RegularObjectPersister.java:182)
      at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:90)
      at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
      at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206)
      at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithFields(RegularObjectPersister.java:182)
      at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:90)
      at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
      at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206)
      at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithFields(RegularObjectPersister.java:182)
      at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:90)
      at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
      at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206)
      at org.jboss.serial.persister.ArrayPersister.saveObjectArray(ArrayPersister.java:110)
      at org.jboss.serial.persister.ArrayPersister.writeData(ArrayPersister.java:101)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
      at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206)
      at org.jboss.serial.io.JBossObjectOutputStream.writeObjectOverride(JBossObjectOutputStream.java:181)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:298)
      at org.jboss.serial.io.MarshalledObject.(MarshalledObject.java:51)
      at org.jboss.ejb3.stateful.StatefulBeanContext.writeExternal(StatefulBeanContext.java:855)
      at org.jboss.serial.persister.ExternalizePersister.writeData(ExternalizePersister.java:58)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
      at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206)
      at org.jboss.serial.io.JBossObjectOutputStream.writeObjectOverride(JBossObjectOutputStream.java:181)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:298)
      at org.jboss.ejb3.cache.simple.StatefulSessionFilePersistenceManager.passivateSession(StatefulSessionFilePersistenceManager.java:390)
      at org.jboss.ejb3.cache.simple.SimpleStatefulCache.passivate(SimpleStatefulCache.java:301)
      at org.jboss.ejb3.cache.simple.SimpleStatefulCache$SessionTimeoutTask.run(SimpleStatefulCache.java:209)
      Caused by: java.lang.NoClassDefFoundError: org/jaxen/VariableContext
      at java.lang.Class.getDeclaredMethods0(Native Method)
      at java.lang.Class.privateGetDeclaredMethods(Class.java:2395)
      at java.lang.Class.getDeclaredMethod(Class.java:1907)
      at org.jboss.serial.classmetamodel.ClassMetaData.lookupMethodOnHierarchy(ClassMetaData.java:102)
      at org.jboss.serial.classmetamodel.ClassMetaData.lookupInternalMethods(ClassMetaData.java:432)
      at org.jboss.serial.classmetamodel.ClassMetaData.(ClassMetaData.java:122)
      at org.jboss.serial.classmetamodel.ClassMetamodelFactory.getClassMetaData(ClassMetamodelFactory.java:350)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:168)
      at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206)
      at org.jboss.serial.persister.ArrayPersister.saveObjectArray(ArrayPersister.java:110)
      at org.jboss.serial.persister.ArrayPersister.writeData(ArrayPersister.java:101)
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
      at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206)
      at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithFields(RegularObjectPersister.java:182)
      at org.jboss.serial.persister.ObjectOutputStreamProxy.writeFields(ObjectOutputStreamProxy.java:79)
      at org.jboss.serial.persister.ObjectOutputStreamProxy.defaultWriteObject(ObjectOutputStreamProxy.java:68)
      at java.util.Vector.writeObject(Vector.java:1018)
      ... 120 more

        • 1. Re: java.lang.NoClassDefFoundError: org/jaxen/VariableContex
          seancronin

          Hi everyone,

          please ignore this. I've fixed the problem, which was nothing to do with JBoss Cache (and nothing to do with a missing class file either :-) )

          • 2. Re: java.lang.NoClassDefFoundError: org/jaxen/VariableContex
            galder.zamarreno

            So Sean, what was the issue? Maybe other readers can benefit from the same fix you did...

            • 3. Re: java.lang.NoClassDefFoundError: org/jaxen/VariableContex
              seancronin

              The system I'm building currently has a stateful session bean between the seam layer and JBoss Cache (for historical reasons, this might not be our final architecture). The stateful bean passivated at its default time of 5 minutes. My TreeCacheMBean and objects within it were within the session bean. I'm guessing bad things happened as passivation of the cache and it's contents was attempted by the session bean (into another cache)?

              In case you don't know you can set this time on a stateful bean (non clustered environment using the annotation @org.jboss.annotation.ejb.cache.simple.CacheConfig) and/or implement the ejbPassivate method to clean up before passivation.

              The error occuring in 5 minutes was the giveaway. Seems to be quite a common default value in the JBoss world.