I am trying to use URLClassLoader class tor retrieve information about a class in the
local file system, using the version 4.0.5 of the JBoss application server.
I have a business function in a session bean class in which i do this:
| String classPathString = path;
| File classPath = new File(classPathString);
| File[] files = classPath.listFiles();
|
| try {
| URLClassLoader classLoader;
| Thread.currentThread().setContextClassLoader(
| classLoader = new URLClassLoader(
| new URL[] {files[0].toURL()}
| )
| );
| Class c = classLoader.loadClass("classbro.ejb.JClassBroBean");
| return c.getName();
| } catch(ClassNotFoundException e) {
| return "Class not found.";
| } catch(MalformedURLException e) {
| return "Malformed URL.";
| }
|
The call of loadClass throws a NoClassDefFoundError for javax/ejb/SessionBean, which I
cannot understand. The class which I put there exists and it is found, because I tested
this. How could I fix this problem?
Thanks.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3996881#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...