Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting started, can't get hello world to work

Status
Not open for further replies.

spoulson

Programmer
Oct 1, 2002
4
US
Hi all,

I've read over the Tomcat Application Developer's Guide and followed the steps to generating a hello world jsp app. I'm having a couple problems because it's not working as advertised. Please excuse that this is such novice material, but I'm trying to teach myself and it's always hardest the first few steps.

I build a basic jsp app using the standard docs,src,web directory structure. In web/ is a default.jsp containing only HTML for Hello World. I used their instructions for build.properties, build.xml, and web.xml. I made sure to specify the catalina.root, context root, application name, etc. Environment variables CATALINA_HOME, JAVA_HOME, and ANT_HOME are also set appropriately. Also the JDK bin and Ant bin are in the path.

When I run "ant" it compiles fine. When I run "ant install" it deploys fine. However, tells me the requested resource is not available.

Secondly, while trying to redeploy using "ant reload" I get the following error:
[tt]
$ ant reload
Buildfile: build.xml

prepare:

compile:

reload:
[reload] FAIL - Encountered exception java.lang.IllegalStateException: Container StandardContext[/example] has not been started


BUILD FAILED
H:\code\java\web\example\build.xml:476: FAIL - Encountered exception java.lang.IllegalStateException: Container StandardContext[/example] has not been started
[/tt]

I'm running Tomcat 5.0, Ant 1.6.1, JDK 1.4.2 on WinXP.
 
Are you using ant to build a .war file ? If so, forget about ant for a while, and try deploying the war file yourself (ie just copy it to the webapps dir). Check that the structure of the war file is correct also (ie JSPs are in the root, there is a WEB-INF dir etc ...

--------------------------------------------------
Free Database Connection Pooling Software
 
No, I'm not creating a WAR file. I assume the 'reload' ant option is there to do the copy you speak of.

But my real problem is the first one. The install went ok, but I can't access the JSP with the context-root I gave it.
 
Check that the directory structure is correct under webapps, and try restarting tomcat. You structure should be :

TOMCAT_HOME/webapps/example -- your JSP files here
TOMCAT_HOME/webapps/example/WEB-INF -- your web.xml here

--------------------------------------------------
Free Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top