[jboss-user] [Beginners Corner] - Dynamic Class loading

brilleaben do-not-reply at jboss.com
Tue Jul 10 09:02:01 EDT 2007


Hello,


Having read through lots of posts, documents and pages found on Google and still having a, to me, strange problem, I turn to the gurus on jboss.org ...

Situation: I start my main application from within jboss.  My application will generate dynamic java classes outside the jboss directories.
When the classes needs to be loaded the class loading fails with a "Class Not Found Exception".
However, if I restart jboss and loads the previously generated classes everything runs smoothly.

In the jboss-service.xml for the .sar I have a line:



My classes are in a com.hp package and their name starts with Dyn{autogen-id}.   The {autogen-id} is a autogenerated name based on a md5 sum of some of the properties of the class (path, name etc).

A full path to a class would be:

c:\HP\myapp\classes\com\hp\DynXXX.class

To find/load the class I use the following:

class = Thread.currentThread().getContextClassLoader().loadClass("com.hp.DynXXX");

So ... my question is:  how do I "hot deploy" a class outside of the jboss directory hierarchy?


Kind regards,
Brian

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4062417#4062417

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4062417



More information about the jboss-user mailing list