You are here: TWiki > Guides Web > Java > TomcatFaq r6 - 26 May 2006 - 00:04 - JesseSuen


Start of topic | Skip to actions

Create a admin user for Tomcat:

$ cd "$CATALINA_HOME/conf/"
$ vi tomcat-users.xml
  <user username="admin" password="admin" roles="admin,manager"/>

Configuring Tomcat with a JNDI DataSource?

Edit your /WEB-INF/web.xml file
<resource-ref>
  <res-ref-name>your-jndi-datasource-name</res-ref-name> 
  <res-type>javax.sql.DataSource</res-type> 
  <res-auth>Container</res-auth> 
</resource-ref>
Edit your /META-INF/context.xml file:
<Context docBase="application name" path="application context">
  <Resource 
      name="your-jndi-datasource-name"
      auth="Container" type="javax.sql.DataSource"
      factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
      username="dbuser"
      password="dbpassword"
      driverClassName="your-driver-name"
      url="your-url"
  />
  <ResourceLink 
      name="your-jndi-datasource-name"
      global="your-jndi-datasource-name"
      type="javax.sql.DataSource"
  />
</Context>

SQLNestedException: Cannot load JDBC driver class 'oracle.jdbc.driver.OracleDriver'

Make sure you add your JDBC driver jar file to the $CATALINA_HOME/common/lib directory and not your $WEBAPP/WEB-INF/lib/ directory.

SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'

SQLNestedException: Cannot create PoolableConnectionFactory (invalid arguments in call)

At this point, Tomcat was able to lookup your JNDI DataSource?.

-- JesseSuen - 19 May 2006

Edit | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r6 < r5 < r4 < r3 < r2 | More topic actions
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback