Hi all,

I'm trying to use jBPM 3.1 in an EJB project.  Don't care about Hibernate 
functionality, just in-memory usage of jBPM from a session bean.  I created an 
action and ran into a class loading exception that from past messages in this 
forum I can see isn't unusual.  Alas, in my project using the UCL isn't an 
option (even if it were, I'm not a fan of the UCL).  I was looking in 
ProcessClassLoader to see what I could do about the problem, code shown below:


  |   public Class findClass(String name) throws ClassNotFoundException {
  |     Class clazz = null;
  |     FileDefinition fileDefinition = processDefinition.getFileDefinition();
  |     if (fileDefinition!=null) {
  |       String fileName = "classes/" + name.replace( '.', '/' ) + ".class";
  |       byte[] classBytes = fileDefinition.getBytes(fileName);
  |       clazz = defineClass(name, classBytes, 0, classBytes.length);
  |     }
  |     if (clazz==null) {
  |       throw new ClassNotFoundException("class '"+name+"' could not be found 
by the process classloader");
  |     }
  |     return clazz;
  |   }
  | 

Unless I'm missing something, jBPM is only capable of loading classes that 
exist in a "classes" directory off the current classpath?  Isn't that kinda 
strange?  Isn't a "classes" dir what should be ON the classpath, not a 
subdirectory of something else on the classpath?

The above implementation seems like it would be easy to fix so that it would 
work for components that have an appropriate classpath (e.g. because they have 
a manifest-specified classpath).  Allowing for prioritizing backward 
compatibility with whatever motivated the original code, couldn't we just do:


  |     clazz = (clazz == null) ? super.findClass(name) : clazz;
  |     if (clazz==null) {
  |       throw new ClassNotFoundException("class '"+name+"' could not be found 
by the process classloader");
  |     }
  | 

Am I missing something?


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

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


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to