java.lang.ClassNotFoundException: javax.sql.DataSource when using GWT 2.9.0 + Java 11 combination

279 views
Skip to first unread message

Abhishek Yadav

unread,
Jun 29, 2022, 3:58:40 PM6/29/22
to GWT Users
Hi Team,

I am trying to start classic DEV mode in eclipse through GWT eclipse plugin .
I am using GWT 2.9.0 + Java 11 combination.
I am getting below error. Can you help me in resolving the below error:

[b]Caused by: java.lang.ClassNotFoundException: javax.sql.DataSource
        at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload$WebAppClassLoaderExtension.findClass(JettyLauncher.java:478) ~[gwt-dev-2.9.0.jar:?]
        at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:441) 

Jens

unread,
Jun 29, 2022, 4:46:30 PM6/29/22
to GWT Users
Without being able to see the project setup this is tough to answer.

However regardless of the exception you are seeing: Classic/Legacy DevMode will not work with GWT 2.9.0 correctly, because GWT 2.9.0 already uses JsInterop internally in its Java SDK emulation (e.g. java.util.Date uses it). JsInterop is not supported by classic/legacy DevMode. With GWT 2.9.0 you have to use SuperDevMode to have a functional Java SDK emulation during development.

-- J.

Abhishek Yadav

unread,
Jun 29, 2022, 5:07:18 PM6/29/22
to GWT Users
Thanks Jens for your quick help. I appreciate it.

Thomas Broyer

unread,
Jun 30, 2022, 3:30:06 AM6/30/22
to GWT Users
Didn't legacy devmode also only work with JDK 8?

Michael Conrad

unread,
Jun 30, 2022, 7:48:35 AM6/30/22
to google-we...@googlegroups.com
I didn't think that java.sql.DataSource is emulated by GWT. Looks like you are pulling in server side only type stuff from somewhere?

--
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/6d3569b5-b7f0-4c2e-918c-c342b6803441n%40googlegroups.com.

Oleg Ravun

unread,
Jun 30, 2022, 2:57:50 PM6/30/22
to GWT Users
I am not sure if it is the same issue but when  I switched to Java 11 I had the following: 

"Server class 'javax.sql.DataSource' could not be found in the web app, but was found on the system classpath
[ERROR] Found resouce but unrecognized URL format: 'jrt:/java.sql/javax/sql/DataSource.class'"

In according to https://github.com/gwtproject/gwt/issues/9582 there is an issue with JettyLauncher. And it is recommended to use "CodeServer and a separate servlet container." Here is a discussion on Jetty in GWT: https://groups.google.com/g/google-web-toolkit-contributors/c/iU9hckIab2o?pli=1.

It means that one needs to run the application under Tomcat (a separate servlet container) instead of the embedded Jetty.

Rob Newton

unread,
Jun 30, 2022, 8:29:28 PM6/30/22
to GWT Users
Yes it seems that you need to run it in a separate servlet container, but it doesn't have to be Tomcat.  You can use Jetty so long as it is fairly recent (unlike the old version embedded in GWT dev mode).

Josselin Bardet

unread,
Jul 1, 2022, 3:32:18 PM7/1/22
to google-we...@googlegroups.com
Hello all

I use legacy dev mode with a old FF17 with succes on GWT 2.10 / jdk 11. I had to overide JettyLauncher class to add "javax.sql." on the "allowedFromSystemClassLoader" variable
Until now, I have no issue with this mode except this.

--

eliasb...@gmail.com

unread,
Dec 19, 2022, 10:46:31 AM12/19/22
to GWT Users
Overriding JettyLauncher with  "javax.sql." on the "allowedFromSystemClassLoader" variable has worked for me on a variety of projects, using SuperDevMode + GWT 2.9.0 + JDK 11

I hope a future version of GWT will make use of a Jetty version supporting a more elegant way to override the "allowedFromSystemClassLoader" variable.

eliasb...@gmail.com

unread,
Dec 20, 2022, 10:40:31 AM12/20/22
to GWT Users
I take back what I said.

It seems there are classpath resolution issues when using a custom "JettyLauncher" while running under "GWT Eclipse Plugin", probably due to different classloaders assignment.

I am afraid the time has finally come to abandon use of DevMode and the "GWt Eclipse Plugin", until this is fixed in later versions of GWT.

I hope a future version of GWT will make use of a Jetty version supporting a more elegant way to override the "allowedFromSystemClassLoader" variable.

Reply all
Reply to author
Forward
0 new messages