ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Folashade Adeyosoye" <sharda...@gmail.com>
Subject RE: iBatis Dao Setup
Date Tue, 26 Apr 2005 04:13:02 GMT
That was actually due to me refactoring the package names.


But I don't have any space in the real code





From: Richard Yee [mailto:ryee@cruzio.com] 
Sent: Monday, April 25, 2005 11:17 PM
To: ibatis-user-java@incubator.apache.org
Subject: Re: iBatis Dao Setup


It looks like a classpath problem. It is not even getting to any iBATIS
code. Also did you notice that you have a space in your resource string?

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

That will probably cause either the reader to throw an exception or be null.


At 12:21 PM 4/25/2005, you wrote:

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

Where it fails.
It fails right here in the dao.xml file, see dao.xml below.
      Reader reader = Resources.getResourceAsReader(resource);
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
                              |_____ domain <package>
                                                       |_____impl <package>
                              |_____framework <package>
                              |_____ persistence <package>
                                                       |_____iface <package>
|_____ MysqlSelectionObjectDAO.java 
MyExtendedActionServlet.java :
     // load the countires
     ArrayList countires = new ArrayList();
     countires = api.loadDropDownMenu(Constants.DROP_MENU_COUNTRY, false);
     logger.debug("COUNTRIES LOADED...");
            <snip/> - the program is not even getting to this point...
<properties resource="
   <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"/>
    <dao interface="
net.package1.package2.persistence.iface.SelectionObjectDAO" implementation="
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 ---------------
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
            at net. package1.
            at net. package1.
---------- ERROR - start ---------------

View raw message