• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Files in WEB-INF/lib

 
raghu dubey
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I placed mysql driver jar file in the WEB-INF/lib but it did not work and I could not get the connection till I placed the file manually in the system classpath. Here is the code and web.xml config I used. Do I need to do anything else as well apart from doing things below. Also I do not think any import is required when using FQ class name of the driver. Please help.


Class.forName(getServletConfig().getServletContext().getInitParameter("dbDriver"));
Connection con = DriverManager.getConnection(getServletConfig().getServletContext().getInitParameter("dbURL"), "raghu","raghu123");

<context-param>
<param-name>dbDriver</param-name>
<paral-value>com.mysql.jdbc.Driver</param-value>
</context-param>
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
till I placed the file manually in the system classpath.

Which file ?
 
Raghavan Muthu
Ranch Hand
Posts: 3381
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe he says the mysql connector jar file. Is nt it?
 
raghu dubey
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Christophe,

Yes it is the mysql Db driver jar file.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It should be working if it's put in WEB-INF/lib. The problem may be somewhere else.
 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy, y'all.

Indeed, it should be working, Chris is right.
If you put your .jar file in your Tomcat/lib folder, it will work not only for this particular application, but also for all the other applications you may have. But yet, this is a workaround, it should be working if you put the .jar file in the WEB-INF/lib folder of your application.
Well, try unistalling your Tomcat (you're using Tomcat, right?) and installing it again... it might work...
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
raghu, are you using an IDE like Eclipse and running your Tomcat instance inside of the IDE? If so, that would explain the problem. In Eclipse, you'd have to right-click the jars under WEB-INF/lib and select the option for adding them to your Build Path.
 
raghu dubey
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope Mark,

I am not using eclipse as of now. Just manual coding. I will try Bob's recipe and revert soon.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic