错误信息
log4j:WARN No appenders could be found for logger (org.springframework.core.CollectionFactory).
log4j:WARN Please initialize the log4j system properly.
2008-09-21 18:44:07,718 DEBUG [java.sql.PreparedStatement] - {pstm-100001} Executing Statement: select * from T_USER
2008-09-21 18:44:07,718 DEBUG [java.sql.PreparedStatement] - {pstm-100001} Parameters: []
2008-09-21 18:44:07,718 DEBUG [java.sql.PreparedStatement] - {pstm-100001} Types: []
Exception in thread "main" org.springframework.jdbc.BadSqlGrammarException: SqlMapClient operation; bad SQL grammar []; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in Users.xml.
--- The error occurred while applying a parameter map.
--- Check the getAllUser-InlineParameterMap.
--- Check the statement (query failed).
--- Cause: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]对象名 'T_USER' 无效。
Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]对象名 'T_USER' 无效。
com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in Users.xml.
--- The error occurred while applying a parameter map.
--- Check the getAllUser-InlineParameterMap.
--- Check the statement (query failed).
--- Cause: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]对象名 'T_USER' 无效。
Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]对象名 'T_USER' 无效。
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:185)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForList(GeneralStatement.java:123)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:614)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:588)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
at org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(SqlMapClientTemplate.java:240)
at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:169)
at org.springframework.orm.ibatis.SqlMapClientTemplate.executeWithListResult(SqlMapClientTemplate.java:191)
at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:238)
at org.jin.dao.UserDAOImpl2.getAllUser(UserDAOImpl2.java:17)
at org.jin.test.Test.main(Test.java:17)
Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]对象名 'T_USER' 无效。
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSExecuteRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.getNextResultType(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.commonTransitionToState(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.postImplExecute(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.postImplExecute(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.executeInternal(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.execute(Unknown Source)
at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:168)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.ibatis.common.jdbc.logging.PreparedStatementLogProxy.invoke(PreparedStatementLogProxy.java:62)
at $Proxy2.execute(Unknown Source)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:182)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteQuery(GeneralStatement.java:205)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:173)
... 10 more
Caused by:
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]对象名 'T_USER' 无效。
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSExecuteRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.getNextResultType(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.commonTransitionToState(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.postImplExecute(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.postImplExecute(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.executeInternal(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.execute(Unknown Source)
at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:168)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.ibatis.common.jdbc.logging.PreparedStatementLogProxy.invoke(PreparedStatementLogProxy.java:62)
at $Proxy2.execute(Unknown Source)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:182)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteQuery(GeneralStatement.java:205)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:173)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForList(GeneralStatement.java:123)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:614)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:588)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
at org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(SqlMapClientTemplate.java:240)
at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:169)
at org.springframework.orm.ibatis.SqlMapClientTemplate.executeWithListResult(SqlMapClientTemplate.java:191)
at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:238)
at org.jin.dao.UserDAOImpl2.getAllUser(UserDAOImpl2.java:17)
at org.jin.test.Test.main(Test.java:17)
users.xml
<?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="Users">
<typeAlias alias="Users" type="org.jin.model.Users" />
<resultMap id="UserResult" class="Users">
<result property="id" column="ID" jdbcType="int" javaType="int" />
<result property="username" column="USERNAME" jdbcType="varchar"
javaType="String" />
<result property="address" column="ADDRESS" jdbcType="varchar"
javaType="String" />
</resultMap>
<select id="getUserbyUsername" resultClass="org.jin.model.Users"
parameterClass="string">
<![CDATA[
select * from T_USER WHERE USERNAME = #username#
]]>
</select>
<select id="getAllUser" resultMap="UserResult">
<![CDATA[
select * from T_USER
]]>
</select>
</sqlMap>
applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="com.microsoft.jdbc.sqlserver.SQLServerDriver">
</property>
<property name="url"
value="jdbc:microsoft:sqlserver://localhost:1433;database=ibatis">
</property>
<property name="username" value="sa"></property>
<property name="password" value="123"></property>
</bean>
<bean id="sqlMapClient"
class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocation" value="SqlMapConfig.xml" />
<property name="dataSource" ref="dataSource" />
</bean>
<bean id="userDAO1" class="org.jin.dao.UsersDAOImpl">
<property name="sqlMapClient">
<ref bean="sqlMapClient"/>
</property>
</bean>
<bean id="userDAO2" class="org.jin.dao.UserDAOImpl2">
<property name="sqlMapClient">
<ref bean="sqlMapClient"/>
</property>
</bean>
</beans>
测试类
package org.jin.test;
import java.util.List;
import org.jin.dao.UsersDAO;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;
public class Test {
public static void main(String[] args) {
ClassPathResource res = new ClassPathResource("applicationContext.xml");
XmlBeanFactory factory = new XmlBeanFactory(res);
UsersDAO dao = (UsersDAO)factory.getBean("userDAO2");
List list = dao.getAllUser();
if (list != null) {
System.out.println(list.size());
}
}
}
问题补充:表是肯定有的
我在查询分析器里面运行sql代码没问题
相关推荐
Struts2、Spring和Ibatis是Java开发中常用的三大框架,它们各自负责不同的职责:Struts2处理MVC模式中的Action层,Spring提供依赖注入和事务管理,而Ibatis则是轻量级的数据访问层,简化SQL操作。在这个整合实例中,...
总结起来,这份文档全集对于Java开发者来说是一份宝贵的资源,它涵盖了从基础理论到实践应用的全方位知识,特别是对于想要学习或已经在使用ibatis、Mybatis和Spring进行整合开发的人来说,具有很高的参考价值。...
3. **Spring集成**:在实际项目中,Ibatis常与Spring框架结合,通过Spring的 DataSource 和 TransactionManager 进行数据源管理和事务控制。 4. **MyBatis配置**:理解mybatis-config.xml文件的配置,如数据源设置...
Struts2还与各种开源项目有良好的集成,如Spring、Hibernate和iBatis。 **Spring** 是一个全面的企业级应用开发框架,它不仅提供了IOC(Inversion of Control)容器来管理对象的生命周期和依赖关系,还包含了AOP...
标题中的“spring2.5+ibatis3+web service cxf”揭示了这是一个关于整合Spring 2.5、iBATIS 3和Apache CXF Web服务的示例项目。这个项目是在MyEclipse环境中构建的,它是一个强大的Java集成开发环境,特别适合企业级...
MyBatis-Spring 会帮助你将 MyBatis 代码无缝地整合到 Spring ...要在 Spring 中支持 MyBatis,MyBatis 社 区认为现在应该是自己团结贡献者和有兴趣的人一起来开始将 Spring 的整合作为 MyBatis 社 区的子项目的时候了。
《基于jpetstore的Spring、iBatis与Struts整合实战》 jpetstore项目是Spring框架的一个经典示例,它全面展示了如何将Spring、iBatis和Struts这三个核心的Java Web技术进行集成,构建出一个完整的MVC(Model-View-...
MyBatis-Spring集成是MyBatis与Spring框架整合的方案,旨在帮助开发者无缝地将MyBatis整合到Spring项目中。这种整合不仅使MyBatis能够利用Spring框架提供的事务管理功能,还提供了一种方便的方式来注入MyBatis的数据...
为了解决这一问题,MyBatis社区决定启动一个子项目,以支持MyBatis与Spring的整合。 3. **要求** - 在整合MyBatis-Spring之前,确保熟悉Spring和MyBatis框架及其相关的术语。本手册不提供这些框架的基本安装和配置...
它不会强迫使用其内置的解决方案,例如,虽然Spring有自己的MVC框架,但开发者依然可以选择Struts或Webwork等其他框架与Spring进行集成。 Spring的另一个重要特性是对AOP(Aspect-Oriented Programming,面向切面...
Spring框架是Java开发中不可或缺的一...对于那些已经熟悉Spring 2.0或者初次接触Spring框架的人来说,这份文档是一份宝贵的参考资料。通过学习,你可以更好地掌握Spring的精髓,从而在实际项目中发挥出它的强大能力。
在User.xml 的配置文件中,mapper namespace="com.yihaomen.mybatis.inter.IUserOperation" ,命名空间非常重要,不能有错,必须与我们定义的package 和 接口一致。 运行这个测试程序,就可以看到结果了。 除非...
随着 Spring 3.0 的发布,它仅支持 iBatis 2.x 版本,而 MyBatis 社区希望能够在 Spring 3.0 中加入对 MyBatis 3 的支持。然而,在 MyBatis 3 正式发布之前,Spring 3.0 的开发已经结束。由于 Spring 开发团队不愿...
在IT行业中,Spring Boot是一个非常流行的微服务框架,它简化了Spring应用的初始搭建以及开发过程。而MyBatis作为一款强大的持久层框架,能够帮助开发者将SQL操作与Java代码紧密结合,实现灵活的数据访问。本篇文章...
这个项目旨在展示Java技术在构建企业级应用时的强大功能,特别是针对那些想要学习和理解企业级框架如Struts、Spring和Hibernate(SSH)或Spring、Struts、iBATIS(SSI)的人来说,它是一个非常有价值的参考。...
在MyBatis-Spring项目的启动之初,其主要目标是解决Spring框架与MyBatis之间的整合问题。由于Spring在早期仅支持iBatis 2.x版本,而在MyBatis 3.x版本发布后,Spring并未及时跟进对新版本的支持。这主要是因为Spring...
在界面表达方式上 MonoRail 采用模板引擎输出,模板引擎在 PHP 和 JSP 上已广泛使用,而在 ASP.NET 上因为服务端控件的强大功能和易用性而很少有人使用,两者是各有优缺点。 2. Spring.NET Spring.NET 是由 Spring...
通过这四天的实战训练,学员不仅能熟练掌握WebLogic的使用,还能提升JavaEE组件技术、架构规划原则和设计技巧,从而在实际工作中更好地解决问题,提高开发效率。无论是.NET开发者想要转型,还是已有J2EE开发经验的...
随后,工程师参与了甘肃12580项目,主要负责彩信模块的开发,运用了jQuery、DWR、iBatis、Spring、BOSS验证、UMA和Webservice等技术,显示了其在复杂项目中的技术整合能力和问题解决能力。 最后,工程师在质检项目...