Thanks, that helps. A couple questions/points of clarification:
1. I figured it was a ClassLoader problem, but there are so many different
ClassLoaders flying around, it is hard to keep track of, especially for a
newbie. What I would really like to be able to do is change to a
ClassLoader that definitely has access to the jboss.jar stuff, then switch
back before returning. What would you suggest for this?
2. I knew about the jboss-client.jar thing. I made sure that was taken
care of. And, the load still failed when I called it directly out of
TransactionManagerService::initService(), which I assume has access to all
the jboss.jar stuff.
Actually, I think I am going to try to attack some easier problems first,
like adding support for the SessionSynchronization interface on stateful
session beans. Also, the problem of making UserTransaction available to
beans is a little simpler, since I would just have to use a factory that
called getUserTransaction from their own EnterpriseContext. So I may try
that first.
-Charles
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Aaron Mulder
Sent: Saturday, September 16, 2000 8:23 PM
To: jBoss Developer
Subject: Re: [jBoss-Dev] UserTransaction
Sounds like a ClassLoader problem. There are a number of
ClassLoaders here. All MBeans are loaded by one. Each EJB JAR uses a
separate one. Each servlet context in Tomcat uses yet another one. What
you should try to do is determine which ClassLoader loads your factory
classes and which is current when you get the ClassNotFoundException or
NoClassDefFoundError. Depending on the combination, you may be able to
set the correct ClassLoader to be current before you do whatever it is you
need to do. If you're using Tomcat, make sure you include the
JDK12Interceptor in the xerver.xml file (See the Tomcat instructions on
the web page). But if your client is the one executing the code to create
a UserTransImpl, remember that your client does not have access to
UserTransImpl unless you get it included in jboss-client.jar (jboss.jar is
not good enough). And even if the server process creates it, it may get
serialized to the client, in which case the class still needs to be
available in the client's ClassLoader.
Aaron
On Sat, 16 Sep 2000, Charles Crain wrote:
> Ugh, I am having more toruble with this than I thought I would. Since the
> problem of prvidign a UserTransaction to clients running in jBoss that are
NOT
> beans (i.e., Tomcat servlets) is a harder thing to do, I decided to attack
it
> first. The problem I am running into is weird...I created two new
classses
> under org/jboss/tm, UserTransactionFactory and UserTransImpl. As you
might
> guess, UserTransactionFactory is an ObjectFactory that creates
UserTransImpl
> objects. Again, I could not use the EnterpriseContext's
getTransactionFactory,
> because I am trying to serve up UserTransaction's to ALL clients running
in our
> VM.
>
> The problem is, whenever I try to create a UserTransImpl object I get a
> NoClassDefFound exception. This appears regardless of where/when I try to
> actually create it (at the time of the TransactionManagerService
initialization,
> when it is actually looked up, etc.). I checked and that class is
DEFINITELY in
> the jboss.jar file. Any ideas?
>
> -Charles