Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-968

Failed to find DataSource named java:comp/env/jdbc/JiraDS in JNDI server with name default. Trying normal database.

      We get the following error periodically (every 30sec or so - there must be some timer?)

      As far as we can tell Jira seems to be working fine. We seem to be able to do everything we want (except delete users, it seems - but I think that is something else...)

      -Nick Minutello

      1. 2002-11-11 18:27:17,244 WARN [ofbiz.core.entity.ConnectionFactory] [ConnectionFactory.getConnection] Failed to find DataSource named java:comp/env/jdbc/JiraDS in JNDI server with name default. Trying normal database.
        javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
        at org.apache.naming.NamingContext.lookup(NamingContext.java:811)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
        at org.apache.naming.SelectorContext.lookup(SelectorContext.java:183)
        at javax.naming.InitialContext.lookup(InitialContext.java:347)
        at org.ofbiz.core.entity.ConnectionFactory.getConnection(ConnectionFactory.java:93)
        at org.ofbiz.core.entity.jdbc.DatabaseUtil.getConnection(DatabaseUtil.java:58)
        at org.ofbiz.core.entity.jdbc.DatabaseUtil.getTableNames(DatabaseUtil.java:621)
        at org.ofbiz.core.entity.jdbc.DatabaseUtil.checkDb(DatabaseUtil.java:75)
        at org.ofbiz.core.entity.GenericDAO.checkDb(GenericDAO.java:1324)
        at org.ofbiz.core.entity.GenericHelperDAO.checkDataSource(GenericHelperDAO.java:260)
        at org.ofbiz.core.entity.GenericDelegator.<init>(GenericDelegator.java:136)
        at org.ofbiz.core.entity.GenericDelegator.getGenericDelegator(GenericDelegator.java:81)
        at com.atlassian.jira.config.DefaultConfig.<init>(DefaultConfig.java:47)
        at com.atlassian.jira.config.ConfigFactory.getConfig(ConfigFactory.java:26)
        at com.atlassian.jira.service.ServiceRunner.runServices(ServiceRunner.java:35)
        at com.atlassian.jira.service.JiraTimerTask.run(JiraTimerTask.java:34)
        at java.util.TimerThread.mainLoop(Timer.java:432)
        at java.util.TimerThread.run(Timer.java:382)
        2002-11-11 18:27:17,246 ERROR [ofbiz.core.entity.ConnectionFactory] ******* ERROR: No database connection found for helperName "defaultDS"

        1. entityengine.xml
          4 kB
        2. server.xml
          20 kB

            [JRASERVER-968] Failed to find DataSource named java:comp/env/jdbc/JiraDS in JNDI server with name default. Trying normal database.

            Nick,

            Is this really a bug then?

            If you put the WAR inside the web apps directory AND in it's own context, Tomcat is actually deploying it twice afaik. That means the error occurs because only one thing can grab the proper JNDI reference?

            Cheers,
            Mike

            Mike Cannon-Brookes added a comment - Nick, Is this really a bug then? If you put the WAR inside the web apps directory AND in it's own context, Tomcat is actually deploying it twice afaik. That means the error occurs because only one thing can grab the proper JNDI reference? Cheers, Mike

            To reproduce:

            Deploy the war version - put it under the tomcat/webapps dir.

            So you probably have atlassian-jira-2.4.1.war (or something)

            Now, in your tomcat server.xml, put

            <Context path="/jira" docBase="atlassian-jira-2.4.1.war" ..../>

            (you can also put "atlassian-jira-2.4.1" because tomcat will unpack the war)

            Now, because "jira" and "atlassian-jira-2.4.1" are different, you will get this exception.

            If you make them the same, then it will go away.
            If you move the war outside of the webapps dir, then it will also go away.

            -Nick

            Nick Minutello added a comment - To reproduce: Deploy the war version - put it under the tomcat/webapps dir. So you probably have atlassian-jira-2.4.1.war (or something) Now, in your tomcat server.xml, put <Context path="/jira" docBase="atlassian-jira-2.4.1.war" ..../> (you can also put "atlassian-jira-2.4.1" because tomcat will unpack the war) Now, because "jira" and "atlassian-jira-2.4.1" are different, you will get this exception. If you make them the same, then it will go away. If you move the war outside of the webapps dir, then it will also go away. -Nick

            I have no idea about this one. I can't replicate on Tomcat 4.1.27. Apart from this bugreport I've not heard any users reporting this problem. Can someone provide more details on how to replicate this with the standalone distribution?

            Marking as 'cannot reproduce' in the meanwhile.

            Jeff Turner added a comment - I have no idea about this one. I can't replicate on Tomcat 4.1.27. Apart from this bugreport I've not heard any users reporting this problem. Can someone provide more details on how to replicate this with the standalone distribution? Marking as 'cannot reproduce' in the meanwhile.

            Jeff,

            Is this fixed now? If so - let's close out the issue.

            Cheers,
            Mike

            Mike Cannon-Brookes added a comment - Jeff, Is this fixed now? If so - let's close out the issue. Cheers, Mike

            Then you put reference in web.xml JIRA stile log wanrings, but work correctly...

            So, to clear warnings you realy need to equal "path" to "docBase" in "Context". So, if you setup follow structure of tomcat:
            [tomcatRoot]
            [jira-backup]
            [jira-index]
            [jira-attachements]
            [jira-webapp]

            In server.xml
            <Server ...>
            <Service ...>
            <Engine ...>
            <Host appBase="jira-webapp" unpackWARs="false" autoDeploy="false" ...>
            <Context path="" docBase="" reloadable="false" ...>
            <Resource name="jdbc/JiraDS" auth="Container" type="javax.sql.DataSource"/>
            <ResourceParams name="jdbc/JiraDS">
            <parameter>
            <name>factory</name>
            <value>org.objectweb.jndi.DataSourceFactory</value>
            </parameter>
            <parameter>
            <name>username</name>
            <value>jira</value>
            </parameter>
            <parameter>
            <name>password</name>
            <value>jira</value>
            </parameter>
            <parameter>
            <name>driverClassName</name>
            <value>com.mysql.jdbc.Driver</value>
            </parameter>
            <parameter>
            <name>url</name>
            <value>jdbc:mysql://localhost:3306/jira?autoReconnect=true</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>
            </Host>
            </Engine>
            </Service>
            </Server>

            Then it will be work fine, even without references in web.xml. But you must still have in entityengine.xml full JNDI name ("java:comp/env/jdbc/JiraDS")

            <datasource name="defaultDS" field-type-name="mysql"
            helper-class="org.ofbiz.core.entity.GenericHelperDAO"
            check-on-start="true" use-foreign-keys="false"
            use-foreign-key-indices="false"
            check-fks-on-start="false"
            check-fk-indices-on-start="false"
            add-missing-on-start="true">
            <jndi-jdbc jndi-server-name="default" jndi-name="java:comp/env/jdbc/JiraDS"/>

            </datasource>

            Good luck!

            Alexey Efimov added a comment - Then you put reference in web.xml JIRA stile log wanrings, but work correctly... So, to clear warnings you realy need to equal "path" to "docBase" in "Context". So, if you setup follow structure of tomcat: [tomcatRoot] [jira-backup] [jira-index] [jira-attachements] [jira-webapp] In server.xml <Server ...> <Service ...> <Engine ...> <Host appBase="jira-webapp" unpackWARs="false" autoDeploy="false" ...> <Context path="" docBase="" reloadable="false" ...> <Resource name="jdbc/JiraDS" auth="Container" type="javax.sql.DataSource"/> <ResourceParams name="jdbc/JiraDS"> <parameter> <name>factory</name> <value>org.objectweb.jndi.DataSourceFactory</value> </parameter> <parameter> <name>username</name> <value>jira</value> </parameter> <parameter> <name>password</name> <value>jira</value> </parameter> <parameter> <name>driverClassName</name> <value>com.mysql.jdbc.Driver</value> </parameter> <parameter> <name>url</name> <value>jdbc:mysql://localhost:3306/jira?autoReconnect=true</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> </Host> </Engine> </Service> </Server> Then it will be work fine, even without references in web.xml. But you must still have in entityengine.xml full JNDI name ("java:comp/env/jdbc/JiraDS") <datasource name="defaultDS" field-type-name="mysql" helper-class="org.ofbiz.core.entity.GenericHelperDAO" check-on-start="true" use-foreign-keys="false" use-foreign-key-indices="false" check-fks-on-start="false" check-fk-indices-on-start="false" add-missing-on-start="true"> <jndi-jdbc jndi-server-name="default" jndi-name="java:comp/env/jdbc/JiraDS"/> </datasource> Good luck!

            Very stange, but you not need to change path to docBase the same. Just put in web.xml such entry:
            <!-- resource references -->
            <resource-ref>
            <description>DB Connection</description>
            <res-ref-name>jdbc/JiraDB</res-ref-name>
            <res-type>javax.sql.DataSource</res-type>
            <res-auth>Container</res-auth>
            </resource-ref>

            As it described in Tomcat documentation...

            Alexey Efimov added a comment - Very stange, but you not need to change path to docBase the same. Just put in web.xml such entry: <!-- resource references --> <resource-ref> <description>DB Connection</description> <res-ref-name>jdbc/JiraDB</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> As it described in Tomcat documentation...

            I think I have worked out the problem with this:

            You are looking up java:comp/env - and you dont have any <resource-ref> elements in your web.xml

            (How does it work at all?)

            Nick Minutello added a comment - I think I have worked out the problem with this: You are looking up java:comp/env - and you dont have any <resource-ref> elements in your web.xml (How does it work at all?)

            Thanks for the work-around information Nick!

            Scott Farquhar added a comment - Thanks for the work-around information Nick!

            BUT,

            In fact, this same problem seems to exist with Resin - so its not exclusive to Tomcat!

            -Nick

            Nick Minutello added a comment - BUT, In fact, this same problem seems to exist with Resin - so its not exclusive to Tomcat! -Nick

            It seems that this is a problem with Tomcat (or is it).

            See here for a workaround;

            http://forums.atlassian.com/thread.jsp?forum=46&thread=2308&message=28148146&q=%22Failed+to+find+DataSource%22#28148146

            -Nick

            Nick Minutello added a comment - It seems that this is a problem with Tomcat (or is it). See here for a workaround; http://forums.atlassian.com/thread.jsp?forum=46&thread=2308&message=28148146&q=%22Failed+to+find+DataSource%22#28148146 -Nick

              7ee5c68a815f Jeff Turner
              3b1ae0ec93c9 Nick Minutello
              Affected customers:
              1 This affects my team
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: