-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Sreyan,

On 2/18/15 10:15 AM, sreya...@gmail.com wrote:
> What is the SYSTEM PATH that you are referring to ? Is it the 
> JAVA_HOME or the PATH system variable ?

Neither of those. It's commonly referred to as the CLASSPATH
environment variable, which should pretty much never be set because
it's horribly confusing.

Instead, Tomcat uses "java -classpath [the classpath]" to launch the
JVM. The classpath used there includes two JAR files:

> 
> 
> What is the CLASSPATH just before Tomcat properly starts up ? What
> is it after it starts up ? Is the same jar files below -:
> 
> 
> 
> 
> Correct me if I am wrong that means that whatever dependencies I
> have in my project is not added to the SYSTEM CLASSPATH but is
> instead loaded by TOMCAT. So if a module searches only the SYSTEM
> CLASSPATH it won’t be able to find the dependencies. Am I right ?
> 
> 
> Regards Sreyan Chakravarty
> 
> 
> 
> 
> 
> From: Christopher Schultz Sent: ‎Wednesday‎, ‎February‎ ‎18‎,
> ‎2015 ‎8‎:‎30‎ ‎PM To: Tomcat Users List
> 
> 
> 
> 
> 
> Sreyan,
> 
> On 2/18/15 9:25 AM, sreya...@gmail.com wrote:
>> I am writing a simple Servlet that uses JDBC to talk to MySQL and
>>  deploying it in Tomcat. Why do I need to add the line -:
> 
>> Class.forName("com.mysql.jdbc.Driver");
> 
>> to load the JDBC driver ? If I don’t do this I get an exception
>> of -:
> 
>> java.sql.SQLException: No suitable driver was found.
> 
>> Why is it when I use a JDBC connection in Servlets and deploy it
>> in Tomcat must the class be loaded dynamically ? Why can’t Tomcat
>> do that for me when I have already added it to the build path ?
> 
>> From Java 6 onwards there is no need for the JDBC Driver to be 
>> loaded dynamically. So why when using JRE 8 and Tomcat 8 must
>> this be done ?
> 
>> Cant it be loaded automatically like for normal apps ? It sure 
>> would be a lot more cleaner code.
> 
> My guess is that DriverManager only searches the system CLASSPATH 
> which only contains the following JAR files when launching Tomcat 
> using the standard scripts:
> 
> bin/bootstrap.jar bin/tomcat-juli.jar
> 
> The bootstrap class then configures a new ClassLoader (including 
> lib/*.jar) for the Tomcat server and Tomcat properly launches using
>  /that/.
> 
> I think your JDBC driver simply isn't visible to DriverManager's 
> auto-loading. But when you call Class.forName, the driver registers
>  itself with DriverManager, which is okay to do if DriverManager 
> didn't know about your driver.
> 
> -chris
> 
> ---------------------------------------------------------------------
>
>
> 
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJU5Pl4AAoJEBzwKT+lPKRYZgYQALnUclLfhNuu+U9nEGTpOrBi
RbdNgBhQIO5cVvtSrlHRJY5+6V0ltSauDE9A7hdt7ULdo0f1RQ5KS4Km0CCuZX0G
X2/wqGl8Z5tEfhsSaYCMDRNBsH9ggyJ7araVJC702PfBhLMkhzOqk7aove3ZB8sp
1VAjQ0qS+l8WwwHx7oa8az4CO3HKYo4Ow7wClO9qZ1VI4jtOGOUR8KC8am12IB+q
/fu4SjAFafwpjP/WeEn4wD/Ut60dc1DllFKKTBNLj5euMGr3yyxALgxaai8gu0Y9
6tMFVWyRsmIg/D+uvibXMNBQa9vIIsPP2t+GpWhPUEbvsW0RQEbu19+fxjoVphhz
leDi77G4TNN3VamW+1IkvhySKJFi/UJNai32E58sH1LQgCi2A7toyctSsxb/D6bU
w+mX8YU3s97YQO4tNMGLtC5PTGlr31dAXFn7ysjrCtp5QyAGrsj9hFDq025oN+Fa
1njc2OlYFtu6opzG0eyVQJ4/15bR2NTw+Z7BfyzLpsZt8XvKyUwMI88GmQzXUuIE
KwGxv27XGSQz1nI/GtiFRof/RRzmXDAgLpgSu8Mzj07bmuiEJ+MNLU02UCgvlpLh
CbkcvbbwweANEKtxsP/c1Exhi0WTJ98ovvgtOH8B1hRXeBiQ9GCB+s/krIOoYWdl
yCvbirCURAzVP8qiv172
=eu3o
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to