Uploaded image for project: 'Apache Tomcat Maven Plugin'
  1. Apache Tomcat Maven Plugin
  2. MTOMCAT-125

mvn tomcat7:run got "javax.naming.NameNotFoundException: Name jdbc is not bound in this Context"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.0-beta-1
    • None
    • tomcat7
    • None
    • JDK 7, Tomcat 7.0.25, tomcat7-maven-plugin/2.0-beta-1

    Description

      I configured the datatsource as global naming datasource in server.xml,
      <GlobalNamingResources>
      <Resource
      auth="Container"
      maxPoolSize="100" minPoolSize="10"
      name="jdbc/iviewDS"
      testQuery="select count from T_ROLE"
      factory="......"
      type="javax.sql.DataSource"
      uniqueResourceName="jdbc/iviewDS"/>

      The server.xml is copied to src\main\tomcatconf, (this also copyied by the plugin to target\tomcat\conf, so it is used).

      then in webapp/META-INF/context.xml, I have:
      <ResourceLink
      name="jdbc/iviewDS"
      global="jdbc/iviewDS"
      type="javax.sql.DataSource"
      />

      And in web.xml:
      <resource-ref>
      <description>datasoruce</description>
      <res-ref-name>jdbc/iviewDS</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>
      In my code, I lookup the datasource using 'java:/comp/env/jdbc/iviewDS'.

      This works well when I deploy the app into tomcat/app directory.

      Attachments

        1. iview-global.zip
          9 kB
          guofeng zhang

        Activity

          People

            olamy Olivier Lamy
            guofengzh@gmail.com guofeng zhang
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: