File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes GWT and the fly likes GWT servlet works fine in Eclipse, fails to be reached in tomcat and virgo tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » GWT
Bookmark "GWT servlet works fine in Eclipse, fails to be reached in tomcat and virgo tomcat" Watch "GWT servlet works fine in Eclipse, fails to be reached in tomcat and virgo tomcat" New topic
Author

GWT servlet works fine in Eclipse, fails to be reached in tomcat and virgo tomcat

Harry Pulley
Greenhorn

Joined: Sep 03, 2012
Posts: 2
I worked on a GWT web application with client, shared and server code. It all works great in Eclipse when Run As or Debug As a web application, the servlet is found just fine. But if I deploy it in Virgo Tomcat or just Tomcat the calls to the servlet don't work. I get a 404. I have searched and many similar postings are around but none of them fixed my issue. Error from my app, not the vanilla greet example but it is the same:

getSituation failed: 404 <html><head><title>Apache Tomcat/7.0.26 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 404 - Servlet SituationServlet is not available</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>Servlet SituationServlet is not available</u></p><p><b>description</b> <u>The requested resource (Servlet SituationServlet is not available) is not available.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.26</h3></body></html>

I thought maybe it was something I had done so I then created the standard GWT web application example with the greetServer. I added a Warbuilder.xml file to build the war file. It has exactly the same problem so I am wondering what on earth I have done or not done.

Could it be my warbuilder? That's the only part that isn't in the standard GWT web application sample:
<project name="VisualNovel2" basedir="." default="default">

<target name="default" depends="buildwar,deploy"></target>

<target name="buildwar">
<war basedir="war" destfile="VisualNovel2.war" webxml="war/WEB-INF/web.xml">
<exclude name="WEB-INF/**" />
<webinf dir="war/WEB-INF/">
<include name="**/*.jar" />
</webinf>
</war>
</target>

<target name="deploy">
<copy file="VisualNovel2.war" todir="." />
</target>

</project>


Here is the web.xml:


Here is the VisualNovel2.gwt.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='visualnovel2'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>

<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<inherits name='com.google.gwt.user.theme.clean.Clean'/>
<!-- <inherits name='com.google.gwt.user.theme.standard.Standard'/> -->
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->

<!-- Other module inherits -->

<!-- Specify the app entry point class. -->
<entry-point class='visualnovel2.client.VisualNovel2'/>

<!-- Specify the paths for translatable code -->
<source path='client'/>
<source path='shared'/>

</module>

GreetingService.java:

GreetingServiceAsync.java:


VisualNovel2.java:

GreetingServiceImpl.java:


Shared FieldVerifier.java:




My own code is more complex but there is no need to include it as it has the same issue, can't talk to the servlet. It works perfectly from within Eclipse and annoyingly on my Windows 7 64 system with Virgo Tomcat 3.5 and a 64-bit Linux system with Virgo Tomcat 3.5 or Tomcat 6 the system can't connect to the servlet.

I have other services which do work which makes me think it is not a config issue on virgo tomcat or tomcat but if there is config I can fix, please let me know. They are more complicated so I didn't want to use them, I thought I could just use GWT but obviously I am missing something.

Thanks in advance for any help you can provide. It is probably a stupid one liner or something that I've forgotten but for the life of me I cannot find it...

If you want to replicate this simply open eclipse (I have Juno with JDK 1.7.0_07) and create a new Google Web Application Project, create a Warbuilder.xml file, run Google->compile, do Run As ant builder on the Warbuilder.xml and drop the war file in your virgo tomcat pickup or tomcat webapps directory.

Harry

Harry Pulley
Greenhorn

Joined: Sep 03, 2012
Posts: 2
Local help showed me that my class files weren't in the .war file, duh. Adding the class files to the warbuilder.xml to put them in the war file lets tomcat successfully deploy and run the servlet.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: GWT servlet works fine in Eclipse, fails to be reached in tomcat and virgo tomcat