-
1. Re: java.lang.NoClassDefFoundError: org/jboss/cache/TreeCach
brian.stansberry Jan 5, 2006 12:56 PM (in response to vovik1)Hi Vladi,
I suspect the class def it can't find *isn't* org.jboss.cache.TreeCache, but rather some other class that TreeCache uses. One of my favorite java quirks is the fact that a NoClassDefFoundError tells you the class it was trying to initialize when it couldn't find a class, rather than the missing class itself.
Did you copy over jgroups.jar as well? -
2. Re: java.lang.NoClassDefFoundError: org/jboss/cache/TreeCach
vovik1 Jan 5, 2006 1:04 PM (in response to vovik1)Hi Brian,
Thanks for your reply.
I've thought about that. I did copy jgroups.jar there (default/lib).
Should I copy something else?
Vladi. -
3. Re: java.lang.NoClassDefFoundError: org/jboss/cache/TreeCach
brian.stansberry Jan 5, 2006 1:43 PM (in response to vovik1)jboss-cache.jar and jgroups.jar should be all you need; all other JBossCache dependencies are already on the classpath in the default config.
Suggest you try the following (I just did this and it worked fine):
1) Remove any JBOSS_CLASSPATH tweaks you may have done; get JBoss into its standard state except you've got jboss-cache.jar and jgroups.jar in default/lib.
2) Copy the tc5-cluster-service.xml file from all/deploy to default/deploy. This file starts the TreeCache we use for HttpSession replication. You don't need it, but if it deploys correctly we know that a cache instance can be started.
3) Remove your ear (so we can get a clean picture).
4) Start JBoss. If the tree cache starts cleanly, we know the needed classes are on the classpath. If then your app still has a problem, there is something odd with the classloading configuration of your ear. -
4. Re: java.lang.NoClassDefFoundError: org/jboss/cache/TreeCach
vovik1 Jan 5, 2006 3:05 PM (in response to vovik1)Brian,
Thanks so much.
I did what you said and it started working!!!
I guess the problem was in the order of my actions.
I copied jboss-cache.jar
It didn't work, so I explicitly added jboss-cache.jar to the JBOSS_CLASSPATH
It didn't work either, so I copied over jgroups.jar (by the way, I don't think there is a documentation about it. I just guessed)
Then, it didn't work again.
Only removing jboss-cache.jar from the JBOSS_CLASSPATH did the trick.
(this last attempt I haven't done, I mostly tried to copy other .jars and to different places).
The real problem here is (I guess): Why does loader complain about TreeCache class when it misses something else. I am sure that standard JVM loader (at least 1.4 JVM) does not do that (I've been through it ones).
Any way, thanks a lot.
I really appreciate it!
Vladi. -
5. Re: java.lang.NoClassDefFoundError: org/jboss/cache/TreeCach
brian.stansberry Jan 5, 2006 3:20 PM (in response to vovik1)Glad it worked; hadn't really thought through why the JBOSS_CLASSPATH setting would be a problem, but experience has taught me to start with a clean setup :)
I see now why it would be a problem -- jars loaded via JBOSS_CLASSPATH are in a parent classloader to those loaded from default/lib. If you loaded jboss-cache.jar from JBOSS_CLASSPATH and jgroups.jar from default/lib, the classloader that loaded jboss-cache.jar would not be able to see jgroups.jar.The real problem here is (I guess): Why does loader complain about TreeCache class when it misses something else. I am sure that standard JVM loader (at least 1.4 JVM) does not do that (I've been through it ones).
That's interesting. I've seen this kind of problem many times, but honestly can't recall if it was always in JBoss. If I get a chance I'll check it out.
(If anyone in the community wants to look into whether this misleading message is a JBoss issue and finds that it is, please write a test case and create a JIRA issue. Please search JIRA first in case there is an existing issue).