bug汇总

1、ssh项目整合,代码正确,仔细观察报错信息,缺少哪个jar包

2、在页面往action中传递对象,注意:
*页面中对象及属性与action中对象与属性一致
*action中需要接收的对象及属性设置set/get方法
*接收的对象必须有无参构造

3、eclipse打不开,

    解决1:换工作空间,将原项目导入进去

    解决2:可以删除工作空间下的lock文件和某个文件,百度有很多种

4、Unknown tag (s:token).  用struts标签前先引入struts标签

5、定义拦截器并引入,程序不重启二次访问出现:

  No result defined for action org.superman.ssh.action.UserAction and result inputNo result defined for action org.superman.ssh.action.UserAction and result input
  No result defined for action org.superman.ssh.action.UserAction and result input

  

  解决办法1:为main action添加result input配置
    <result name="input" type="dispatcher">
      /WEB-INF/jsp/main.jsp
    </result>

    添加成功或失败返回原页面继续添加,出现相同token被拦截,添加失败

    1、从添加成功页面跳转到,地址定义为自动跳转window.setTimeout("location.href='user/main.action'",3000);或手动跳转

6、Exception in thread "main" java.lang.NoClassDefFoundError: org/hibernate/QueryTimeoutException

    Hibernate批量插入时,出现这个错误org.hibernate.QueryTimeoutException:
    可能原因1:是表空间的容量不足,需要加大空间容量;那首先想到的是应该查询其容量,所以应该想办法查询其容量以及增大其容量
    可能原因2:数据长度太长,超过了字段的长度限制,增加字段的长度限制  

7、No appenders could be found for logger (org.springframework.core.env.StandardEnvironment).

    解决办法:
      在src下面新建file名为log4j.properties内容如下:

      # Configure logging for testing: optionally with log file
      log4j.rootLogger=WARN, stdout
      # log4j.rootLogger=WARN, stdout, logfile

      log4j.appender.stdout=org.apache.log4j.ConsoleAppender
      log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
      log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n

      log4j.appender.logfile=org.apache.log4j.FileAppender
      log4j.appender.logfile.File=target/spring.log
      log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
      log4j.appender.logfile.layout.ConversionPattern=%d %p [%c] - %m%n

    重新发布,OK,没有提示了。加入了这个配置文件后,再次运行程序上面的警告就会消失。尤其在进行Web 层开发的时候,只有加入了这个文件后才能看到Spring 后台完整的出错信息。在开发Spring 整合应用时,经常有人遇到出现404 错误但是却看不到任何出错信息的情况,这时你就需要检查一下这个文件是不是存在。

8、

Exception in thread "main" java.lang.NoClassDefFoundError: org/hibernate/QueryTimeoutException
将hibernate3的jar包换成hibernate4的jar包,hibernate3jar包中包含的是QueryException.class,QueryParameterException.class,没有QueryTimeoutException

9、

Exception in thread "main" 2017-01-23 10:31:12,653 WARN [org.springframework.context.support.ClassPathXmlApplicationContext] - Exception encountered during context initialization - cancelling refresh attempt
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'UserAction' defined in class path resource [config/spring/applicationContext-user.xml]: Cannot resolve reference to bean 'userService' while setting bean property 'userService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService' defined in class path resource [config/spring/applicationContext-service.xml]: Cannot resolve reference to bean 'userDao' while setting bean property 'userDao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao' defined in class path resource [config/spring/applicationContext-dao.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [config/spring/applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: [Lorg/hibernate/engine/FilterDefinition;
找不到 Caused by: java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool 就是Apache所提供的基本对象池。
解决办法:
到这里http://commons.apache.org/downloads/download_pool.cgi下载包,然后,把里面的commons-pool-x.jar复制到myEclipse的Referenced Libraries下.

10、org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'UserAction' defined in class path resource [config/spring/applicationContext-user.xml]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0': Cannot resolve reference to bean 'pointCut' while setting bean property 'pointcut'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pointCut': Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException
缺少aspectjweaver.jar

11、Eclipse报错:
Description Resource Path Location Type
Target runtime com.genuitec.runtime.generic.jee70 is not defined. MyBatis01 Unknown Faceted Project Problem

解决办法:在工程目录下的settings,打开org.eclipse.wst.common.project.facet.core.xml文件,会发现<runtime name="com.genuitec.runtime.generic.jee60" />,把这句话去掉就OK了

12、telnet 127.0.0.1:3306 正在连接127.0.0.1:3306...无法打开到主机的连接。在端口 23:连接失败
解决办法:telnet 127.0.0.1 3306

13、spring4+hibernate4,出现异常Write operations are not allowed in read-only mode (FlushMode.MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition.

解决方法:在hibernate操作前添加,getSessionFactory().getCurrentSession().setFlushMode(FlushMode.AUTO); 设置下FlushMode

posted @ 2017-02-16 15:05  ice&sww  阅读(295)  评论(0编辑  收藏  举报