6 Replies Latest reply on Sep 10, 2002 11:26 AM by Richard Niebaum

    JNDI Binding for java:/DefaultDS using PostgreSQL

    Richard Niebaum Newbie

      I have applied the various files (recommended in this forum) for configuring JBoss 3.0.2 to work with PostgreSQL instead of Hypersonic SQL.

      After configuring for PostgreSQL, when I move the hsqldb-service.xml file out of the way in favor of the postgres-service.xml, the java:/DefaultDS name no longer binds to the JNDI registry. (I satisfied myself that this is the case with an InitialContext.lookup(...) at the tail end of the doStart() method in ServerImpl.)

      I am attaching my <jboss.server>/deploy/login-config.xml and postgres-service.xml files, as well as my <jboss.server>/conf/jbosscmb-jdbc.xml file.

      If there is an obvious configuration problem, I will be grateful for assistance spotting it.

      If not, I welcome any suggestions for my next stage of debugging.

      Thanks,
      Rich

        • 2. Re: JNDI Binding for java:/DefaultDS using PostgreSQL
          Richard Niebaum Newbie

          > Try looking at the
          >
          > http://localhost:8080/jmx-console/index.jsp
          >
          > It might tell you something more

          Thanks for the tip about:

          http://localhost:8080/jmx-console/index.jsp

          I had not yet discovered that, and I know it will prove helpful in ways I have not fully explored yet.

          It did also indirectly lead me to another piece of information that leaves me with another question.

          In studying the logs, I am seeing that my jboss:service=PostgreSQL service is not starting. In studying the logs and the difference between my postgres-service.xml and my hsqldb-service.xml, I believe this may be related to the custom local MBean

          The following dependency snippet is from hsqldb-service.xml:

          <!--Below here are advanced properties -->
          <!--hack-->
          <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=JBoss LocalTransaction JDBC Wrapper
          jboss:service=Hypersonic

          ...

          <!-- Moved to end to test anonymous depends -->


          1476
          true
          default
          false


          There is no equivalent type reference in my postgres-service.xml.

          Do I need to have a class like org.jboss.jdbc.HypersonicDatabase, or should the "JBoss LocalTransaction JDBC Wrapper" be taking care of this for me?

          Thanks in advance for any additional insights.

          Rich

          • 3. Re: JNDI Binding for java:/DefaultDS using PostgreSQL
            Richard Niebaum Newbie

            I'm not sure if this last message got posted or not--if in duplication, please accept my apologies...

            --

            Thanks for the tip about:

            http://localhost:8080/jmx-console/index.jsp

            I had not yet discovered that, and I know it will prove helpful in ways I have not fully explored yet.

            It did also indirectly lead me to another piece of information that leaves me with another question.

            In studying the logs, I am seeing that my jboss:service=PostgreSQL service is not starting. In studying the logs and the difference between my postgres-service.xml and my hsqldb-service.xml, I believe this may be related to the custom local MBean

            The following dependency snippet is from hsqldb-service.xml:

            <!--Below here are advanced properties -->
            <!--hack-->
            <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=JBoss LocalTransaction JDBC Wrapper
            jboss:service=Hypersonic

            ...

            <!-- Moved to end to test anonymous depends -->


            1476
            true
            default
            false


            There is no equivalent type reference in my postgres-service.xml.

            Do I need to have a class like org.jboss.jdbc.HypersonicDatabase, or should the "JBoss LocalTransaction JDBC Wrapper" be taking care of this for me?

            Thanks in advance for any additional insights.

            Rich

            • 4. Re: JNDI Binding for java:/DefaultDS using PostgreSQL
              Fusayuki Minamoto Apprentice

              Hi,

              When I diff your postgres-service.xml and the original one, I see yours has the next line at line 59.

              jboss:service=PostgreSQL

              In my PostgreSQL configuration I don't have this line but it works well.
              Remove this and try again.

              Miki

              • 5. Re: JNDI Binding for java:/DefaultDS using PostgreSQL
                Fusayuki Minamoto Apprentice

                Here is my procedure to set postgres as DefaultDS for JBoss 3.0.
                As I sometimes run with Hypersonic, I create a server directory for the postgres configuration but it's optional.

                1. Create a server directory for postgres(optional).
                > copy -pr $JBOSS_HOME/server/default postgres

                2. Deploy postgres driver.
                >copy postgres.jar $JBOSS_HOME/server/postgres/deploy

                3. Edit postgres-service.xml.
                Find a postgres-service.xml in the $JBOSS_HOME/docs/examples/jdbc.
                Change the JNDI name to DefaultDS and setup the connection url.

                JNDI name:

                <!-- ========== Set the JndiName ======================= -->
                DefaultDS

                ConnectionURL:

                <config-property name="ConnectionURL" type="java.lang.String">jdbc:postgresql://localhost/mydb</config-property>
                <config-property name="DriverClass" type="java.lang.String">org.postgresql.Driver</config-property>
                <config-property name="UserName" type="java.lang.String">yourusername</config-property>
                <config-property name="Password" type="java.lang.String">yourpasswd</config-property>

                Note: italic parts should be changed according to your configuration.

                4. Deploy postgres-service.xml
                >copy postgres-service.xml $JBOSS_HOME/server/postgres/deploy

                5. Change standardjaws.xml and standardjbosscmp-jdbc.xml

                standardjaws.xml:


                java:/DefaultDS
                <type-mapping>PostgreSQL</type-mapping>

                standardjbosscmp-jdbc.xml:

                <jbosscmp-jdbc>

                java:/DefaultDS
                <datasource-mapping>PostgreSQL</datasource-mapping>

                Note: there are two postgres mapping: PostgreSQL and PostgreSQL 7.2.

                6. Remove hsqldb-service.xml and its JDBC driver

                7. Run the JBoss server
                >run.sh -c postgres


                If you use JAAS security, you also have to change login-conf.xml.
                I hope this helps,
                Miki

                • 6. Re: JNDI Binding for java:/DefaultDS using PostgreSQL
                  Richard Niebaum Newbie

                  Just a quick note, first and foremost, to thank Miki for the detailed posting and instructions, which I am DELIGHTED! to say worked great!

                  To others who might find this thread in the future, the postgres-service.xml file I found locally was actually in the <JBoss.home>/docs/examples/jca directory.

                  Also, since Miki did not include the login-config.xml in his post, please refer back to mine in the the original post. That appears to be correct and working fine.

                  Thanks again, Miki, and also to Patrick for your help in opening up my world to the jmx-console.

                  Now I'm on to why the sample application's run-client.sh blows up with "JNDI broken" messages. I'll do some homework first and deal with that in a separate thread...

                  Rich