Announcement Announcement Module
Collapse
No announcement yet.
How to JNDI to Datasource? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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.

    Comment


    • #3
      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.

      Comment


      • #4
        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.

        Comment

        Working...
        X