ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Folashade Adeyosoye" <sharda...@naijatek.com>
Subject iBatis Dao Setup
Date Mon, 25 Apr 2005 19:21:30 GMT
Hi all let me see if I can explain my problem and how I have things setup.

 

First, my problem is having difficulty converting one of my working and
deployed applications to using iBatis Dao. I basically yanged out my Dao
factory and try to replace it with iBatis version in hopes to use SQLMAP.

 

 

1.	Application starts up and calls the MyExtendedActionServlet.java to
load my cache object (drop downs)
2.	MyExtendedActionServlet.java calls MyServiceImpl.java (Service
Layer) which in turns calls the MysqlSelectionObjectDAO.java
3.	MysqlSelectionObjectDAO.java makes the jdbc calls to the DB to pull
stuff.

 

 

Where it fails.

============================

It fails right here in the dao.xml file, see dao.xml below.

 

<snip>

      Reader reader = Resources.getResourceAsReader(resource);

</snip>

 

 

Question:

Do I still need to define my transactionManager even thou I have my own
connectionManager class - See dao.xml below

 

 

 

Any help will be appreciated.

 

 

 

Package Structure

============================

 

net.package1.package2
                              |
                              |_____ domain <package>
                                                       |
                                                       |_____impl <package>
                                                                    |
                                                                    |_____
MyServiceImpl.java
                              |
                              |_____framework <package>
                                                       |
 
|_____MyExtendedActionServlet.java

                              |
                              |_____ persistence <package>
                                                       |
                                                       |_____iface <package>
                                                       |
                                                       |_____mysql
<package>

                                                                         |
 
|_____ MysqlSelectionObjectDAO.java 
                                                       |
                                                       |_____sqlmapdao
<package>
                                                       |
                                                       |_____dao.xml
                                                       |
                                                       |_____DaoConfig.java

 

 

 

MyExtendedActionServlet.java :

============================

 

     // load the countires

     ArrayList countires = new ArrayList();

     countires = api.loadDropDownMenu(Constants.DROP_MENU_COUNTRY, false);

     getServletContext().setAttribute(appProp.getValue("lookup.country"),
countires);

     logger.debug("COUNTRIES LOADED...");

 

 

 

 

 

 

MysqlSelectionObjectDAO.java:

============================

 

            <snip/> - the program is not even getting to this point...

 

 

 

dao.xml

============================

 

<daoConfig>

 

<properties resource="
net/package1/package2/properties/database_local.properties"/>

 

  <context>

   <transactionManager type="JDBC">

      <property name="DataSource" value="SIMPLE"/>

      <property name="JDBC.Driver" value="${driver}"/>

      <property name="JDBC.ConnectionURL" value="${url}"/>

      <property name="JDBC.Username" value="${username}"/>

      <property name="JDBC.Password" value="${password}"/>

      <property name="JDBC.DefaultAutoCommit" value="true"/>

      <property name="Pool.MaximumActiveConnections" value="10"/>

      <property name="Pool.MaximumIdleConnections" value="5"/>

      <property name="Pool.MaximumCheckoutTime" value="120000"/>

    </transactionManager>

 

    <dao interface="
net.package1.package2.persistence.iface.SelectionObjectDAO" implementation="
net.package1.package2.persistence.mysql.MysqlSelectionObjectDAO"/>

  </context>

</daoConfig>

 

 

DaoConfig.java

============================

 

public class DaoConfig {

 

  private static final DaoManager DAO_MANAGER;

 

  static {

 

    try {

      String resource = " net/package1/package2/persistence/dao.xml";

      Reader reader = Resources.getResourceAsReader(resource);

      DAO_MANAGER = DaoManagerBuilder.buildDaoManager(reader);

      System.out.println("Finished getting the DAO_MANAGER...");

    } catch (Exception e) {

      throw new RuntimeException("Could not initialize DaoConfig.  Cause: "
+ e);

    }

  }

 

  public static DaoManager getDaomanager() {

    return DAO_MANAGER;

  }

 

}

 

 

 

 

---------- ERROR - start ---------------

<snip>

DEBUG[2005-Apr-25 13:17:49] -
jdbc.SimpleDataSource(SimpleDataSource.java:407) - SimpleDataSource
forcefully closed/removed all connections.

ApplicationDispatcher[/myContext]: Servlet.service() for servlet debugjsp
threw exception

java.lang.NoClassDefFoundError

            at net. package1.
package2.domain.impl.MyServiceImpl.<init>(MyServiceImpl.java:34)

            at net. package1.
package2.framework.taglib.BuildBirthdayListTag.<init>(BuildBirthdayListTag.j
ava:73)

</snip>

---------- ERROR - start ---------------

 

 

 


Mime
View raw message