Ok, I'm on the last step on this page and still having trouble! Yes, I made
my own person object but my package name is different than the examples.
That could be the source of my latest problem. I use com.craig as my root
package. Now when I run mvn test I get:
Running com.craig.dao.PersonDaoTest
AbandonedObjectPool is used
([EMAIL PROTECTED])
   LogAbandoned: false
   RemoveAbandoned: true
   RemoveAbandonedTimeout: 60
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 2.56 sec <<<
FAILURE!
testFindPersonByLastName(com.craig.dao.PersonDaoTest)  Time elapsed: 2.453
sec  <<< ERROR!
com.ibatis.sqlmap.client.SqlMapException: There is no statement named
findByLastName in this SqlMap.
        at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.getMappedStatement(SqlMapExecutorDelegate.java:293)
        at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:606)
        at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:589)
        at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
        at
org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(SqlMapClientTemplate.java:268)
        at
org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:193)
        at
org.springframework.orm.ibatis.SqlMapClientTemplate.executeWithListResult(SqlMapClientTemplate.java:219)
        at
org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:266)
        at
com.craig.dao.ibatis.PersonDaoiBatis.findByLastName(PersonDaoiBatis.java:21)
        at
com.craig.dao.PersonDaoTest.testFindPersonByLastName(PersonDaoTest.java:20)
        at
com.craig.dao.PersonDaoTest.testFindPersonByLastName(PersonDaoTest.java:20)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at junit.framework.TestCase.runTest(TestCase.java:164)
        at junit.framework.TestCase.runBare(TestCase.java:130)
        at
org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:120)
        at junit.framework.TestSuite.runTest(TestSuite.java:230)
        at junit.framework.TestSuite.run(TestSuite.java:225)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at
org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:213)
        at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:138)
        at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:125)
        at org.apache.maven.surefire.Surefire.run(Surefire.java:132)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:290)
        at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:818)

testAddAndRemovePerson(com.craig.dao.PersonDaoTest)  Time elapsed: 0.015 sec 
<<< ERROR!
com.ibatis.sqlmap.client.SqlMapException: There is no statement named
addPerson in this SqlMap.
        at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.getMappedStatement(SqlMapExecutorDelegate.java:293)
        at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.insert(SqlMapExecutorDelegate.java:429)
        at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.insert(SqlMapSessionImpl.java:82)
        at
org.springframework.orm.ibatis.SqlMapClientTemplate$9.doInSqlMapClient(SqlMapClientTemplate.java:369)
        at
org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:193)
        at
org.springframework.orm.ibatis.SqlMapClientTemplate.insert(SqlMapClientTemplate.java:367)
        at 
org.appfuse.dao.ibatis.GenericDaoiBatis.save(GenericDaoiBatis.java:75)
        at
com.craig.dao.PersonDaoTest.testAddAndRemovePerson(PersonDaoTest.java:30)
        at
com.craig.dao.PersonDaoTest.testAddAndRemovePerson(PersonDaoTest.java:30)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at junit.framework.TestCase.runTest(TestCase.java:164)
        at junit.framework.TestCase.runBare(TestCase.java:130)
        at
org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:120)
        at junit.framework.TestSuite.runTest(TestSuite.java:230)
        at junit.framework.TestSuite.run(TestSuite.java:225)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at
org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:213)
        at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:138)
        at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:125)
        at org.apache.maven.surefire.Surefire.run(Surefire.java:132)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:290)
        at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:818)


Results :

Tests in error: 
  testFindPersonByLastName(com.craig.dao.PersonDaoTest)
  testAddAndRemovePerson(com.craig.dao.PersonDaoTest)

Tests run: 3, Failures: 0, Errors: 2, Skipped: 0

Here's my sqlMap:
<sqlMap namespace="PersonSQL">
    <typeAlias alias="person" type="com.craig.model.Person"/>

    <parameterMap id="addParam" class="person">
        <parameter property="firstName" jdbcType="VARCHAR"
javaType="java.lang.String"/>
        <parameter property="lastName" jdbcType="VARCHAR"
javaType="java.lang.String"/>
    </parameterMap>

    <parameterMap id="updateParam" class="person">
        <parameter property="id" jdbcType="INTEGER"
javaType="java.lang.Long"/>
        <parameter property="firstName" jdbcType="VARCHAR"
javaType="java.lang.String"/>
        <parameter property="lastName" jdbcType="VARCHAR"
