File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Spring and the fly likes Error The requested resource is not available Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Error The requested resource is not available" Watch "Error The requested resource is not available" New topic
Author

Error The requested resource is not available

Mark Chan
Greenhorn

Joined: Feb 05, 2012
Posts: 9
I am trying to learn Spring MVC, and I've followed the tutorial in http://static.springsource.org/docs/ to build my first spring project and so far everything was going OK up to the Deploy step then when I tried to test it using the URL: http://localhost:8080/springapp/index.jsp

I got the following error:

HTTP Status 404 - /springapp/index.jsp

type Status report

message /springapp/index.jsp

description The requested resource (/springapp/index.jsp) is not available.


So can someone please tell me what I might doing wrong?

Thanks for your time and help

Note: I have Apache, Tomcat 6, Ant installed and running
Prasad Krishnegowda
Ranch Hand

Joined: Apr 25, 2010
Posts: 587
    
    3

Please TellTheDetails.
Post the server log files and with relevant code snippets. First, we need to see, if the application is deployed successfully.
Mark Chan
Greenhorn

Joined: Feb 05, 2012
Posts: 9
Prasad Krishnegowda wrote:Please TellTheDetails.
Post the server log files and with relevant code snippets. First, we need to see, if the application is deployed successfully.


The link I provided earlier contains all the code, I've just copied and pasted code from the website 'as is'. If you want me to copy and paste the code from the website to here again, i really have no problem in this yet I thought it will be like stuffing the post with code which is already in the link

Regarding the log files, any idea what kind of log files you are looking for? I am pretty new to Spring and web apps and still learning so i am not sure what type of log files you are looking for, yet I will be more than glad to get them once I know which log files

Thanks for your time
Prasad Krishnegowda
Ranch Hand

Joined: Apr 25, 2010
Posts: 587
    
    3

I will see the code from that link, can you please post the logs from file located under your tomcathome/logs, file will be named catalina-<date>.log.

P:S: If you are very new to web applications, I would suggest you first learning Servlets and JSP's first, because servlets are the building blocks of any MVC framework.
Mark Chan
Greenhorn

Joined: Feb 05, 2012
Posts: 9
Prasad Krishnegowda wrote:I will see the code from that link, can you please post the logs from file located under your tomcathome/logs, file will be named catalina-<date>.log.

P:S: If you are very new to web applications, I would suggest you first learning Servlets and JSP's first, because servlets are the building blocks of any MVC framework.


Thanks a lot for your advice and help. I've no problem in learning Servlet, JSP...the problem all raised when I tried to test

Please find below the content of catalina-date.log


Feb 6, 2012 1:02:11 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/lib/jvm/java-6-openjdk/jre/lib/i386/server:/usr/lib/jvm/java-6-openjdk/jre/lib/i386:/usr/lib/jvm/java-6-openjdk/jre/../lib/i386:/usr/java/packages/lib/i386:/usr/lib/jni:/lib:/usr/lib
Feb 6, 2012 1:02:11 AM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Feb 6, 2012 1:02:11 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1658 ms
Feb 6, 2012 1:02:11 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Feb 6, 2012 1:02:11 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.24
Feb 6, 2012 1:02:11 AM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor manager.xml
Feb 6, 2012 1:02:12 AM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor docs.xml
Feb 6, 2012 1:02:12 AM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor host-manager.xml
Feb 6, 2012 1:02:12 AM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor ROOT.xml
Feb 6, 2012 1:02:13 AM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor examples.xml
Feb 6, 2012 1:02:13 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Feb 6, 2012 1:02:13 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1599 ms
Feb 6, 2012 1:04:23 AM org.apache.catalina.core.StandardContext reload
INFO: Reloading this Context has started
Feb 6, 2012 1:04:46 AM org.apache.catalina.core.StandardContext reload
INFO: Reloading this Context has started
Feb 6, 2012 1:04:46 AM org.apache.catalina.core.StandardContext reload
INFO: Reloading this Context has started
Feb 6, 2012 1:04:47 AM org.apache.catalina.core.StandardContext reload
INFO: Reloading this Context has started
Feb 6, 2012 1:05:01 AM org.apache.catalina.core.StandardContext reload
INFO: Reloading this Context has started


