SERVLET CANNOT BE LOCATED

SERVLET CANNOT BE LOCATED

Here is the error message:  /rtpmWEBApp/DBHandler
The description: The requested resource (/rtpmWEBApp/DBHandler) is not available.

I presume this problem is related to a war file.
I've uploaded my web application's war file to a virtual dedicated server and I'm trying to run the application from there.
Here is the hierarchy of my file system:
/home/rrugemalira/rtpmWEBApp
/home/rrugemalira/rtpmWEBApp/WEB-INF
/home/rrugemalira/rtpmWEBApp/WEB-INF/classes
/home/rrugemalira/rtpmWEBApp/WEB-INF/classes/pandemicMonitor
/home/rrugemalira/rtpmWEBApp/WEB-INF/classes/pandemicMonitor/RTPMServlets
      DBHandler.java and DBHandler.class are in the RTPMServlets folder
/home/rrugemalira/rtpmWEBApp/WEB-INF/classes/pandemicMonitorBeans -contains java beans

The file rtpmWEBApp.war is in the webapps folder on the path shown below:
/usr/local/jakarta-tomcat-5.0.19/webapps

I point my web browser to http://IP:8080/rtpmWEBApp/mainEMCapital.html
and the applications main page is displayed.
When I run the application, I get the above mentioned error.

Kindly instruct as to where to place my files. Thanks for your quick response as this is extremely urgent!
RrugemaliraAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
KuldeepchaturvediConnect With a Mentor Commented:
thats what is bugging me...
and your web.xml looks very clean so there can not be a problem..
since this is a VDS, you can create another test app as well right??
so lets try this..

create a new folder in webapps, name it Test..
in Test create a folder as WEB-INF
and then following..
/WEB-INF/classes/pandemicMonitor/RTPMServlets
/WEB-INF/lib

put your servlet classes in RTPMServlets and all the jar files in lib..

then create the web.xml as
<web-app id="WebApp_2">
      <display-name>Test</display-name>
      <description>Test Package</description>
      <servlet id="Servlet_1">
         <servlet-name>MyTest</servlet-name>
         <description>PackageTest</description>
         <servlet-class>pandemicMonitor.RTPMServlets.DBHandler</servlet-class>
        </servlet>
     <servlet-mapping id="ServletMapping_1">
         <servlet-name>MyTest</servlet-name>
         <url-pattern>/servlet/DBHandler</url-pattern>
     </servlet-mapping>
 </web-app>

put this in web-inf
and then in browser try
http://IP:8080/Test/servlet/DBHandler
lets see what it returns
0
 
KuldeepchaturvediCommented:
where are you using these classes?
by the error it looks like that the class being accessed on a URL..
if thats the case then the url should have been
/rtpmWEBApp/servlet/pandemicMonitor.RTPMServlets.DBHandler
(assuming that your web.xml maps to /servlet/yourServlet) for mapping.
or if you are using the class as a been than the package name should have been

pandemicMonitorRTPMServlets.DBHandler
0
 
RrugemaliraAuthor Commented:
My web.xml contains the following:
  <servlet>
    <servlet-name>DBHandler</servlet-name>
    <servlet-class>pandemicMonitor.RTPMServlets.DBHandler</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>DBHandler</servlet-name>
    <url-pattern>/DBHandler</url-pattern>
  </servlet-mapping>
Now, this web.xml is the one that was archived into a war file and uploaded to the server.

DBHandler.java and DBHandler.class are located in the RTPMServlets folder  - following path:
/home/rrugemalira/rtpmWEBApp/WEB-INF/classes/pandemicMonitor/RTPMServlets

DBHandler.java has the line:
package pandemicMonitor.RTPMServlets;

I appreciate your kind help Kuldeepchaturvedi.
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
KuldeepchaturvediCommented:
By your response, everything looks in order..

your web.xml is clean and your package looks correctly placed.. and if the first page is coming up correctly, I wd assume that the server is also runnning...

lets check if your web app is loading correctly..
when your tomcat starts do you see any messages at the console?? if not in console then you will find them in stdout.log file...
I am thinking that may be your web app is not getting loaded properly..
is there any jsp page that you can access from your web app??
0
 
