java - HTTP Status 500 - Error instantiating servlet in eclipse maven -
i trying run simple servlet in maven using eclipse. getting error 500. please see doing wrong. main concern how run servlet in maven not familiar maven .
index.jsp
<html> <body> <h2>hello world!</h2> <form action="mylog" method="post"> loginid:<input type="text" name="name"/><br/> <input type="submit" value="login"/> </form> </body> </html>
mylog.java (servlet class)
import java.io.ioexception; import java.io.printwriter; import javax.servlet.servletexception; import javax.servlet.http.httpservlet; import javax.servlet.http.httpservletrequest; import javax.servlet.http.httpservletresponse; public class mylog extends httpservlet { private static final long serialversionuid = 1l; public mylog() { super(); // todo auto-generated constructor stub } protected void doget(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { // todo auto-generated method stub response.getwriter().append("served at: ").append(request.getcontextpath()); } protected void dopost(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { // todo auto-generated method stub string n = request.getparameter("name"); printwriter out = response.getwriter(); out.print(n); out.close(); doget(request, response); } }
web.xml , directory structure- see attached image
error stack
http status 500 - error instantiating servlet class com.issac.mylog type exception report message error instantiating servlet class com.issac.mylog description server encountered internal error prevented fulfilling request. exception javax.servlet.servletexception: error instantiating servlet class com.issac.mylog org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:502) org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:79) org.apache.catalina.valves.abstractaccesslogvalve.invoke(abstractaccesslogvalve.java:616) org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:528) org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1100) org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:687) org.apache.tomcat.util.net.nioendpoint$socketprocessor.dorun(nioendpoint.java:1520) org.apache.tomcat.util.net.nioendpoint$socketprocessor.run(nioendpoint.java:1476) java.util.concurrent.threadpoolexecutor.runworker(unknown source) java.util.concurrent.threadpoolexecutor$worker.run(unknown source) org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run(taskthread.java:61) java.lang.thread.run(unknown source) root cause java.lang.classnotfoundexception: com.issac.mylog org.apache.catalina.loader.webappclassloaderbase.loadclass(webappclassloaderbase.java:1333) org.apache.catalina.loader.webappclassloaderbase.loadclass(webappclassloaderbase.java:1167) org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:502) org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:79) org.apache.catalina.valves.abstractaccesslogvalve.invoke(abstractaccesslogvalve.java:616) org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:528) org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1100) org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:687) org.apache.tomcat.util.net.nioendpoint$socketprocessor.dorun(nioendpoint.java:1520) org.apache.tomcat.util.net.nioendpoint$socketprocessor.run(nioendpoint.java:1476) java.util.concurrent.threadpoolexecutor.runworker(unknown source) java.util.concurrent.threadpoolexecutor$worker.run(unknown source) org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run(taskthread.java:61) java.lang.thread.run(unknown source)
create source folder src/main/java
, move java source file there
Comments
Post a Comment