Question

I have 3 projects. One is a Servlet (made inside a Dynamic Web Project), the other is a socket project (also a Dynamic Web Project) and the last is a real Dynamic Web Project that I want to use to unify the other 2 project and can upload both on my Apache Tomcat Server (it not my idea, is my boss idea).

I have added the Servlet and Socket project to the Unify Project using "java built path" option on eclipse. I have runned the Unify Project inside Eclipse/Tomcat and when I made a Telnet Command to the Socket, it works!. But (allways exist a but) the Servlet Project is not working because Tomcat it can't found the Listener Servlet Class. I think that the problem is on web.xml of the Unify Project

For me the problem is this line:

<servlet-class>
   com.ninatec.fnet3.bussiness_servlet.web.ListenerServlet
</servlet-class>

So, how can reference that clase, from Servlet Project, on the Unify Project?

Any idea? What do you think about this Unify Project?. It is a right approach?

Thanks and sorry for my poor english

Was it helpful?

Solution

You'd need to put that class (com.ninatec.fnet3.bussiness_servlet.web.ListenerServlet) in the same project as the servlet because that is where's it's used.

If you're unable to do this due to design constraints from your boss then you'd either have to add the other project as a dependency of the servlet project; put the built jar file in the /lib folder of the created war file (or use dependency managment such as maven). Or the other solution would be to add it as a Tomcat dependency. To do this when you have a tomcat server instance in eclipse you'd do:

  • Servers view
  • Double click the Tomcat instance
  • Open launch config
  • Classpath tab
  • Click user entries item
  • Add projects
  • Select the project with com.ninatec.fnet3.bussiness_servlet.web.ListenerServlet in

But the last solution is probably the worst ideally you'd have the listener class in the servlet project as I doubt it would be used anywhere else, or is it?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top