RrugemaliraAuthor Commented:
Yes I can access processUser.jsp

This is how my web application is structured:

I point my web browser to:
http://IP:8080/rtpmWEBApp/rtpm_NewUser.html
rtpm_NewUser.html posts to processUser.jsp
processUser.jsp is a controller. Here it is:

<% /* This is the controler JSP that will call different bean components */
%>
<%@page import="java.util.*"%>

<%! ResourceBundle bundle=null;
public void jspInit() {
   bundle = ResourceBundle.getBundle("pandemicMonitorBeans.formsUser");
   }
%>

<jsp:useBean id="formHandler" class="pandemicMonitorBeans.FormBean" scope= "request">
<jsp:setProperty name="formHandler" property="*"/>
</jsp:useBean>

<%
 if(formHandler.validate()) {
%>

<jsp:forward page="DBHandler"/>
<%
} else{
%>
<jsp:forward page="<%=bundle.getString("processUser.retry")%>"/>
<%
}
%>

The formHandler performs correctly.
validate() checks to see if the data entered in rtpm_NewUser.html is correct.
This part works fine.

But DBHandler is cannot located, as the error message indicates!
0
 
KuldeepchaturvediCommented:
<jsp:forward page="DBHandler"/>
change this line to
<jsp:forward page="/DBHandler"/>

and see what it results to..
also try putting following in you browser and let me know which one returns a 404 and which one returns a 500 error

http://IP:8080/rtpmWEBApp/DBHandler
http://IP:8080/DBHandler
0
 
RrugemaliraAuthor Commented:
http://IP:8080/rtpmWEBApp/DBHandler
returns  HTTP Status 404 - /rtpmWEBApp/DBHandler
type Status report
message /rtpmWEBApp/DBHandler
description The requested resource (/rtpmWEBApp/DBHandler) is not available.

http://IP:8080/DBHandler
returns  HTTP Status 404 - /DBHandler
type Status report
message /DBHandler
description The requested resource (/DBHandler) is not available.

I must mention that the web application works fine on my local machine.
The problems have arisen when I have uploaded rtpmWEBApp.war to a remote virtual dedicated server.
At the virtual dedicated server, I have installed jakarta-tomcat and placed rtpmWEBApp.war  at this location:
/usr/local/jakarta-tomcat-5.0.19/webapps
At the remote server, I have also duplicated the directory structure of my local machine.

I have changed
 <jsp:forward page="DBHandler"/>
change this line to
<jsp:forward page="/DBHandler"/>
but I still get the 404
0
 
KuldeepchaturvediCommented:
Now thats interesting!!
if both the URLs are giving you 404 then there is something wrong with the tomcat or the with the folders..
what kind of permissions are there on the folders??
the user profile thats running tomcat shd have 777 permissions on the folders...
and also check of rtpmWEBApp.xml in your conf folder of the tomcat and see if it points to the correct directory on your virtual server
0
 
RrugemaliraAuthor Commented:
I do not have rtpmWEBApp.xml in the conf folder.
This is what I have at: /usr/local/jakarta-tomcat-5.0.19/conf

.   Catalina         catalina.properties  server-minimal.xml  tomcat-users.xml
..  catalina.policy  jk2.properties       server.xml          web.xml

And web.xml in this folder is completely different from the one in rtpmWEBApp.war
web.xml in the conf folder is different from the one in /home/rrugemalira/rtpmWEBApp/WEB-INF
Is this right?

ls -l at /home/rrugemalira/rtpmWEBApp/WEB-INF/classes gives:
drwxr-xr-x    3 root     root         1024 Apr  3 07:08 pandemicMonitor
drwxr-xr-x    2 root     root         2048 Apr  3 07:07 pandemicMonitorBeans

ls -l at /home/rrugemalira/rtpmWEBApp/WEB-INF/classes/pandemicMonitor gives:
drwxr-xr-x    2 root     root         1024 Apr  4 12:16 RTPMServlets

ls -l  DBHandler.* at /home/rrugemalira/rtpmWEBApp/WEB-INF/classes/pandemicMonitor/RTPMServlets gives:
-rw-r--r--    1 root     root         3269 Apr  3 07:12 DBHandler.class
-rw-r--r--    1 root     root         2015 Apr  3 07:12 DBHandler.java

