6 Replies Latest reply on Sep 16, 2005 12:26 PM by norman.richards

    JB's Developer Notebook - Omission and Error

    arnieaustin

      I am going through this book, which is GREAT by the way, but I have found one missing line of code and have now come up against something that is beyond me.

      I am in chapter 4: Connecting to a Real Database. I have created the jbossdb as root and assigned the todoapp user to the database w/full rights.

      I've done the ant with the -Doptional.ddl switch and deployed the WAR (which was working up to that point with Hypersonic. I can delve into the WAR and see the jbosscmp-jdbc.xml file. But when the war is deployed (before its first use):

      2005-09-13 14:39:57,937 DEBUG [org.jboss.mq.pm.jdbc2.PersistenceManager] Starting jboss.mq:service=PersistenceManager
      2005-09-13 14:39:57,937 DEBUG [org.jboss.mq.pm.jdbc2.PersistenceManager] Resolving uncommited TXS
      2005-09-13 14:39:57,937 DEBUG [org.jboss.mq.pm.jdbc2.PersistenceManager] Could not create table with SQL: CREATE CACHED TABLE JMS_MESSAGES ( MESSAGEID INTEGER NOT NULL, DESTINATION VARCHAR(255) NOT NULL, TXID INTEGER, TXOP CHAR(1), MESSAGEBLOB OBJECT, PRIMARY KEY (MESSAGEID, DESTINATION) )
      java.sql.SQLException: Table already exists: JMS_MESSAGES in statement [CREATE CACHED TABLE JMS_MESSAGES]

      and

      2005-09-13 14:39:57,953 DEBUG [org.jboss.mq.pm.jdbc2.PersistenceManager] Could not create table with SQL: CREATE CACHED TABLE JMS_TRANSACTIONS ( TXID INTEGER, PRIMARY KEY (TXID) )
      java.sql.SQLException: Table already exists: JMS_TRANSACTIONS in statement [CREATE CACHED TABLE JMS_TRANSACTIONS]

      Which I know to be wrong since the database has no tables and still doesn't. I've created -ds.xml files for our production servers and other code is connecting so I know that's not it. The JMX shows the DS up and running and usable.

      Page 56 says to edit the jbosscmp-jdbc.xml file but there are 7 of these in the todo folder hierarchy and no mention is made to which needs to be edited and/or copied to another directory (/default?)

      What is causing this?

        • 1. Re: JB's Developer Notebook - Omission and Error
          jasperboy

          I am currently working thorugh this book - what a breath of fresh air it is. On Chp 4 some time later today - will let you know how I get on.

          • 2. Re: JB's Developer Notebook - Omission and Error
            jasperboy

            I managed to get the database to switch from Hypersonic to MySql - it all worked fine. I can check through the JMX Managment Console that the new datasource is in use and connecting - and the web application works OK.

            The only thing I did differently to the instructions in the book was to change the optional.dd property directly in the build.xml file as oppossed to the command line -D parameter (as I'm using ant from within eclipse). That ensured the correct jboxxcmp-jdbc.xml file was inlcuded in the generated jar file (from the etc/mysql folder). This file isn't needed in the jar for Hypersonic.

            You may just want to check to ensure the correct settings are in this file in the genertaed jar file after you've run the build.

            • 3. Re: JB's Developer Notebook - Omission and Error
              arnieaustin

              I'm in eclipse too. Could you tell me what you did in the build.xml file?

              • 4. Re: JB's Developer Notebook - Omission and Error

                I don't understand what you are doing. Redeploying the application would not cause the JMS persistence manager to be redeployed or to fail. There has to be something else going on.

                Could you please step back and repeat the process slowly and see if you get different results? I ran the example just now and had no problems.

                • 5. Re: JB's Developer Notebook - Omission and Error
                  arnieaustin

                  My bad...I had been using mySQL with other tools and IDEs so I knew it was working. But JBoss didn't have a copy of the jdbc driver in its /lib folder.

                  DOH! But it is really odd that it would say it had a db table creation error when it could even communicate with the db!

                  Looks like something wasn't coming to the surface. Argh.

                  All fine now.

                  • 6. Re: JB's Developer Notebook - Omission and Error

                    Ok, that's a relief. Since you are in Austin, if you have any questions/comments about the book, you can catch me at the Austin Java User's Group. (http://www.austinjug.org/) I'm there every month I'm in town, and I'm always eager to hear about what readers liked/disliked about the book.