GWT 2.9, java 11, tomcat 10.0.2 - standard gwt example having RPC error, 404

693 views
Skip to first unread message

Michel Pikkaart

unread,
Feb 22, 2021, 8:49:09 AM2/22/21
to GWT Users
Thank you for reading. I tried for serveral days but I cannot find why this is going wrong.

I have build a standard Tomcat v10.0.2 server. I have setup my Eclipse with java jdk 11 and using GWT 2.9.0

I Generated the sample code of GWT 2.9.0 with java jdk 11. I compile this succes fully. I deployed the war file to the tomcat server, but then it give me a RPC 404 error. 

According to the tutorials which I read on http://gwtproject.org/ this should all be in the right place, right coded...still I got the a 404 error on a RPC call.. which means the service isn't there where it suppose to be.

Could somebody please point me in the right direction... 

I already tried. <url-pattern>/local.appletree.Banana/greet</url-pattern> but I have a rename-to in the gwt.xml so banana should be allright.

Thank you in advance Michel.

Banana.gwt.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.9.0//EN"
<module rename-to='banana'>                
  <inherits name='com.google.gwt.user.User'/>
  <inherits name='com.google.gwt.user.theme.clean.Clean'/>
  <entry-point class='local.appletree.client.Banana'/>
  <source path='client'/>
  <source path='shared'/>
  <add-linker name="xsiframe"/>
</module> 

WEB.XML
<?xml version="1.0" encoding="UTF-8"?>
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
         version="2.5"
         xmlns="http://java.sun.com/xml/ns/javaee">
  <servlet>
    <servlet-name>greetServlet</servlet-name>
    <servlet-class>local.appletree.server.GreetingServiceImpl</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>greetServlet</servlet-name>
    <url-pattern>/banana/greet</url-pattern>
  </servlet-mapping>
  <welcome-file-list>
    <welcome-file>Banana.html</welcome-file>
  </welcome-file-list>
</web-app>

Java interface..
package local.appletree.client;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
@RemoteServiceRelativePath("greet")
public interface GreetingService extends RemoteService {
String greetServer(String name) throws IllegalArgumentException;
}

Michel Pikkaart

unread,
Feb 22, 2021, 10:40:00 AM2/22/21
to GWT Users
Additional info.. this is a wireshark tcp stream..

server is nlapp006
tomcat runs on port 8080
war file, app file is fruit.war
banana is the gwt project name

Client Post the request:

POST /fruit/banana/greet HTTP/1.1
Host: nlapp006:8080
Connection: keep-alive
Content-Length: 176
X-GWT-Module-Base: http://nlapp006:8080/fruit/banana/
X-GWT-Permutation: 1EA337DEFF6D19CF818E1670973E08AA
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36 Edg/88.0.705.74
Content-Type: text/x-gwt-rpc; charset=UTF-8
Accept: */*
Origin: http://nlapp006:8080
Referer: http://nlapp006:8080/fruit/
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9,nl;q=0.8

7|0|6|http://nlapp006:8080/fruit/banana/|EBDFCF2CB094B97E74D5C6DAEB4AF866|local.appletree.client.GreetingService|greetServer|java.lang.String/2004016611|GWT User|1|2|3|4|1|5|6|

Server answers:
HTTP/1.1 404
Content-Type: text/html;charset=utf-8
Content-Language: en
Content-Length: 682
Date: Mon, 22 Feb 2021 15:34:35 GMT
Keep-Alive: timeout=20
Connection: keep-alive

<!doctype html><html lang="en"><head><title>HTTP Status 404 ... Not Found</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 404 ... Not Found</h1><hr class="line" /><p><b>Type</b> Status Report</p><p><b>Description</b> The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.</p><hr class="line" /><h3>Apache Tomcat/10.0.2</h3></body></html>



Op maandag 22 februari 2021 om 14:49:09 UTC+1 schreef Michel Pikkaart:

Michael Conrad

unread,
Feb 22, 2021, 12:03:02 PM2/22/21
to google-we...@googlegroups.com
It is usually /CONTEXT-AKA-WAR-NAME/URL-PATTERN

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/976b7279-2e77-4842-b96e-efd4c2ee4797n%40googlegroups.com.

Craig Mitchell

unread,
Feb 22, 2021, 11:53:01 PM2/22/21
to GWT Users
It looks like you've done everything correctly to me.   Maybe try naming your war ROOT.war, so the RPC post will go directly to /banana/greet (no fruit), removing any possible errors with tomcats war mappings.

Michel Pikkaart

unread,
Feb 23, 2021, 2:57:09 AM2/23/21
to GWT Users
I solved my problem. I installed tomcat on my Debian server and everything works.....when I checked I installed Tomcat version 9 with JDK 11. 
There are major versions difference between Tomcat 9 and 10 on the Servlet SpecJSP, SpecEL, SpecWebSocket, SpecAuthentication and (JASIC) Spec. See http://tomcat.apache.org/whichversion.html
My guess GWT won't work on the most modern specs of Tomcat 10.
I could find info on gwtproject site about these specifications or I overlooked this kind of info.

gr Michel



Op dinsdag 23 februari 2021 om 05:53:01 UTC+1 schreef Craig Mitchell:

Thomas Broyer

unread,
Feb 23, 2021, 7:41:24 AM2/23/21
to GWT Users
Indeed, this is a result of the Jakarta EE fiasco.

“Users of Tomcat 10 onwards should be aware that, as a result of the move from Java EE to Jakarta EE as part of the transfer of Java EE to the Eclipse Foundation, the primary package for all implemented APIs has changed from javax.* to jakarta.*. This will almost certainly require code changes to enable applications to migrate from Tomcat 9 and earlier to Tomcat 10 and later.”

So, yes, Tomcat 10 (servlet 3) is definitely not a drop-in replacement for Tomcat 9 or earlier (servlet 2.x)
Reply all
Reply to author
Forward
0 new messages