我的一个ssh项目的一个问题。恩,我的数据库的连接以及数据的获取方法测试过是没有问题的。 @Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
// 取得spring上下文   
springContext = WebApplicationContextUtils
.getWebApplicationContext(config.getServletContext());

palService = (PalService)springContext.getBean("palService");
//开始取出首页面所需要的全部结果
------------就是由于下面这句会报错------------
List<ForumSection> forumSectionList = palService.getForumSectionService().getAllForumSection(); System.out.println(forumSectionList);
} 问题是我的方法绝对没有问题,其他地方可以调用。这个init属于一个特殊的servlet,它在tomcat启动时就被调用。
报的错误如下2009-10-7 16:40:58 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet ForumStart threw exception
org.springframework.orm.hibernate3.HibernateQueryException: ForumSection is not mapped. [from ForumSection]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: ForumSection is not mapped. [from ForumSection]
Caused by: org.hibernate.hql.ast.QuerySyntaxException: ForumSection is not mapped. [from ForumSection]
at org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:157)
at org.hibernate.hql.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:87)
at org.hibernate.hql.ast.tree.FromClause.addFromElement(FromClause.java:70)
at org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:265)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3049)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2938)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:688)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:544)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)求救各位,这个问题最有可能是哪里不对了 ....

解决方案 »

  1.   

    应该是没有Hibernate的mapping文件,用于定义ForumSection。
      

  2.   

    找一下hibernate.hbm.xml配置文件中的mapping节点有没有你的ForumSection 类!
      

  3.   

    hibernate.hbm.xml里
    看看有没有这个<mapping resource="??/??.hbm.xml" />
      

  4.   

    org.springframework.orm.hibernate3.HibernateQueryException: ForumSection is not mapped.
      

  5.   

    ForumSection is not mapped 异常已经说的很明显了。
    不可能告诉你程序里哪个文件的哪个字母写错了,要自己去想去找。
      

  6.   

    jsp标签使用错误,查看一下/ars/list.jsp(201,14) 这里是否引用的JSP标签没有正确对name赋值