Tibco EMS with database backend (postgresql)


I recently tried to build a JMS Server with database backend. The chosen product was the TIBCO EMS Server. The Server brings its own database support over hibernate.

Unfortunately TIBCO supports only Oracle,Mysql and DB2 by default. Lucky me, I needed an installation for Postgres but this shouldn’t be a big deal, because hibernate supports postgres as well. You just have to modify the hibernate config.

First you should install the EMS server and hibernate (version provided by Tibco). After that let’s start configuring.

To have everthing in the database you need 3 databases (3 separate EMS stores). For me I used the following 3 stores:

  1. emsmeta -> for metadata content
  2. emsnf -> for nonfailsafe data
  3. emsf -> for failsafe data

I used the same account for all 3 databases (just easier for testing purposes).

Setup the stores in the stores.conf in the EMS folder:

[$sys.meta]
type=dbstore
dbstore_driver_url=jdbc:postgresql://localhost/emsmeta
dbstore_driver_username=ems
dbstore_driver_password=ems

[$sys.nonfailsafe]
type=dbstore
dbstore_driver_url=jdbc:postgresql://localhost/emsnf
dbstore_driver_username=ems
dbstore_driver_password=ems

[$sys.failsafe]
type=dbstore
dbstore_driver_url=jdbc:postgresql://localhost/emsf
dbstore_driver_username=ems
dbstore_driver_password=ems

After that you have to change you tibemsd.conf file.The following line is a sample what you should add. Additionally you should add tha path to your jdbc driver (in this sample the last parameter – change it to your config). You also have to add the path to your JVM (here it is the debian lenny default).

dbstore_classpath       = ../../../components/eclipse/plugins/com.tibco.tpcl.org.hibernate_3.2.5.001/hibernate3.jar:../../../components/eclipse/plugins/com.tibco.tpcl.org.com.mchange.c3p0_0.9.1.001/c3p0-0.9.1.jar:antlr-2.7.6.jar:asm-attrs.jar:asm.jar:cglib-2.1.3.jar:commons-collections-2.1.1.jar:commons-logging-1.0.4.jar:dom4j-1.6.1.jar:ehcache-1.2.3.jar:jta.jar:/usr/local/bin/oracledrivers/lib/ojdbc5.jar:/home/jens/tibco/tpcl/5.6/jdbc/postgresql-8.3-603.jdbc3.jar

## db section
#dbstore_driver_name     = oracle.jdbc.driver.OracleDriver
#dbstore_driver_dialect  = org.hibernate.dialect.Oracle10gDialect
dbstore_driver_name     = org.postgresql.Driver
dbstore_driver_dialect  = org.hibernate.dialect.PostgreSQLDialect
jre_library             = /usr/lib/jvm/java-6-sun/jre/lib/i386/server/libjvm.so

As you can see changing databases is easy. You just have to change the driver_name and driver_dialect of hibernate.

After that you have the basic configuration ready. Next thing to do is to initialize the dabases. For that task Tibco provides a tool which generates the proper sql-statements.

You can run the following command in your shell and get the sql as output.

java -jar tibemsd_util.jar -tibemsdconf tibemsd.conf -createall

For some reason the create sql-statements had no ‘;’ at the end of every command. So you can’t just pipe the output to psql. You have to do it old school.

After that you can start the EMS Server and it stores all data to the selected database.

, , ,

  1. #1 by Anders on February 23, 2009 - 20:10

    Thanks!

  2. #2 by Ritesh on April 7, 2009 - 14:37

    Any body can tell me how can we make connectivity with SQL-server 2005 database

    Thanx Ritesh

  3. #3 by jens on April 9, 2009 - 12:29

    Microsoft SQL Server is supported out of the box. So you just have to read the installation manual.

  4. #4 by harti on October 15, 2010 - 10:54

    Hi,
    I’m trying to generate sql for db stores but getting following error:

    java.lang.Exception: ERROR: stores file ‘stores.conf”‘ does not exist
    at com.tibco.tibems.tibemsd.internal.db.util.EMSSchemaExport.parseStoresConf(EMSSchemaExport.java:429)
    at com.tibco.tibems.tibemsd.internal.db.util.EMSSchemaExport.exportSchema(EMSSchemaExport.java:577)
    at com.tibco.tibems.tibemsd.internal.db.util.EMSSchemaExport.main(EMSSchemaExport.java:609)

    any ideas how can I fix this ??

    Regards,
    harti

  5. #5 by jens on October 22, 2010 - 12:38

    Hi,

    I’m sure you figured it out by now, but just for the record.
    The stores.conf file will be generated automatically by the EMS on the first startup. So just start the EMS with the default config an then use the stores.conf generated.
    A college of mine also mentioned one exception to this behavior with EMS 6.0. With the new release this seems no longer to work. In order to get a stores.conf he had to create an empty file called stores.conf and then start the server. After that the server would write its config to this file. Why TIBCO changed the behavior to this really is a mystery to me.

    Regards,
    jens

  6. #6 by Jeff on October 28, 2010 - 20:20

    I”m having the same problem as Harti with EMS 5.1.2. The stores.conf file exists:

    -rw-r–r– 1 tibco tibco 2162 Oct 28 11:49 stores.conf

    And contains entries for the DB stores. But the error keeps popping up:

    TIBCO Enterprise Message Service Schema Export Tool.
    Copyright 2003-2009 by TIBCO Software Inc.
    All rights reserved.

    Version 5.1.0 V10 2/4/2009

    java.lang.Exception: ERROR: stores file ‘stores.conf”‘ does not exist
    at com.tibco.tibems.tibemsd.internal.db.util.EMSSchemaExport.parseStoresConf(EMSSchemaExport.java:429)
    at com.tibco.tibems.tibemsd.internal.db.util.EMSSchemaExport.exportSchema(EMSSchemaExport.java:577)
    at com.tibco.tibems.tibemsd.internal.db.util.EMSSchemaExport.main(EMSSchemaExport.java:609)

  7. #7 by jens on October 28, 2010 - 23:37

    Hi Jeff,

    I downloaded the EMS 5.1, used a fresh installation and got the same error.
    The solution is rather simple. As the error states, the process cannot find the stores.conf file starting from the tibemsd.conf. Starting with that error I fired a strace up and got to the following line in the log:
    stat(“\”/home/jens/tibco/ems-conf/tibco/cfgmgmt/ems/data/stores.conf\”", 0x7ffc449705d0) = -1 ENOENT (No such file or directory)

    -> As you can see, TIBCO reuses the quotes in the actual filename. If you unquote the stores.conf entry in the tibemsd.conf the application works fine.

    Further to that I found that the classpaths for the “dbstore_classpath” had changed. Here I just used the absolute path to be sure.

(will not be published)