facebook

Class found for one DAO; not found for another DAO

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #287050 Reply

    Gert Cuppens
    Member

    I’m working on a web application using JSF. I’ve followed one of your tutorials and it works fine. I’ve made another project inside MyEclipse to test the connection with MySQL using MySQL connector 1.5.6 and it works fine.
    The I tried to put those 2 together : using a logon screen connecting to a MySQL database and I always get the error “class not found”.
    Nevertheless, I have imported the JAR file I downloaded from mysql.com and put it into the WEB-INF/lib folder. After closing MyEclipse and reopening it, I saw the different jar files under “Referenced Libraries”. It also includes the mysql-connector-java-1.5.6.

    As a final test, I coped the UserDao, GeneralDao and TestDao from the other project into the webapp project. And it also works there.

    So, in conclusion , I have a General Data Access Object which works fine when I call it from the testDao class. But when I call the General Data Access Object from the JSF web app, I get “class not found”.
    What do I have to add to make the DAO find the class when it’s called from the JSF web app ?

    #287064 Reply

    Gert Cuppens
    Member

    Just to be sure, I deleted one DAO and worked with only one GeneralDao to connect to the MySQL database.
    The GeneralDao is an abstract class and the UserDao extends this class.

    When calling UserDao from an TestDao class (containing a main() method), everything works fine and I can select data from the MySQL database.
    When calling UserDao from the JSF web application I always get “class not found error”. Neverteless, the classes were all in the same Java web project inside MyEclipse.

    The solution was on one of the MyEclipse forums. I found it right here :
    https://www.genuitec.com/forums/topic/myeclipse-tomcat-common-libs/

    I was working with the Tomcat server who comes with MyEclipse. What I had to do, was the following:
    – go to MyEclipse – preferences
    – go to servers – integrated Sandbox
    – choose “MyEclipse Tomcat 6”.
    – you will see 3 options : JDK – Launch – Paths
    – choose Paths.
    Then I clicked the button “add JAR/ZIP” under the title “append to classpath”.
    I browsed until I found the executable Jar file from the MySQL connector.

    After adding, I restarted the Tomcat server and this time I could connect to the database.

    I hope this thread can help others having the same problem. And frankly, I found the solution also under another thread.

    [/url]

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Class found for one DAO; not found for another DAO

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