0 Replies Latest reply on Jun 23, 2002 1:41 AM by Thomas Phan

    NullPointerException due to missing TransactionManager -- Ca

    Thomas Phan Newbie

      I'm using the Castor plugin:
      - include castor-jdo-plugin.jar in lib
      - load the MBean in my service xml file (file:..\server\esb\conf\database.xml, where esb is my instance name; and esbJDO)
      - put database.xml and mapping.xml in conf






      I'm sure that my data source works, since I have been using it in my application.

      My mapping.xml is generated by XDoclet, and I've

      * @ejb:resource-ref
      * res-name="jdo/esbJDO"
      * res-type="org.exolab.castor.jdo.DataObjects"
      * res-auth="Container"

      * @jboss:resource-manager
      * res-man-class="org.jboss.ejb.deployment.CastorJDOResource"
      * res-man-name="jdo/esbJDO"
      * res-man-jndi-name="java:/esbJDO"

      I think the plugin cannot get the TransactionManager from the JNDI, how may I fix this?

      When will castor.sar be available? The current MBean depends on file system's path :(

      Thanks

      My code (esb.util.DAOHelper.create):

      public void create(Object data) throws Exception {
      Database db = null;
      try {
      System.out.println("jdo = " + ((jdo == null) ? "NULL" : "NOT NULL"));
      db = jdo.getDatabase();
      System.out.println("db = " + ((db == null) ? "NULL" : "NOT NULL"));
      db.create(data);
      System.out.println("end");
      }
      finally {
      try{ if (db != null) db.close(); }
      catch (PersistenceException pe) {}
      }
      }

      The error:

      12:31:27,044 INFO [STDOUT] jdo = NOT NULL
      12:31:29,228 ERROR [CastorJDOImpl] Exception
      java.lang.NullPointerException
      at org.exolab.castor.jdo.JDO.getDatabase(JDO.java:558)
      at org.jboss.jdo.castor.CastorJDOImpl.getDatabase(CastorJDOImpl.java:276)
      at esb.util.DAOHelper.create(Unknown Source)
      at esb.ejb.UserDAOBean.createUser(Unknown Source)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:664)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:77)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:96)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:219)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:61)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:129)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:166)
      at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:313)
      at org.jboss.ejb.Container.invoke(Container.java:705)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
      at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:98)
      at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:102)
      at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:73)
      at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:76)
      at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:111)
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
      at $Proxy33.createUser(Unknown Source)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:347)
      at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:225)
      at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:263)
      at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71)
      at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:154)
      at org.apache.axis.SimpleChain.invoke(SimpleChain.java:121)
      at org.apache.axis.server.AxisServer.invoke(AxisServer.java:288)
      at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:543)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:371)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:607)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1387)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1326)
      at org.mortbay.http.HttpServer.service(HttpServer.java:757)
      at org.jboss.jetty.Jetty.service(Jetty.java:527)
      at org.mortbay.http.HttpConnection.service(HttpConnection.java:742)
      at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:915)
      at org.mortbay.http.HttpConnection.handle(HttpConnection.java:757)
      at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:151)
      at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:287)
      at org.mortbay.util.ThreadPool$JobRunner.run(ThreadPool.java:715)
      at java.lang.Thread.run(Thread.java:536)
      12:31:29,298 INFO [STDOUT] db = NOT NULL
      12:31:29,298 INFO [STDOUT] org.exolab.castor.jdo.TransactionNotInProgressException: No transaction in progress for the current thread