3 Replies Latest reply on Nov 28, 2004 12:57 PM by alfredpal alfredpal

    Database problem with Duke's Bank example

    Nick de Graeve Newbie

      I just can't seem to get the banking example to work. This time it's apparently a database error.
      Error in browser:
      Server Error
      Your request cannot be completed. The server got the following error:

      null

      Stack trace:
      [...]
      08:45:52,684 INFO [STDOUT] Debug: AccountBean makeConnection
      08:45:52,687 ERROR [LogInterceptor] EJBException in method: public abstract java.util.Collection com.sun.ebank.ejb.account.AccountHome.findByCustomerId(java.lang.String) throws javax.ejb.FinderException,java.rmi.RemoteException
      javax.ejb.EJBException: ejbFindByCustomerId Unable to connect to database. Could not dereference object
      at com.sun.ebank.ejb.account.AccountBean.ejbFindByCustomerId(Unknown Source)
      [...]
      08:45:52,733 ERROR [Engine] ApplicationDispatcher[/bank] Servlet.service() for servlet jsp threw exception
      java.lang.NullPointerException
      at org.apache.jsp.links_jsp._jspService(links_jsp.java:68)
      [...]

      I followed the instructions in the tutorial and edited hsqldb-ds.xml:

      <?xml version="1.0" encoding="UTF-8"?>
      <datasources>
       <local-tx-datasource>
       <jndi-name>DefaultDS</jndi-name>
       <connection-url>jdbc:hsqldb:hsql://localhost:1701</connection-url>
       <driver-class>org.hsqldb.jdbcDriver</driver-class>
       <user-name>sa</user-name>
       <password></password>
       <min-pool-size>5</min-pool-size>
       <max-pool-size>20</max-pool-size>
       <idle-timeout-minutes>5</idle-timeout-minutes>
       <track-statements/>
       <security-domain>HsqlDbRealm</security-domain>
       <prepared-statement-cache-size>32</prepared-statement-cache-size>
       <depends>jboss:service=Hypersonic,database=localDB</depends>
       </local-tx-datasource>
       <mbean code="org.jboss.jdbc.HypersonicDatabase" name="jboss:service=Hypersonic">
       <attribute name="Port">1701</attribute>
       <attribute name="Silent">true</attribute>
       <attribute name="Database">default</attribute>
       <attribute name="Trace">false</attribute>
       <attribute name="No_system_exit">true</attribute>
       </mbean>
      </datasources>

      The Ant-scripts for creating tables and data exit without errors. I can start the HSQL Database Manager Tool and run some SQL queries that return data.

      I have to say that when I start JBoss I get in the sartup log a message that may shed some light on the problem:
      [...]
      Depends On Me:

      MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM:
      ObjectName: jboss:service=Hypersonic,database=localDB
      state: NOTYETINSTALLED
      I Depend On:
      Depends On Me: jboss.jca:service=ManagedConnectionFactory,name=DefaultDS

      I probably forgot to set something in the configuration files but I have no idea what.