1. getOutputStream() has already been called for this response
jsp文件末尾添加两句话
out.clear();
out = pageContext.pushBody();
2. java.lang.IncompatibleClassChangeError: Expecting non-static method
原因可能是静态方法没有用静态的方式去访问
3. java.lang.IllegalStateException
在response.sendRedirect("")方法后加return;语句即可,原因是在程序中两次调用response.sendRedirect("")方法
4.NoClassDefFoundError: com/sun/mail/util/LineInputStream
javax.mail和javax.activation这两个包已经在javaEE5的javaee.jar当中属于基础包了,与外部引用的mail.jar冲突
5 struts2 iterator
java.lang.Integer cannot be cast to java.lang.String
使用的时候在前面加上#,如<s:property value='#id' />
6 Struts中the request was rejected because its size (***) exceeds the configured maximum (2097152)
struts.xml中加上如下配置
<constant name="struts.multipart.maxSize" value="10485760" />
7 failed to lazily initialize a collection of role: no session or session was closed
web.xml中添加如下代码,并且要添加在struts2的filter的前面
<filter>
<filter-name>hibernateFilter</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
<init-param>
<param-name>singleSession</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>hibernateFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
8 mysql存中文的时候报错 data too long
mysql数据库字符集设置有问题,用show variables like 'character_%'查看数据库字符集
9 tomcat报错:SEVERE: Error listenerStart
是其他错误引起的这个错,例如FileNotFoundException等等
tomcat没有显示具体错误,可以在classes下面新建logging.properties文件用来监控具体错误信息
handlers = org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
############################################################
# Handler specific properties.
# Describes specific configuration info for Handlers.
############################################################
org.apache.juli.FileHandler.level = FINE
org.apache.juli.FileHandler.directory = ${catalina.base}/logs
org.apache.juli.FileHandler.prefix = error-debug.
java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
10 Caused by: java.lang.ClassCastException: org.apache.xerces.parsers.XML11Configuration cannot be cast to org.apache.xerces.xni.parser.XMLParserConfiguration
项目xerces.jar和tomcat自带的包可能有冲突,可以将项目内的xerces.jar去掉试试
11 ssh项目tomcat启动时spring报错 could not resolve placeholder
<bean id="placeholderConfig"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>classpath:init.properties</value>
</property>
<property name="ignoreUnresolvablePlaceholders" value="true" />
</bean>
解决办法如上加入<property name="ignoreUnresolvablePlaceholders" value="true" />
12 invalid subscription level
解决办法:
Window->Preferences->Myeclipse Enterprise Workbench->Subscription
填写相应myeclipse注册码即可
13 ssh中hibernate自动创建表时报错 check the manual that corresponds to your MySQL server version for the right syntax to use near 'type=MyISAM' at line 1
查看hibernate方言设置,把org.hibernate.dialect.MySQLMyISAMDialect改为org.hibernate.dialect.MySQLDialect
14 Myeclipse 报错 Refresh property sheet
Windows > Preferences > MyEclipse > Community Essentials,
把选项 "Search for new features on startup"的前勾去掉即可.