1,把你的web.xml帖出来看看
2,如果懒得帖的话,保证你把sql-map-config.xml 这个文件放在你的工程目录的\WEB-INF\classess这个目录下了,如果还是有问题的话,请参考第一条

解决方案 »

  1.   

    补充下:
    3,考虑到即使遵循了第一条的要求,依然有可能看不出来问题在哪里,建议你列出你的WEB-INF\classess下的*.xml文件的名称来
    4,考虑到即使遵循了第三条的要求,依然有可能看不出来问题在哪里,建议你将xml配置文件中涉及到有加载sql-map-config.xml的地方的配置代码帖出来。
      

  2.   

    我用Struts+Spring+Ibatis都可以,没问题,我用Junit测试了也通过了,我写了个main()方法测试就是报那错,我的例子流程很简单,就是写了一个Student.xml,在sql-map-config.xml
    中加载,sql-map-config.xml没有在任何地方加载过,我根本没有和前台搭上关系,我就是用类似于JUNIT测试的方法在main()里面测试,不知道你这句话什么意思:“1,把你的web.xml帖出来看看”这因该和web.xml没关系啊,我就是想得到SqlMapClient对象对数据库进行操作。
      

  3.   

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
        "http://www.ibatis.com/dtd/sql-map-config-2.dtd"><sqlMapConfig>
    <properties resource="com/yumeng/ssidemo/mapping/database.properties" /> <settings cacheModelsEnabled="true" enhancementEnabled="true"
    lazyLoadingEnabled="true" maxRequests="32" maxSessions="10"
    maxTransactions="5" useStatementNamespaces="false" /> <transactionManager type="JDBC">
    <dataSource type="SIMPLE">
    <property value="${driver}" name="JDBC.Driver" />
    <property value="${url}" name="JDBC.ConnectionURL" />
    <property value="${username}" name="JDBC.Username" />
    <property value="${password}" name="JDBC.Password" />
    </dataSource>
    </transactionManager> <sqlMap resource="com/yumeng/ssidemo/po/Student.xml" /></sqlMapConfig>
      

  4.   

    <?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE sqlMap      
        PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"      
        "http://ibatis.apache.org/dtd/sql-map-2.dtd">
    <sqlMap namespace="Student">
        <typeAlias alias="student" type="com.yumeng.ssidemo.po.Student"/>
    <resultMap id="ResultStudent" class="com.yumeng.ssidemo.po.Student" >
    <result property="id" column="id" columnIndex="1" />
    <result property="name" column="name" columnIndex="2" />
    <result property="sex" column="sex" columnIndex="3" />
    <result property="age" column="age" columnIndex="4" />
    <result property="nationality" column="nationality" columnIndex="5" />
    <result property="address" column="address" columnIndex="6" />
    <result property="phonenumber" column="phonenumber" columnIndex="7" /> </resultMap>
    <select id="selectStudent" resultMap="ResultStudent">
        select * from student
    </select>
    <select id="selectStudentById" parameterClass="int" resultClass="Student">
        select id ,name,sex,age,nationality,address,phonenumber
        from student where id = #id#
    </select>
    <select id="selectStudentByName" parameterClass="java.lang.String" resultClass="Student">
        select * from student where name = #name#
    </select>
    <update id="updateStudent" parameterClass="Student">
        update student set name =#name#,sex = #sex#,age = #age#,
        nationality = #nationality#,address = #address#,phonenumber = #phonenumber#
        where id = #id#
    </update>
    <insert id="insertStudent" parameterClass="Student">
        insert into student(name,sex,age,nationality,address,phonenumber)
        values(#name#,#sex#,#age#,#nationality#,#address#,#phonenumber#)
    </insert>
    <delete id="deleteStudent" parameterClass="int">
        delete from student where id = #id#
    </delete>
    </sqlMap>
      

  5.   

    问题是你的sql-map-config.xml是通过哪个配置文件加载的???,配置文件中加载的路径是什么???你的sql-map-config.xml这个文件又放在你服务器的哪个目录下了???这是重点!!!你在main里面测试的是直接给的绝对地址,当然没问题了,这个不是重点!
      

  6.   

    试试 放到src下,直接写String resource = "sql-map-config.xml ";