BC4J and JNDI DataSource Configuration
Hi,
I need help in making the BC4J use a DataSource for creating connections. Could you anyone tell me step by step instructions to do it?
I have created a Database Connection using JDBC for creating a BC4J App Module, View Objects etc.
Then I created a Business Component Package by using the wizard. Everything worked fine till now. But I was to use a connection pool that is created in my App Server which happens to be a WebLogic 7.0 App Server. I have created a JDBCConnection pool and a JDBCDataSource in the App Server. The configuration for it is as follows in the weblogic configuration file.
<JDBCConnectionPool DriverName="oracle.jdbc.driver.OracleDriver"
MaxCapacity="5" Name="OracleConnectionPool"
Password="{3DES}n51DlVgPmmQ="
Properties="user=empac;dll=ocijdbc9;protocol=oci"
Targets="myserver" URL="jdbc:oracle:oci:@DB921C"/>
<JDBCDataSource JNDIName="OCIDataSource" Name="OCIDataSource"
PoolName="OracleConnectionPool" Targets="myserver"/>
I wanted to edit the "Configurations" to specify the JDBC DataSource. When I saved the configuration for the App Module this is how my bc4j.xcfg looks.
<?xml version = '1.0' encoding = 'UTF-8'?>
<BC4JConfig>
<AppModuleConfigBag>
<AppModuleConfig name="BuyerModuleLocal">
<java.naming.security.principal>system</java.naming.security.principal>
<DeployPlatform>LOCAL</DeployPlatform>
<jbo.TypeMapEntries>Java</jbo.TypeMapEntries>
<JDBCDataSource>OCIDataSource</JDBCDataSource>
<jbo.project>BC4JTry</jbo.project>
<AppModuleJndiName>com.explore.bc4j.BuyerModule</AppModuleJndiName>
<ApplicationName>com.explore.bc4j.BuyerModule</ApplicationName>
<java.naming.security.credentials>security</java.naming.security.credentials>
</AppModuleConfig>
</AppModuleConfigBag>
<ConnectionDefinition name="DB921C">
<ENTRY name="JDBC_PORT" value="1521"/>
<ENTRY name="ConnectionType" value="JDBC"/>
<ENTRY name="HOSTNAME" value="joshua"/>
<ENTRY name="user" value="empac"/>
<ENTRY name="ConnectionName" value="DB921C"/>
<ENTRY name="SID" value="DB921C"/>
<ENTRY name="JdbcDriver" value="oracle.jdbc.driver.OracleDriver"/>
<ENTRY name="password" value="empac"/>
<ENTRY name="ORACLE_JDBC_TYPE" value="thin"/>
<ENTRY name="DeployPassword" value="true"/>
</ConnectionDefinition>
</BC4JConfig>
When I tried to run a testClient which uses the App Module it is failing giving me an exception saying could not lookup for the DataSource. In one of the detailed error messages, I got this error.
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
I checked the "Configurations" window and it was having
"oracle.jbo.common.JboInitialContextFactory" for the property "java.naming.factory.initial".
Could anyone tell me how to solve this issue. I did read the BC4J & JNDI Datasource configuration thread in the same forum and unfortunately that did not help.
Krish