javaType="java.lang.String"/>
    </parameterMap>

    <resultMap id="personResult" class="person">
        <result property="id" column="id"/>
        <result property="firstName" column="first_name"/>
        <result property="lastName" column="last_name"/>
    </resultMap>

    <select id="getPersons" resultMap="personResult">
        <![CDATA[
        select * from person
    ]]>
    </select>

    <select id="getPerson" resultMap="personResult">
        <![CDATA[
        select * from person where id = #value#
    ]]>
    </select>

    <select id="findByLastName" resultMap="personResult">
        select * from person where last_name = #value#
    </select>

    <insert id="addPerson" parameterMap="addParam">
        <![CDATA[
            insert into person (first_name,last_name) values ( ?,? )
        ]]>
        <selectKey resultClass="java.lang.Long" keyProperty="id"
type="post">
            SELECT LAST_INSERT_ID() AS id
        </selectKey>
    </insert>

    <update id="updatePerson" parameterMap="updateParam">
        <![CDATA[
        update person set first_name = ?, last_name = ? where id = ?
    ]]>
    </update>

    <delete id="deletePerson">
        <![CDATA[
        delete from person where id = #value#
    ]]>
    </delete>
</sqlMap>

And here's my Spring bean def:
    <bean id="personDao" class="com.craig.dao.ibatis.PersonDaoiBatis">
        <property name="dataSource" ref="dataSource"/>
        <property name="sqlMapClient" ref="sqlMapClient"/>
    </bean>

What am I missing now?

Cliff wrote:
> 
> I'm following the Spring/iBatis tutorial and I'm at the step where you run
> the PersonDaoTest using the GenericDao. The error I get is different from
> the error the tutorial expects. I get:
> 
> AbandonedObjectPool is used
> ([EMAIL PROTECTED])
>    LogAbandoned: false
>    RemoveAbandoned: true
>    RemoveAbandonedTimeout: 60
> 
> org.springframework.beans.factory.BeanCreationException: Error creating
> bean with name 'universalDao' defined in URL
> [jar:file:/home/ccc/.m2/repository/org/appfuse/appfuse-ibatis/2.0-m5-SNAPSHOT/appfuse-ibatis-2.0-m5-SNAPSHOT.jar!/applicationContext-dao.xml]:
> Cannot resolve reference to bean 'sqlMapClient' while setting bean
> property 'sqlMapClient'; nested exception is
> org.springframework.beans.factory.BeanCreationException: Error creating
> bean with name 'sqlMapClient' defined in URL
> [jar:file:/home/ccc/.m2/repository/org/appfuse/appfuse-ibatis/2.0-m5-SNAPSHOT/appfuse-ibatis-2.0-m5-SNAPSHOT.jar!/applicationContext-dao.xml]:
> Invocation of init method failed; nested exception is
> java.lang.RuntimeException: Error occurred.  Cause:
> com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause:
> java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'. 
> Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause:
> java.lang.RuntimeException: Error parsing XPath '/sqlMap/resultMap'. 
> Cause: java.lang.RuntimeException: Error configuring Result.  Could not
> set ResultClass.  Cause: java.lang.ClassNotFoundException:
> org.appfuse.tutorial.model.Person
> Caused by: org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'sqlMapClient' defined in URL
> [jar:file:/home/ccc/.m2/repository/org/appfuse/appfuse-ibatis/2.0-m5-SNAPSHOT/appfuse-ibatis-2.0-m5-SNAPSHOT.jar!/applicationContext-dao.xml]:
> Invocation of init method failed; nested exception is
> java.lang.RuntimeException: Error occurred.  Cause:
> com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause:
> java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'. 
> Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause:
> java.lang.RuntimeException: Error parsing XPath '/sqlMap/resultMap'. 
> Cause: java.lang.RuntimeException: Error configuring Result.  Could not
> set ResultClass.  Cause: java.lang.ClassNotFoundException:
> org.appfuse.tutorial.model.Person
> Caused by: java.lang.RuntimeException: Error occurred.  Cause:
> com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause:
> java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'. 
> Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause:
> java.lang.RuntimeException: Error parsing XPath '/sqlMap/resultMap'. 
> Cause: java.lang.RuntimeException: Error configuring Result.  Could not
> set ResultClass.  Cause: java.lang.ClassNotFoundException:
> org.appfuse.tutorial.model.Person
>       at
> com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:109)
>       at
> com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(SqlMapClientBuilder.java:90)
> 
> I can see the error is from the missing sqlMapClient bean definition in
> applicationContext.xml. I noticed the problem right when I created the
> file and copied the contents from the tutorial as Idea was highlighting
> it. (I also noted how the dataSource was defined in another spring bean
> def file so I ignored that error.) I'm looking back over the tutorial and
> I don't see where I was supposed to define this bean. So now I ask did I
> miss something or is the tutorial leaving out a step?
> 

-- 
View this message in context: 
http://www.nabble.com/Did-I-miss-a-step--tf3711975s2369.html#a10383761
Sent from the AppFuse - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to