I'm having terrible problems attempting to use a JNDI datasource for ojb under: 

tomcat 4.1.10.
Struts
OJB
MySQL


When I use the standard connection pooling I can perform all operations without any 
problems(CRUD),

When I switch to using a JNDI data source I get an UnsupportedOperationException when 
trying to retreive a collection using ODMD OQL.  

It is seemingly thrown by the commons (PoolingDataSource) api that tomcat 4 jndi 
datasources use under the covers. (stacktrace available on request)

i.e from this config

   <jdbc-connection-descriptor
     platform="MySQL"
     jdbc-level="2.0"

     driver="org.gjt.mm.mysql.Driver"
     protocol="jdbc"
     subprotocol="mysql"
     dbalias="//localhost:3306/mydb"
     username="root"
     password="root"
   />

to this:

   <jdbc-connection-descriptor
     platform="MySQL"
     jdbc-level="2.0"
  jndi-datasource-name="java:comp/env/jdbc/TestDB" 

username="root"
     password="root"
   />

I have also changed the connection factory to use the standard non pooled version :

ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryDefaultImpl

in OJB.properties

AND

If I change the PersistenceBrokerFactoryClass prop to

PersistenceBrokerFactoryClass=org.apache.ojb.broker.ta.PersistenceBrokerFactoryJ2EEImpl
PersistenceBrokerClass=org.apache.ojb.broker.ta.PersistenceBrokerJ2EEImpl
(I tried these as a shot in the dark)

the error changes to an OQLQueryException (nullpointerexception).  Should these be set 
this way if I want to use the JNDI DS?

Has anyone else encountered similar problems/ what am I doing wrong.  I've scoured the 
mailing archive to no avail - apart from the connection factory class change.

Help!!!


Jin

Reply via email to