First of all the exception stack trace can be something like:
java.net.SocketException: java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:3306 connect,resolve)
at com.mysql.jdbc.StandardSocketFactory.unwrapExceptionToProperClassAndThrowIt(StandardSocketFactory.java:407)
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:268)
at com.mysql.jdbc.MysqlIO.(MysqlIO.java:271)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:2921)
at com.mysql.jdbc.Connection.(Connection.java:1555)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
at java.sql.DriverManager.getConnection(DriverManager.java:620)
at java.sql.DriverManager.getConnection(DriverManager.java:222)
First of all, this problem may happens as simple JDBC authorization error such like "Permission denied" which happens in sendAuth() (or sendAuth441() ) connection stage. But there isn't problem of your connection or credentials it's only told you that you not given permissions to use socket connection to your MySQL connector JAR under J2EE container :-)
You can give it in a simple way configuring security.police file in your J2EE application server configuration directory ( in your domain configuration directory if you use Sun Glassfish ):
grant codeBase "${path_to_your_mysql_connector_jar}!/-" {
permission java.net.SocketPermission ${your_host}, "connect";
}
Do not forget that your problem can be difference than JAR permission ;-)
Комментариев нет:
Отправить комментарий