4 Replies Latest reply on Sep 20, 2006 11:14 PM by Ovidiu Feodorov

    Replacing persistence database - Hibernate to Postgres

    Anuj Shah Newbie

      Hi,

      Sorry for the such a question but I had to ask. I am trying to replace Hibernate to Postgres as my persistence database.

      How do I disable persistence altogether?

      The other question has to do with the replacement of xml files.

      The docs say that

      In order to enable support for one of these databases, just replace the default hsqldb-persistence-service.xml configuration file with the database-specific configuration file and restart the server.


      I couldn't find hsqldb-persistence-service.xml in any of my C:\jboss-4.0.3SP1 directories. Which directory should I be looking in? And where do I place the postgres-persistence-service.xml file. Also do I have to do it before I run

      cd util
       ant -f release-admin.xml


        • 1. Re: Replacing persistence database - Hibernate to Postgres
          Peter Johnson Master

          Regarding replacement of of the xml files, run "ant -f release-admin.xml" first (make sure JBoss AS is not running). Then in ./server/messaging/deploy/jboss-mesaging.sar you will find the hsqldb-persistence-service.xml file.

          • 3. Re: Replacing persistence database - Hibernate to Postgres
            Anuj Shah Newbie

            Yeah that document helps. Finally got the replacement working and can see that the tables are created in my postgres db. however there's now a very strange behavior that I have noticed.

            I have written a Queue client that listens on myQueue. It's a stand alone java program and here's how I initialize my connection to the queue.

            public void initialize() throws Exception {
             // lookup the queue and topic objects
             System.out.println("Starting init");
             Destination queue = (Destination) mCtx.lookup("/queue/myQueue");
             System.out.println("q look up done " + queue);
             // lookup a connection factory
             ConnectionFactory factory = (ConnectionFactory) mCtx
             .lookup("/ConnectionFactory");
             System.out.println("factory done ");
             // create a connection
             javax.jms.Connection connection = factory.createConnection();
             System.out.println("created connection ");
             // create a session
             Session session = connection.createSession(true,
             Session.AUTO_ACKNOWLEDGE);
             System.out.println("created session");
             // create a message consumer for the topic
             MessageConsumer subscriber = session.createConsumer(queue);
             System.out.println("created consumer");
             // set this class as message listener for the topic
             subscriber.setMessageListener(this);
             System.out.println("finished init");
             connection.start(); // start connection
             }


            You see so many print statements only because I wanted to figure out at what step does it hang..

            here's the output for this java program

            [java] You are connecting to server wd55237
             [java] Threads available 4
             [java] datasource look up done
             [java] Starting init
             [java] q look up done JBossQueue[myQueue]
             [java] factory done


            However it does not get past the createConnection() step. It just hangs there??? Any ideas why?

            Here's the classpath that I am running this clss with
            C:\Documents and
             Settings\d3m293\workspace\NCBIOfflineRetrieval\build\lib\ncbiretrieval.jar
             -C:\Documents and Settings\d3m293\workspace\NCBIOfflineRetrieval\lib\blueprint-commons-db-3.8.jar
             -C:\Documents and Settings\d3m293\workspace\NCBIOfflineRetrieval\lib\brm-server.jar
             -C:\Documents and Settings\d3m293\workspace\NCBIOfflineRetrieval\lib\brm-util.jar
             -C:\Documents and Settings\d3m293\workspace\NCBIOfflineRetrieval\lib\jboss-messaging-client.jar
             -C:\Documents and Settings\d3m293\workspace\NCBIOfflineRetrieval\lib\seqhound-4.0.jar
             -C:\Documents and Settings\d3m293\workspace\NCBIOfflineRetrieval\lib\axis\axis.jar
             -C:\Documents and Settings\d3m293\workspace\NCBIOfflineRetrieval\lib\axis\commons-discovery-0.2.jar
             -C:\Documents and Settings\d3m293\workspace\NCBIOfflineRetrieval\lib\axis\commons-logging.jar
             -C:\Documents and Settings\d3m293\workspace\NCBIOfflineRetrieval\lib\axis\jaxrpc.jar
             -C:\Documents and Settings\d3m293\workspace\NCBIOfflineRetrieval\lib\axis\saaj.jar
             -C:\Documents and Settings\d3m293\workspace\NCBIOfflineRetrieval\lib\axis\wsdl4j-1.5.1.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\activation.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\antlr-2.7.5H3.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\asm-attrs.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\asm.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\autonumber-plugin.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\axis.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\bcel.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\bindingservice-plugin.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\blueprint-commons-db-3.8.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\bsf.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\bsh-1.3.0.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\bsh-deployer.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\cglib-2.1_2jboss.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\commons-collections.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\commons-httpclient.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\commons-logging.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\ejb3-persistence.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\hibernate-annotations.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\hibernate-entitymanager.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\hibernate3.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\hsqldb-plugin.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\hsqldb.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\javax.servlet.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\javax.servlet.jsp.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\jboss-common-jdbc-wrapper.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\jboss-hibernate.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\jboss-j2ee.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\jboss-jaxrpc.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\jboss-jca.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\jboss-jsr77.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\jboss-jsr88.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\jboss-management.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\jboss-monitoring.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\jboss-remoting.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\jboss-saaj.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\jboss-transaction.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\jboss.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\jbosssx.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\jmx-adaptor-plugin.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\jnpserver.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\jpl-pattern.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\jpl-util.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\log4j.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\mail-plugin.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\mail.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\msbase.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\mssqlserver.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\msutil.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\mysql-connector-java-5.0-nightly-20060131-bin.
             jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\pg74jdbc3.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\properties-plugin.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\scheduler-plugin-example.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\scheduler-plugin.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\seqhound-4.0.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\snmp-support.jar
             -C:\jboss-4.0.3SP1\server\messaging\lib\xmlentitymgr.jar
             -C:\Documents and Settings\d3m293\workspace\NCBIOfflineRetrieval\etc\jndi.properties
             -C:\Documents and Settings\d3m293\workspace\NCBIOfflineRetrieval\build\lib
            


            Any idea why this is happening? This was working before with the hypersonic database default configuration and suddenly now it just seems to hang while creating a connection.

            Thanks,
            Anuj


            • 4. Re: Replacing persistence database - Hibernate to Postgres
              Ovidiu Feodorov Master

              Enable TRACE logging on the client (for an idea how, use http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossMessagingUser_Enabling_TRACE_logging_on_server as source of inspiration) and send me the log file.

              DO NOT post it here, it is usually huge, zip it and send it to me by e-mail instead. Include this thread's URL somewhere in the message.