Hi everyone:
          I was worked with javasssist a few days but I have a cuesstion about it, but 
the main cuestion is how integrate javassist with jboss, because really I don't know 
after 5 days of work on it.

         My problem is the next,  i created a new class (without problems), but when a 
mdb  try to execute it ways its catch the same error "ClassNotFound",  I think that is 
because the class is not in the classloader. Please help me. 



 public static void createScript(String nameScript, String inputTextScript) 
  |                             throws NotFoundException, CannotCompileException, 
IOException{
  |         
  |         try{
  |         ClassPool pool;
  |         
  |             pool = ClassPool.getDefault();
  | 
  |             pool.appendClassPath(classPath);
  |                 
  |             CtClass newClass = pool.makeClass( nameScript );
  |             newClass.stopPruning(true);
  |             
  |             CtClass superClass = null;
  |             superClass = pool.get( packageName + suffixClass );
  |             
  |             newClass.setSuperclass(superClass);
  |             
  |             newClass.addConstructor(CtNewConstructor.defaultConstructor(newClass));
  | 
  |             executeBody = executeBody + inputTextScript ;
  |                         
  |             newClass.addMethod(CtNewMethod.make(executeBody, newClass));
  |             newClass.writeFile(workingDir);
  |             newClass.defrost();
  |             newClass.detach();
  |         }
  |         catch (NotFoundException e ){
  |             throw e;
  |             
  |         }
  |         catch (CannotCompileException e ){
  |                     throw e;
  |         }
  |         catch (IOException e ){
  |                     throw e;
  |         }
  |         
  |          
  |     }
  |      
  |     
  |     
  |     
  |     public static ArrayList executeScript(String name, Mensaje msg){
  |         
  |         ArrayList msgs = null;
  | 
  |         
  |         Class c = null;
  |         
  | 
  |         
  |         try {
  |             c = Class.forName(name);
  |         } catch (ClassNotFoundException e) {
  |             e.printStackTrace();
  |         }
  |                 
  | 
  |         Object testConstructed = null;
  |         try {
  |             testConstructed = c.newInstance();
  |         } catch (InstantiationException e1) {
  |             e1.printStackTrace();
  |         } catch (IllegalAccessException e1) {
  |             e1.printStackTrace();
  |         }
  |                    
  |        Script valor = (Script) testConstructed;
  |      
  |        msgs = valor.execute();
  |        return msgs;
  |            
  |         
  |     }
  | 

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

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


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to