2 Replies Latest reply on Oct 2, 2017 10:22 AM by Tom Jenkinson

    JNDI lookup issue in ubuntu packaged Tomcat7-8

    simone pascucci Newbie

      Hi there,

       

      I recently developed a batch spring based webapp which makes use of 3 datasources spanning across distinct mysql instances, successfully tested on the official Apache Tomcat 7 (0.68, 0.72, 0.76) and 8.0.32 distributions, using the tomcat jta module of the narayana release 5.7.0-FINAL (tested also using 5.6.0-FINAL).

       

      Datasources are defined as follow as global resources in server.xml

       

           <Resource

              factory="com.mysql.jdbc.jdbc2.optional.MysqlDataSourceFactory"

              name="jdbc/idb-readwrite-transactional"

              auth="Container"

              type="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource"

              driverClassName="com.mysql.jdbc.Driver"

              username="readwrite"

              password="*******"

              url="jdbc:mysql://idb-dev.****.*****.com:3306"

              explicitUrl="true"

          />

       

          <Resource

              factory="com.mysql.jdbc.jdbc2.optional.MysqlDataSourceFactory"

              name="jdbc/idb-readwrite-batch-transactional"

              auth="Container"

              type="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource"

              driverClassName="com.mysql.jdbc.Driver"

              username="readwrite"

              password="*****"

              url="jdbc:mysql://idb-dev.****.*****.com:3306/Batch"

              explicitUrl="true"

          />

         

          <Resource

              factory="com.mysql.jdbc.jdbc2.optional.MysqlDataSourceFactory"

              name="jdbc/corebiz-readwrite-transactional"

              auth="Container"

              type="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource"

              driverClassName="com.mysql.jdbc.Driver"

              username="readwrite"

              password="*****"

              url="jdbc:mysql://atlas.****.****.com:3306"

              explicitUrl="true"

          />

         

          <Resource

              name="jdbc/idb-readwrite-transactionalDataSource"

              uniqueName="jdbc/idb-readwrite-transactionalDataSource"

              auth="Container"

              type="javax.sql.DataSource"

              username="readwrite"

              password="******"

              driverClassName="com.arjuna.ats.jdbc.TransactionalDriver"

              url="jdbc:arjuna:java:comp/env/jdbc/idb-readwrite-transactional"

              description="Transactional Driver Data Source"

          />

       

      Recovery files also are provided in the following way

       

      <?xml version="1.0" encoding="UTF-8"?>

      <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">

      <properties>

          <entry key="DB_1_DatabaseUser">*******</entry>

          <entry key="DB_1_DatabasePassword">*******</entry>

          <entry key="DB_1_DatabaseDynamicClass"></entry>

          <entry key="DB_1_DatabaseURL">java:comp/env/jdbc/idb-readwrite-transactional</entry>

      </properties>

       

      The app is working just fine when deployed in a official apache tomcat release distribution, problems arise when trying to to that in a ubuntu packaged release. Tomcat7 can't event startup for a jndi issue, it complains for [java:comp] not being bound, then, at connections refresh, each 2 minutes the error became just [comp] not bound.

      Switched then to Tomcat8, the server startup issue disappeared but now the app is failing with a cryptic error (was unable to get more info raising log levels everywhere):

       

       

      Sep 29, 2017 2:35:23 PM org.apache.catalina.core.StandardContext listenerStart

      SEVERE: Exception sending context initialized event to listener instance of class org.jboss.narayana.tomcat.jta.NarayanaJtaServletContextListener

      java.lang.NullPointerException

        at com.arjuna.ats.arjuna.objectstore.StoreManager.initStore(StoreManager.java:159)

        at com.arjuna.ats.arjuna.objectstore.StoreManager.getActionStore(StoreManager.java:111)

        at com.arjuna.ats.arjuna.objectstore.StoreManager.getRecoveryStore(StoreManager.java:68)

        at com.arjuna.ats.internal.arjuna.recovery.AtomicActionRecoveryModule.<init>(AtomicActionRecoveryModule.java:67)

        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)

        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)

        at java.lang.Class.newInstance(Class.java:442)

        at com.arjuna.common.internal.util.ClassloadingUtility.loadAndInstantiateClass(ClassloadingUtility.java:135)

        at com.arjuna.common.internal.util.ClassloadingUtility.loadAndInstantiateClassesWithInit(ClassloadingUtility.java:192)

        at com.arjuna.ats.arjuna.common.RecoveryEnvironmentBean.getRecoveryModules(RecoveryEnvironmentBean.java:465)

        at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.loadModules(PeriodicRecovery.java:883)

        at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.<init>(PeriodicRecovery.java:121)

        at com.arjuna.ats.internal.arjuna.recovery.RecoveryManagerImple.<init>(RecoveryManagerImple.java:107)

        at com.arjuna.ats.arjuna.recovery.RecoveryManager.<init>(RecoveryManager.java:475)

        at com.arjuna.ats.arjuna.recovery.RecoveryManager.manager(RecoveryManager.java:132)

        at com.arjuna.ats.arjuna.recovery.RecoveryManager.manager(RecoveryManager.java:112)

        at org.jboss.narayana.tomcat.jta.NarayanaJtaServletContextListener.contextInitialized(NarayanaJtaServletContextListener.java:97)

        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4812)

        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5255)

        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)

        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)

        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)

        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)

        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:939)

        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1812)

        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

        at java.util.concurrent.FutureTask.run(FutureTask.java:266)

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

        at java.lang.Thread.run(Thread.java:748)

       

      Any hint would be appreciated,

       

      Thanks

      SImone