4 Replies Latest reply on Oct 8, 2008 4:30 PM by mdalsey

    User not found; hsqldb-ds.xml

    henkomannen

      Hi all,

      I'm using JBoss for my EJB3 application. When starting up JBoss I run into a java.sql.SQLException that tells me that the user 'SA' - though configured as 'sa' in the datasource file - is not found. The datasource file looks like this:

      <?xml version="1.0" encoding="UTF-8"?>
      
      <!-- The Hypersonic embedded database JCA connection factory config
      $Id: hsqldb-ds.xml,v 1.15 2004/09/15 14:37:40 loubyansky Exp $ -->
      
      
      <datasources>
       <local-tx-datasource>
      
       <!-- The jndi name of the DataSource, it is prefixed with java:/ -->
       <!-- Datasources are not available outside the virtual machine -->
       <jndi-name>DefaultDS</jndi-name>
      
       <!-- for tcp connection, allowing other processes to use the hsqldb
       database. This requires the org.jboss.jdbc.HypersonicDatabase mbean.
       <connection-url>jdbc:hsqldb:hsql://localhost:1701</connection-url>
      -->
      
       <!-- for totally in-memory db, not saved when jboss stops.
       The org.jboss.jdbc.HypersonicDatabase mbean necessary
       <connection-url>jdbc:hsqldb:.</connection-url>
      -->
      
       <!-- for in-process persistent db, saved when jboss stops. The
       org.jboss.jdbc.HypersonicDatabase mbean is necessary for properly db shutdown-->
       <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}localDB</connection-url>
      
       <!-- The driver class -->
       <driver-class>org.hsqldb.jdbcDriver</driver-class>
      
       <!-- The login and password -->
       <user-name>sa</user-name>
       <password></password>
      
       <!--example of how to specify class that determines if exception means connection should be destroyed-->
       <!--exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.DummyExceptionSorter</exception-sorter-class-name-->
      
       <!-- this will be run before a managed connection is removed from the pool for use by a client-->
       <!--<check-valid-connection-sql>select * from something</check-valid-connection-sql> -->
      
       <!-- The minimum connections in a pool/sub-pool. Pools are lazily constructed on first use -->
       <min-pool-size>5</min-pool-size>
      
       <!-- The maximum connections in a pool/sub-pool -->
       <max-pool-size>20</max-pool-size>
      
       <!-- The time before an unused connection is destroyed -->
       <!-- NOTE: This is the check period. It will be destroyed somewhere between 1x and 2x this timeout after last use -->
       <!-- TEMPORARY FIX! - Disable idle connection removal, HSQLDB has a problem with not reaping threads on closed connections -->
       <idle-timeout-minutes>0</idle-timeout-minutes>
      
       <!-- sql to call when connection is created
       <new-connection-sql>some arbitrary sql</new-connection-sql>
       -->
      
       <!-- sql to call on an existing pooled connection when it is obtained from pool
       <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
       -->
      
       <!-- example of how to specify a class that determines a connection is valid before it is handed out from the pool
       <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.DummyValidConnectionChecker</valid-connection-checker-class-name>
       -->
      
       <!-- Whether to check all statements are closed when the connection is returned to the pool,
       this is a debugging feature that should be turned off in production -->
       <track-statements/>
      
       <!-- Use the getConnection(user, pw) for logins
       <application-managed-security/>
       -->
      
       <!-- Use the security domain defined in conf/login-config.xml -->
       <security-domain>HsqlDbRealm</security-domain>
      
       <!-- Use the security domain defined in conf/login-config.xml or the
       getConnection(user, pw) for logins. The security domain takes precedence.
       <security-domain-and-application>HsqlDbRealm</security-domain-and-application>
       -->
      
       <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
       <metadata>
       <type-mapping>Hypersonic SQL</type-mapping>
       </metadata>
      
       <!-- This mbean can be used when using in process persistent hypersonic -->
       <depends>jboss:service=Hypersonic,database=localDB</depends>
       </local-tx-datasource>
      
       <!-- This mbean should be used only when using tcp connections. Uncomment
       when the tcp based connection-url is used.
       <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>
       -->
      
       <!-- This mbean can be used when using in process persistent db -->
       <mbean code="org.jboss.jdbc.HypersonicDatabase"
       name="jboss:service=Hypersonic,database=localDB">
       <attribute name="Database">localDB</attribute>
       <attribute name="InProcessMode">true</attribute>
       </mbean>
      </datasources>
      


      And the exception like this:

      sdx1 /opt/UMC/jboss/server/all/deploy>21:03:14,465 WARN [ServiceController] Problem starting service jboss:service=Hypersonic,database=localDB
      java.sql.SQLException: User not found: SA
       at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
       at org.hsqldb.jdbc.jdbcConnection.<init>(Unknown Source)
       at org.hsqldb.jdbcDriver.getConnection(Unknown Source)
       at org.hsqldb.jdbcDriver.connect(Unknown Source)
       at java.sql.DriverManager.getConnection(DriverManager.java:525)
       at java.sql.DriverManager.getConnection(DriverManager.java:171)
       at org.jboss.jdbc.HypersonicDatabase.getConnection(HypersonicDatabase.java:806)
       at org.jboss.jdbc.HypersonicDatabase.startStandaloneDatabase(HypersonicDatabase.java:617)
       at org.jboss.jdbc.HypersonicDatabase.startService(HypersonicDatabase.java:587)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:274)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:230)
       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:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:943)
       at $Proxy0.start(Unknown Source)
       at org.jboss.system.ServiceController.start(ServiceController.java:428)
       at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
       at $Proxy4.start(Unknown Source)
       at org.jboss.deployment.SARDeployer.start(SARDeployer.java:285)
       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:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.mx.util.JMXInvocationHandler.invoke(JMXInvocationHandler.java:273)
       at $Proxy41.start(Unknown Source)
       at org.jboss.deployment.XSLSubDeployer.start(XSLSubDeployer.java:185)
       at org.jboss.deployment.MainDeployer.start(MainDeployer.java:989)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:790)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:753)
       at sun.reflect.GeneratedMethodAccessor17.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
       at $Proxy9.deploy(Unknown Source)
       at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:319)
       at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:507)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:192)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:203)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:182)
      21:03:14,488 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
      
      --- MBeans waiting for other MBeans ---
      ObjectName: jboss:service=Hypersonic,database=localDB
       State: FAILED
       Reason: java.sql.SQLException: User not found: SA
       Depends On Me:
       jboss.jca:service=ManagedConnectionFactory,name=DefaultDS
      
      --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
      ObjectName: jboss:service=Hypersonic,database=localDB
       State: FAILED
       Reason: java.sql.SQLException: User not found: SA
       Depends On Me:
       jboss.jca:service=ManagedConnectionFactory,name=DefaultDS
      
      


      I use JBoss AS 4.0.3SP1 with the latest EJB3 packages. In the jmx-console I see that the DefaultDS DataSourceBinding service is created but not started and it has no BindName assigned (null). The Hypersonic Service fails to start according to the jmx-console.

      Is any JBoss EJB3 component depending on the Hypersonic service? Is this critical or can it be ignored?

      This is quite urgent so please, if anyone has some tips please let me know.

      /Henrik

        • 1. Re: User not found; hsqldb-ds.xml
          psmith

          Just in case anyone else is looking at this an wondering what's going on. I had the same issue on JBoss 4.0.5GA. It turned out that under the folder /server//date/hypersonic the files had been corrupted. It seems that normally when you shutdown the server these get cleaned up and when you start the server they are recreated from the configuration. Basically I deleted the hypersonic directory and contents and restarted JBoss and everything sorted itself out.

          • 2. Re: User not found; hsqldb-ds.xml
            ruifang

            Gracias!!

            • 3. Re: User not found; hsqldb-ds.xml

              psmith's post just saved my butt!! I had a project working in Eclipse.Europa/Maven that stopped working in Eclipse.Ganymede/Maven because of this very thing. Applying psmith's recommendation got it working again. Muito obrigado, psmith!!!

              • 4. Re: User not found; hsqldb-ds.xml
                mdalsey

                Thank you psmith! Your post helped me tremendously. My application had this issue in one environment (out of 4) and I was really scratching my head until I found this.

                Three cheers for psmith and google!