• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Files in WEB-INF/lib

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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>
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

till I placed the file manually in the system classpath.


Which file ?
 
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Christophe,

Yes it is the mysql Db driver jar file.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It should be working if it's put in WEB-INF/lib. The problem may be somewhere else.
 
Bartender
Posts: 2292
3
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic