Alternative title: Unable to find [main.SearchServlet], mapping my servlet in Tomcat whilst using annotations
I'm trying to migrate my web application from java netbeans glassfish jdk 1.8 to eclipse tomcat jdk 1.7.
I keep getting a 405 then 404 error when I try to perform my POST by pressing a button on my loaded index jsp.
javax.naming.NameNotFoundException: Name [main.SearchServlet/annj] is not bound in this Context. Unable to find [main.SearchServlet].
I thought that setting a <context root>/</context root>
in web.xml would fix this. It did move my loading page from localhost/animelist/index
and localhost/animelist
down one level to localhost/
and localhost/animelist
however it did not fix my error.
As it stands, my project does not run at http://localhost:8080/
or http://localhost:8080/index.jsp
. It DOES run at http://localhost:8080/animelist1/
and http://localhost:8080/animelist1/index.jsp
The project works fine in my netbeans setup so my question is what do i need to do for my servlets to be mapped properly in tomcat?
Someone said that " Likely the only problem you have is that the application deployment in your secondary Eclipse isn't working properly yet. As in: the servlet class file is not deployed to the server at all." I'm not sure how to go about fixing this (or googling for it).
I have my classes instanced with
@EJB
private AnnJAXB annj;
and servlet with
@WebServlet(name = "SearchServlet", urlPatterns = { "/search" })
and like i said it all works in netbeans setup.
so do i have to do something with tomcat config or application properties, since deployment should be done automatically? why isn't mainClass.SearchServlet
being found?
thankyou for reading. i am near the end i feel . it has been 15 hours trying to deploy this to a host and it is exhausting.