This is for uni homework, but I reckon it is more a generic problem to the Tomcat Server(version 5.5.27) on my uni.
The problem is, I first did a skeleton Java Web Application (Just a simple Servlet and a welcome-file, nothing complicated, no lib included) using NetBeans 6.8 with the bundled Tomcat 6.0.20 (localhost:8084/WSD)
Then, to test and prove it is "portable" and "auto-deploy-able", I cleaned and built a WSD.war file and dropped it onto my Xampp Tomcat (localhost:8080/WSD). The war extracted everything accordingly and I can see identical output from this Tomcat. So far, so good.
However, after I tried to drop to war onto uni server, funny thing happens:
uni server
Even though I've changed the war permission to 755, it is simply not "responding".
I then copied the extracted files to uni server, the MainServlet cannot be recognized from within its Context Path "/WSD", basically nothing works, expect the static index.jsp. I tried several times to stop and restart uni Tomcat, it doesn't help?
I wonder what makes this happen? Is there anything I did wrong with my approach?
To be frank I paid no attention to a server not under my control, and I am unfortunately not a real active day-to-day Java Programmer now. I understand the fundamentals of MVC, Servelets, JSPs, JavaBeans, but I really feel frustrated by this, as I cannot see why...
Or, should I ask, a Java Web Application, after cleaned and built by NetBeans6.8, is self-contained and self-configured so ready to be开发者_StackOverflow社区 deployed to any Java Web Container?
I know, I can certainly program everything in plain old JSP, but this is soooo... unacceptable to myself...
Update :
I am now wondering if there is any free Tomcat Hosting so that I would like to see if my war file and/or my web app can go with them without any configuration at all?
Second Update :
matt b makes a good point, so I went and checked my environment with an ad-hoc way: a fake JSP page that goes to nowhere
And I did see the word Tomcat 5.5.27 prompted...
Also, another test page to see if uni has installed JDBC driver for MySQL (I am happy to see they did, as promised):JSP JDBC Test Page
So Resin or Tomcat... I cannot really tell at this point :)
Confirmed from my colleague, that we do share the identical environment. According to the Http headers (curl -I output)
Either another server besides Tomcat is serving your files (see how the headers returned are for Apache web server), or if your environment is setup such that Apache HTTP server proxies requests to Tomcat, then something is wrong with your setup.
$ curl -I http://www-student.it.uts.edu.au/~cmao/WSD/WEB-INF/web.xml
HTTP/1.1 200 OK
Date: Wed, 09 Jun 2010 01:17:42 GMT
Server: Apache/2.2.10 (Unix) PHP/5.2.6 Resin/3.1.7a mod_perl/2.0.3 Perl/v5.8.8
Last-Modified: Wed, 09 Jun 2010 01:17:42 GMT
ETag: W/"d0304-2f3-4889b8d410680"
Accept-Ranges: bytes
Content-Length: 755
Content-Type: application/xml
Tomcat wouldn't usually serve WEB-INF or web.xml files.
Also, the Server header mentions Resin, which is a competing servlet container to Tomcat. Perhaps it is configured incorrectly?
The headers above indicate an Apache2 server which may be a frontend to the Tomcat server. The Tomcat server is likely on a port in the 8000 range, likely 8080. To find your application Apache would need to be configured to forward requests for /WSD to Tomcat.
精彩评论