views:

713

answers:

8

Hi,

I downloaded a couple of webapps and placed them in my /webapps folder. Some of them I could open by going to http://localhost:8080/app1 and it would open. However, some others I would do the exact same thing and go to http://localhost:8080/app2 and it will display "HTTP Status 404 - /app2/", even though I am sure it is there. I've checked that it contains a WEB-INF folder just like app1, and I've even restarted Tomcat to be sure.

My question is: is there anything (perhaps in the web.xml file) that specifies what the URL has to be to start the webapp? Or is it simply just http://localhost:8080/ ?

P.S. If you want to know exactly what app1 and app2 I am refering to: app1 (works) = http://assets.devx.com/sourcecode/11237.zip app2 (doesn't work) = http://www.laliluna.de/download/eclipse-spring-jdbc-tutorial.zip

I've tried a few others as well, some work, some don't. I'm just wondering if I'm missing something. Thanks!

+1  A: 

Hum...

What about logs? Some information that could help?

Kind Regards

marcospereira
+1  A: 

The second requires the spring framework. The only runnable things I could find were a client in eclipse-spring-jdbc-tutorial.zip\SpringJdbc\src\test\de\laliluna\library\TestClient.java and one in eclipse-spring-jdbc-tutorial.zip\SpringJdbc\src\de\laliluna\library\sample\MyApplication.java. If you open it in eclipse (it is an eclipse project), and compile, provided the Spring framework is installed, you should be able to run both.

Tony BenBrahim
+1  A: 

I usually debug this by going the the manager page and making sure that all of the contexts are deployed (http://localhost:8080/manager/html).

It sounds like app2 has not been deployed properly or is not starting up because of some other error.

I would look at the logs. There may be a bunch of information in there but usually it explains what is broken.

Casey Watson
A: 

I checked out the Tomcat manager. It says running=true but when I click on the link "/", it goes to the same Status 404 not available page. I also tried it with the some of the samples that came with the Spring Framework zip file. Those aren't working.

The strange thing is that some of the ones I've downloaded from random sites are working. Does Spring have a back-wards compatibility issue?

Edit: also, I've tried importing it into eclipse but I can't seem to do it directly. Does it require an ANT or Maven build first?

no, there is already an eclipse .project and .classpath file in the zip file. You should be able to put the project in your workspace and open it
Tony BenBrahim
+2  A: 

The first zip file you mention has a .war file as part of the zip. The second one is just the source code and it needs to be built into a .war file. It looks like it is setup to have that done in Eclipse. Try the File|Export option and select War file as the export type.

John Meagher
A: 

Are you familiar with log4j? Spring puts a lot of often-useful information into the logs created via log4j. When I have a SpringMVC application that won't startup correctly or otherwise isn't running I check my log4j and potentially turn up the Spring log level to INFO or even DEBUG.

enricopulatzo
A: 

If "/" is not accessible it means that there is no "index.html", "index.jsp" or whatever is defined in the welcome-files list of the web.xml Also no Servlet-Mapping for the context ROOT directory is present. Check the web.xml for Servlet-Mappings or try to figure out the name of the jsp/html /... file being in the context root

+1  A: 

The second app (the directory named WebRoot) can also be deployed correctly but you get a 404 by going to it because there is not an "index.jsp" or "index.html" file in the root directory.

Try putting a file there with any of those names, and the 404 is gone.

A servlet mapping in the web.xml is not strictly necessary for this to work.

Tom De Leu
Thank You for that suggestion - I missed the lack of proper index file.
zeroDivisible