Search code examples
javagwtservletsbuildgwt-compiler

How GWT Compler find gwt_servlets?


How gwt compiler finds gwt_servlets into gwtModule?

Right now I am getting exception "The requested resource (/finalWar/GWTAPPS/gwtmainmodule/GWTServlet) is not available."

/finalWar/GWTAPPS/gwtmainmodule/GWTServlet = /warFileName/GWTAPPS/myGwtModuleName/GWTServletName

 <servlet>
     <servlet-name>GWTServlet</servlet-name>
     <servlet-class>.ui.gwtmainmodule.server.GWTServletImpl</servlet-class>
  </servlet>


<servlet-mapping >
   <servlet-name>GWTServlet</servlet-name>
   <url-pattern>/GWTServlet</url-pattern>
</servlet-mapping>

I manually added compiled gwt_servlet class in gwt module still same issue. :-|

I want to know How GWT Compiler finds gwtServlets (RemoteServiceServlet) ?

Any help or guidance in this matter would be appreciated


Solution

  • Paths in a web.xml are relative to the webapp's root (the folder where you have a WEB-INF subfolder containing your web.xml).

    So, you have to either adjust the path in the web.xml to the one your client calls (GWTAPPS/gwtmainmodule/GWTServlet, or gwtmainmodule/GWTServlet, it's hard to tell from your description), or adjust the path your client-side code uses (either using the @RemoteServiceRelativePath –note that this path is relative to your module, so probably gwtmainmodule in your case, not the HTML page that loads the nocache.js, also known as the host page; note that you can use ../ to walk up the folder hierarchy– or cast your RPC service to ServiceDefTarget and call setServiceEntryPoint). All of this is at runtime, and is about URLs, not files (and keep in mind you have client and server sides which talk in HTTP through the network)

    That has strictly nothing to do with the GWT compiler though, or even dev mode.