Drools 6.x Workbench cannot be deployed to tomcat on Windows - no resources registered with unique name "jdbc / jbpm"

I cannot run drools 6.2 in tomcat (version 7.x) for windows. This works great on my Linux machine. But on windows I get the following error:

Caused by: org.hibernate.service.jndi.JndiException: Unable to lookup JNDI name [java:comp/env/jdbc/jbpm]
    at org.hibernate.service.jndi.internal.JndiServiceImpl.locate(JndiServiceImpl.java:68)
    at org.hibernate.service.jdbc.connections.internal.DatasourceConnectionProviderImpl.configure(DatasourceConnectionProviderImpl.java:116)
    at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:85)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:184)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:156)
    at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.buildJdbcConnectionAccess(JdbcServicesImpl.java:223)
    at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:89)
    at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:85)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:184)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:156)
    at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1827)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1785)
    at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:96)
    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:915)
    ... 94 more
Caused by: javax.naming.NamingException: no resource registered with uniqueName 'jdbc/jbpm', available resources: []
    at bitronix.tm.resource.ResourceObjectFactory.getObjectInstance(ResourceObjectFactory.java:55)
    at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:141)
    at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)

      

+3


source to share


2 answers


Safely wrapped in warlock drools file is README.txt. Be sure to read it before proceeding. I followed most of the instructions. And it works really well on linux on the first try. But for windows, things are a little different:

STEP 3 in the README.txt file

*******************************************************************************

    NOTE: jdbc/jbpm is the JNDI name used by tomcat distribution of the application

3. Define system properties for btm.root, bitronix config file, JBoss logging provider and others.

    create setenv.sh (or setenv.bat) file inside TOMCAT_HOME/bin and add following:

    CATALINA_OPTS="-Xmx512M -XX:MaxPermSize=512m -Dbtm.root=$CATALINA_HOME \
    -Dbitronix.tm.configuration=$CATALINA_HOME/conf/btm-config.properties \
    -Djbpm.tsr.jndi.lookup=java:comp/env/TransactionSynchronizationRegistry \
    -Djava.security.auth.login.config=$CATALINA_HOME/webapps/kie-drools-wb/WEB-INF/classes/login.config \
    -Dorg.jboss.logging.provider=jdk"

    NOTE: this is an example for unix like systems for Windows $CATALINA_HOME needs to be replaced with windows env variable or absolute path
    NOTE: java.security.auth.login.config value includes name of the folder in which application is deployed by default it assumes kie-drools-wb so ensure that matches real installation.
    login.config file can be externalized as well meaning be placed outside of war file.


   *****************************************************************

      

In the above note:

NOTE: this example is for UNIX-like systems for Windows $ CATALINA_HOME needs to be replaced with env variable or absolute path

This applies to all files. This is where things get complicated if you are not (like me) an expert with batch and windows. So I'll tell you 2 things and give you the exact changes I made to get it working.



  • The above note applies to all files.
  • Just setting an environment variable with a real path didn't make it work for me, I also needed to remove those odd forward slashes.

Below are the exact steps I followed:

  • In resource.properties, change the path of this prop in windows format instead of linux. (~ on linux means home directory)

    resource.ds1.driverProperties.url=jdbc:h2:file:C:/Users/nanospeck/Downloads/apache-tomcat-7.0.54/temp2

  • In Catalina.bat add the full content of the line 'set CATALINA_OPTS' above CATALINA_HOME (or you can try adding it to setenv.bat too, it might work). Change the path according to the locations in your car of course.

echo Using CATALINA_BASE: "% CATALINA_BASE%"

set CATALINA_OPTS=-Xmx512M -XX:MaxPermSize=512m -Dbtm.root=C:\Users\nanospeck\Downloads\apache-tomcat-7.0.54\ -Dbitronix.tm.configuration=C:\Users\nanospeck\Downloads\apache-tomcat-7.0.54\conf\btm-config.properties -Djbpm.tsr.jndi.lookup=java:comp/env/TransactionSynchronizationRegistry -Djava.security.auth.login.config=C:\Users\nanospeck\Downloads\apache-tomcat-7.0.54\webapps\kie-drools-wb\WEB-INF\classes\login.config -Dorg.jboss.logging.provider=jdk

echo Using CATALINA_HOME:   "%CATALINA_HOME%"
echo Using CATALINA_TMPDIR: "%CATALINA_TMPDIR%"

      

+2


source


I followed the readme workbench instructions in the answer below with a few changes - I had to add jvm options not via setenv.bat but directly to tomcat startup options. Also i used full path without environment variable name% catalina_home% in path enter image description here



-Dbtm.root=C:\Program Files\Apache Software Foundation\Tomcat 8.0
-Dbitronix.tm.configuration=C:\Program Files\Apache Software Foundation\Tomcat 8.0\conf\btm-config.properties
-Djbpm.tsr.jndi.lookup=java:comp/env/TransactionSynchronizationRegistry
-Djava.security.auth.login.config=C:\Program Files\Apache Software Foundation\Tomcat 8.0\webapps\kie-drools-wb\WEB-INF\classes\login.config
-Dorg.jboss.logging.provider=jdk

      

+2


source







All Articles