Drools 6.x Workbench cannot be deployed to tomcat in windows- no resource registered with uniqueName 'jdbc/jbpm'

3.3k views Asked by At

I cannot start drools 6.2 in tomcat (version 7.x) for Windows. This was working fine in my linux machine. But in windows I keep getting 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

There are 3 answers

1
nanospeck On

Safely wrapped inside the drools war file is a README.txt. Make sure you read it before you continue from here.I followed most of the instructions. And it works pretty well in linux in the first try. But for windows things are a bit different:

STEP 3 in README.txt

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

    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 this:

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

This applies for all files. Here, things get complicated if you are not (like me) an expert with batch and windows. So I will tell you 2 things and give the exact change I made to make it work.

  1. The above note applies for all files.
  2. Just setting the environment variable with real path didn't make it work for me, i needed to remove those odd slashes too.

Here are the exact steps I followed:

  1. In the resources.properties change the path of this prop to be in windows format instead of linux. (~ in linux means home directory)

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

  2. In the catalina.bat add the full content of line 'set CATALINA_OPTS' above CATALINA_HOME ( or you may try adding it to setenv.bat too, might work). Of course change the path to suit the locations in you machine.

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%"
0
Pete_ch On

I followed The workbench readme instructions in the answer below with a few changes - I had to add the jvm options not through the setenv.bat but directly in the tomcat startup options. Also I used the full path without the %catalina_home% environment variable name in the 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
0
Edwin Quita On

In windows, setenv.bat should be like this:

SET 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