spring相关问题解决

1. ExtensionValidator[/TestSpringMVC][commons-attributes-api.jar]: 

    Required extension "ant"not found.
 

    Container org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/XXXX] has not

    been started .

    解决:这个问题出现的原因是commons-attributes-compiler.jar包的MANIFEST.MF文件出现问题,如

    果对这个包没有依赖,直接删除这个包的引用,项目就可以正常启动。



2. Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError:

   javax/transaction/TransactionManager

   解决:导入spring的lib包下的j2ee中的jta.jar.



3. java.lang.NoClassDefFoundError: net/sf/cglib/proxy/CallbackFilter 

  解决:\lib\cglib\cglib-nodep-2.1_3.jar包

 

4.java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required

  往往原因:DAO实现类如果继承了HibernateDaoSupport类,那么使用getHibernateTempate()获得一个

  HibernateTemplate对象的时候,产生了对它的依赖。

  解决:加入sessionFactory 或者HibernateTmeplate属性引用 便可。


5.org.xml.sax.SAXParseException: cvc-complex-type.3.2.2: Attribute 'singleton' is not allowed
  to appear in element 'bean'.
  spring 2.0 需要使用scope属性来声明 singleton。

6.getOutputStream() has already been called for this response
  原因:在JSP页面释放资源的时候,调用了ServetResponse.getWriter()方法
          public java.io.PrintWriter getWriter()
   Either this method or getOutputStream() may be called to write the body, not both
  由于ServletResponse.getOutputStream()方法和该方法都有可能被调用,来输出JSP页面的内容,如果其中的一个方法被调用了,再调用另一个方法就会抛出异常。
在jsp页面最后加上:
      out.clear();清空缓存的内容
       out = pageContext.pushBody();
                                          // ·返回一个新的BodyContent(代表一个HTML页面的BODY部分内容)
                                         //·保存JspWriter实例的对象out
                                        // ·更新PageContext的out属性的内容

猜你喜欢

转载自mywaylife.iteye.com/blog/1810015