• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Requested resource is not available - how to correct

 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I developed an application consisting of several jsp pages and a few java beans. I have it all working on my PC with Tomcat 6 - no problems. I got the application moved to a test server which turns out to be Tomcat 5.0.28. No matter what I try, I cannot get it to work. I keep getting "The requested resource (/EME/eme_login.jsp) is not available"

I uninstalled Tomcat 6 on my PC and installed Tomcat 5.0.28 and everything is working without problems. (I was hoping I could recreate whatever is happening on the server and work on it from my PC.) I was hoping to get some help/ideas/pointers regarding the error and how to get this working.

Here are some details:
All the application files (jsp, html, etc) are in D:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\EME\
In that same folder I have a web.xml with the following contents:

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<display-name>EME</display-name>
<description>EME</description>
<servlet>
<servlet-name>org.apache.jsp.index_jsp</servlet-name>
<servlet-class>org.apache.jsp.index_jsp</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>org.apache.jsp.index_jsp</servlet-name>
<url-pattern>/index.jsp</url-pattern>
</servlet-mapping>
</web-app>

The CLASSPATH on the server includes the servlet-api.jar, jsp-api.jar and el-api.jar
I also verified that I'm using the right case for everything as I know Tomcat is case-sensitive.
The URL I am using to access the application is http://myserver:8080/EME/eme_login.jsp
There is another application running on this server that works without issues.

Any ideas on what I need to change to get this working? I'm new to Tomcat, java, jsps, you-name-it so I may be missing something obvious. Thanks for any info!
 
Sheriff
Posts: 67756
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why complicate things by mapping the JSP in the deployment descriptor?

I'm not sure what your issue is off the top of my head, but the more you needlessly complicate the setup, the more likely something can go wrong.

What's your reason for the mapping?
 
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The jsp in question is a different one from the one he is trying to access so I don't think that this is the problem here. Don't know why the index.jsp is mapped as it is tough...

By the way, can you access that servlet that is mapped there? if you can then you know that the problem is with jsp pages only and not with ordinary servlets...
One thing that comes to mind is to add this servlet mapping to your servlet mappings in web.xml
 
K DeLucia
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The reason for the mapping? Sheer ignorance? ;-) I didn't have a web.xml file at all and added it thinking I needed it with Tomcat 5. I'm not sure exactly what is required in the file so I've tried adding and removing various pieces to the file. I'll remove the mapping. Thanks!
 
K DeLucia
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ilari Moilanen:
The jsp in question is a different one from the one he is trying to access so I don't think that this is the problem here. Don't know why the index.jsp is mapped as it is tough...

By the way, can you access that servlet that is mapped there? if you can then you know that the problem is with jsp pages only and not with ordinary servlets...
One thing that comes to mind is to add this servlet mapping to your servlet mappings in web.xml




I had that servlet-mapping in there at one point, but removed it. I'm very confused in general regarding the web.xml and what I need in it and what each piece does. Looks like it's time for more research!
 
Bear Bibeault
Sheriff
Posts: 67756
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you're just trying to hit the JSP in order to test the setup, no mappings are required. Don't go gumming up the works.

Make sure that your deployment is correct. Is the context correctly declared in the Tomcat config?

P.S. For future work, always develop and test on the same version of Tomcat as you will be deploying to in order to prevent future nasty surprises.
 
K DeLucia
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Part of my problem is that I can't find information that outlines what I need to do to deploy this application. I'm very new to this and I'm finding conflicting information everywhere. Do I need a web.xml for my application? I don't have one on my PC, but I've seen it said that it's required and that it's not. If it is required, do I need to somehow define my jsp in it? Do I need a servlet entry? (I don't use a servlet, just some jsp pages and some javabeans). Do I need to make changes to the server.xml? (I've seen references to adding a context entry). Do I need all three environment variables Cataline_Home, Java_Home and Classpath? I have the 2nd and 3rd on one PC and things are working. I have the 3rd only on another PC and things are working. I have the 3rd only on the server and nothing is working. I don't have the first defined anywhere.

Can anyone provide a link that may help clarify some of what I actually need to do and what I don't. If I can figure out what pieces I need, I'm sure I can get it to work, but at this point I can't even figure out what it is that I need and what I don't need. Very frustrating!

Thanks again!
 
Bear Bibeault
Sheriff
Posts: 67756
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by K DeLucia:
Do I need a web.xml for my application? I don't have one on my PC, but I've seen it said that it's required and that it's not

You should have one. if for nothing else than to make sure that your app is deployed as a Servlets 2.4 app which will enable JSP 2.0 mechanisms.

If it is required, do I need to somehow define my jsp in it?

No. JSPs can be directly addressed (unless you want to hide them as part of an MVC solution -- but that's later...).

Do I need a servlet entry?

Only when you add servlets. (Something you should think about soon since all modern best practice web app structures utilize servlets.) Servlets must be declared and mapped in the deployment descriptor.

(I don't use a servlet, just some jsp pages and some javabeans). Do I need to make changes to the server.xml? (I've seen references to adding a context entry).

Context entries are added in their own folder. They may not be necessary for a straight-forward context deployed under webapps.

Do I need all three environment variables Cataline_Home, Java_Home and Classpath

You should only need to have JAVA_HOME defined. By the way, case counts. Don't be sloppy either in your code or posts.

The Tomcat scripts will define CATALINA_HOME, and CLASSPATH is ignored during execution.

Have you checked out the Tomcat docs?
[ July 07, 2008: Message edited by: Bear Bibeault ]
 
K DeLucia
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you so much. This really really helps. (Hopefully it will also fix the problems I'm having!) I have seen the Tomcat docs and I've been in a out of them, finding useful bits here and there, but obviously I need to spend more time with them. Thanks again. I'll let you know how I make out.
 
K DeLucia
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm finally getting back to this. I have this in the web.xml:


I've set JAVA_HOME to what I believe is the correct location. It's to tell on this server because there is no c:\Java or c:\Program Files\Java. It appears to be buried in an oracle folder on the D:\ drive, but it was the only jdk folder I could find on the machine that looked like it might be correct (has the correct subfolders/files and javac.exe).

In any case, it still isn't working. I can get to the root Tomcat screens just fine (with the help, documentatation, etc), but I continue to get that same error when I try to access my application. I can't even get to a simple html page that I have there so it's not just a java/jsp thing.

Any ideas on where I can look next would be most appreciated!
 
K DeLucia
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does this even make sense?? I copied a gif file into the ROOT of the webapps folder. When I access tomcat.gif which is part of the main tomcat success/help/doc page, that opens fine. When I try to open ptred25.gif which I copied into the same folder, I get the error message (the requested resource is not available). I've restarted Tomcat several times and have just rebooted the server. As far as I can tell there is no difference between the two gif files other than the filename and a slight difference in size. Why can't I open any file that I put on the server?
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
After building and deploying your webapp to Tomcat, what is the directory structure of the webapp or war?
 
K DeLucia
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My jsp, html, css, js files are in:
D:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\EME

My images are in:
D:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\EME\images

My web.xml is in:
D:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\EME\WEB-INF

My jdbc driver is in:
D:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\EME\WEB-INF\lib

And my java class files are in:
D:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\EME\WEB-INF\classes\eme (the package name is eme)
 
K DeLucia
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Turned out to be a workers.properties file that needed to be updated to include my application. Thanks everyone for all the help and suggestions.
reply
    Bookmark Topic Watch Topic
  • New Topic