facebook

Cannot load JDBC driver class when using MyEclipse Tomcat

  1. MyEclipse Archived
  2.  > 
  3. Bugs
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #330630 Reply

    Jeff Decker
    Participant

    Hi,

    I’m not sure if this is a bug or I am just doing something wrong.

    I have a web app that uses a Resource in the context.xml to connect to a mysql database. I have the mysql-connector-java-5.1.15-bin.jar in my WEB-INF/lib folder. However when I run my code I get the ‘Cannot load JDBC driver class ‘com.mysql.jdbc.Driver” message.

    This exact same setup works when I deploy from within MyEclipse to my Tomcat 7 setup. I double checked and my Tomcat 7 does not have the mysql jar in it’s lib folder. Which is correct, I want to make sure that the mysql connector I use is embedded in my web app, instead of relying on what is installed on the server.

    To me this looks like a bug with the MyEclipse Tomcat instance, but I am not sure.

    Can anyone let me know if I am doing something wrong?

    Thanks,
    Jeff

    #330652 Reply

    support-swapna
    Moderator

    Jeff,

    Sorry that you are seeing this issue.

    1. Can you please share the Installation Details from MyEclipse > Installation Summary > Installation Details ?

    2. For all latest versions of Tomcat, it is advised to add the MySQL Connector/J library (mysql-connector-java-5.1.15-bin.jar) to $CATALINA_HOME/lib.

    Can you check if any of these works for you ?

    a. You can add the Connector/J to the Embedded Tomcat Classpath. Navigate to Preferences->MyEclipse->Servers->Integrated Sandbox->MyEclipse Tomcat->Paths, and Add the MySQL Connector/J to the classpath. I guess prepend or append will work equally well.

    b. Also you can adjust the project build path setting. Right Click on the web project->Properties->Java Build Path->Libraries Tab->Add External Jars Button, and add the MySQL Connector/J jar to your build path. The MyEclipse deployment utility by default also deploys any dependent libs specified in the build path.

    3. If you are still seeing issue, please clear the contents of the .log file which is located at <workspace dir>/.metadata/.log, replicate the issue and copy paste the entire error message here for us.

    4. Can you please create a sample project which exhibits the issue and send it to us to help replicate the issue at our end ?

    Let us know how it works for you.

    #330819 Reply

    Jeff Decker
    Participant

    Hi Swapna,

    Where would I find
    MyEclipse > Installation Summary > Installation Details

    I’m trying to avoid adding the mysql connector lib to the tomcat lib path. I’d much rather it use the lib in my webapp’s WEB-INF/lib. MyEclipse knows about these libraries because under classpath for the project it includes “Web App Libraries” which includes all JARs in that lib folder.

    Where is the $CATALINA_HOME/lib folder for the MyEclipse Tomcat? I looked under C:\Users\jdecker\Workspaces\MyEclipse 10\.metadata\.me_tcat which includes a logs and webapps folder, but I cannot find a lib folder here.

    Thanks,
    Jeff

    #330832 Reply

    support-swapna
    Moderator

    Jeff,

    I could replicate the issue with the ME Tomcat not picking up the driver jar file. A PR is filed for the dev team to investigate it.

    As a workaround, please copy the jar file into common>plugins>com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201109141806>tomcat>lib folder and try.

    Take a look at this FAQ for information on the ‘common’ folder location along with other MyEclipse files and folders locations :
    https://www.genuitec.com/forums/topic/installation-where-are-the-myeclipse-files-and-folders/

    #330850 Reply

    Jeff Decker
    Participant

    Hi Swapna,

    Thank you for the quick reply! I’m glad you can see this issue as well. In the meantime, I just setup an external version of Tomcat 7 to link MyEclipse to. This is how I used to do it in the old days anyway 🙂

    Thanks for a great product, and keep up the good work!
    Jeff

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: Cannot load JDBC driver class when using MyEclipse Tomcat

You must be logged in to post in the forum log in