Java Open Transaction Manager and Tomcat

Discussion in 'Java' started by Anders Steinlein, Dec 8, 2003.

  1. I can't seem to get JOTM (Java Open Transaction Manager) to work in my
    web application. I tried the example at
    http://www.onjava.com/pub/a/onjava/2003/07/30/jotm_transactions.html
    successfully, but I get a NamingException when looking up the data source
    in my application (it worked fine without JOTM). The root cause:

    Caused by: javax.naming.NamingException: Could not create resource
    factory instance, null
    at org.apache.naming.factory.ResourceFactory.getObjectInstance
    (ResourceFactory.java:146)
    at javax.naming.spi.NamingManager.getObjectInstance
    (NamingManager.java:301)

    From my web.xml:

    <resource-env-ref>
    <description>Database connection</description>
    <resource-env-ref-name>jdbc/3c_db</resource-env-ref-name>
    <resource-env-ref-type>javax.sql.DataSource</resource-env-ref-type>
    </resource-env-ref>

    The context in server.xml:

    <Context path="/conquerian" docBase="conquerian" debug="6"
    reloadable="true">
    <Logger className="org.apache.catalina.logger.FileLogger"
    prefix="conquerian_log." suffix=".txt" timestamp="true"/>

    <Realm className="org.apache.catalina.realm.JDBCRealm"
    driverName="org.postgresql.Driver"
    connectionURL="jdbc:postgresql:conquerian"
    connectionName="user_3c" connectionPassword="2db4user"
    userTable="players" userNameCol="user_name"
    userCredCol="password" userRoleTable="players_roles"
    roleNameCol="role_name" debug="50"/>

    <Resource name="jdbc/3c_db" auth="Container"
    type="javax.sql.DataSource"/>
    <ResourceParams name="jdbc/3c_db">
    <parameter>
    <name>factory</name>
    <value>org.objectweb.jndi.DataSourceFactory</value>
    </parameter>
    <parameter>
    <name>driverClassName</name>
    <value>org.postgresql.Driver</value>
    </parameter>
    <parameter>
    <name>url</name>
    <value>jdbc:postgresql://127.0.0.1/conquerian</value>
    </parameter>
    <parameter>
    <name>username</name>
    <value>mydbuser</value>
    </parameter>
    <parameter>
    <name>password</name>
    <value>mydbpass</value>
    </parameter>
    </ResourceParams>

    <Resource name="UserTransaction" auth="Container"
    type="javax.transaction.UserTransaction"/>
    <ResourceParams name="UserTransaction">
    <parameter>
    <name>factory</name>
    <value>org.objectweb.jotm.UserTransactionFactory</value>
    </parameter>
    <parameter>
    <name>jotm.timeout</name>
    <value>60</value>
    </parameter>
    </ResourceParams>
    </Context>

    Just for reference, I have put the JOTM jar files in common/lib.

    My setup consists of JOTM 1.4.3, Tomcat 4.1.27, PostgreSQL 7.4.3,
    pg73jdbc3 driver.

    This problem is driving me nuts, so any and all help will be extremely
    appreciated.

    Thanks!

    Regards,
    \Anders
     
    Anders Steinlein, Dec 8, 2003
    #1
    1. Advertising

  2. Anders Steinlein

    kNate Guest

    Anders,

    I'm running into the same problem... j2sdk1.4.2, Tomcat/4.1.27, JOTM
    1.4.3, using Merant JDBC Drivers...

    Any one have a resolution?


    Anders Steinlein <> wrote in message news:<>...
    > I can't seem to get JOTM (Java Open Transaction Manager) to work in my
    > web application. I tried the example at
    > http://www.onjava.com/pub/a/onjava/2003/07/30/jotm_transactions.html
    > successfully, but I get a NamingException when looking up the data source
    > in my application (it worked fine without JOTM). The root cause:
    >
    > Caused by: javax.naming.NamingException: Could not create resource
    > factory instance, null
    > at org.apache.naming.factory.ResourceFactory.getObjectInstance
    > (ResourceFactory.java:146)
    > at javax.naming.spi.NamingManager.getObjectInstance
    > (NamingManager.java:301)
    >
    > From my web.xml:
    >
    > <resource-env-ref>
    > <description>Database connection</description>
    > <resource-env-ref-name>jdbc/3c_db</resource-env-ref-name>
    > <resource-env-ref-type>javax.sql.DataSource</resource-env-ref-type>
    > </resource-env-ref>
    >
    > The context in server.xml:
    >
    > <Context path="/conquerian" docBase="conquerian" debug="6"
    > reloadable="true">
    > <Logger className="org.apache.catalina.logger.FileLogger"
    > prefix="conquerian_log." suffix=".txt" timestamp="true"/>
    >
    > <Realm className="org.apache.catalina.realm.JDBCRealm"
    > driverName="org.postgresql.Driver"
    > connectionURL="jdbc:postgresql:conquerian"
    > connectionName="user_3c" connectionPassword="2db4user"
    > userTable="players" userNameCol="user_name"
    > userCredCol="password" userRoleTable="players_roles"
    > roleNameCol="role_name" debug="50"/>
    >
    > <Resource name="jdbc/3c_db" auth="Container"
    > type="javax.sql.DataSource"/>
    > <ResourceParams name="jdbc/3c_db">
    > <parameter>
    > <name>factory</name>
    > <value>org.objectweb.jndi.DataSourceFactory</value>
    > </parameter>
    > <parameter>
    > <name>driverClassName</name>
    > <value>org.postgresql.Driver</value>
    > </parameter>
    > <parameter>
    > <name>url</name>
    > <value>jdbc:postgresql://127.0.0.1/conquerian</value>
    > </parameter>
    > <parameter>
    > <name>username</name>
    > <value>mydbuser</value>
    > </parameter>
    > <parameter>
    > <name>password</name>
    > <value>mydbpass</value>
    > </parameter>
    > </ResourceParams>
    >
    > <Resource name="UserTransaction" auth="Container"
    > type="javax.transaction.UserTransaction"/>
    > <ResourceParams name="UserTransaction">
    > <parameter>
    > <name>factory</name>
    > <value>org.objectweb.jotm.UserTransactionFactory</value>
    > </parameter>
    > <parameter>
    > <name>jotm.timeout</name>
    > <value>60</value>
    > </parameter>
    > </ResourceParams>
    > </Context>
    >
    > Just for reference, I have put the JOTM jar files in common/lib.
    >
    > My setup consists of JOTM 1.4.3, Tomcat 4.1.27, PostgreSQL 7.4.3,
    > pg73jdbc3 driver.
    >
    > This problem is driving me nuts, so any and all help will be extremely
    > appreciated.
    >
    > Thanks!
    >
    > Regards,
    > \Anders
     
    kNate, Dec 30, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. MetroFix
    Replies:
    1
    Views:
    1,091
    Lee Fesperman
    Sep 8, 2003
  2. Joe
    Replies:
    0
    Views:
    1,684
  3. ShadowMan

    EJB container manager transaction

    ShadowMan, Nov 8, 2004, in forum: Java
    Replies:
    5
    Views:
    4,107
    Grzegorz Trafny
    Nov 9, 2004
  4. sid derra

    Transaction manager (Objectstore)

    sid derra, Jun 7, 2005, in forum: Java
    Replies:
    2
    Views:
    377
    Wibble
    Jun 8, 2005
  5. Vencz Istv?n
    Replies:
    2
    Views:
    288
Loading...

Share This Page