OC4J配置的数据源,如果被OC4J自己内部运行的程序调用没有问题
如:oc4j903\j2ee\home\config\data-sources.xml中
在</data-sources>到</data-sources>之间添加
<data-source class="com.evermind.sql.ConnectionDataSource" location="jdbc/PortalDB"
password="assgis"
username="portal"
url="jdbc:oracle:thin:@172.18.2.6:1521:apps"
inactivity-timeout="30"
max-connections="50"
max-connect-attempts="2"
min-connections="4"
connection-driver="oracle.jdbc.driver.OracleDriver"
schema="PortalDB"
name="PortalDB"/>
则在程序中调用:
DataSource dataSource = (DataSource) context.lookup("jdbc/PortalDB");
没有问题;
如果是RMI远程调用,会出现如下错误:
'javax.naming.NamingException: Not in an application scope - start Orion with
the -userThreads switch if using user-created threads'
解决办法:
对于oc4j的启动文件添加参数: -userThreads
如:
java -jar oc4j.jar -userThreads