0 Replies Latest reply on Jul 1, 2008 2:24 AM by dhanushgopinath

    Hibernate Exception - javax.naming.NameNotFoundException: jb

    dhanushgopinath

      Hi All,

      I am trying to deploy a BPEL Process using API's. I have figured that out using the help in forum. (http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4161648#4161648).

      But when I am running the code - I am getting the following exception.

      11:50:05,675 DEBUG [Configuration] resolving reference to class: com.ibm.wsdl.MessageImpl
      11:50:05,675 DEBUG [Configuration] resolving reference to class: org.jbpm.bpel.graph.def.ImportDefinition
      11:50:05,754 INFO [NamingHelper] JNDI InitialContext properties:{}
      11:50:06,035 FATAL [DatasourceConnectionProvider] Could not find datasource: java:/DefaultDS
      javax.naming.NameNotFoundException: jbpmbpel-client not bound
       at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
       at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)


      The Sample Code is attached:

      
      import java.io.File;
      import java.io.FileInputStream;
      import java.io.FileNotFoundException;
      import java.util.zip.ZipInputStream;
      
      import org.jbpm.JbpmConfiguration;
      import org.jbpm.JbpmContext;
      import org.jbpm.bpel.graph.def.BpelProcessDefinition;
      import org.jbpm.bpel.persistence.db.BpelGraphSession;
      import org.jbpm.bpel.tools.WebModuleBuilder;
      import org.jbpm.graph.def.ProcessDefinition;
      import org.jbpm.jpdl.par.ProcessArchive;
      
      
      public class DeployProcess {
      
       public static void main(String[] args)
       {
       String fileName = "E:\\WorkFlowProjects\\JBoss-BPEL-Deployments\\Workflow3\\src\\Workflow3.zip";
      
       DeployProcess deployObj = new DeployProcess();
       deployObj.InitDeployDirectory();
       try {
       deployObj.Deploy(fileName,args);
       } catch (Exception e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
       }
      
      
      
       }
      
       private void InitDeployDirectory() {
       String deployDirectoryName = null;
       // deduce the deploy directory from environment information
       String serverHomeDirectory;
       try {
       serverHomeDirectory = "D:\\JBOSS\\jboss-4.2.0.GA";
       }
       catch (SecurityException e) {
       serverHomeDirectory = null;
       }
       deployDirectoryName = serverHomeDirectory + File.separatorChar + "deploy";
       deployDirectory = new File(deployDirectoryName);
      
       }
      
       private File deployDirectory = null;
      
       private void Deploy(String fileName, String[] args) throws Exception {
       String xmlResource =args[0]; //"D:\\JBOSS\\jbpm-bpel-1.1.GA\\config\\jbpm.cfg.xml";
       JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance(xmlResource);
       JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
       FileInputStream fisProcess = new FileInputStream(fileName);
       ProcessArchive processArchive = new ProcessArchive(new ZipInputStream(fisProcess));
       ProcessDefinition processDefinition = processArchive.parseProcessDefinition();
      
      
       if (processDefinition instanceof BpelProcessDefinition)
       {
       BpelGraphSession graphSession = BpelGraphSession.getContextInstance(jbpmContext);
       graphSession.deployProcessDefinition((BpelProcessDefinition) processDefinition);
       }
       else
       jbpmContext.deployProcessDefinition(processDefinition);
       if (processDefinition instanceof BpelProcessDefinition)
       deployWebModule((BpelProcessDefinition) processDefinition, fileName);
       }
      
       private void deployWebModule(BpelProcessDefinition processDefinition,
       String fileName) {
       File moduleFile = new File(deployDirectory, extractFilePrefix(fileName) + ".war");
      
       WebModuleBuilder builder = new WebModuleBuilder();
       builder.setModuleFile(moduleFile);
       builder.buildModule(processDefinition);
      
      
       }
      
       private static String extractFilePrefix(String fileName) {
       int dotIndex = fileName.lastIndexOf('.');
       return dotIndex != -1 ? fileName.substring(0, dotIndex) : fileName;
       }
      }
      
      


      This issue i have already reported in the earlier post. But I am posting this again hoping more people will notice the exception in the Post Title and respond.

      Please let me know if you have come across this exception. And if you know the solution please let me know.

      Thanks & Regards
      Dhanush