Search |
||
Debugging RMI Security Permissions for Server-side MySQL DatabasesPosted by smontgom on June 3, 2004 at 9:40 AM PDT
I experienced a problem where a client application accessing a server was unable to use the server to subsequently access a MySQL database. However, unit testing on the server side allowed the MySQL data access. What was happening to the server when using the remote connection then and why were SQL connection failure errors like the following being thrown?
and ...
The interesting clue was that the database access worked fine when the client accessed a web service version of the server as opposed to an RMI-based server. Okay then so it is an RMI problem... However, no permission denied exceptions are being thrown (i.e. i thought my policy file was correct). Creating another unit test determined that if I didn't set the RMISecurityManager everything was cool. Must be a permission problem then. But the expected result would be an exception of the form..
Not so!
The life-saver was in William Grosso's book, "Java RMI", that mentioned that you can watch the security manager at work by setting the
It still wasn't crystal clear though as why would the access work for "file.encoding" above and then fail below. Fortunately, "google-caching" found a webpage that once had the source code for the com.mysql.jdbc.MysqlIO class. The error was in fact here
It was the get property on "file.encoding" from this jar and adding this line to my security.policy file fixed the connection problem
So... the practical lesson learned was, if you are having problems with RMI, set the security debug property and look to see if everything can access what it needs to (Probably not the most revolutionary result, but gtna "googling-to-no-avail" on these exceptions / this problem made me want to put this story on the web in some form) »
Related Topics >>
Databases Comments
Comments are listed in date ascending order (oldest first)
|
||
|
|