ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niels Beekman" <n.beek...@wis.nl>
Subject RE: java.lang.InstantiationException using Ibatis DAO
Date Tue, 09 Sep 2008 13:55:18 GMT
I don't understand. If this code is generated by Ibator, I would say
that somehow you have a version mismatch. Maybe Jeff can comment on
this?

 

Niels

________________________________

From: Paul Ski [mailto:paulski82@hotmail.com] 
Sent: Tuesday, September 09, 2008 10:20 AM
To: user-java@ibatis.apache.org
Subject: RE: java.lang.InstantiationException using Ibatis DAO

 

package com.intient.smash.ibatis.impl;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.intient.smash.ibatis.Aliases;
import com.intient.smash.ibatis.AliasesExample;
import java.sql.SQLException;
import java.util.List;
public class AliasesDAOImpl implements AliasesDAO
{
 /**
  * This field was generated by Abator for iBATIS. This field
corresponds to the database table aliases
  * @abatorgenerated  Fri Sep 05 23:35:30 EST 2008
  */
 private SqlMapClient sqlMapClient;
 /**
  * This method was generated by Abator for iBATIS. This method
corresponds to the database table aliases
  * @abatorgenerated  Fri Sep 05 23:35:30 EST 2008
  */
 public AliasesDAOImpl ( SqlMapClient sqlMapClient )
 {
  super ();
  this.sqlMapClient = sqlMapClient;
 }
 /**
  * This method was generated by Abator for iBATIS. This method
corresponds to the database table aliases
  * @abatorgenerated  Fri Sep 05 23:35:30 EST 2008
  */
 public void insert ( Aliases record ) throws SQLException
 {
  sqlMapClient.insert ( "aliases.abatorgenerated_insert", record );
 }
 /**
  * This method was generated by Abator for iBATIS. This method
corresponds to the database table aliases
  * @abatorgenerated  Fri Sep 05 23:35:30 EST 2008
  */
 public int updateByPrimaryKey ( Aliases record ) throws SQLException
 {
  int rows = sqlMapClient.update (
    "aliases.abatorgenerated_updateByPrimaryKey", record );
  return rows;
 }
 /**
  * This method was generated by Abator for iBATIS. This method
corresponds to the database table aliases
  * @abatorgenerated  Fri Sep 05 23:35:30 EST 2008
  */
 public int updateByPrimaryKeySelective ( Aliases record )
   throws SQLException
 {
  int rows = sqlMapClient.update (
    "aliases.abatorgenerated_updateByPrimaryKeySelective", record );
  return rows;
 }
 /**
  * This method was generated by Abator for iBATIS. This method
corresponds to the database table aliases
  * @abatorgenerated  Fri Sep 05 23:35:30 EST 2008
  */
 public List selectByExample ( AliasesExample example ) throws
SQLException
 {
  List list = sqlMapClient.queryForList (
    "aliases.abatorgenerated_selectByExample", example );
  return list;
 }
 /**
  * This method was generated by Abator for iBATIS. This method
corresponds to the database table aliases
  * @abatorgenerated  Fri Sep 05 23:35:30 EST 2008
  */
 public Aliases selectByPrimaryKey ( Integer id ) throws SQLException
 {
  Aliases key = new Aliases ();
  key.setId ( id );
  Aliases record = (Aliases)sqlMapClient.queryForObject (
    "aliases.abatorgenerated_selectByPrimaryKey", key );
  return record;
 }
 /**
  * This method was generated by Abator for iBATIS. This method
corresponds to the database table aliases
  * @abatorgenerated  Fri Sep 05 23:35:30 EST 2008
  */
 public int deleteByExample ( AliasesExample example ) throws
SQLException
 {
  int rows = sqlMapClient.delete (
    "aliases.abatorgenerated_deleteByExample", example );
  return rows;
 }
 /**
  * This method was generated by Abator for iBATIS. This method
corresponds to the database table aliases
  * @abatorgenerated  Fri Sep 05 23:35:30 EST 2008
  */
 public int deleteByPrimaryKey ( Integer id ) throws SQLException
 {
  Aliases key = new Aliases ();
  key.setId ( id );
  int rows = sqlMapClient.delete (
    "aliases.abatorgenerated_deleteByPrimaryKey", key );
  return rows;
 }
 /**
  * This method was generated by Abator for iBATIS. This method
corresponds to the database table aliases
  * @abatorgenerated  Fri Sep 05 23:35:30 EST 2008
  */
 public int countByExample ( AliasesExample example ) throws
SQLException
 {
  Integer count = (Integer)sqlMapClient.queryForObject (
    "aliases.abatorgenerated_countByExample", example );
  return count.intValue ();
 }
 /**
  * This method was generated by Abator for iBATIS. This method
corresponds to the database table aliases
  * @abatorgenerated  Fri Sep 05 23:35:30 EST 2008
  */
 public int updateByExampleSelective ( Aliases record, AliasesExample
example )
   throws SQLException
 {
  UpdateByExampleParms parms = new UpdateByExampleParms ( record,
example );
  int rows = sqlMapClient.update (
    "aliases.abatorgenerated_updateByExampleSelective", parms );
  return rows;
 }
 /**
  * This method was generated by Abator for iBATIS. This method
corresponds to the database table aliases
  * @abatorgenerated  Fri Sep 05 23:35:30 EST 2008
  */
 public int updateByExample ( Aliases record, AliasesExample example )
   throws SQLException
 {
  UpdateByExampleParms parms = new UpdateByExampleParms ( record,
example );
  int rows = sqlMapClient.update (
    "aliases.abatorgenerated_updateByExample", parms );
  return rows;
 }
 /**
  * This class was generated by Abator for iBATIS. This class
corresponds to the database table aliases
  * @abatorgenerated  Fri Sep 05 23:35:30 EST 2008
  */
 private static class UpdateByExampleParms extends AliasesExample
 {
  private Object record;
  public UpdateByExampleParms ( Object record, AliasesExample example )
  {
   super ( example );
   this.record = record;
  }
  public Object getRecord ()
  {
   return record;
  }
 }
}



________________________________


Subject: RE: java.lang.InstantiationException using Ibatis DAO
Date: Mon, 8 Sep 2008 11:37:14 +0200
From: n.beekman@wis.nl
To: user-java@ibatis.apache.org



Please include the contents of
com.intient.smash.ibatis.impl.AliasesDAOImpl, this has definitely
something to do with class/member visibility.

________________________________

From: Paul Ski [mailto:paulski82@hotmail.com] 
Sent: Monday, September 08, 2008 11:31 AM
To: user-java@ibatis.apache.org
Subject: RE: java.lang.InstantiationException using Ibatis DAO

 

com.ibatis.dao.client.DaoException: Error while configuring DaoManager.
Cause: com.ibatis.dao.client.DaoException: Error configuring DAO.
Cause: java.lang.InstantiationException:
com.intient.smash.ibatis.impl.AliasesDAOImpl
 at
com.ibatis.dao.engine.builder.xml.XmlDaoManagerBuilder.buildDaoManager(X
mlDaoManagerBuilder.java:129)
 at
com.ibatis.dao.client.DaoManagerBuilder.buildDaoManager(DaoManagerBuilde
r.java:59)
 at
com.intient.smash.DaoManagerMapper.<clinit>(DaoManagerMapper.java:17)
 at
com.intient.smash.TestDaoManagerMapper.<init>(TestDaoManagerMapper.java:
13)
 at
com.intient.smash.TestDaoManagerMapper.main(TestDaoManagerMapper.java:39
)
Caused by: com.ibatis.dao.client.DaoException: Error configuring DAO.
Cause: java.lang.InstantiationException:
com.intient.smash.ibatis.impl.AliasesDAOImpl
 at
