----- Original Message -----

> From: Rainer Frey <rainer.f...@inxmail.de>
> To: Tomcat Users List <users@tomcat.apache.org>
> Cc: 
> Sent: Tuesday, July 26, 2011 5:01 AM
> Subject: Re: Tomcat 6 not working with JDBC driver for MySQL
> 
> Please stop top posting.
> 
> On 26.07.2011, at 12:02, A Df wrote:
>>>  On 25.07.2011, at 22:40, A Df wrote:
>>> 
>>>>  Dear All:
>>>> 
>>>>  I have read numerous posts and documentation and now I really need 
> help.
>>>> 
>>>> 
>>>>  I am using the following:
>>>> 
>>>>  Product Version: NetBeans IDE 7.0 (Build 201104080000)
>>>> 
>>>>  I performed the steps below as follows:
>>>> 
>>>>  I have added the MySQL Connector/J JDBC Driver to the 
> $CATALINA_HOME/lib directory
>>>>  However, it gives the error:
>>>>  org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC 
> driver
>>>>  OR
>>>>  java.sql.SQLException: No suitable driver
>>> 
>>>  Are you launching Tomcat from within Netbeans? Then I'd suspect 
> that Netbeans sets it 
>>>  up with its own configuration, and esp. with a project specific class 
> path. Most instructions
>>>  out there imply that you launch Tomcat with the supplied scripts or 
> service utilities, and not with 
>>>  an IDE plugin.
>>> 
>>>  Try
>>>  * launching Tomcat manually, by shell/batch scripts OR
>>>  * add the JDBC driver also to your Netbeans project class path
> 
>>  Hi Rainer:
>> 
>>  I had already added the JDBC driver to my Netbeans project class path and 
> that worked for awhile then stopped.
> 
> Well sorry, no idea, as I don't use Netbeans. Maybe ask on a Netbeans 
> list/forum.
>> 

>>  I will have to do some reading on launching Tomcat manually by shell/batch 
> scripts but I don't have much time as I have a deadline to meet which is my 
> major concern.
> 
> Not much to read. See RUNNING.txt in a tomcat distribution. 
> $CATALINA_HOME/lib 
> is the correct place for the driver.
> 
> Rainer


NetBeans is pretty benign when it comes to changing the Tomcat environment. It 
changes the JRE (uses the $JDK_HOME/jre/bin/java instead of JRE_HOME), and 
captures catalina.out to display in the IDE.

Other than that, it adds nothing to the CLASSPATH, nor does it add any 
additional defines to JAVA_OPTS. You can change JAVA_OPTS defines in the server 
properties dialog, but I normally just use $CATALINA_HOME/bin/setenv.sh for 
that. That way my environment is consistent both in and out of NetBeans.

When you start the server in debugging or profile mode, NetBeans adds the 
appropriate properties, but does not alter those you have defined in 
$CATALINA_HOME/bin/setenv.sh.

When you're building a project in NetBeans and have it assigned to a server, 
NetBeans will add the content of that server's library to your project's 
CLASSPATH. There is no need to add the JDBC driver to your project's CLASSPATH 
if it already exists in $CATALINA_HOME/lib. In fact, coupled with the default 
NetBeans server property of Enable JDBC driver deployment, this is almost 
certainly a bad thing. Also, adding the library or JAR file to your project and 
having NetBeans package that in the WAR file is a bad thing.

Just add the JAR file to $CATALINA_HOME/lib, use the Tomcat supplied database 
pooling, and everything just works.

Permission problems may be an issue. If you're on Linux and the copied MySQL 
JAR file cannot be read by the owner of the Tomcat process, that would create 
problems. If you're on Windows, I imagine there are similar access issues, 
especially with Windows Vista or Windows 7.

It would be interesting to see the following:

1. Use NetBeans to just build the project
   right-mouse button on the project and select Build
2. Start the Tomcat server using startup.sh (or startup.bat if you're on 
Windows)
   a. Open a command line window
   b. Change directory to $CATALINA_HOME/bin (%CATALINA_HOME%\bin on Windows)
   c. ./startup.sh (startup.bat on Windows)
3. Open a browser to localhost:8080
4. Start up the Manager application (use the same userid / password defined in 
NetBeans)
5. Choose a file to deploy
   a. Navigate to <Project_Name>/dist in the browser
   b. Select the war file
   c. Click on the Deploy button
6. Open the application in a new browser window or tab
7. Post the contents of the log files
   a. catalina.out
   b. catalina.<date>.log
   c. any logging your application does (you do catch and log exceptions, yes?)

I use this combination on Linux and Windows/XP Professional all the time.

. . . . just my two cents.

/mde/

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

Reply via email to