3

My application is working great in development mode (with GWT-RPC calls), however whenever I try to test it using production mode (by removing the ?gwt.codesvr=127.0.0.1:9997 part of the URL), it used to give me a blank page.

I manually checked the VoitureTourisme.html file and modified the voitureTourisme.nocache.js file's path to a working one (this means that my Web.xml isn't configured properly, right? then why does it work in dev mode?)

Now it looks like this <script language="javascript" src="voitureTourisme/voitureTourisme.nocache.js"></script> but it used to be

src="com.devsys.calculateur.voitureTourisme.VoitureTourisme/com.devsys.calculateur.voitureTourisme.VoitureTourisme.nocache.js" when I first compiled. Because I tried different variations and compiled a few times, I now got 2 module folders inside my war : "voitureTourisme" and the other with the full path as shown above.

I'm pretty sure I'm confusing how to properly configure the VoitureTourisme.gwt.xml and Web.XML files, because I wouldn't have to manually correct the compiled html file if I did. After I fixed it manually (which I shouldn't have to do), my RPC calls showed a 404 error because they didn't find my servlet for the service (bad url).

Hopefully you can show me what's wrong and why with my configuration

Web.xml

<?xml version="1.0" encoding="utf-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
    <!-- TODO: Add <servlet> tags for each servlet here. -->
    <!-- TODO: Add <servlet-mapping> tags for each <servlet> here. -->
    <!-- TODO: Optionally add a <welcome-file-list> tag to display a welcome file. -->
     <!-- Servlets -->
  <servlet>
    <servlet-name>calculateurDataService</servlet-name>
    <servlet-class>com.devsys.calculateur.voitureTourisme.server.form.CalculateurDataServiceImpl</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>calculateurDataService</servlet-name>
    <url-pattern>/com.devsys.calculateur.voitureTourisme.VoitureTourisme/calculateurDataService</url-pattern>
  </servlet-mapping>
</web-app>

VoitureTourisme.gwt.xml

<module>
    <inherits name="com.google.gwt.user.User"/>
    <inherits name="com.google.gwt.user.theme.standard.Standard"/>
    <inherits name="com.devsys.util.XmlUtil"/>
    <inherits name="com.devsys.util.UrlUtil"/>
    <inherits name="com.google.gwt.i18n.I18N"/>
    <entry-point class="com.devsys.calculateur.voitureTourisme.client.VoitureTourisme"/>
</module>

I also have my service interface using

@RemoteServiceRelativePath("calculateurDataService")

Is that correct? Should I use it?

dominicbri7
  • 2,479
  • 4
  • 23
  • 33

1 Answers1

2

i think the problem is module name related. Try adding this line of your gwt.xml before inherits begin:

<module rename-to='voituretourisme'>

and then in your web.xml file try changing to :

<url-pattern>/voituretourisme/calculateurDataService</url-pattern>

your html file should be like :

<script language="javascript" src="voituretourisme/voituretourisme.nocache.js"></script>

mind case sensitivity and I beleive this should compile correctly and work both in development mode and production mode.

pistolPanties
  • 1,880
  • 13
  • 18
  • Hello pistolPanties, I also think this is the nature of my problem, however with whatever I tried it never seem'd to work. I now tried with "voiture_tourisme" just to be sure not to be confused anymore. The javascript.nocache.js file was named accordingly, so did the folders created. The HTML file was pointing to the right names also. But when I first tried to run as web application, my console would show a 404 error as it couldn't find the JS file, as it did before. I went out to get a coffee, tried once again and now it works without changing anything..? I guess GWT needed time to adjust... – dominicbri7 Aug 18 '11 at 12:48
  • Did it work without changing anything or did you get a chance to try ? – pistolPanties Aug 18 '11 at 13:01
  • I did change the rename-to to "voiture_tourisme" as I stated, didn't work at first (like the multiple times I tried before, hence why I created this question), but after a couple of minutes it then worked without doing further changes, sorry if I wasn't clear. I guess GWT did some background processing (after the compilation, maybe during the Hosted mode) I wasn't aware of and discovered I had changed the – dominicbri7 Aug 18 '11 at 13:32
  • In hosted mode (Development mode), when you change your web.xml or when you make changes to your server side classes, you need to restart the development server (as in stop and re-run) for changes to take effect. Perhaps some of the configurations you tried were right, but your server did not reflect the changes because of this reason. – pistolPanties Aug 18 '11 at 13:58
  • I think you're right that must be why. That's good to know! Also I've had problems with the GWT arguments, I don't know how but there were 2 module names(including path), including 1 with a previous "package-path" so it didn't matter if I changed the path back and forth, there would always be one that was wrong. Anyways, it works for now, thanks! – dominicbri7 Aug 18 '11 at 15:52