java - Servlet URL 404'ing, although JSP files work fine -
setup: tomcat 7 server, eclipse mars milestone 3
the problem: when attempting run servlet files or connect them files 404. although can connect fine jsp files servlet files 404. picture below.
also should mention effects servlets, not 1 or 2 all.
i believe local problem colleague running next same setup on machine, although servlet found.
this log startup although no apparent error show either on startup or on load of servlets url.
i'm using servlet mapping within servlets define url ie @webservlet("/sterling")
question: causing , how can fix it? thank you.
sep 30, 2015 10:21:29 org.apache.catalina.core.aprlifecyclelistener init info: apr based apache tomcat native library allows optimal performance in production environments not found on java.library.path: c:\program files (x86)\java\jre6\bin;.;c:\windows\sun\java\bin;c:\windows\system32;c:\windows;c:/program files (x86)/java/jre6/bin/client;c:/program files (x86)/java/jre6/bin;c:/program files (x86)/java/jre6/lib/i386;c:\windows\system32;c:\windows;c:\windows\system32\wbem;c:\windows\system32\windowspowershell\v1.0\;c:\program files\tortoisesvn\bin;c:\program files (x86)\micro focus\rumba\;c:\program files (x86)\micro focus\rumba\system;c:\eclipse; sep 30, 2015 10:21:30 org.apache.tomcat.util.digester.setpropertiesrule begin warning: [setpropertiesrule]{server/service/engine/host/context} setting property 'source' 'org.eclipse.jst.jee.server:{redacted}' did not find matching property. sep 30, 2015 10:21:30 org.apache.coyote.abstractprotocol init info: initializing protocolhandler ["http-bio-80"] sep 30, 2015 10:21:30 org.apache.coyote.abstractprotocol init info: initializing protocolhandler ["ajp-bio-8009"] sep 30, 2015 10:21:30 org.apache.catalina.startup.catalina load info: initialization processed in 1879 ms sep 30, 2015 10:21:30 org.apache.catalina.core.standardservice startinternal info: starting service catalina sep 30, 2015 10:21:30 org.apache.catalina.core.standardengine startinternal info: starting servlet engine: apache tomcat/7.0.34 sep 30, 2015 10:21:37 org.apache.coyote.abstractprotocol start info: starting protocolhandler ["http-bio-80"] sep 30, 2015 10:21:37 org.apache.coyote.abstractprotocol start info: starting protocolhandler ["ajp-bio-8009"] sep 30, 2015 10:21:37 org.apache.catalina.startup.catalina start info: server startup in 6704 ms
web.xml
<?xml version="1.0" encoding="utf-8"?> <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" id="webapp_id" version="3.0"> <display-name>*****datamanagementtool</display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list> </web-app>
deployment assembly setup
this not found error. log shows no error quite simple, deploy not reach desired servlets.
there no enough info determine cause, due can reach jsp files, check if have configured correctly servlets web-inf/web.xml
descriptor.
edit
as have edited question, can tell problem. have not configured servlets ... configure servlets want following:
<servlet> <servlet-name>servlet name</servlet-name> <servlet-class>path.to.servletclass</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>servlet name</servlet-name> <url-pattern>url-pattern</url-pattern> </servlet-mapping>
edit 2
after edition, didn't see have used annotations, if have servlet annotated don't need configuration.
edit 3
make sure web.xml
has right schema version, other way make app ignore annotations.
<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">
i suppose servlet class inherits httpservlet, right?
Comments
Post a Comment