java - Simple Tomcat/ Servlets - Getting HTTP Status 404 -


i followed page's tutorial.http://www.coreservlets.com/apache-tomcat-tutorial/tomcat-7-with-eclipse.html , downloaded test-app zip file. file working perfectly. when try create simple helloworld servlet gives 404 error. have seen related questions on forum none of them seem address problem. using tomcat7 , java6 ee. able add links , access static web pages plain html pages 404 when try access servlets. servlet code.

@webservlet(name="loginservlet1",urlpatterns={"/loginservlet1"})  public class loginservlet1 extends httpservlet {   public void doget(httpservletrequest request,                     httpservletresponse response)       throws servletexception, ioexception {       response.setcontenttype("text/html");     printwriter out = response.getwriter();     out.println       ("<!doctype html>\n" +        "<html>\n" +        "<head><title>a test servlet</title></head>\n" +        "<body bgcolor=\"#fdf5e6\">\n" +        "<h1>test</h1>\n" +        "<p>simple servlet testing.</p>\n" +        "</body></html>");   }   } 

this index.html

    <!doctype html> <html> <head><title>test web app tomcat 7 or other servlet 3.0 container</title> <link rel="stylesheet"       href="./css/styles.css"       type="text/css"/> </head> <body> <table class="title">   <tr><th>test web app tomcat 7</th></tr> </table> <p/> <fieldset> <ul>   <li><a href="loginservlet1">hello</a> helloworld servlet       generates plain text.</li> </ul> </fieldset> <p/> </body></html> 

this console log during startup.

jun 08, 2014 11:00:55 pm 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: /usr/java/packages/lib/amd64:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib jun 08, 2014 11:00:55 pm org.apache.tomcat.util.digester.setpropertiesrule begin warning: [setpropertiesrule]{server/service/engine/host/context} setting property 'source' 'org.eclipse.jst.jee.server:test-app' did not find matching property. jun 08, 2014 11:00:55 pm org.apache.coyote.abstractprotocol init info: initializing protocolhandler ["http-bio-8080"] jun 08, 2014 11:00:55 pm org.apache.coyote.abstractprotocol init info: initializing protocolhandler ["ajp-bio-8009"] jun 08, 2014 11:00:55 pm org.apache.catalina.startup.catalina load info: initialization processed in 989 ms jun 08, 2014 11:00:55 pm org.apache.catalina.core.standardservice startinternal info: starting service catalina jun 08, 2014 11:00:55 pm org.apache.catalina.core.standardengine startinternal info: starting servlet engine: apache tomcat/7.0.47 jun 08, 2014 11:00:56 pm org.apache.catalina.startup.hostconfig deploydirectory info: deploying web application directory /home/karan/tomcat eclipse/webapps/sensorwebapplication4 jun 08, 2014 11:00:58 pm org.apache.catalina.startup.hostconfig deploydirectory info: deploying web application directory /home/karan/tomcat eclipse/webapps/examples jun 08, 2014 11:00:58 pm org.apache.catalina.core.applicationcontext log info: contextlistener: contextinitialized() jun 08, 2014 11:00:58 pm org.apache.catalina.core.applicationcontext log info: sessionlistener: contextinitialized() jun 08, 2014 11:00:58 pm org.apache.catalina.core.applicationcontext log info: contextlistener: attributeadded('org.apache.jasper.compiler.tldlocationscache', 'org.apache.jasper.compiler.tldlocationscache@6c814dbd') jun 08, 2014 11:00:58 pm org.apache.catalina.startup.hostconfig deploydirectory info: deploying web application directory /home/karan/tomcat eclipse/webapps/sensorwebapplication1 jun 08, 2014 11:01:00 pm org.apache.catalina.startup.hostconfig deploydirectory info: deploying web application directory /home/karan/tomcat eclipse/webapps/sensorwebapplication9 jun 08, 2014 11:01:01 pm org.apache.catalina.startup.hostconfig deploydirectory info: deploying web application directory /home/karan/tomcat eclipse/webapps/root jun 08, 2014 11:01:01 pm org.apache.catalina.startup.hostconfig deploydirectory info: deploying web application directory /home/karan/tomcat eclipse/webapps/host-manager jun 08, 2014 11:01:01 pm org.apache.catalina.startup.hostconfig deploydirectory info: deploying web application directory /home/karan/tomcat eclipse/webapps/manager jun 08, 2014 11:01:01 pm org.apache.coyote.abstractprotocol start info: starting protocolhandler ["http-bio-8080"] jun 08, 2014 11:01:01 pm org.apache.coyote.abstractprotocol start info: starting protocolhandler ["ajp-bio-8009"] jun 08, 2014 11:01:01 pm org.apache.catalina.startup.catalina start info: server startup in 6144 ms 

well seems fine here. try deleting server , creating new one... , run project. tomcat behave weird sometimes.


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -