12 Replies Latest reply on Jul 11, 2002 4:55 PM by Stefan Kuehn

    Q: HELP! My DataSource Is Broken in 3.0 RC1!

    David Jencks Master

      Q: HELP! My DataSource Is Broken in 3.0 RC1!

      A: Several people have been confused by the configuration changes present in JBoss 3.0 RC1. I'll attempt to explain what to do to set up a working configuration.

      Please remember that what you are configuring is a complete replacement for the previous system(s), it is new, I am trying to make it easier to use, and I'm changing the sample configuration files fairly frequently in attempts to make what is going on more clear. The new configuration is unrelated to the old configuration so it is easier to start over than try to modify an old file.

      First of all, the most recent sample configuration files are in cvs, not the RC1 binary download. You can view them at
      http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jboss/jbosscx/src/etc/example-config/

      or if you have checked jboss out of cvs they are at
      connector/src/etc/example-config/

      If you get a working configuration for a database or other resource adapter (such as SAP R/3) please contribute it.

      If there is an example for your database, start with it.

      Fill in the ConnectionURL to point to your database. If you are using a JDBC 1 driver, you may want to check that the URL is correct using a small standalone test program or other external tool.

      Set the JndiName property to what you want the DataSource to be bound under in the java:/ context.

      Assuming you want everyone logged in to the db as the same user, copy the xml snippet <application-policy-name.... from the comment near the end and put it in your login-conf.xml file. Fill in the appropriate username and password. The principal can be the same as the username.

      Double and triple check that the following match:
      name="xxx" from the <mbean code="org.jboss.resource.connectionmanager.LocalTxConnectionManager" name="jboss.jca:service=LocalTxCM,name=PostgresDS">
      (normally the first mbean in the file)

      MUST MATCH

      <module-option name = "managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=PostgresDS</module-option>


      AND

      java:/jaas/PostgresDbRealm

      MUST MATCH

      <application-policy name = "PostgresDbRealm">

      Everything else can be considered "Advanced Configuration"

      PROBLEMS:

      1. If you get log messages about trying to log in using UserRolesLoginModule, this means the second match, between the realm name, is not set up properly.

      2. If you get log messages about username=null and invalid login attempts, this means that the first match is is not set up correctly and the object names are different.

      Notes:
      Some databases do not allow you to specify username and password. In this case remove the SecurityDomainJndiName element.

      If you want CallerIdentity security, there is a login module for that purpose in cvs.

      For any real installation, obviously you will have to tune the pooling parameters. Please try out the documentation you can get by compiling build/build.sh all and looking in the jmx-api directory.

      Thanks. Suggestions on how to improve the configuration process and setup are appreciated.

        • 1. 3706193
          Paul Webster Newbie

          I've been dealing with some of the same problems on 3.0. The conf, log and deploy directories have recently been moved. They're now at:

          %JBOSS_HOME%/server/default/conf
          %JBOSS_HOME%/server/default/log
          %JBOSS_HOME%/server/default/deploy


          • 2. 3706155
            Paul Webster Newbie

            Hi All,

            My simple J2EE application is made up of 2 components...one containing a couple of EJBs and one containing a Web application (containing a couple of servlets plus html pages and WEB-INF directory).

            They have been packaged as a JAR file and WAR file respectively. They can both be deployed in jboss/deploy with seemingly no problem (in fact I can view the HTML pages in the WAR file no problem)

            However, when I attempt to package the above as an EAR file it has the following structure:

            0 Mon Apr 08 16:38:16 BST 2002 META-INF/
            68 Mon Apr 08 16:38:16 BST 2002 META-INF/MANIFEST.MF
            5397 Mon Apr 08 16:22:38 BST 2002 NameAge.jar
            5781 Mon Apr 08 16:23:42 BST 2002 NameAge.war
            368 Fri Apr 05 16:30:20 BST 2002 META-INF/application.xml

            which seems OK to me(?)

            BUT, when I deploy this EAR file I get an HTTP500 error when attempting to access one of the HTML pages as before.

            The only thing I can think is wrong is with META-INF/application.xml.........it's contents are:

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

            <!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN" "http://java.sun.com/dtd/application_1_3.dtd">



            <web-uri>NameAge.war</web-uri>



            NameAge.jar




            Any ideas?

            Many thanks,

            Mike

            • 3. Re: Q: HELP! My DataSource Is Broken in 3.0 RC1!
              Yasir Khokhar Newbie

              David:

              the postgresql string example in the configuration is slightly misleading. The line :

              jdbc:postgresql:

              should infact be :

              jdbc:postgresql://:/<database name>

              Also, IMHO, the XML syntax can be improved a little:

              Instead of:
              <config-property>
              <config-property-name>ConnectionURL</config-property-name>
              <config-property-type>java.lang.String</config-property-type>
              <config-property-value>jdbc:postgresql://deathstar:5432/karakorams</config-property-value>
              </config-property>

              You could have

              <config-property name="Connection URL" type="java.lang.String"> VALUE </config-property>

              It would make it easier to eid and less prone to errors

              YSK

              • 4. Re: Q: HELP! My DataSource Is Broken in 3.0 RC1!
                David Jencks Master

                Thanks for the correction for postgres. I'll fix it.

                I like your xml suggestion as well, however the current xml matches the ra.xml format. I have plans of merging user conf with the ra.xml using xslt... I will think about whether this can be done easily enough with the improved xml syntax you suggest. Probably yes;-)

                • 5. Re: Q: HELP! My DataSource Is Broken in 3.0 RC1!
                  Steve Corwin Newbie

                  I also had to copy the JDBC driver (postgresql.jar for Postgres) to jboss-3.0.0RC1\lib, presumably because it's not specified in the configuration file the way it was for beta 2. Without that I got a ClassNotFoundException.

                  • 6. Re: Q: HELP! My DataSource Is Broken in 3.0 RC1!
                    David Jencks Master

                    I should retitle this

                    "NOT AGAIN!!!"

                    I've removed the old local jdbc wrapper and modified all the example config files to use its replacement. I also took Steveco's suggestion about easier to read xml syntax.

                    If you have a config file for a local tx datasource (NOT XA!!!) the minimum conversion necessary is to replace

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


                    with

                    <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=JBoss LocalTransaction JDBC Wrapper

                    The xa config remains unchanged.

                    • 7. Re: Q: HELP! My DataSource Is Broken in 3.0 RC1!
                      Paul Webster Newbie

                      I've grabbed the latest oracle-service.xml from cvs & cannot manage to get it working. I've followed all the steps below but still cannot get it working.

                      I'm attaching my oracle-service.xml file and login-conf.xml. Well actually I'm not because the attach files facility is NOT working. I'm having a fantastc day!

                      Here's the exception I get. Can anyone help?

                      16:28:08,074 INFO [MainDeployer] Starting deployment of package: file:/E:/J
                      /jboss-3.0.0RC1_tomcat-4.0.3/server/default/deploy/oracle-service.xml
                      16:28:08,354 WARN [ServiceController] jboss.jca:service=LocalTxDS,name=Orac
                      does not implement any Service methods
                      16:28:08,354 INFO [LocalTxConnectionManager] Creating
                      16:28:08,364 INFO [LocalTxConnectionManager] Created
                      16:28:08,364 INFO [LocalTxConnectionManager] Starting
                      16:28:08,384 ERROR [LocalTxConnectionManager] Starting failed
                      java.lang.NullPointerException
                      at javax.naming.InitialContext.getURLScheme(InitialContext.java:224)
                      at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext
                      a:273)
                      at javax.naming.InitialContext.lookup(InitialContext.java:347)
                      at org.jboss.resource.connectionmanager.LocalTxConnectionManager.sta
                      rvice(LocalTxConnectionManager.java:178)
                      at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.ja
                      62)
                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorI
                      java:39)
                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodA
                      sorImpl.java:25)
                      at java.lang.reflect.Method.invoke(Method.java:324)
                      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(Reflected
                      nDispatcher.java:284)
                      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:4
                      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceCon
                      ler.java:867)
                      at $Proxy0.start(Unknown Source)
                      at org.jboss.system.ServiceController.start(ServiceController.java:3
                      at org.jboss.system.ServiceController.start(ServiceController.java:3
                      at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodA
                      sorImpl.java:25)
                      at java.lang.reflect.Method.invoke(Method.java:324)
                      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(Reflected
                      nDispatcher.java:284)
                      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:4
                      at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
                      at $Proxy3.start(Unknown Source)
                      at org.jboss.deployment.SARDeployer.start(SARDeployer.java:281)
                      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:665)
                      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:507)
                      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:470)
                      at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodA
                      sorImpl.java:25)
                      at java.lang.reflect.Method.invoke(Method.java:324)
                      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(Reflected
                      nDispatcher.java:284)
                      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:4
                      at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)

                      etc etc....

                      This isn't problem 1 or 2. The oracle-service.xml from cvs already has the right names. I jusr copied and pasted it.

                      • 8. Re: Q: HELP! My DataSource Is Broken in 3.0 RC1!
                        Greg Turner Apprentice

                        Here is my setup for Cloudscape that works:



                        COM.cloudscape.core.RmiJdbcDriver



                        HrefLibDB
                        org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl
                        jdbc:cloudscape:rmi://localhost:1098/HrefLibDB;autocommit=false
                        databaseName=HrefLibDB
                        me
                        mypassword


                        • 9. Re: Q: HELP! My DataSource Is Broken in 3.0 RC1!
                          David Jencks Master

                          sgturner-- a jboss 2.x db config is unfortunately completely useless for any 3.0 version.

                          --Do you have rc2 or later? if not, start by upgrading. I'm not sure of the exact code you have, but it looks like it is looking for the transaction manager in jndi. Is it bound? Do you have the transaction manager attribute there and set?

                          • 10. Re: Q: HELP! My DataSource Is Broken in 3.0 RC1!
                            Greg Turner Apprentice

                            My Bad. My contribution of cloudscape stuff was premature. I started down the path of upgrading my app from 2.4.5 to 3.0.0RC1 and never finished the upgrade.

                            I have now switched to 3.0.0RC2 and am working to upgrade my app to the new JBoss. When I finish, I will post my XML file for cloudscape db.

                            Sorry for my confusing things.

                            • 11. Re: Q: HELP! My DataSource Is Broken in 3.0 RC1!
                              David Jencks Master

                              Thanks, no problem, looking forward to the config file.

                              • 12. Re: Q: HELP! My DataSource Is Broken in 3.0 RC1!
                                Stefan Kuehn Newbie


                                Hi David!

                                I folowed your steps to set up a Datasource for Postgres.

                                Could you plase tell me what the warning mean that i get when i start JBoss. (PostgresDS does not implement any Service methods)

                                Im Using JBoss 3.0 on SuSe Linux 8.0

                                Here ist the Output:

                                22:15:33,657 WARN [ServiceController] jboss.jca:service=LocalTxDS,name=PostgresDS does not implement any Service methods
                                22:15:33,659 INFO [JBossManagedConnectionPool] Creating
                                22:15:33,659 INFO [JBossManagedConnectionPool] Created
                                22:15:33,663 INFO [JBossManagedConnectionPool] Starting
                                22:15:33,686 INFO [JBossManagedConnectionPool] Started
                                22:15:33,688 INFO [MainDeployer] Successfully completed deployment of package: file:/usr/jboss/jboss-3.0.0_tomcat-4.0.3/server/default/deploy/postgres-service.xml

                                As there are more of these WARNs when JBoss is started,
                                i posted the question here.

                                Thanks and rgds!
                                Stefan