Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7504775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:41:06+00:00 2026-05-29T21:41:06+00:00

I am using Tomcat and Java (through Eclipse) and SQL Server 2008 R2 I

  • 0

I am using Tomcat and Java (through Eclipse) and SQL Server 2008 R2

I am getting

org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of 
class '' for connect URL 'null'

I also tried deploying to Tomcat 7 and I got exactly the same error. (I made sure that in this case the sqljdbc4.jar was in the lib directory of Tomcat, rather than just in the WAR)

Can anyone help? Thanks!

My code is as follows:

Server.xml

<GlobalNamingResources>
<Resource type="javax.sql.DataSource" auth="Container"
        name="jdbc/charmDB"
        factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
        driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
        url="jdbc:sqlserver://localhost:1433;databaseName=CH;
        integratedSecurity=true"
        />

Web.xml

<resource-ref>
  <description>CH Database</description>
  <res-ref-name>jdbc/charmDB</res-ref-name>
  <res-type>javax.sql.DataSource</res-type>
  <res-auth>Container</res-auth>
</resource-ref> 

Java code

InitialContext ic = new InitialContext();
DataSource ds = (DataSource) ic.lookup("java:comp/env/jdbc/charmDB");
Connection con = ds.getConnection();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T21:41:07+00:00Added an answer on May 29, 2026 at 9:41 pm

    Resources declared in the the GlobalNamingResources will not be visable by your web application unless you link them to the application’s context.

    Otherwise, you could define the resource in the default context or the web application’s context.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to create a installer using Java that combine tomcat, mysql and war file
I'm getting this error while running tomcat 'java.lang.ClassNotFoundException: com.mysql.jdbc.Driver'. I'm using a combination of
An Apache Tomcat (Atlassian Confluence) instance is started using the following Java options: JAVA_OPTS=-Xms256m
I am using Apache tomcat 7.02 as a server.I created an application using sphinx4
I am currently building an application using Tomcat, Spring and JAVA. I am using
I'm using Java 6, Tomcat 6, and Metro. I use WebService and WebMethod annotations
I am using Java 6 64-bit and STANDALONE Tomcat 6.0.18 on Vista 64-bit. I
i am using tomcat server and i have added a rhino engine to able
I'm probably going to be using Tomcat and the Apache Axis webapp plugin, but
Working in Eclipse on a Dynamic Web Project (using Tomcat (v5.5) as the app

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.