JBoss Community

Re: How to add Java code to the jbpm process

created by Jaiyachandhiran Thangaraju in jBPM - View the full discussion

Hi

 

Thanks for ur reply.  Now i have created a simple process and wrote a simple java code.

 

Java Code

 

public void execute(ExecutionContext executionContext) throws Exception {
  // TODO Auto-generated method stub
    String query = "SELECT login_name from rs_users";

  System.out.println("Testing JAVA Code");
     Class.forName("oracle.jdbc.driver.OracleDriver");
     Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","resonancedev","resonancedev");
     Statement stmt = con.createStatement();
     ResultSet rs = stmt.executeQuery(query);
     while (rs.next()) {
       String message = rs.getString("login_name");
           System.out.println("name-->" +message);
           }
         con.close();

  //executionContext.getContextInstance().setVariable("message", message);
 
}

 

 

 

 

 

 

I tried to start the process from console and i get the below error.

 

 

  Failed to start process: class 'oracle.jdbc.driver.OracleDriver' could not be found by the process classloader

 

I have added the jar file to the project, I need to know where to add this jar file?

 

Please reply me

Reply to this message by going to Community

Start a new discussion in jBPM at Community