Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Tomcat and the fly likes Cannot create JDBC driver of class '' for connect URL 'null' Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Cannot create JDBC driver of class Watch "Cannot create JDBC driver of class New topic
Author

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

raj jaiswal
Ranch Hand

Joined: Nov 25, 2008
Posts: 56
Hello everyone,


I want to create connection object inside tomcat .I am using SQL2005.But i am gettting error like


Please anyone help me.
My Code is

this is my class


inside tomcat context.xml i have put that code.
C:\Program Files\Apache Software Foundation\Tomcat 5.5\conf\context.xml










this is web.xml where i put that code





thanks

Raj jaiswal.
MCA SCJP6.0
amit punekar
Ranch Hand

Joined: May 14, 2004
Posts: 511
Hi,
Have you placed the required SQL 2005 database driver JAR file in <<tomcat.home>>/lib directory.

You might find this useful.

Regds,
Amit
raj jaiswal
Ranch Hand

Joined: Nov 25, 2008
Posts: 56
hi amit punekar ,
Thanks for reply.
But I have already put driver jar inside tomcat lib .
So please tell me solution.
Thanks in advance
Raj
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2491
    
    8

I have moved this post to our Tomcat forum for you.


OCUP UML fundamental and ITIL foundation
youtube channel
Misha Ver
Ranch Hand

Joined: Mar 03, 2008
Posts: 470
raj jaiswal wrote:hi amit punekar ,
Thanks for reply.
But I have already put driver jar inside tomcat lib .
So please tell me solution.
Thanks in advance
Raj


Where exactly you put jar file? It should be $CATALINA_HOME/common/lib for Tomcat 5, not $CATALINA_HOME/lib
raj jaiswal
Ranch Hand

Joined: Nov 25, 2008
Posts: 56
hello everyone,

Still i am getting below error. Could you please solve it .


Thanks in advance.
Raj jaiswal
raj jaiswal
Ranch Hand

Joined: Nov 25, 2008
Posts: 56
hi Misha ,
Thanks for reply.


Where exactly you put jar file? It should be $CATALINA_HOME/common/lib for Tomcat 5, not $CATALINA_HOME/lib



I have put driver jar file that location C:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib\sqljdbc4.jar.

please find the Solution.


Thanks
raj jaiswal
Ranch Hand

Joined: Nov 25, 2008
Posts: 56
Hi all,


Still i am waiting for solution.

please anybody solve it.



Thanks
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15958
    
  19

raj jaiswal wrote:
please anybody solve it.


Raj, the way the JavaRanch works is that people don't pay us, and we don't solve things. We help people solve things, and - since we don't get paid, it may sometimes take some time before someone who can help gets online.

The important part of your error message is "driver of class ''". There's an empty string where the classname should be in that message, so somehow you've mis-specified part of your database connection pool definition. To be able to tell you more than that, I'd have to take time away from things I do get paid to do, but I can say that overall, it looks like you're doing everything right. Except, obviously for the 5% of the work that's going to take 95% of the time. Which, sadly is how it usually goes for all of us.

Anyway, do a fine-grained comparison of your application Context database pool definition against the Tomcat docs with special attention to the driver class and JDBC URL and I think you'll find your problem.


Customer surveys are for companies who didn't pay proper attention to begin with.
raj jaiswal
Ranch Hand

Joined: Nov 25, 2008
Posts: 56
Hi Tim,

quote] please anybody solve it.

Sorry for this ,But this is not mean i am forcefully saying you have to solve it .I wrote please anybody solve it .So please don't take wrong meaning.I know we don't pay at all .anyway If you are hurted by my words i saying sorry for that.


Thanks.
Raj jaiswal
amit punekar
Ranch Hand

Joined: May 14, 2004
Posts: 511
Hi again,
Upon looking again at your configuration

url="jdbc:sqlserver://10.10.5.88:1433;Database=Ilastic Development;"


Can you check if we really need the ";" in the above URL?
I did not remember I putting it when I connected to Oracle. This might be even correct for the database you are using but just noticed this.

regds,
amit
raj jaiswal
Ranch Hand

Joined: Nov 25, 2008
Posts: 56
thanks all of you,

I have solved this problem by the help of javaranch team.
The problem was i kept this code





inside context.xml but we need to keep inside server.xml
now my program is working fine.

Thanks once again
Raj jaiswal
MCA SCJP1.6
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15958
    
  19

raj jaiswal wrote:thanks all of you,

I have solved this problem by the help of javaranch team.
The problem was i kept this code





inside context.xml but we need to keep inside server.xml
now my program is working fine.

Thanks once again
Raj jaiswal
MCA SCJP1.6


Actually, that's not true. Normally you would put it in server.xml if you wanted the connection pool to be common to multiple webapps, and you would put it in a context.xml if you wanted to it to be in a single webapp.

If you put it in both places, that could be a conflict. You can also get a conflict if you created a META-INF/context.xml file in your WAR and also had defined a context XML file in the TOMCAT_HOME/conf/Catalina/localhost directory. Finally, just to make life really challenging, if you change a WAR file and re-deploy it, you must delete the exploded version of the previous WAR file if it is present in the TOMCAT_HOME/webapps directory because if you do not, not only will you have out-of-date database connections, you will have out-of-date code and data resources!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Cannot create JDBC driver of class '' for connect URL 'null'
 
Similar Threads
Solution ------ Cannot create JDBC driver of class '' for connect URL 'null'
javax.servlet.ServletException: Name java: is not bound in this Context
JDBC connection error on a share Tomcat host
making connection pool in Glassfish v3
Unable to create Data Source in Tomcat