Thanks for your time and help
Prasad Krishnegowda
Ranch Hand

Joined: Apr 25, 2010
Posts: 587
    
    3

I don't see the application getting deployed at all. Where have you placed the war file, is it under tomcathome/webapps? Also, you can try restarting tomcat, once you place the war file under webapps.
Mark Chan
Greenhorn

Joined: Feb 05, 2012
Posts: 9
Prasad Krishnegowda wrote:I don't see the application getting deployed at all. Where have you placed the war file, is it under tomcathome/webapps? Also, you can try restarting tomcat, once you place the war file under webapps.


As per the tutorial in http://static.springsource.org/docs/Spring-MVC-step-by-step/part1.html I've deployed it using ANT and i can clearly see it under /usr/share/tomcat6/webapps/

There is no war file there, if you checked the tutorial in the link you will notice I am just testing a simple JSP file with static text This is a very basic spring tutorial, and it is like the first step in the tutorial...please check it to know what I am referring to

Thanks for your help!
Mark Chan
Greenhorn

Joined: Feb 05, 2012
Posts: 9
I just wanted to add that I've tested Servlet / JSP examples that come with Tomcat and all work OK, which means that Tomcat is running without a problem
Prasad Krishnegowda
Ranch Hand

Joined: Apr 25, 2010
Posts: 587
    
    3

From the link you posted. please post the output when you follow section 1.4. i.e ant list.
Mark Chan
Greenhorn

Joined: Feb 05, 2012
Posts: 9
Prasad Krishnegowda wrote:From the link you posted. please post the output when you follow section 1.4. i.e ant list.



Buildfile: build.xml

list:
[list] OK - Listed applications for virtual host localhost
[list] /:running:0:ROOT
[list] /manager:running:0:/usr/share/tomcat6-admin/manager
[list] /docs:running:0:/usr/share/tomcat6-docs/docs
[list] /examples:running:0:/usr/share/tomcat6-examples/examples
[list] /host-manager:running:0:/usr/share/tomcat6-admin/host-manager

BUILD SUCCESSFUL
Total time: 3 seconds
Prasad Krishnegowda
Ranch Hand

Joined: Apr 25, 2010
Posts: 587
    
    3

As you can only see, the springapp example is not deployed. Can you please try restarting the tomcat, after you run the ant script to deploy the application.
Mark Chan
Greenhorn

Joined: Feb 05, 2012
Posts: 9
Prasad Krishnegowda wrote:As you can only see, the springapp example is not deployed. Can you please try restarting the tomcat, after you run the ant script to deploy the application.


I have done so many times and same result Actually this is my problem from the start which is the I keep trying, restarting and nothing happens which make the problem even weirder

Thanks for your help
Prasad Krishnegowda
Ranch Hand

Joined: Apr 25, 2010
Posts: 587
    
    3

Have you followed the tutorial completely? Please post the code if necessary here..
Mark Chan
Greenhorn

Joined: Feb 05, 2012
Posts: 9
Prasad Krishnegowda wrote:Have you followed the tutorial completely? Please post the code if necessary here..


Yes I did, here is all the code I have so far:

Build.xml




Build.properties



index.jsp



WEB-INF/web.xml




This is all I have here

Thanks for your help
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17260
    
    6

You could also just manually copy the war file to your webapps directory and bypass ant if ant isn't doing the copying correct.

Looking at your properties

# appserver.home=${user.home}/apache-tomcat-6.0.24
appserver.home=/usr/share/tomcat6
# for Tomcat 5 use $appserver.home}/server/lib
# for Tomcat 6 use $appserver.home}/lib
appserver.lib=${appserver.home}/lib

deploy.path=${appserver.home}/webapps

Are those directories correct? Is your tomcat installed at /user/share/tomcat6?

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Mark Chan
Greenhorn

Joined: Feb 05, 2012
Posts: 9
I found it now it works

See the problem is that we never thought when deploying the command shall be
ant build
OR
ant buildwar

with the last one, I was able to build war file which was placed in /usr/share/tomcat6/webapps/

then from the tomcat6 manage I just selected the war file, deployed it and voila it worked

Thanks a lot for your time and help
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error The requested resource is not available