com.ibatis.dao.engine.builder.xml.XmlDaoManagerBuilder.parseDao(XmlDaoMa
nagerBuilder.java:231)
 at
com.ibatis.dao.engine.builder.xml.XmlDaoManagerBuilder.parseContext(XmlD
aoManagerBuilder.java:160)
 at
com.ibatis.dao.engine.builder.xml.XmlDaoManagerBuilder.buildDaoManager(X
mlDaoManagerBuilder.java:102)
 ... 4 more
Caused by: java.lang.InstantiationException:
com.intient.smash.ibatis.impl.AliasesDAOImpl
 at java.lang.Class.newInstance0(Class.java:340)
 at java.lang.Class.newInstance(Class.java:308)
 at
com.ibatis.dao.engine.builder.xml.XmlDaoManagerBuilder.parseDao(XmlDaoMa
nagerBuilder.java:225)
 ... 6 more
Exception in thread "main" java.lang.ExceptionInInitializerError
 at
com.intient.smash.TestDaoManagerMapper.<init>(TestDaoManagerMapper.java:
13)
 at
com.intient.smash.TestDaoManagerMapper.main(TestDaoManagerMapper.java:39
)
Caused by: java.lang.RuntimeException: Could not initialize DaoManager.
Cause: com.ibatis.dao.client.DaoException: Error while configuring
DaoManager.  Cause: com.ibatis.dao.client.DaoException: Error
configuring DAO.  Cause: java.lang.InstantiationException:
com.intient.smash.ibatis.impl.AliasesDAOImpl
 at
com.intient.smash.DaoManagerMapper.<clinit>(DaoManagerMapper.java:22)
 ... 2 more

________________________________

Subject: RE: java.lang.InstantiationException using Ibatis DAO
Date: Mon, 8 Sep 2008 09:55:56 +0200
From: n.beekman@wis.nl
To: user-java@ibatis.apache.org

Can you post the complete stacktrace?

 

________________________________

From: Paul Ski [mailto:paulski82@hotmail.com] 
Sent: Monday, September 08, 2008 9:14 AM
To: user-java@ibatis.apache.org
Subject: RE: java.lang.InstantiationException using Ibatis DAO

 

My DAO and DAOImlp classes were generated by Ibator.  The only generated
constructor for AliasesDAOImpl is below:
 
---snip---
 /**
  * This method was generated by Abator for iBATIS. This method
corresponds to the database table aliases
  * @abatorgenerated  Fri Sep 05 23:35:30 EST 2008
  */
 public AliasesDAOImpl ( SqlMapClient sqlMapClient )
 {
  super ();
  this.sqlMapClient = sqlMapClient;
 }
---snip---

Is there a config option for abatorConfig.xml that tells Ibator to build
classes including a constructor that takes a DaoManager object?
 
Thanks,
 
Paul

________________________________


Subject: RE: java.lang.InstantiationException using Ibatis DAO
Date: Mon, 8 Sep 2008 08:56:37 +0200
From: n.beekman@wis.nl
To: user-java@ibatis.apache.org

Your AliasesDaoImpl should have a public constructor that takes a
DaoManager as its single argument. Can you check that this is the case?

 

Hth,

 

Niels

 

________________________________

Sell your car for just $40 at CarPoint.com.au It's simple!
<http://a.ninemsn.com.au/b.aspx?URL=http://secure-au.imrworldwide.com/cg
i-bin/a/ci_450304/et_2/cg_801459/pi_1004813/ai_859641&_t=762955845&_r=ti
g_OCT07&_m=EXT> 

 

________________________________

Find great deals on eBay Net yourself a bargain
<http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Frover%2Eebay%2Ecom%2Fro
ver%2F1%2F705%2D10129%2D5668%2D323%2F4%3Fid%3D10&_t=763807330&_r=hotmail
TAGLINES&_m=EXT> 


Mime
View raw message