tomcat is saying request resource is not available
tomcat is saying request resource is not available
this is my application present in C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\hello_app
and my .class file is present in C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\hello_app\WEB-INF\classes folder
when i called my servlet using http://localhost:8080/hello_app/callmyservlet it is saying that request resource is not available, i checked it my side but invain. did i go wrong any where?
view plaincopy to clipboardprint?
Note: Text content in the code blocks is automatically word-wrapped
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 HelloServlet extends HttpServlet
{
public void service(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException
{
PrintWriter out=res.getWriter();
out.println("hello all");
out.close();
}
}
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 HelloServlet extends HttpServlet
{
public void service(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException
{
PrintWriter out=res.getWriter();
out.println("hello all");
out.close();
}
}
here is my web.xml file
view plaincopy to clipboardprint?
Note: Text content in the code blocks is automatically word-wrapped
<web-app>
<servlet>
<servlet-name>hello</servlet-name>
<servlet-class>HelloServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>hello<servlet-name>
<url-pattern>/callmyservlet</url-pattern>
</servlet-mapping>
</web-app>
i tried but same result it is not working
yes thank you for you reply and yes i have created a package named krn.servlets, and i put it in my source file and i re-ran java file and i copied the class file in
C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\hello_app\WEB-INF\classes\krn\servlets folder
and i changed servlet-class tag and web.xml is as shown below
view plaincopy to clipboardprint?
Note: Text content in the code blocks is automatically word-wrapped
<web-app>
<servlet>
<servlet-name>hello</servlet-name>
<servlet-class>krn.servlets.HelloServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>hello<servlet-name>
<url-pattern>/callmyservlet</url-pattern>
</servlet-mapping>
</web-app>
<web-app>
<servlet>
<servlet-name>hello</servlet-name>
<servlet-class>krn.servlets.HelloServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>hello<servlet-name>
<url-pattern>/callmyservlet</url-pattern>
</servlet-mapping>
</web-app>
but still i am getting same error it is not running. and yes i restarted the server before running it. What about the other steps? Have you checked the logs? Have you used the Manager application to see if the context has even started?
you mean the log folder present in this path C:\Program Files\Apache Software Foundation\Tomcat 5.5\logs right? if yes
there are many files under this folder how can check? and actually what information can i get from those files? and what actually is Manager application? yes i am just a starter of servlet topic so these many questions
yes i found them under tomcat manager application i have different applications one of them is my hello_app under that there is no display name and running status is false and when i click start it says
"FAIL - Application at context path /hello_app could not be started"
and under catalina log i have the following information
Jul 4, 2013 2:42:42 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Apache Software Foundation\Tomcat 5.5\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\oraclexe\app\oracle\product\10.2.0\server\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
Jul 4, 2013 2:42:42 PM org.apache.
i don't know the why it ran very successfully i will say i did, i found it amusing.
i just went to web.xml file C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\ROOT\WEB-INF i just copied entire things in to my current web.xml and i just changed the corresponding things like servlet name,servletclass,url pattern. and when i ran it i was successful. don't know what exactly i did wrong previously. it went fine. guys if you have any idea what mistake did i do previously please tell me. previously i hard coded web.xml and while running it was a failure but when i copied web.xml contents and just by changing corresponding things i got it right.