2008年3月18日
#
一,錯(cuò)誤:java.lang.ClassCastException: oracle.sql.BLOB
一般在存儲(chǔ)blob數(shù)據(jù)時(shí)首先要將java.sql.Blob類型轉(zhuǎn)為oracle.sql.BLOB再進(jìn)行寫(xiě)入操作,在強(qiáng)制轉(zhuǎn)換時(shí)就會(huì)丟
java.lang.ClassCastException: oracle.sql.BLOB轉(zhuǎn)型錯(cuò)誤,形如:
SerializableBlob sb = (SerializableBlob) instance.getBlobData();
BLOB wrapblob = (BLOB) sb.getWrappedBlob();//此行丟出
主要原因少此行:session.refresh(instance, LockMode.UPGRADE);加鎖查詢出,這樣instance中存放的Blob數(shù)據(jù)就
是oracle.sql.BLOB類型的。
二,錯(cuò)誤:SQL Error: 1002, SQLState: 72000,ORA-01002: 提取違反順序 出現(xiàn)這樣的錯(cuò)誤一定是事務(wù)沒(méi)有控制好,用ssh
框架請(qǐng)檢查調(diào)用此功能的method是否在事務(wù)控制中,直接用hibernate操作是否有開(kāi)事務(wù)。正確配置好事務(wù)就不會(huì)有
問(wèn)題了。
struts2中使用二級(jí)聯(lián)動(dòng)標(biāo)簽<s:doubleselect/>時(shí)總是丟:XML descendants internal method called on incompatible HTMLDocument 錯(cuò)誤,檢查標(biāo)簽格式,取值以及l(fā)istKey,listValue,doubleName,boubleList,doubleListKey,doubleListValue.......所有可能出錯(cuò)的地方,但就是一直丟這個(gè)錯(cuò)誤,后來(lái)檢查標(biāo)簽<s:doubleselect/>外面有一個(gè)<s:form action="" type="post">....</s:form>,問(wèn)題就出在這里,將action屬性賦值,eg:action="xxxxAction.action"就好了,或者干脆將action屬性砍掉!一切正常??!
spring2+struts2+hibernate3架構(gòu)下,在spring中配置quartz(1.6版本)一運(yùn)行就丟:java.lang.NoSuchMethodError: org.apache.commons.collections.SetUtils.orderedSet(Ljava/util/Set;)Ljava/util/Set.......這樣的錯(cuò)誤,在網(wǎng)上找了很久都提到更換commons-collections.jar到3.0以上的版本,自己試了多次,3.2的也拉下來(lái)試了,但是終沒(méi)有解決,仍然出那個(gè)錯(cuò)誤,最后將commons-collections.jar刪除掉再運(yùn)行,發(fā)現(xiàn)還是報(bào)這個(gè)錯(cuò)誤,所以就懷疑classpath下面肯定還有commons-collection.jar,仔細(xì)檢查,原來(lái)我自己將tomcat下的lib也導(dǎo)入進(jìn)來(lái)了,里面有一個(gè)commons-collection.jar(2.0版本),暈啊!馬上砍掉,導(dǎo)入commons-collection.jar 3.0版本,一切OK,郁悶了一個(gè)晚上?。。。?
tomcat控制臺(tái)會(huì)打出如下警告:
WARN - No configuration found for the specified action: 'xxxxx'in namespace: '/'. Form action defaulting to 'action' attribute's literal value.
主要由于在寫(xiě)struts2表單時(shí)有給action指定全名,如:<s:form action="xxxAction.do"...>,直接寫(xiě)成<s:form action="xxxAction"...>即可,因?yàn)?br />
在struts.xml中struts.action.extension屬性有指定啦。
struts2.0.11版本不支持el,因而以前在低版本下寫(xiě)和程式將不能正常運(yùn)行:
下面是一段分頁(yè)所用的循環(huán):
<c:forEach var="i" begin="1" end="${requestScope.page.afterPage}" step="1">
<c:if
test="${requestScope.page.indexPage<requestScope.page.totalPage && requestScope.page.indexPage+i<requestScope.page.totalPage}">
<s:url id="afterUrl" value="/photoItemsList.html">
<s:param name="indexPage" value="${requestScope.page.indexPage+i}" /><!-- struts2.0.11中已不支持el,因而<s:url>將取不到相關(guān)值-->
</s:url>
<s:a theme="ajax" href="%{afterUrl}" indicator="indicator" showLoadingText="false" targets="pageItems">
<c:out value="${requestScope.page.indexPage+i}" /> </s:a>
</c:if>
</c:forEach>
修改成如下:
<c:forEach var="i" begin="1" end="${requestScope.page.afterPage}" step="1">
<c:set value="${i}" var="var"/>
<c:if test="${requestScope.page.indexPage<requestScope.page.totalPage && requestScope.page.indexPage+i<requestScope.page.totalPage}">
<s:url id="afterUrl" value="/photoItemsList.html">
<s:param name="indexPage" value="#request.page.indexPage+#attr.var" />
</s:url>
<s:a theme="ajax" href="%{afterUrl}" indicator="indicator" showLoadingText="false" targets="pageItems">
<c:out value="${requestScope.page.indexPage+i}" /> </s:a>
</c:if>
</c:forEach>