GWT Development mode not working (configuring web.xml)

2.3k views Asked by At

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?

1

There are 1 answers

5
pistolPanties On BEST ANSWER

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.