From: Urberg, J. <ju...@ve...> - 2002-08-08 14:04:24
|
> Damn! I really don't understand why the following line wouldn't > work: > > ds.storeResource( > resources[i], Thread.currentThread().getContextClassLoader() > ); > >( in SessionFactoryStub.getImpl() ). Have I got it totally wrong, > or isn't Thread.currentThread.getContextClassLoader() meant to get > the classloader used by the calling EJB? Perhaps I'm > hallucinating... I often feel that way when confronted with class loaders. I don't know much about them yet, so I can't be much help there. >> The only way I can see making this MBean useful is if users put all >> their mapped classes and mappings in the server's classpath. Then >> they can put them all in one mapping or split them up and it won't >> matter because the MBean and SessionFactoryStub will have access >> to them. I should always test it out before I make pronounciations! I tried my little example with the jar files containing the mapping files in Jboss's lib/ext directory (which get loaded when JBoss starts up). I got the same exception as I did when it was in the EJB jar file. The SesstionFactory stub could not find it. When I moved the creation of the SessionFactory completely into a class in my jar file, everything worked a.o.k. (This last version is what I'm doing in my application) My original attempt created the session factory in the MBean at startup. I had the domain classes in jboss's lib/ext directory and the MBean seemed to find them ok. Unless someone has some classloader answers for you, this will probably be the only way to do it. Regards, John |