8 Replies Latest reply on May 22, 2002 11:01 AM by kk37

    Problem with hsql datasource in petstore and Jboss 3 RC1

    attila1

      Hi all,
      I deployed the petsore successfully on jboss 2.44 and worked and am now trying to do the same with jboss 3 RC1. I am using the hsql db and include my hsql-service.xml below. When I try to run the petsore on Jboss 3, when I enter the store I get the following message : "Unable to connect to database, Database Connection is closed: Confirm that you have started your database ". During the jboss bootup, I get a warning with rspect to the EstoreDb and InventoryDb. Can someone see what's wrong with my datasource setup for jboss 3 ? Thanks.
      12:41:17,893 INFO [MainDeployer] Starting deployment of package: file:/E:/java/jboss/server/default
      /deploy/hsqldb-service.xml
      12:41:36,780 WARN [ServiceController] jboss.jca:service=LocalTxDS,name=EstoreDB does not implementany Service methods
      12:41:36,800 INFO [LocalTxConnectionManager] Creating
      12:41:36,800 INFO [LocalTxConnectionManager] Created
      12:41:36,810 WARN [ServiceController] jboss.jca:service=LocalTxDS,name=InventoryDB does not implement any Service methods


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

      <!-- ===================================================================== -->
      <!-- -->
      <!-- JBoss Server Configuration -->
      <!-- -->
      <!-- ===================================================================== -->

      <!-- $Id: hsqldb-service.xml,v 1.2 2002/04/14 04:31:56 d_jencks Exp $ -->



      <!-- ==================================================================== -->
      <!-- New ConnectionManager setup for default hsql dbs -->
      <!-- ==================================================================== -->


      <!--make the rar deploy! hack till better deployment-->
      jboss.jca:service=RARDeployer


      <depends optional-attribute-name="ManagedConnectionFactoryName">
      <!--embedded mbean-->

      <!--hack-->
      <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=Minerva JDBC LocalTransaction ResourceAdapter


      <!--real attributes-->


      <config-property>
      <config-property-name>ConnectionURL</config-property-name>
      <config-property-type>java.lang.String</config-property-type>
      <config-property-value>jdbc:hsqldb:hsql://localhost:1476</config-property-value>
      </config-property>
      <config-property>
      <config-property-name>DriverClass</config-property-name>
      <config-property-type>java.lang.String</config-property-type>
      <config-property-value>org.hsqldb.jdbcDriver</config-property-value>
      </config-property>
      <config-property>
      <config-property-name>UserName</config-property-name>
      <config-property-type>java.lang.String</config-property-type>
      <config-property-value>sa</config-property-value>
      </config-property>
      <config-property>
      <config-property-name>Password</config-property-name>
      <config-property-type>java.lang.String</config-property-type>
      <config-property-value></config-property-value>
      </config-property>


      EstoreDB


      <depends optional-attribute-name="ManagedConnectionPool">
      <!--embedded mbean-->


      0
      50
      5000
      15
      <!--criteria indicates if Subject (from security domain) or app supplied
      parameters (such as from getConnection(user, pw)) are used to distinguish
      connections in the pool. Choices are
      ByContainerAndApplication (use both),
      ByContainer (use Subject),
      ByApplication (use app supplied params only),
      ByNothing (all connections are equivalent, usually if adapter supports
      reauthentication)-->
      ByContainer


      <depends optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager

      <!-- Include a login module configuration named HsqlDbRealm.
      Update your login-conf.xml, here is an example for a
      ConfiguredIdentityLoginModule:

      <application-policy name = "HsqlDbRealm">

      <login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule" flag = "required">
      <module-option name = "principal">yourprincipal</module-option>
      <module-option name = "userName">yourusername</module-option>
      <module-option name = "password">yourpassword</module-option>
      <module-option name = "managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=OracleDS</module-option>
      </login-module>

      </application-policy>

      NOTE: the application-policy name attribute must match the part of
      SecurityDomainJndiName after java:/jaas/, and the
      module-option name = "managedConnectionFactoryName"
      must match the object name of the ConnectionManager you are configuring here.
      -->
      <!--comment out this line if you want component managed security or want
      to use the default values in the ManagedConnectionFactoryProperties -->
      java:/jaas/HsqlDbRealm

      java:/TransactionManager








      <!--make the rar deploy! hack till better deployment-->
      jboss.jca:service=RARDeployer


      <depends optional-attribute-name="ManagedConnectionFactoryName">
      <!--embedded mbean-->

      <!--hack-->
      <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=Minerva JDBC LocalTransaction ResourceAdapter


      <!--real attributes-->


      <config-property>
      <config-property-name>ConnectionURL</config-property-name>
      <config-property-type>java.lang.String</config-property-type>
      <config-property-value>jdbc:hsqldb:hsql://localhost:1476</config-property-value>
      </config-property>
      <config-property>
      <config-property-name>DriverClass</config-property-name>
      <config-property-type>java.lang.String</config-property-type>
      <config-property-value>org.hsqldb.jdbcDriver</config-property-value>
      </config-property>
      <config-property>
      <config-property-name>UserName</config-property-name>
      <config-property-type>java.lang.String</config-property-type>
      <config-property-value>sa</config-property-value>
      </config-property>
      <config-property>
      <config-property-name>Password</config-property-name>
      <config-property-type>java.lang.String</config-property-type>
      <config-property-value></config-property-value>
      </config-property>


      InventoryDB


      <depends optional-attribute-name="ManagedConnectionPool">

      <!--embedded mbean-->


      0
      50
      5000
      15
      <!--criteria indicates if Subject (from security domain) or app supplied
      parameters (such as from getConnection(user, pw)) are used to distinguish
      connections in the pool. Choices are
      ByContainerAndApplication (use both),
      ByContainer (use Subject),
      ByApplication (use app supplied params only),
      ByNothing (all connections are equivalent, usually if adapter supports
      reauthentication)-->
      ByContainer


      <depends optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager


      java:/jaas/HsqlDbRealm

      java:/TransactionManager


        • 1. Re: Problem with hsql datasource in petstore and Jboss 3 RC1
          davidjencks

          You need a security realm config in login-conf.xml for each datasource configuration.

          • 2. Re: Problem with hsql datasource in petstore and Jboss 3 RC1
            faisalab

            Petstore1.2 run on even jboss2.4.4 .Use Jboss2.4.4 or 2.4.5 and you won't encounter this pb
            Fais

            • 3. Re: Problem with hsql datasource in petstore and Jboss 3 RC1
              attila1

              well, I also put this in the login-config.xml and still getting the same "unable to connect to database ..." message. Any other thoughts ? Thanks.

              • 4. Re: Problem with hsql datasource in petstore and Jboss 3 RC1
                attila1

                forgot to publish it :
                <application-policy name = "HsqlDbRealm">

                <login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule" flag = "required">
                <module-option name = "principal">sa</module-option>
                <module-option name = "userName">sa</module-option>
                <module-option name = "password"></module-option>
                <module-option name = "managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=EstoreDB</module-option>
                </login-module>

                </application-policy>


                <application-policy name = "HsqlDbRealm">

                <login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule" flag = "required">
                <module-option name = "principal">sa</module-option>
                <module-option name = "userName">sa</module-option>
                <module-option name = "password"></module-option>
                <module-option name = "managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=InventoryDB</module-option>
                </login-module>

                </application-policy>

                • 5. Re: Problem with hsql datasource in petstore and Jboss 3 RC1
                  davidjencks

                  Make sure the security domain/application policy names are UNIQUE!!! How else will you get the one you want in jndi? Its not magic!

                  • 6. Re: Problem with hsql datasource in petstore and Jboss 3 RC1
                    attila1

                    ok, ok !!! Actually, there is another problem. My hsqldb is not starting and I don't why. When I ran jboss 2.44, it was starting w/o any problem, but not in jboss 3 RC1. Is there any know issue with starting hsqldb in jboss 3 ? Thanks all.

                    • 7. Re: Problem with hsql datasource in petstore and Jboss 3 RC1
                      attila1

                      I found out why. There was a problem with the hsqldb-server.xml . When I switched it back to the original, then the hsql db worked again. So I modified that one instead of using the one you can download from the examples.

                      • 8. Re: Problem with hsql datasource in petstore and Jboss 3 RC1
                        kk37


                        Hi attila1

                        I am running JBoss-2.4.4_Tomcat-4.0.1 with
                        J2SE1.3.1_03 amd J2EE SDK 1.3.1. I ran
                        run_with_catalina.sh and it started with no error.

                        I am reading the forum furiously and found your
                        question. Since you've got Petstore 1.1.2 working
                        on JBoss 2.4.4, could you please kindly tell
                        me (if you kno wthe answer), why am I getting the error

                        [08:46:26,971,ContainerFactory] Deploying TheShoppingClientController
                        [08:46:27,217,JRMPContainerInvoker] Container Invoker RMI Port='4444'
                        [08:46:27,218,JRMPContainerInvoker] Container Invoker Client SocketFactory='Defa
                        ult'
                        [08:46:27,218,JRMPContainerInvoker] Container Invoker Server SocketFactory='Defa
                        ult'
                        [08:46:27,218,JRMPContainerInvoker] Container Invoker Server SocketAddr='Default
                        '
                        [08:46:27,219,JRMPContainerInvoker] Container Invoker Server sslDomain='Default'
                        [08:46:27,219,JRMPContainerInvoker] Container Invoker Optimize='true'
                        [08:46:27,390,StatefulSessionInstancePool] config - MaximumSize=30, strictMaximu
                        mSize=false, feederPolicy=null
                        [08:46:27,469,ContainerFactory] DeploymentError
                        java.lang.ClassNotFoundException: com.sun.j2ee.blueprints.petstore.control.ejb.S
                        hoppingClientControllerHome

                        at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
                        at java.security.AccessController.doPrivileged(Native Method)
                        at java.net.URLClassLoader.findClass(URLClassLoader.java:183)
                        at java.lang.ClassLoader.loadClass(ClassLoader.java:294)
                        at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
                        at org.jboss.ejb.StatefulSessionContainer.init(StatefulSessionContainer.
                        java:175)

                        at org.jboss.ejb.Application.init(Application.java:202)
                        at org.jboss.ejb.ContainerFactory.deploy(ContainerFactory.java:372)
                        at org.jboss.ejb.ContainerFactory.deploy(ContainerFactory.java:306)
                        at java.lang.reflect.Method.invoke(Native Method)
                        at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:16
                        28)
                        :
                        :
                        more error messages

                        I can see the class at petstoreEjb.jar .

                        PLEASE HELp. THANKS.