1

I am writing a web application using Eclipse Neon, GWT and sqlite. My webapp at a certain point connects to a database located in the war directory (I understand that the app has only access to that directory, server-side). When I try to create the connection:

Class.forName("org.sqlite.JDBC");
return DriverManager.getConnection("jdbc:sqlite:db.db");

The following exceptions occur in the console:

java.security.AccessControlException: access denied ("java.io.FilePermission" "C:\c:\Users\me\workspace\BookLovers\war\db.db" "read")
[...]
GRAVE: javax.servlet.ServletContext log: Exception while dispatching incoming RPC call
com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract boolean it.me.gc.booklovers.client.LoginService.login(java.lang.String,int) throws java.lang.IllegalArgumentException' threw an unexpected exception: java.lang.Error: Internal Error in _syscall()
[...]
Caused by: java.lang.Error: Internal Error in _syscall()

This is the first time I get such an error and the internet seems oblivious of this issue. One thing I can't explain myself is why "C:/" is repeated twice in the db path; moreover, I would understand if the exception was just an "access denied" one, but I think I'm doing it right (I also tried to move the db in WEB-INF folder, to no avail).

What do you think about it?

phagio
  • 196
  • 1
  • 14
  • what if you put `.\db.db`? what is the result? – Apostolos Jul 11 '16 at 18:00
  • Thank you, Apostolos. I'm running on Windows, so not sure about that syntax. However, I changed the string (quoting ".\\db.db") and the result is the same. The path string is the same as before: `"C:\c:\Users\me\workspace\BookLovers\war\db.db" "read"` – phagio Jul 11 '16 at 18:14
  • ok 2 things: which xerial jdbc version are you using? try using full path directly and see what happens. havent had an issue with such a thing to be honest. – Apostolos Jul 11 '16 at 18:16
  • I'm using 3.7.2, got from http://www.java2s.com/Code/JarDownload/sqlite/sqlite-jdbc-3.7.2.jar.zip. Going to change to absolute path, let's see what changes. – phagio Jul 11 '16 at 18:37
  • And, no changes. The path is still the same, even with the double C:\ connection string: `jdbc:sqlite:C:\\users\\me\\workspace\\BookLovers\\war\\db.db` – phagio Jul 11 '16 at 18:43
  • ok this is really weird. so you re saying that if you put `users\\me\\workspace\\BookLovers\\war\\db.db` as path, it will prepend the `C:\\` and will work! – Apostolos Jul 11 '16 at 19:19
  • As if! Since it doesn't start with a drive letter, it is taken as a relative path and tries to open c:\Users\me\workspace\BookLovers\war\users, which obviously does not exist. – phagio Jul 11 '16 at 19:28
  • final attempt: since 3.7.2 is a really old version, is there a chance of using a more recent xerial version? ` org.xerial sqlite-jdbc 3.8.11.2 ` – Apostolos Jul 11 '16 at 19:31
  • Ok, I found the 3.8.11.2. The error now is different: `java.lang.NoClassDefFoundError: java.io.FileOutputStream is a restricted class. Please see the Google App Engine developer's guide for more details.` But I'm not using FileOutputStream anywhere... – phagio Jul 11 '16 at 19:42
  • this is a google app engine specific error. please see here http://stackoverflow.com/questions/8090670/google-appengine-not-supporting-fileoutputstream – Apostolos Jul 11 '16 at 19:53
  • i'm not familiar with GAE :( – Apostolos Jul 11 '16 at 19:53
  • also check this http://stackoverflow.com/questions/17555490/can-i-use-sqlite-libraries-on-google-app-engine – Apostolos Jul 11 '16 at 19:58
  • ... I guess I'll try to use MySQL or something else as dbms. – phagio Jul 11 '16 at 20:04

1 Answers1

0

As it turns out, it seems that the problem was caused by an older version of the .jar connector. Using a more recent connector solved the problem. Thank you, Apostolos.

phagio
  • 196
  • 1
  • 14