Maven Tomcat plugin - 404 WebServlet not found -
i have webapp maven uses tomcat plugin server. app gets compiled .war which, when extracted, seems contain classes (incl. servlets) in web-inf/classes folder.
when url http://localhost:8080/com.galya.crm gets hit, index.html (which spa app) gets loaded redirecting http://localhost:8080/com.galya.crm/#!/login/msg/notlogged
i have 4 servlets annotated in similar manner:
@webservlet("/restapi/login") public class logincontroller extends httpservlet {
the problem comes when spa app tries authenticate using login servlet (shown above). expect here: http://localhost:8080/com.galya.crm/restapi/login , 404 error.
below attached tomcat plugin folder automatically created. work directory empty , i'm not sure if it's ok.
initially webapp/web-inf/web.xml auto generated , contained following:
<!doctype web-app public "-//sun microsystems, inc.//dtd web application 2.3//en" "http://java.sun.com/dtd/web-app_2_3.dtd" > <web-app> <display-name>archetype created web application</display-name> </web-app>
i tried change accept webservlet annotations, didn't work also:
<!doctype web-app public "-//sun microsystems, inc.//dtd web application 2.3//en" "http://java.sun.com/dtd/web-app_2_3.dtd" > <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> </web-app>
p.s. app working on server time ago, problem should in server configurations, not in code itself.
surely cause deployment descriptor must declared of version 3.0. web.xml still 2.3.
remove doctype declaration , leave root node did:
<web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
tested myself, , worked.
Comments
Post a Comment