Did I correctly understand your instruction in regard to permissions on folders?






0
 
KuldeepchaturvediCommented:
your server.xml will at conf will be diff than your web app.. this how it is suppose to be... if you do not have rtpmWEBApp.xml as a separate XML then this entry must be in your server.xml .. open up your server.xml and see if the entry is there...

your folder should have got -rwx for your DBHandlers...
grant the authority for your files and then try them.... and also paste the <Context> entry for your web app that you will find in server.xml..

and check if you xml file in conf/Catalina/Localhost...
0
 
RrugemaliraAuthor Commented:
I have granted rwx permissions to the DBHandlers. but I still get the 404
ls -l DBHandler.* now gives:
-rwxr--r--    1 root     root         3269 Apr  3 07:12 DBHandler.class
-rwxr--r--    1 root     root         2015 Apr  3 07:12 DBHandler.jav

rtpmWEBApp.xml is at the end of this path:
    /usr/local/jakarta-tomcat-5.0.19/conf/Catalina/localhost
and contains the following lines:
<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="/home/rrugemalira/rtpmWEBApp" path="/rtpmWEBApp"/>

server.xml located at /usr/local/jakarta-tomcat-5.0.19/conf
does not contain anything about rtpmWEBApp.xml
0
 
KuldeepchaturvediCommented:
now thats very interesting..
your context looks perfect as well!!!
it says that your webapp should be located at
/home/rrugemalira/rtpmWEBApp  
and thats where we have got it..
your web.xml xml looks correct as well!!!
do you see anyting wrong at the tomcat console? is there any msg when tomcat starts? if you dont see it on console then its normally at tomcat/logs/stdout.log see if u can get this log and paste it here..
this is quite confusing.. every thing looks in place and ideally it should be working..
0
 
RrugemaliraAuthor Commented:
This is what I read on the terminal when I start tomcat:

[root@emcapital bin]# ./startup.sh
Using CATALINA_BASE:   /usr/local/jakarta-tomcat-5.0.19
Using CATALINA_HOME:   /usr/local/jakarta-tomcat-5.0.19
Using CATALINA_TMPDIR: /usr/local/jakarta-tomcat-5.0.19/temp
Using JAVA_HOME:       /usr/local/j2sdk1.4.2_08
0
 
KuldeepchaturvediCommented:
Is this all? ideally you shd be seeing your web apps getting loaded as well something like..
INFO: Processing Context configuration file URL file:/usr/local/jakarta-tomcat-5.0.19
/conf/Catalina/localhost\admin.xml
and so on...
0
 
KuldeepchaturvediCommented:
I am off to home now.. Will look into it tomorrow if its not yet fixed..
0
 
RrugemaliraAuthor Commented:
To start tomcat I go to:
/usr/local/jakarta-tomcat-5.0.19/bin
and do ./startup.sh
This results in:
Using CATALINA_BASE:   /usr/local/jakarta-tomcat-5.0.19
Using CATALINA_HOME:   /usr/local/jakarta-tomcat-5.0.19
Using CATALINA_TMPDIR: /usr/local/jakarta-tomcat-5.0.19/temp
Using JAVA_HOME:       /usr/local/j2sdk1.4.2_08
at the term window.

Pointing my browser to http://216.69.173.64:8080/rtpmWEBApp/rtpm_NewUser.html
gives me a form in which I enter data. This shows me that tomcat is up and that my web application is accessible.

rtpm_NewUser.html posts to processUser.jsp
If I enter erreneous data in the form, processUser.jsp calls retry.jsp having discovered the errors by using a bean called FormBean
FormBean.java and FormBean.class are located at:
/home/rrugemalira/rtpmWEBApp/WEB-INF/classes/pandemicMonitorBeans
When correct data is entered into the form, processUser.jsp is supposed to forward to DBHandler.
Now why should FormBean be found but not DBHandler?

Also, I do not have the file stdout.log at: /usr/local/jakarta-tomcat-5.0.19/logs
Frustration wants to creap in but I won't let it!!!

 
0
All Courses

From novice to tech pro — start learning today.