1

I'm developing a web-application on Eclipse. I've implemented the DAL as a separate project and set it as dependency of my main project.

I can compile the main project, but when I run it, i get this exception:

SEVERE: Servlet.service() for servlet InputServlet threw exception
java.lang.ClassNotFoundException

It can't find a class that is in my "DAL Project" so it seems that classes of this project are not deployed in Tomcat when I run the web-app.

How can I solve it? Is there something to configure?

davioooh
  • 23,742
  • 39
  • 159
  • 250
  • Did you add it as a dependency correctly? Try adding that project to the build path. – Jeremy May 08 '12 at 16:51
  • @Jeremy yes, I added the DAL Project to the build path, in fact i can use objects packaged in this project in my main project (web-app), and i get no compile-time errors. But when I run the main project the `ClassNotFoundException` is thrown... – davioooh May 09 '12 at 07:24

1 Answers1

2

I solved my problem following the answer of rodgarcialima to this question: Eclipse Web Project Dependencies:

  1. Go to web project properties.
  2. Deployment Assembly (Left).
  3. Add > Select project > Select your lib project > Check "Assemble projects into the WEB-INF/lib folder of the web application" if not checked > Finish.
  4. Java Build Path (Left) > Projects Tab > Add... > Select your lib project > OK
  5. Java Build Path (Left) > Order and Export Tab > Select your lib project.
  6. Save
  7. Now it works.
Community
  • 1
  • 1
davioooh
  • 23,742
  • 39
  • 159
  • 250