my dog learned polymorphism*
The moose likes Struts and the fly likes Problem running Struts applications on external Tomcat server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem running Struts applications on external Tomcat server" Watch "Problem running Struts applications on external Tomcat server" New topic
Author

Problem running Struts applications on external Tomcat server

Chuck Minarik
Greenhorn

Joined: Apr 06, 2006
Posts: 4
I'm new at this so please forgive...I don't know if I have a Struts issue, or a Tomcat issue.

In trying to learn Struts, I've coded several "StrutsLoginDemo" apps, including the one on this site. I can get them to run on my personal instance of Tomcat running on my PC. But I can't get them to run on my department's internal development Tomcat server.

On this server, there are two folders in webapps: "example" and "ROOT". I was told to place my app in "example", and it would be immediatly available to run. I don't have administrator rights to this instance of Tomcat, so modifying server.xml or shutting down and restarting Tomcat are not options for me.

There are a lot of objects (tlds, jars, jsps, classes, & bmps) in my application, so I don't want to just dump them in the "example" folder...so when I deploy my app, it creates a folder in "example"...call it "MyApp". Inside "MyApp" is my "WEB-INF" folder containing "classes" and "lib" folders.

At first, MyApp couldn't find my tlds (it was looking in "example/WEB-INF"), but I changed my <taglib> statments to fix this problem. But now, I'm getting the dreaded "Cannot find ActionMappings or ActionFormBeans collection" error when I try to start the app.

Isn't there a way to tell Tomcat that for MyApp, its root is "MyApp", and ALL folder references are based off this?

TIA.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
A struts web application needs to run as it's own application. Just dropping the resources into another web application isn't going to work. If you want to run your Struts application on the department's server, you're going to have to get permission to copy the war file to the webapps folder.


Merrill
Consultant, Sima Solutions
Chuck Minarik
Greenhorn

Joined: Apr 06, 2006
Posts: 4
Thanks Merrill...I tried putting the WAR file in "example"...didn't work. I'll give your suggestion a shot.

By the way, when I do this, will Tomcat need to be restarted for the app to work?
[ April 06, 2006: Message edited by: Chuck Minarik ]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
It depends on how Tomcat is configured. Most of the time in a development environment, Tomcat is configured to auto-deploy new applications placed in the webapps folder. However, in production environments sometimes this feature is turned off.

Since you say this is a development server, most likely the auto-deploy is turned on, so you probably won't have to restart the server.
Chuck Minarik
Greenhorn

Joined: Apr 06, 2006
Posts: 4
I'm guessing from these settings that Tomcat would have to be bounced...right?

Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The settings you posted have to do with the example application, and have nothing to do with whether or not the server is set to auto-deploy.

The setting you're looking for is in a file named server.xml in the <Tomcat Root>/conf folder.

Look for this text or something similar:

<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">

Give up on putting your struts app inside the example folder. It isn't going to work. The example app is a separate web application, and as I mentioned before, a struts app will not run inside another web app. The only way for you to run your app on this server is to copy the war file to the <tomcat root>/webapps folder.
 
 
subject: Problem running Struts applications on external Tomcat server