wood burning stoves 2.0*
The moose likes Tomcat and the fly likes where is my webapp? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "where is my webapp?" Watch "where is my webapp?" New topic
Author

where is my webapp?

Reginald Carter
Greenhorn

Joined: Apr 14, 2008
Posts: 17
Hello-
I am a newbie when it comes to Tomcat.
I've downloaded it and edited my batch files (startup.bat, catalina.bat, shutdown.bat and setclasspath.bat) so that I am able to start and stop tomcat.
I created a .war file in eclipse using ant and load into firefox this url:

I get the following:
OK - Started application at context path /mywebapp
But I don't see my web app! Apparently it's started but where is it?
Can anyone help me on this? I would be grateful for any clues.
Thanks.
-G
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60063
    
  65

Did you use a browser to try and see it?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Reginald Carter
Greenhorn

Joined: Apr 14, 2008
Posts: 17
Yes
In firefox's address bar I put:
http://localhost:8080/manager/start?path=/mywebapp
and then I got
OK - Started application at context path /mywebapp
-R
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60063
    
  65

And so then you entered the URL for the web app and what happened?
Reginald Carter
Greenhorn

Joined: Apr 14, 2008
Posts: 17
I'm obviously missing something here..
Would the URL for the web app be the path to the .war file?
-R
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60063
    
  65

It already told you:
OK - Started application at context path /mywebapp
Vamsi Mohan
Ranch Hand

Joined: Jun 20, 2009
Posts: 80
Please check where exactly the .war file is located. You can see the instance and properties from User Interface.


VAMSI MOHAN.V
(SCJP5.0, IBM Rational Solution Designer, IBM Rational Architect, IBM RUP Designer)
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60063
    
  65

The war file is immaterial -- it's the context path that forms the address of the application.
Reginald Carter
Greenhorn

Joined: Apr 14, 2008
Posts: 17
OK My context.xml:

When I look at the folder:C:/MyWebApp
I don't see any URL!
-R
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60063
    
  65

<Context path="C:/MyWebApp" docBase="../../MyWebApp"



Remove the "C:" from the context path, what's that doing there? Also, the relative path "../.." not a good idea. Put the absolute file path.

Then:


Reginald Carter
Greenhorn

Joined: Apr 14, 2008
Posts: 17
Thanks for all your help.
I know how frustrating it can be.
I think I'm just going to start over.
-R
Reginald Carter
Greenhorn

Joined: Apr 14, 2008
Posts: 17
OK Now when I enter:
http:/localhost:8080/mywebapp
I get

What to do now?
-R
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60063
    
  65

Are you still getting the correct startup message? How did you change the context xml file? Is there an index.html or index.jsp file in the root folder?

You're not giving us much help in helping you.
Reginald Carter
Greenhorn

Joined: Apr 14, 2008
Posts: 17
Sorry.
I edited my context.xml like so:

I am still getting the same startup message.
In the folder C:/MyWebApp are all the files the eclipse project needs to run the program plus the WAR file and context.xml as well.
-R
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60063
    
  65

Are you trying to run this in eclipse or as standalone Tomcat?
Reginald Carter
Greenhorn

Joined: Apr 14, 2008
Posts: 17
I'm trying to use tomcat, but since the war file contains classes which need some of the files in the root folder of my eclipse project I thought I should do everything from there. Is this not a good idea?
I admit its confusing.
Maybe I should copy the war file to the tomcat directory and try to do it from there?
I don't know I am really confused at this point.
-R
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60063
    
  65

If you are trying to run a real application -- one that's not dependent upon an IDE -- then there can be no dependencies to things in the IDE. Sounds like your problem is that you are straddling the fence and getting your britches caught up in the barbed witre.

Either use the IDE to run the app, or create a self-contained, real web application that can run outside the IDE. There is no middle ground.
Reginald Carter
Greenhorn

Joined: Apr 14, 2008
Posts: 17
Well shoot-Y'all wouldn't happen t' have a pair of war cutters on ya wouldja pilgrim?
Seriously though, since until two days ago I thought tomcat referred to a feline of the male gender, I don't know how to create
a "real" web app using tomcat.
Do you know of any tutorials that I could read?
Maybe a good primer?
Also I'm not really using the IDE for this, only to generate the WAR file.
Hopefully the class files I have can still be used?
Anyways thanks for your efforts to help me.
I really do appreciate it.
-R.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60063
    
  65

As long as the war file is correctly structured and all jar files needed are in WEB-INF/lib (except for those provided by Tomcat itself), it should work fine.

The Tomcat docs spell out what's required, as does the Servlet Specification, or any tutorial or book on JSP/servlets.

Of particular note. Make sure that you have a WEB-INF, which contains the web.xml. And a WEB-INF/lib that contains the referenced jar files.

If you have any loose class files, they need to be in the package hierarchy under WEB-INF/classes.

Do you get any errors in the logs when you start the app up? What does the manager app at /manager/html have to say?
Reginald Carter
Greenhorn

Joined: Apr 14, 2008
Posts: 17
Hello-
Would that be
C:\tomcat\server\webapps\host-manager\WEB-INF
or
C:\tomcat\server\webapps\manager\WEB-INF
or
C:\tomcat\webapps\balancer\WEB-INF
or
C:\tomcat\webapps\ROOT\WEB-INF
or
C:\tomcat\webapps\servlets-examples\WEB-INF
or
C:\tomcat\webapps\webdav\WEB-INF
??
You see when you say
and all jar files needed are in WEB-INF/lib

My head starts to spin.
Where should my files go?
-R

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: where is my webapp?
 
Similar Threads
Configuring multiple Web apps
Problem while virtual hosting in Tomcat 5.0.28
Running a web app with compiled code
Context Root in TomCat
Virtual Host Configuration in Tomcat 4.01