我们将websphere 17用于基于eclipse-link作为持久层的Web应用程序。应用程序运行正常,但过一会儿(在用户活动期间),我们收到了此类错误,迫使我们重新启动服务器。
org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Access denied ("java.util.PropertyPermission" "oracle.jdbc.sqlTranslationProfile" "read")
Error Code: 0
此错误是什么意思?
据我了解,发生此错误是因为没有对该属性的读取权限。但这可能是由于安全管理器所致。问题是我希望websphere设置任何安全管理器,并且可以肯定的是我们不会创建任何自定义安全管理器。安全管理器不应该存在于我们的应用程序中。那么,谁来设置呢?还是我错过了什么?
以下是完整的堆栈跟踪:
Internal Exception: java.sql.SQLException: Access denied ("java.util.PropertyPermission" "oracle.jdbc.sqlTranslationProfile" "read")
Error Code: 0
at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:316)
at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:147)
at org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:162)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.setOrDetectDatasource(DatabaseSessionImpl.java:207)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:760)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:265)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:731)
... 83 common frames omitted
Caused by: java.sql.SQLException: Access denied ("java.util.PropertyPermission" "oracle.jdbc.sqlTranslationProfile" "read")
at com.ibm.ws.rsadapter.AdapterUtil.toSQLException(AdapterUtil.java:822)
at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:152)
at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:116)
at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:135)
... 88 common frames omitted
Caused by: javax.resource.spi.ResourceAllocationException: Access denied ("java.util.PropertyPermission" "oracle.jdbc.sqlTranslationProfile" "read")
at com.ibm.ejs.j2c.FreePool.createManagedConnectionWithMCWrapper(FreePool.java:1576)
at com.ibm.ejs.j2c.FreePool.createOrWaitForConnection(FreePool.java:1228)
at com.ibm.ejs.j2c.PoolManager.reserve(PoolManager.java:1434)
at com.ibm.ejs.j2c.ConnectionManager.allocateMCWrapper(ConnectionManager.java:573)
at com.ibm.ejs.j2c.ConnectionManager.allocateConnection(ConnectionManager.java:309)
at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:143)
... 90 common frames omitted
Caused by: java.security.AccessControlException: Access denied ("java.util.PropertyPermission" "oracle.jdbc.sqlTranslationProfile" "read")
at java.security.AccessController.throwACE(AccessController.java:176)
at java.security.AccessController.checkPermissionHelper(AccessController.java:237)
at java.security.AccessController.checkPermission(AccessController.java:373)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:562)
at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:1307)
at java.lang.System.getProperty(System.java:456)
at oracle.jdbc.driver.GeneratedPhysicalConnection$1.run(GeneratedPhysicalConnection.java:84)
at java.security.AccessController.doPrivileged(AccessController.java:640)
at oracle.jdbc.driver.GeneratedPhysicalConnection.getSystemProperty(GeneratedPhysicalConnection.java:82)
at oracle.jdbc.driver.GeneratedPhysicalConnection.getSystemPropertySqlTranslationProfile(GeneratedPhysicalConnection.java:46)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:555)
at oracle.jdbc.pool.OracleDataSource.getPhysicalConnection(OracleDataSource.java:317)
at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:241)
at oracle.jdbc.pool.OracleConnectionPoolDataSource.getPhysicalConnection(OracleConnectionPoolDataSource.java:164)
at oracle.jdbc.pool.OracleConnectionPoolDataSource.getPooledConnection(OracleConnectionPoolDataSource.java:102)
at oracle.jdbc.pool.OracleConnectionPoolDataSource.getPooledConnection(OracleConnectionPoolDataSource.java:79)
at com.ibm.ws.rsadapter.impl.DatabaseHelper$1.run(DatabaseHelper.java:949)
at java.security.AccessController.doPrivileged(AccessController.java:696)
at com.ibm.ws.rsadapter.impl.DatabaseHelper.getPooledConnection(DatabaseHelper.java:958)
at com.ibm.ws.rsadapter.impl.WSManagedConnectionFactoryImpl.getConnection(WSManagedConnectionFactoryImpl.java:810)
at com.ibm.ws.rsadapter.impl.WSManagedConnectionFactoryImpl.createManagedConnection(WSManagedConnectionFactoryImpl.java:656)
at com.ibm.ejs.j2c.FreePool.createManagedConnectionWithMCWrapper(FreePool.java:1354)
... 95 common frames omitted
感谢您的帮助,
答案 0 :(得分:0)
bootstrap.properties中的websphere.java.security
属性控制是否在Liberty中启用Java 2安全性。
在启用Java 2安全性的情况下运行时,以下示例服务器配置代码段(用于server.xml文件)说明如何授予oracle JDBC驱动程序读取以“ oracle.jdbc”开头的系统属性的权限,< / p>
<javaPermission codebase="C:/drivers/oracle/ojdbc7.jar" className="java.util.PropertyPermission" actions="read" name="oracle.jdbc.*"/>