Eclipse 2020-06 JDK 11, GWT project cannot connect to Oracle Database

80 views
Skip to first unread message

Yibin Li

unread,
Aug 13, 2021, 2:53:45 PMAug 13
to GWT Users
I just upgrade my Eclipse to 2020-06 and Java JDK 11

My Oracle client on my PC is Oracle 11.2. There is ojdbc6_g.jar is in C:\Oracle\product\11.2.0\client_1\jdbc\lib

I created a new GWT Web Application

In Data connection module, I copied or Java 8 DB Connection code here

1. I tried
OracleDataSource ods2 = new OracleDataSource();
String url = "jdbc:oracle:thin:@/server:port/service";
 ods2.setURL(url);
 ods2.setUser(appsettings.getString("username"));
  ods2.setPassword( appsettings.getString("pwd")  );

It can compile. But when I debug the connection
Line : OracleDataSource ods2 = new OracleDataSource(); throws exception
[ERROR] Found resouce but unrecognized URL format: 'jrt:/java.sql/javax/sql/DataSource.class'.

2. Then I try another way to connect to t DB
Connection con=DriverManager.getConnection(  "jdbc:oracle:thin:@server:port","username","pwd");  

It throws :
java.lang.NoClassDefFoundError: org/ietf/jgss/GSSException
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:315)
at oracle.net.ano.Ano.init(Unknown Source)
at oracle.net.ns.NSProtocol.connect(NSProtocol.java:284)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1407)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:328)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:535)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:218)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:29)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:528)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:677)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:228)


Any suggestions or comments

Thank you for your help

Yibin Li


Yibin Li

unread,
Aug 13, 2021, 2:59:28 PMAug 13
to GWT Users
Also Console prints

[WARN] Server class 'org.ietf.jgss.GSSException' could not be found in the web app, but was found on the system classpath
   [ERROR] Found resouce but unrecognized URL format: 'jrt:/java.security.jgss/org/ietf/jgss/GSSException.class'

Jens

unread,
Aug 16, 2021, 6:45:40 AMAug 16
to GWT Users
[WARN] Server class 'org.ietf.jgss.GSSException' could not be found in the web app, but was found on the system classpath
   [ERROR] Found resouce but unrecognized URL format: 'jrt:/java.security.jgss/org/ietf/jgss/GSSException.class'

JRT urls are available since Java 9 and the embedded Jetty 9.2.x that GWT provides does not understand these kinds of URLs.

For complex GWT apps the recommendation is to not use the embedded Jetty provided by GWT. Instead use GWT CodeServer to serve GWT client code during development and your own Jetty server to deploy your server side code to. You need at least Jetty 9.4.7 and not higher than Jetty 10.x because Jetty 11.x uses the new Jakarta EE namespace which GWT server side code does not support.


Yibin Li

unread,
Aug 19, 2021, 9:36:00 AMAug 19
to GWT Users
Jens,

I will try this approach

Almost each UI is working as GWT 2.5. But not DB connection. I deployed the code to my test server and use DB datasource on server, everything is working. The only obstacle is DB connection.

Thank you for your reply.

Yibin Li

unread,
Aug 19, 2021, 9:43:41 AMAug 19
to GWT Users
I changed the JDK to Java 8 and everything is working. 

The same DB connection code can connect to DB

Eclipse 2020-06

1. NO GWT
    Java11 can connect to DB

2. With GWT
   Java 11 cannot connection to DB

Reply all
Reply to author
Forward
0 new messages