我们的应用程序通过使用嵌入式JDBC数据源(即通过用户名/密码/连接字符串)或JNDI(如果大客户不想与明文属性文件混合)在不同的客户上工作。
这是由弹簧控制的
<beans profile="JNDIDS">
<jee:jndi-lookup id="dataSource" jndi-name="${database.jndi}" resource-ref="true" />
</beans>
当我配置纯文本数据源时,上面的代码在Jboss、Websphere和Tomcat 8上成功运行。
server.xml
是由他们管理的,所以他们集成了CyberArk EPV(企业密码库)。
服务器.xml
<Resource name="DB-Global" auth="Container" type="oracle.jdbc.pool.OracleDataSource"
driverClassName="oracle.jdbc.driver.OracleDriver" vendorFactoryClass="oracle.jdbc.pool.OracleDataSourceFactory" factory="com.cyberark.aim.v550.tomcat.ASCPDataSourceFactory"
url="(redacted)" userPropertyName="user" passwordPropertyName="password" maxActive="20" maxIdle="10" maxWait="-1" ascp.connectionPort="18923" ascp.appId="(redacted)"
ascp.query="(redacted)" ascp.connectionTimeOut="30" ascp.reason="To retrieve the password for appID (redacted)"/>
上下文.xml
<ResourceLink name="DB" global="DB-Global" type="oracle.jdbc.pool.OracleDataSource" />
数据库JNDI等于
java:/comp/env/DB
Caused by: javax.naming.NamingException: The local resource link [DB] that refers to global resource [DB-Global] was expected to return an instance of [oracle.jdbc.pool.OracleDataSource] but returned an instance of [com.cyberark.aim.v550.tomcat.ASCPDataSource]
at org.apache.naming.NamingContext.lookup(NamingContext.java:864) ~[catalina.jar:8.0.47]
at org.apache.naming.NamingContext.lookup(NamingContext.java:158) ~[catalina.jar:8.0.47]
at org.apache.naming.NamingContext.lookup(NamingContext.java:835) ~[catalina.jar:8.0.47]
at org.apache.naming.NamingContext.lookup(NamingContext.java:158) ~[catalina.jar:8.0.47]
at org.apache.naming.NamingContext.lookup(NamingContext.java:835) ~[catalina.jar:8.0.47]
at org.apache.naming.NamingContext.lookup(NamingContext.java:172) ~[catalina.jar:8.0.47]
at org.apache.naming.SelectorContext.lookup(SelectorContext.java:157) ~[catalina.jar:8.0.47]
at javax.naming.InitialContext.lookup(InitialContext.java:417) ~[?:1.8.0_141]
at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:155) ~[spring-context-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:87) ~[spring-context-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152) ~[spring-context-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:179) ~[spring-context-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95) ~[spring-context-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:106) ~[spring-context-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:231) ~[spring-context-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:217) ~[spring-context-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
... 27 more
以上是我的客户发送的最新错误。
我知道
OracleDataSource
(尽管我们运行的是Oracle)但是
javax.sql.DataSource
可能的
将Oracle的数据源包装成自己的数据源。
即使我要求申请
javax.sql.DataSource数据源
OracleDataSource数据库
,我也犯了同样的错误,这次是这样说的
com.cyberark.aim.v550.tomcat.ASCPDataSource
javax.sql.DataSource数据源
问题是:如何将Cyberark EPV数据源配置为在Tomcat8.0中工作?