无法使用Glassfish JDBC连接池连接到Oracle,抛出AccessControlException

时间:2015-11-03 13:42:53

标签: java oracle jdbc glassfish

当我尝试从Glassfish 3管理控制台ping Oracle 11g时,我得到以下异常:

Caused by: java.security.AccessControlException: access denied ("java.util.PropertyPermission" "javax.net.ssl.keyStorePassword" "read")
       at com.sun.enterprise.security.ssl.SSLUtils.checkPermission(SSLUtils.java:336)
       at com.sun.enterprise.security.J2EESecurityManager.checkProperty(J2EESecurityManager.java:146)
       at com.sun.enterprise.security.J2EESecurityManager.checkPropertyAccess(J2EESecurityManager.java:131)
       at java.lang.System.getProperty(System.java:744)
       at oracle.jdbc.driver.PhysicalConnection$1.run(PhysicalConnection.java:3117)
       at java.security.AccessController.doPrivileged(Native Method)
       at oracle.jdbc.driver.PhysicalConnection.getSystemProperty(PhysicalConnection.java:3113)
       at oracle.jdbc.driver.PhysicalConnection.readConnectionProperties(PhysicalConnection.java:1300)
       at oracle.jdbc.driver.PhysicalConnection.(PhysicalConnection.java:517)
       at oracle.jdbc.driver.T4CConnection.(T4CConnection.java:228)
       at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
       at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
       at oracle.jdbc.pool.OracleDataSource.getPhysicalConnection(OracleDataSource.java:280)
       at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:207)
       at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:157)
       at com.sun.gjc.spi.DSManagedConnectionFactory.createManagedConnection(DSManagedConnectionFactory.java:115)
       at com.sun.enterprise.resource.allocator.LocalTxConnectorAllocator.createResource(LocalTxConnectorAllocator.java:87)
       at com.sun.enterprise.resource.pool.ConnectionPool.createSingleResource(ConnectionPool.java:907)
       ... 61 more

使用相同JDBC驱动程序的独立应用程序可以正常工作。我在本地Ubuntu 12.04盒子上运行Glassfish 3.1.2,Oracle 11g XE部署为Docker镜像。我有AppArmor停止,没有防火墙活动,也不知道它与SSL有什么关系。我还尝试向Glassfish server.policy和JDK java.policy文件添加javax.net.ssl.keyStorePassword权限,但它没有解决问题。

同一个Glassfish实例有一个MySQL池,没有这样的错误。可能我需要在Oracle服务器上配置一些东西才能使它工作吗?

1 个答案:

答案 0 :(得分:0)

通过将Oracle JDBC驱动程序jar文件放到200 Ok而不是../glassfish/lib来解决此错误。