Jump to content
  • Advertisement
Sign in to follow this  
Lucidquiet

[java] Tomcat and well an error [FIXED]

This topic is 4498 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello: I'm having the following problem and cannot seem to get it resolved: INFO: Missing application web.xml, using defaults only StandardEngine[Catalina].StandardHost[www.lucid-edge.net].StandardContext[/] When running Tomcat 5.5 with java 1.4.2 I've looked all over the web for something -- but I'm at a loss. I've configured the server and started and stopped the thing N-million times in an attempt to get it running but no luck. I checked to see if the logger file was locked (and I don't think that it was). I figure this is just a good a place as Webdev -- I'm not sure. Thanks for all help, L- [Edited by - Lucidquiet on July 30, 2006 6:21:04 PM]

Share this post


Link to post
Share on other sites
Advertisement
Sorry if the question sounds lame, but... Do you have a WEB-INF/web.xml file in your application? Is it well defined?

If so, how do you deploy your application? Perhaps your web.xml file is not being directed to the right place by your build script.

And how's your server.xml configured?

Son Of Cain

Share this post


Link to post
Share on other sites
web.xml is not required for a simple application to work. I don't think that error message is a problem, provided you don't want to do anything which requires a web.xml file.

You've stated that it is "not working", yet not described the symptoms yet. What have you done to try to make it work? What makes you think it's not working?

By default Tomcat ships with a default application in its root context which demostrates various servlets, JSPs etc. Get that working before you do anything of your own.

Mark

Share this post


Link to post
Share on other sites
Everything works for the example servlets -- got that running right away a long time ago.

I'm trying to run my own servlets, on a linux host environment. I need the web.xml file to be recognized in order for servlets to class name mappings, and name mappings to urls will work.

I've read through the context and in my tests the web.xml is too simple to be invalid. After the error began I could not even get HelloWorld to run.

The server.xml file has been configured to find the 2 host elements that I'm running. It has been gone over with different contexts, and no contexts, in an attempt to fix it. Everything seems to be correct -- it has a few minor change really compared to the example server.xml that comes with Tomcat.

I've also gotten the weird error:

Unknown host: localhost

How can it be that localhost is unknown? That is really strange, and on top of that when I give it the name of the computer it is running on it then doesn't produce this error.


L-

Share this post


Link to post
Share on other sites
"localhost" is not special or magic. Linux knows nothing about it magically (like Windows appears to do, but it's anybody's guess really). Most distributions will put

127.0.0.1 localhost


In /etc/hosts by default.

It's also possible that you're using "localhost" in a context where it's not checking it as a host name, but rather the name of some named object in the server.xml

You need to make doubly and triply sure that the web.xml is in the right place. It needs to be in WEB-INF, not web-INF, WEB-inf, web-inf or any other capitalisation.

Mark

Share this post


Link to post
Share on other sites
web.xml is in the right place -- that is WEB-INF, and not some permutation of lower and upper case (linux is case sensitive) I realize this.

The hosts file appears to have 127.0.0.1 appears to be labelled correctly as localhost.

L-

Share this post


Link to post
Share on other sites
Alright this is what i found out, and it appears to be the remedy for everything but the missing web.xml file. However the missing web.xml problem could very much be associated with this problem. Also, the solution is particular to the current httpd (Apache) configuration being used.

Seeing as a similar configuration could be in use I figured I should post the solution that I found here for others.

1.) If Tomcat is going to be used as a proxy service with the Connector element, then the proxyName attribute must be set to the virtual host.

2.) Also in the /etc/httpd.conf file there is likely to be entries for the host which specifies RewriteRule(s). It would look something like this:

RewriteRule ^/(.*\.php5$) http://YourCompanyName.com:84/$1 [P,L]
AddHandler cgi-script .pl
RewriteRule (.*\.jsp;jsessionid=.*) http://www.YourCompanyName.com:10080$1 [P,L]
RewriteRule (.*\.jsp$) http://www.YourCompanyName.com:10080$1 [P,L]
RewriteRule (.*\.jws$) http://www.YourCompanyName.com:10080$1 [P,L]
RewriteRule (.*\.xml$) http://www.YourCompanyName.com:10080$1 [P,L]
RewriteRule (.*\.xtp$) http://www.YourCompanyName.com:10080$1 [P,L]
RewriteRule (.*\.do;jsessionid=.*) http://www.YourCompanyName.com:10080$1 [P,L]
RewriteRule (.*\.do$) http://www.YourCompanyName.com:10080$1 [P,L]
RewriteRule ^/servlet/(.*) http://www.YourCompanyName.com:10080/servlet/$1 [P,L]

As can be seen the request is being rewritten for most all URLs ending in jsp, jws, xml, xtp, do;jsession=, do.

This is important to know because servlets can map to any URL based on the servlet to URL mapping in web.xml.

However all of this doesn't matter if the proxyName attribute is not set for all of the virtual hosts.

Here is a link to the Apache/Tomcat proxy documentation: Proxy


L-

[Edited by - Lucidquiet on July 31, 2006 12:11:15 PM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!