• Post Reply Bookmark Topic Watch Topic
  • New Topic

Servlet doe not responde

 
joka badi
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guyz!!..Am doing the java project but the problem is servlet it does not respond...have try to run the simple code line inorder to examine where the problem iz but am fail....also have try alot of method inorder to fix this but also failed.so can anybody help me to tackle this cause have stopped to proceed.



this is my servlet code
package loginJspServletlib;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/Teba")
public class Teba extends HttpServlet {
private static final long serialVersionUID = 1L;


public void init(ServletConfig config) throws ServletException {
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
@SuppressWarnings("unused")
Connection con=(Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/maji","root", "");
} catch(Exception e){
System.err.println(e.getMessage());

}
}


protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request,response);
}

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html");
@SuppressWarnings("unused")
PrintWriter out=new PrintWriter(response.getWriter());
int id=-1;
String un=request.getParameter("username");
String pw=request.getParameter("password");

try {
java.sql.Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/maji","un","pw");
java.sql.Statement stm;
ResultSet rs=null;

String SQLquery="SELECT * FORM login WHERE username= '" +un +"';";
stm=con.createStatement();
rs=stm.executeQuery(SQLquery);
while(rs.next()){
id=rs.getInt("level");
pw=rs.getString("password");
}
con.close();
} catch (SQLException e) {
System.err.println(e.getMessage());
}
RequestDispatcher dispatcher=null;
Object password=null;
if(id==-1){
dispatcher=getServletContext().getRequestDispatcher("sucess.jsp");
} else if(pw.equals(password)){
dispatcher=getServletContext().getRequestDispatcher("sucess.jsp");

}else{

dispatcher=getServletContext().getRequestDispatcher("failer.jsp");
}

dispatcher.forward(request, response);
}
}

this is the result in the console

Mar 25, 2014 4:26:24 PM org.apache.catalina.startup.HostConfig deployDirectory
SEVERE: Error deploying web application directory C:\apache-tomcat-7.0.52\webapps\host-manager
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [/host-manager]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:904)
at org.apache.catalina.core.ContainerBase.access$000(ContainerBase.java:133)
at org.apache.catalina.core.ContainerBase$PrivilegedAddChild.run(ContainerBase.java:156)
at org.apache.catalina.core.ContainerBase$PrivilegedAddChild.run(ContainerBase.java:145)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1229)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1875)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Mar 25, 2014 4:26:24 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\apache-tomcat-7.0.52\webapps\manager
Mar 25, 2014 4:26:24 PM org.apache.catalina.startup.HostConfig deployDirectory
SEVERE: The web application with context path [/manager] was not deployed because it contained a deployment descriptor [C:\apache-tomcat-7.0.52\webapps\manager\META-INF\context.xml] which may include configuration necessary for the secure deployment of the application but processing of deployment descriptors is prevented by the deployXML setting of this host. An appropriate descriptor should be created at [C:\apache-tomcat-7.0.52\conf\Catalina\localhost\manager.xml] to deploy this application.
Mar 25, 2014 4:26:24 PM org.apache.catalina.core.ContainerBase addChildInternal
SEVERE: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [/manager]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.access$000(ContainerBase.java:133)
at org.apache.catalina.core.ContainerBase$PrivilegedAddChild.run(ContainerBase.java:156)
at org.apache.catalina.core.ContainerBase$PrivilegedAddChild.run(ContainerBase.java:145)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1229)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1875)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.catalina.LifecycleException: Failed to process either the global, per-host or context-specific context.xml file therefore the [/manager] Context cannot be started.
at org.apache.catalina.startup.FailedContext.startInternal(FailedContext.java:158)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 15 more
Mar 25, 2014 4:26:24 PM org.apache.catalina.startup.HostConfig deployDirectory
SEVERE: Error deploying web application directory C:\apache-tomcat-7.0.52\webapps\manager
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [/manager]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:904)
at org.apache.catalina.core.ContainerBase.access$000(ContainerBase.java:133)
at org.apache.catalina.core.ContainerBase$PrivilegedAddChild.run(ContainerBase.java:156)
at org.apache.catalina.core.ContainerBase$PrivilegedAddChild.run(ContainerBase.java:145)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1229)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1875)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This seems to be the heart of the matter:

SEVERE: The web application with context path [/manager] was not deployed because it contained a deployment descriptor [C:\apache-tomcat-7.0.52\webapps\manager\META-INF\context.xml] which may include configuration necessary for the secure deployment of the application but processing of deployment descriptors is prevented by the deployXML setting of this host. An appropriate descriptor should be created at [C:\apache-tomcat-7.0.52\conf\Catalina\localhost\manager.xml] to deploy this application.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!