1、
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlMapClient' defined in class path resource
[dao/spring-config-dao.xml]: Invocation of init method failed; nested exception is java.io.FileNotFoundException:
class path resource [Sqlmap-config.xml] cannot be opened because it does not exist
解決方法:加入從spring-config.xml進入配置文件,那麼其他配置文件的classpath是spring-config所在的路徑。
2、
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlMap' defined in class path resource
[dao/spring-config-dao.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException:
Failed to parse config resource: class path resource [dao/Sqlmap-config.xml]; nested exception is com.ibatis.common.xml.NodeletException:
Error parsing XML. Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'.
Cause: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: org.xml.sax.SAXParseException:
The processing instruction target matching "[xX][mM][lL]" is not allowed.
這個異常解釋爲:xml文件不能被解析,一般出現這樣的問題在於xml格式上,並且問題多出現在xml文件的頭部。我就是出現了這個問題。昨天還可以正常運行的,今天來了就運行不了了,很奇怪,查看了下錯誤信息,找到了原因。這是因爲我的xml文件頭部有兩行空行,第三行纔開始寫
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd">
的。
總結:<?xml version="1.0" encoding="UTF-8"?>前面不要有任何其他字符,如空格、回車、換行這些否則就會出現上面的異常。
3、
org.springframework.jdbc.BadSqlGrammarException: SqlMapClient operation; bad SQL grammar []; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred while applying a parameter map.
--- Check the user.match-InlineParameterMap.
--- Check the statement (query failed).
--- Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from user WHERE username = 'llx' AND password = 'llx'' at line 1
數據庫sql語法錯誤,修改sql語句
<sql id="Column_List_user">
id,
username,
password,
sex,
age,
isDelete,------》最後一個column多了一個逗號,汗,去掉逗號就ok了。
</sql>
4、。
java.lang.ClassCastException: java.lang.Integer cannot be cast to cm.llx.module.pojo.User
類型轉換異常。可能ibatis中resultClass錯誤。
5、
org.springframework.web.servlet.PageNotFound [http-apr-8080-exec-9] - No mapping found for HTTP request with URI [/bookborrow/lwb/user/userlist.do] in DispatcherServlet with name 'dispatcher'
需要在servlet配置文件中加入組件掃描,掃描controller。
6、
org.springframework.web.servlet.DispatcherServlet [localhost-startStop-1] - Context initialization failed
Servlet配置文件有問題。
7.
Duplicate entry '1' for key 1
主鍵自增,但插入時卻有id插入
http://xiao1227372602.iteye.com/blog/1684089
汗,在insert中不要id就行了。
- 。。
INFO 14-04-04 10:16 - org.springframework.web.context.support.XmlWebApplicationContext [localhost-startStop-1] - Refreshing Root WebApplicationContext: startup date [Fri Apr 04 10:16:39 CST 2014]; root of context hierarchy
INFO 14-04-04 10:16 - org.springframework.beans.factory.xml.XmlBeanDefinitionReader [localhost-startStop-1] - Loading XML bean definitions from ServletContext resource [/WEB-INF/classes/ctx-work-web.xml]
Could not open ServletContext resource [/WEB-INF/classes/ctx-work-web.xml]
Context initialization failed
項目開始可以運行,項目clean後,就不能運行了。Spring加載失敗。 不能加載web.xml文件。原因: web.xml被clean掉了。
解決方法:svn更新。Clean下項目。
- Data too long for column 'class_hour_fee' at row 1
數據庫編碼問題,插入數據有中文,將數據庫和表改成utf-8即可。
ALTER TABLE `test` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin
或者字段真的太短了,改成text就可以了
- nested exception is org.springframework.web.multipart.MaxUploadSizeExceededException: Maximum upload size of 100000 bytes exceeded; nested exception is org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (237254) exceeds the configured maximum (100000)] with root cause
上次文件大小大於設置的大小,設置在dispatch-servlet
<!-- 這裏申明的id必須爲multipartResolver -->
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<!-- one of the properties available; the maximum file size in bytes -->
<property name="maxUploadSize" value="10000000" />
</bean>
- Servlet.service() for servlet jsp threw exception
可能有個 標籤括號掉了
12、An error occurred at line: 17 in the jsp file: /WEB-INF/page/outsch/class/add.jsp
path cannot be resolved to a variable
<form class="form-horizontal" role="form" action="<%=path%>/outsch/class/add.html" method="post">
錯誤原因,使用了<%=path%> ,但未加入
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
- javax.el.PropertyNotFoundException: Property 'account' not found on type java.lang.String
解決辦法
- <c:forEach items="productTypes" var="type">
- ${type.typeid } ${type.name } ${type.note } <c:if test="${!empty type.parent }">${type.parent.name }</c:if>
- </c:forEach>
將items="productTypes"修改爲
[html] view plaincopyprint?
- items="${productTypes }"解決問題。
- There is no statement named oa_institution.insertEntry in this SqlMap.
解決方法:1.你的sqlmap 文件中確實沒有xxx這個statement ,很有可能某個字母寫錯了
2.sqlmap文件定義了namespace屬性,此時在本文件中引用別的statement,就需要這樣寫:(你的namespace).(定義的statement 的id),如果把namespace屬性漏了,就被報此異常
也可能沒建立映射關係 在 sqlmap_config.xml 配置文件中
<sqlMap resource="dao/sqlmap/oa_term_class.xml" />
<sqlMap resource="dao/sqlmap/oa_term.xml" />
<sqlMap resource="dao/sqlmap/oa_institution.xml" />
<sqlMap resource="dao/sqlmap/oa_finance.xml" />
- Duplicate <sql>-include 'oa_finance.Column_List' found
Sqlmap_config.xml配置文件中有重複,或者xxx.xml中有重複
16、Description Resource Path Location Type Java compiler level does not match the version of the instal
分類: eclipse2013-03-21 09:30 8102人閱讀 評論(5) 收藏 舉報
解決辦法
在項目上右鍵Properties-》Project Facets,在打開的Project Facets頁面中的Java下拉列表中,選擇相應版本。
有可能是java1.6 改成java6之類的
17
The constructor BASE64Decoder() is not accessible due to restriction on required library
分類: Java2013-06-15 10:39 1124人閱讀 評論(2) 收藏 舉報
搭建G4Studio的開發環境出現這個錯誤:
Description Resource Path Location Type Access restriction: The constructor BASE64Decoder() is not accessible due to restriction on required library D:\java\Tomcat6\jdk\jre\lib\rt.jar G4Utils.java /G4Studio/JavaCode/org/g4studio/core/util line 805 Java Problem
百度找到答案,只需要在project build path中先移除JRE System Library,再添加庫JRE System Library,重新編譯後就一切正常了
18、Page directive: illegal to have multiple occurrences of contentType with different values (old: text/html; charset=utf-8,new: text/html;charset=utf-8)
原來是包含頁面與被包含頁面的@page指令裏面的contentType不一致,仔細檢查兩個文件第一行的 @page,
包含頁面的是: <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
被包含頁面: <%@ page language="java" contentType="text/html;charset=utf-8" pageEncoding="utf-8"%>
解決方法:果然contentType="text/html;和charset=utf-8"之間多了一個空格,把兩個文件第一行的@page內容改爲一致,再執行程序,運行通過。
19.java.lang.UnsupportedOperationException
引起異常代碼:
1.String[] strs = new String[]{"a","b"};
2. List<String> strList = Arrays.asList(strs);
3. strList.add("c");
在第三行拋出的異常
經分析java源代碼Arrys.asList();方法返回的不是平常熟悉的java.util.ArrayList類的對象。而是Arrays類的內部類的對象,而Arrays類裏的內部類ArrayList沒有實現AbstractList類的add方法,導致拋此異常! strList.add("c");這行代碼調用的add方法實際上是這樣的:
public boolean add(E e) {
add(size(), e);
return true;
}
public void add(int index, E element) {
throw new UnsupportedOperationException();
}
解決方法:
String[] strs = new String[]{"a","b"};
List<String> strList = new ArrayList<String>(Arrays.asList(strs));
strList.add("c");