0

I am experimenting with GWT and I created a GWT Application Project within Eclipse (project name is "echo"), as explained in GWT tutorial. I left the generated example code untouched. When I run the application within Eclipse (Run As > GWT Development Mode with Jetty), it runs just fine.

I then create a .war file by going in the war folder and using the command jar cv * >../echo.war.

I then open Tomcat 10.1 Web Application Manager and under the "Deploy" section I deploy the generated echo.war file. An /echo application appears under "Applications" section, if I click on the link it correctly shows the application page:

app home page correctly displayed

However, as soon as I click the "Send" button it shows an error; it seems RPC is not working. Do I miss anything? I thought uploading the .war file using the manager would do the magic.

error when sending

mzattera
  • 13
  • 5
  • My `echo.war` file can be found [here](https://github.com/mzattera/file-exchange/blob/dd1397a5712484639756b261b8b976eca3b7a449/echo.war) – mzattera May 28 '23 at 06:18
  • Does this answer your question? [Servlet 5.0 JAR throws compile error on javax.servlet.\* but Servlet 4.0 JAR does not](https://stackoverflow.com/questions/64387472/servlet-5-0-jar-throws-compile-error-on-javax-servlet-but-servlet-4-0-jar-does) (or, in other words: Try deploying on Tomcat 9). Also, it helps a lot more to share source code _(in the question)_ rather than a binary file on an external server. – Olaf Kock May 28 '23 at 12:21
  • In the developer tools in the browser, what URL is being called when you click Send? Also you might want to look at the tomcat logs on the backend. e.g. catalina.out and localhost_access.* – Robert Newton May 29 '23 at 00:04
  • Hi @OlafKock the code is what GWT Eclipse plugin creates by default....I can zip the project if needed. – mzattera May 29 '23 at 20:55
  • Will check and revert back ASAP @RobertNewton – mzattera May 29 '23 at 20:56
  • "what the GWT plugin creates by default": All entries here should be _self-contained_ and still be reproducible when that default changes. Check the "Help others reproduce the problem" paragraph in [ask]. And no, we definitely don't need a zip of all of the source code, just a [mcve]. If you'd like to get an answer, my recommendation is to provide as much information as possible _within the question_. Often someone will be able to just look at your code and immediately spot a problematic point. That assumes that there is something to look at - and currently there's nothing in your question – Olaf Kock May 30 '23 at 07:37

1 Answers1

0

OK, thanks, I managed to solve this!

Solution: Use Tomcat 9 :) (I am using 9.0.75).

Being paranoid, and hoping this can help others, I provide below the exact steps to deploy GWT 2.10 under Tomcat 9 using JDK 11 compliance (I need it for my libraries), making sure no problem is detected in Eclipse.

Setup Eclipse Workspace for Java 11

  1. Install JDK 11 on your machine.

  2. Create new Eclipse workspace.

  3. Under Windows > Preferences > Java > Installed JREs, chose your JDK 11 installation and make it default.

  4. Under Windows > Preferences > Java > Compiler set "Compiler compliance level" to 11.

Create and setup GWT project

  1. Download and install GWT 2.10

  2. Under Windows > Preferences > GWT > GWT Settings, add installed GWT SDK.

  3. Create new GWT Web Application project v. 2.10; leave "Generate Sample Code" ticked.

  4. Under Project properties > Resources, select "Text file encoding" for your project files.

  5. Under Project properties > Java Compiler, make sure "Enable project specific settings is disabled, so JDK compliance is set to 11.

  6. Open web.xml under war/WEB-INF with Eclipse text editor, it will trigger a validation error. You can fix it as explained here.

mzattera
  • 13
  • 5