Now that I read Michael Campbell's email I understand the problem, my actual dao.xml file is this:
<!DOCTYPE daoConfig
PUBLIC "-//iBATIS.com//DTD DAO Configuration 2.0//EN"
"http://www.ibatis.com/dtd/dao-2.dtd";>
<daoConfig>
 <context>
   <transactionManager type="JDBC">
     <property name="DataSource" value="JNDI"/>
     <property name="DBJndiContext" value="jdbc/xxxxxxxxPooledDS"/>
     <property name="JDBC.DefaultAutoCommit" value="true" />
   </transactionManager>
   <dao interface="mil.osd.dmdc.deers.web.bwe.dao.IControlTableDao"
implementation="mil.osd.dmdc.deers.web.bwe.dao.jdbc.ControlTableDao"/>
 </context>

 <context>
  <transactionManager type="JDBC">
    <property name="DataSource" value="SIMPLE"/>
    <property name="JDBC.Driver" value="oracle.jdbc.OracleDriver"/>
<property name="JDBC.ConnectionURL" value="jdbc:oracle:thin:@xxx:1521:xxxt"/>
    <property name="JDBC.Username" value="xxx"/>
    <property name="JDBC.Password" value="xxxxx"/>
    <property name="JDBC.DefaultAutoCommit" value="true" />
   </transactionManager>
   <dao interface="mil.osd.dmdc.deers.web.bwe.dao.IPlanManagerDao"
implementation="mil.osd.dmdc.deers.web.bwe.dao.jdbc.PlanManagerDao"/>
 </context>
</daoConfig>


I had both a JNDI and non-JNDI datasource in the same file so that when I ran standalone, the JNDI datasource caused the DaoException. By separating the two into two separate files, I should be able to run iBATIS in a standalone unit test for my web application.

Thanks Nathan and Michael.

-Richard


Richard Yee wrote:
Nathan,
Thanks for responding. Here is the file that I use to configure the DaoManager.

<!DOCTYPE daoConfig
PUBLIC "-//iBATIS.com//DTD DAO Configuration 2.0//EN"
"http://www.ibatis.com/dtd/dao-2.dtd";>
<daoConfig>
 <context>
  <transactionManager type="JDBC">
    <property name="DataSource" value="SIMPLE"/>
    <property name="JDBC.Driver" value="oracle.jdbc.OracleDriver"/>
<property name="JDBC.ConnectionURL" value="jdbc:oracle:thin:@myhost:1521:mysid"/>
    <property name="JDBC.Username" value="user"/>
    <property name="JDBC.Password" value="pass"/>
    <property name="JDBC.DefaultAutoCommit" value="true" />
   </transactionManager>
   <dao interface="mil.osd.dmdc.deers.web.bwe.dao.IPlanManagerDao"
implementation="mil.osd.dmdc.deers.web.bwe.dao.jdbc.PlanManagerDao"/>
 </context>
</daoConfig>

Is an App Server needed to run iBATIS?

-Richard

Nathan Maves wrote:
Well I am just guessing here but it appears that you have set up your datasource as a jndi lookup.

We really need to see your config file to give a better solution.

Nathan

On Sep 27, 2005, at 5:19 PM, Yee, Richard K, CTR,, DMDCWEST wrote:

Hi,
I'm trying to use iBatis DAO in a standalone Java class but am getting a JNDI NoInitialContext error when I try to configure the DaoManager. I am using a SIMPLE datasource and am specifying the username, driver, etc. This
is the error:

Exception in constructor: testGetPcmFacility
(com.ibatis.dao.client.DaoException: Error while configuring DaoManager. Cause: com.ibatis.dao.client.DaoException: There was an error configuring
the DataSource from JNDI.
Cause: 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
Caused by: 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
Caused by: com.ibatis.dao.client.DaoException: There was an error
configuring the DataSource from JNDI.
Cause: 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
Caused by: javax.naming.NoInitialContextException: Need to specify class
name in environment


Any idea which class name I need to specify and what the property name is?

Thanks,

Richard











Reply via email to