Results 1 to 4 of 4

Thread: How to JNDI to Datasource?

  1. #1
    Join Date
    May 2005
    Posts
    6

    Default How to JNDI to Datasource?

    Hi,
    I just begin doing the project using springframework, and I successfully using the single datasource in my peoject. Since I need multiple databases, then i tried using JtaTransactionManager, so follow the examples in JPetStore and PetClinic, however i always get the following error msg:

    2005-05-12 16:39:28,694 ERROR [org.apache.catalina.core.ContainerBase.[Catalina]
    .[localhost].[/springapp]] - StandardWrapper.Throwable org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'transactionManager' defined in ServletContext resource [/WEB-INF/springapp-servlet.xml]: Initialization of bean failed; nested exception is org.springframework.transaction.TransactionSystemE xception: JTA UserTransaction is not available at JNDI location [java:comp/UserTransaction]; nested exception is javax.nam
    ing.NamingException: Cannot create resource instance
    org.springframework.transaction.TransactionSystemE xception: JTA UserTransaction is not available at JNDI location [java:comp/UserTransaction]; nested exception
    is javax.naming.NamingException: Cannot create resource instance
    javax.naming.NamingException: Cannot create resource instance.
    .

    And I am using springframework 1.1.3, is it problem that I need a new version springframework, or may be anyone can give some suggestions?


    Cheers![/b]

  2. #2
    Join Date
    May 2005
    Posts
    6

    Default

    I have just read a reply to a similar question as mine, it says Tomcat doesn't support(i am also using Tomcat).

    So if this is the case, is it mean if using Tomcat, then can't using JNDI for multiple databases? Springframework doesnt compatible with Tomcat using class "JtaTransactionManager"?

    And the only thing to solve this may be using two different beans implement class "DataSourceTransactionManager" and "DriverManagerDataSource"?
    But i think tomcat support JNDI, since i tried using JNDI follow the tomcat's instruction, Tomcat implement in this way: put <context>xxxx<context> in its server.xml.

  3. #3
    Join Date
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,104

    Default

    is it mean if using Tomcat, then can't using JNDI for multiple databases?
    NAFAIK.

    Springframework doesnt compatible with Tomcat using class "JtaTransactionManager"?
    It is, but Tomcat doesn't handle JTA transactions by default. You can try using JOTM, or just use an app-server (JBoss) that supports JTA out of the box.

  4. #4
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    Quote Originally Posted by wowo
    And the only thing to solve this may be using two different beans implement class "DataSourceTransactionManager" and "DriverManagerDataSource"?
    But i think tomcat support JNDI, since i tried using JNDI follow the tomcat's instruction, Tomcat implement in this way: put <context>xxxx<context> in its server.xml.
    That's a read-only JNDI implementation - unless something has been defined at start-up it doesn't exist - the JNDI can't be written. I suppose there are some alternatives out there (using a JNDI compatible library or smth?) but I haven't tried them.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

Similar Threads

  1. Replies: 7
    Last Post: Aug 29th, 2011, 05:01 AM
  2. Replies: 13
    Last Post: Feb 5th, 2010, 12:31 AM
  3. JBoss DataSource not found
    By moacsjr in forum Data
    Replies: 10
    Last Post: Aug 25th, 2005, 01:26 PM
  4. Replies: 1
    Last Post: Feb 12th, 2005, 07:30 AM
  5. Ignoring missing Jndi DataSource within IDE?
    By Bill Pearce in forum Container
    Replies: 2
    Last Post: Oct 27th, 2004, 09:06 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •