久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

ColdFusion 沒(méi)有捕捉到 NoClassDefFoundError

ColdFusion not catching NoClassDefFoundError(ColdFusion 沒(méi)有捕捉到 NoClassDefFoundError)
本文介紹了ColdFusion 沒(méi)有捕捉到 NoClassDefFoundError的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

我正在使用 ColdFusion 8.我想在 ColdFusion 中捕獲 NoClassDefFoundError 異常,但是我不能...它仍然失敗并在 exception.log 文件中記錄錯(cuò)誤.這是我嘗試過(guò)的.

I am using ColdFusion 8. I would like to catch a NoClassDefFoundError exception in ColdFusion however I can't... It still fails and logs the error in the exception.log file. Here is what I tried.

<cftry>
    <cfset myJavaObject.myMethod()>
    <cfcatch type="any">
        <cfdump var="#cfcatch #">
    </cfcatch>
    <cfcatch type="java.lang.Throwable">
        Horrible exception.
        <cfdump var="#cfcatch #">
    </cfcatch>
</cftry>

但這不起作用.你能告訴我怎么做嗎?我需要在特定位置捕獲此錯(cuò)誤,而不是在 Application.cfc 的 OnError 函數(shù)中.

But this does not work. Could you please show me how to do that? I need to catch this error at a particular place and not in the OnError function of my Application.cfc.

推薦答案

現(xiàn)在我喝了更多的咖啡,我不認(rèn)為 cfcatch 能夠捕獲 NoClassDefFoundError.根據(jù)文檔,它只處理 Exceptions:

Now that I have had more coffee, I do not think cfcatch is capable of catching a NoClassDefFoundError. According to the documentation, it only processes Exceptions:

異常是破壞正常指令流的事件在 ColdFusion 頁(yè)面中,例如數(shù)據(jù)庫(kù)操作失敗、丟失包括文件和開發(fā)人員指定的事件.

Exceptions are events that disrupt the normal flow of instructions in a ColdFusion page, such as failed database operations, missing include files, and developer-specified events.

NoClassDefFoundError 是一個(gè) 錯(cuò)誤.

一個(gè)錯(cuò)誤表示嚴(yán)重的問(wèn)題,一個(gè)合理的應(yīng)用程序不應(yīng)該試圖抓住

An Error indicates serious problems that a reasonable application should not try to catch

聽起來(lái) cfcatch 只是為了處理正常的可恢復(fù)"問(wèn)題而設(shè)計(jì)的.一旦你得到 NoClassDefFoundError,你真的無(wú)能為力.這是一個(gè)嚴(yán)重的錯(cuò)誤,你無(wú)法克服它(在正常情況下).您最多只能顯示錯(cuò)誤消息并退出.

It sounds like cfcatch was only designed to handle normal "recoverable" problems. There is really not much you can do once you get a NoClassDefFoundError. It is a severe error and you cannot get past it (under normal circumstances). The most you can do is show an error message and exit.

Application.onErrora> 似乎可以處理 NoClassDefFoundError 等未捕獲的錯(cuò)誤以及異常.所以我認(rèn)為你能做的最好的就是實(shí)現(xiàn) onError 并讓它顯示一個(gè)錯(cuò)誤頁(yè)面.

Application.onError seems to handle uncaught Errors like NoClassDefFoundError, as well as Exceptions. So I think the best you can do is implement onError and have it display an error page.

    <!---- test code --->
    <cfset myJavaObject = createObject("java", "path.to.MyClass") />
    <cfset myJavaObject.myMethod() />

    <!---- Application.cfc --->
    <cfcomponent>
         .... settings ...
         <cffunction name="onError" returnType="void"> 
             <cfargument name="Exception" required="true" /> 
             <cfargument name="EventName" type="string" required="true" /> 
             <h1>onError Test</h1>
             <cfdump var="#Exception#" />
         </cffunction>
    </cfcomponent>

    // test class
    public class MyClass {
        public void myMethod() {
            throw new NoClassDefFoundError ("Testing...");
        }
    }

<小時(shí)>

更新

Any 類型包括 Java 對(duì)象類型的所有錯(cuò)誤java.lang.異常.它不包括 java.lang.Throwable 錯(cuò)誤.要捕獲 Throwable 錯(cuò)誤,請(qǐng)?jiān)?cfcatch 中指定 java.lang.Throwable標(biāo)簽類型屬性

The Any type includes all error with the Java object type of java.lang.Exception. It does not include java.lang.Throwable errors. To catch Throwable errors, specify java.lang.Throwable in the cfcatch tag type attribute

盡管文檔說(shuō)了什么,捕獲 Throwable 在我(或您的)的任何測(cè)試中都不起作用.這強(qiáng)烈表明行為或文檔中存在錯(cuò)誤.無(wú)論哪種方式,它都像宣傳的那樣工作,所以如上所述,我所知道的唯一替代方法是使用通用錯(cuò)誤處理程序.如果您出于某種原因必須堅(jiān)持使用 Application.cfm 文件,請(qǐng)嘗試使用 <cferror type="exception" ...>

Despite what the documentation says, catching Throwable does not work in any of my tests (or yours). That strongly suggests a bug in the behavior or the documentation. Either way it does not work as advertised, so as mentioned above, the only alternative I know of is using a general error handler. If you must stick with an Application.cfm file for some reason, try using <cferror type="exception" ...>

(荒謬)測(cè)試用例:

<cftry>
   <cfset myJavaObject = createObject("java", "path.to.MyClass")>
   <cfset myJavaObject.myMethod()>
   <cfcatch type="java.lang.NoClassDefFoundError">
      CAUGHT java.lang.NoClassDefFoundError
   </cfcatch>
   <cfcatch type="java.lang.LinkageError">
      CAUGHT java.lang.LinkageError
   </cfcatch>
   <cfcatch type="java.lang.Error">
      CAUGHT java.lang.Error
   </cfcatch>
   <cfcatch type="java.lang.Throwable">
      CAUGHT java.lang.Throwable 
   </cfcatch>
   <cfcatch type="any">
      CAUGHT ANY
   </cfcatch>
   <cfcatch>
      CAUGHT
   </cfcatch>
</cftry>

這篇關(guān)于ColdFusion 沒(méi)有捕捉到 NoClassDefFoundError的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

How to wrap text around components in a JTextPane?(如何在 JTextPane 中的組件周圍環(huán)繞文本?)
MyBatis, how to get the auto generated key of an insert? [MySql](MyBatis,如何獲取插入的自動(dòng)生成密鑰?[MySql])
Inserting to Oracle Nested Table in Java(在 Java 中插入 Oracle 嵌套表)
Java: How to insert CLOB into oracle database(Java:如何將 CLOB 插入 oracle 數(shù)據(jù)庫(kù))
Why does Spring-data-jdbc not save my Car object?(為什么 Spring-data-jdbc 不保存我的 Car 對(duì)象?)
Use threading to process file chunk by chunk(使用線程逐塊處理文件)
主站蜘蛛池模板: 久久久久久成人 | 黄色av网站在线观看 | 久久久精品亚洲 | 成人精品免费 | 九九在线视频 | 国产一区二区三区四区五区加勒比 | 很黄很污的网站 | 性视频网 | 九九九视频 | 亚洲成人高清 | 欧美日韩精品 | 一级a性色生活片久久毛片 午夜精品在线观看 | 在线观看免费毛片 | 久久一二 | 亚洲成人免费在线观看 | 国产精品国产成人国产三级 | 国偷自产av一区二区三区 | 日韩一区二区久久 | 国产在线小视频 | 精品久久香蕉国产线看观看亚洲 | 欧美lesbianxxxxhd视频社区 | 国产99久久精品 | 丁香一区二区 | 国产综合精品一区二区三区 | 狠狠干天天干 | 国产成人免费视频 | 九九久久精品视频 | 凹凸日日摸日日碰夜夜 | 九色网址 | 91亚洲精品在线观看 | 中文在线一区二区 | 国产精品视频一区二区三区不卡 | 国产免费人成xvideos视频 | 成人一区二区在线 | 免费看a | 国产成人综合网 | 精品国偷自产在线 | 亚洲精品成人网 | 久久久久久国产 | 国产成人在线视频免费观看 | 国产成人av电影 |