There is a serializable class for sharing over gwt-rpc. One of the class methods works with the sqlite database.
The application does not load, the first error indicates the line

Class.forName("org.sqlite.JDBC"); 

The method of the class being serialized and writes:
"The method forName (String) is undefined for the type Class".

As far as I understand, the problem is in loading the class "org.sqlite.JDBC". I tried different options, including these

 MyClass.getClassLoader().loadClass("org.sqlite.JDBC").newInstance(); Class.class.getClassLoader().loadClass("org.sqlite.JDBC"); 

the result is the same: "The method getClassLoader () is undefined for the type Class <class>"
Is it possible to solve the problem?

  • The GWT form also cannot load this class. Maybe this is due to the limitations of gwt arising from compilation in JavaScript? - Ildar
  • Is it just loaded on the server? I did not quite understand what part of the application swears (gradually it comes to the browser that - obviously there is no class there). Why do you need a database driver in shared? - avp
  • On the server is loaded, not loaded on the client. It was necessary that the class that interacts with rpc, could work with sqlite. Although this method was supposed to be called only on the server side, it also gets into the gwt module, where its class is a loader, which seems not to be able to work with sqlite, it probably does not need it. Gwt has its own compiler, it gives errors. - Ildar
  • Redo the class. - avp

1 answer 1

At the client this should not work. GWT does not implement the Class.forName method. And the more so it is impossible to load such classes. How do you imagine it will work?

The solution is simple: make it normal and do not interfere with everything in a heap. In shared, 90% is all sorts of serializable bins, and the remaining 10% are universal utils. If your class involves serialization, then this is probably a bin with data. It is clear that it is necessary to single out the logic for working with the base away from it, since you have violated one of the most important rules during the development: the division of responsibilities. As a bonus, you will get the absence of such problems with GWT.

  • I understand that all my problems are probably the result of a lack of web programming experience and client-server software in general. We rewrites old web software. Classes rewrote, it seems everything turned out neatly. - Ildar