Hello,

I am currently using WebSphere Studio Application Developer (WSAD) v5.1.2
as my development environment. I created a WebSphere v5.1 Test Environment
server within this and created a Data source with JNDI name
"jdbc/OJBTestDataSource" using
"COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource" as Implementation class for
the Data source. Outside of this WSAD environment, I have my OJB test
apparatus (repository*.xml files and java class files). In my
repository_database.xml file, I have this setup:

<jdbc-connection-descriptor
            jcd-alias="OJBTest"
            default-connection="true"       
            jdbc-level="2.0"
            jndi-datasource-name="jdbc/OJBTestDataSource"
            batch-mode="false"
            useAutoCommit="1"
            ignoreAutoCommitExceptions="false"
        >

        <sequence-manager
className="org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl">
            <attribute attribute-name="grabSize" attribute-value="1"/>
        </sequence-manager>
   </jdbc-connection-descriptor>
   
   For my OJB test setup, I set the JAVA_HOME to "C:\Program
Files\IBM\WebSphere Studio\Application
Developer\v5.1.2\runtimes\base_v51\java". I also added "C:\Program
Files\IBM\WebSphere Studio\Application
Developer\v5.1.2\runtimes\base_v51\lib\namingclient.jar" to my CLASSPATH
and had to copy "C:\Program Files\IBM\WebSphere Studio\Application
Developer\v5.1.2\runtimes\base_v51\properties\implfactory.properties" to
my OJB test folder since it was complaining that this props file could not
be found. Now, when I run my test client, I get the following exception: 
   
   java.lang.ClassCastException: javax.naming.Reference
        at
org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.newConnectionFromDataSource(Unknown
Sour
ce)
        at
org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.lookupConnection(Unknown
Source)
        at
org.apache.ojb.broker.accesslayer.ConnectionFactoryManagedImpl.lookupConnection(Unknown
Source)
        at
org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.getConnection(Unknown
Source)
        at
org.apache.ojb.broker.accesslayer.StatementManager.getPreparedStatement(Unknown
Source)
        at
org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(Unknown
Source)
        at
org.apache.ojb.broker.accesslayer.RsQueryObject.performQuery(Unknown
Source)
        at org.apache.ojb.broker.accesslayer.RsIterator.<init>(Unknown
Source)
        at
org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(Unknown
Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(Unknown
Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(Unknown
Source)
        at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
        at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
        at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown
Source)
        at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown
Source)
        at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown
Source)
        at PBTest.queryStuff(PBTest.java:80)
        at PBTest.runTest(PBTest.java:67)
        at PBTest.main(PBTest.java:166)
        
        This is apparently happening at "ds = (DataSource)
ic.lookup(jcd.getDatasourceName());" this line
ConnectionFactoryAbstractImpl.java. I did a few sysouts, recompiled and
found that the resultant object from the lookup is a
javax.naming.Reference object and hence the cast to DataSource is failing.
This works when I am using "WebSphere v4.0 Test Environment". What changed
from v4.0 to v5.1 in WebSphere? Or do I change something in OJB settings.
Another big (or silly) question I have is, how does OJB figure out that it
is looking up a resource deployed on WebSphere? 
        
        Any help is greatly appreciated. 
        
        Thanks,
        -Vamsi


                
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - now with 250MB free storage. Learn more. 
http://info.mail.yahoo.com/mail_250

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to