views:

57

answers:

2

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 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)

+2  A: 

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?

matt b
@matt b : Thanks so much for the analysis. To be frank, it was the subject coordinator that told me it "is" Tomcat... And... this makes me not sure about it :( Okay, I will go and check my colleagues environment and see if they get similar config as me...
Michael Mao
@matt b : I've updated the thread, only to get myself more confused :)
Michael Mao
+1  A: 

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.

BillThor
@BillThor : This might be the case. I tested the port 80 with my JSP file and it gets "compiled and executed as Servlet under the hood", and now that I see Tomcat with the output, so I suspect it does the job for me. But again, I am so regretful that I didn't pay any attention to Networking and Server stuff before :(
Michael Mao