简体   繁体   中英

GWT Super Dev Mode RPC 404

I am trying to get started with super dev mode. I have super dev mode running, and have a web server serving up my main html page, where I am able to do 'Dev mode on' and recompile the module. Now I am trying to get this page to access my RequestFactory and RPC servlets. I started up regular dev mode and have the servlets available at localhost:8888/gwtRequest. So now I have three servers running:

http://localhost:9876/ - GWT Code Server
http://localhost:8080/ - Mongoose web server serving /war directory
http://localhost:8888/ - GWT Dev Mode running servlets

How do I point my app to the correct servlet container? And are all those servers necessary? I get a 404 right now because it is looking at http://localhost:8080/gwtRequest .

Here's a snippet of web.xml:

<servlet>
  <servlet-name>requestFactoryServlet</servlet-name>
  <servlet-class>com.example.server.util.ExampleRequestFactoryServlet</servlet-class>
</servlet>

<servlet-mapping>
  <servlet-name>requestFactoryServlet</servlet-name>
  <url-pattern>/gwtRequest</url-pattern>
</servlet-mapping>

Past that, are there any ways I can make this less convoluted? Maybe some new feature takes care of some of these headaches? I'm hoping to setup other developers with the environment once I know how! And hopefully not make it too much more difficult to push to production (ie hopefully minimal configuration/code changes).

Thank you!

You only need 2 servers:

  • one that serves your static files and server-side code (servlets). This includes a version of your app compiled to JavaScript (you don't need to update it often though!). This can be the server that's embedded in DevMode, but can also be a standalone Jetty or Tomcat or whatever, or things like the tomcat7-maven-plugin or jetty-maven-plugin in Maven or the jetty plugin in Gradle.
  • the SuperDevMode's CodeServer

Note that if you use GWT-RPC, you'll want to launch your server with the gwt.codeserver.port system property set to the port of the CodeServer (assuming they live on the same machine). That way, when your browser (which runs a more recent client-side code than what you compiled to JS and deployed to your server) talks to your servlet, that one will load the GWT-RPC serialization policy from the CodeServer. Otherwise, GWT-RPC is likely to fail with an IncompatibleRemoteServiceException .

See also https://stackoverflow.com/a/18333050/116472

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM