Java一些常見的出錯異常處理方法總結(jié)
一些平時常見的錯誤及解決辦法,我 是新手,每次遇到的錯誤都記錄了下來。
1. 404錯誤
description The requested resource (/Struts2_0100_Introduction/hello.action) is not available.
先檢查Manager Deployments,使之能打開(出現(xiàn)NullPointerException不能打開),主要是服務(wù)器在每次允許前備份,再修改了錯誤后不能及時更正。(如果是勾選的Backup,要改成delete)
2. Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
端口寫錯了,端口是3306,我寫成
了8080
問題描述 |
問題情況 |
問題解決 |
嚴(yán)重: StandardServer.await: create[8005]: java.net.BindException: Address already in use: JVM_Bind |
|
|
Error configuring application listener of class org.springframework.web.context.ContextLoaderListener java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener |
Spring3.0 Web Librariess包沒有引入 |
重新構(gòu)建項目,添加Sping包的時候引入Spring 3.0 Web Libraries包 |
java.lang.ClassCastException: java.lang.Integer cannot be cast to java.util.List |
Object o=session.getAttribute(a); List l = (List)o; 不能將object對象轉(zhuǎn)換成List |
無法解決,找了很多,都說的可以轉(zhuǎn)化,但是我用的不行。 我這里就把object對象轉(zhuǎn)換成了String對象,再來放進(jìn)list String s=session.getA...(a).toString(); List<String> l=new ArrayList(); L.add(s); |
Errors occurred during the build. Errors running builder 'DeploymentBuilder' on project '項目名'. java.lang.NullPointerException |
此問題一般發(fā)生在Myeclipse 保存文件并自動部署時候。寫項目的時候,還沒等部署好,關(guān)閉了了myeclipse 10,結(jié)果出現(xiàn)了這種情況。有一種產(chǎn)生此錯誤的原因是因為此項目不不是由myeclipse創(chuàng)建的,需要檢查.project 文件,并且添加com.genuitec.eclipse.j2eedt.core.webnature。 |
1、首先關(guān)閉MyEclipse工作空間。 2、然后刪除工作空間下的"/.metadata/.plugins/org.eclipse.core.runtime/.settings/com.genuitec.eclipse.ast.deploy.core.prefs" 取消myeclipse的自動部署: 右鍵點(diǎn)擊項目 ->properties -> Builders,將DeploymentBuilder勾選去除. |
Js文件報錯 |
選擇js右鍵->MyEclipse->Exclude From Validation 勾選 |
|
Eclipse里面的J2EE項目放到MyEclipse里面運(yùn)行,servlet文件報錯 |
選中一個servlet報錯的地方,添加一個javaee.jar包進(jìn)來 |
|
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 'by publishDate desc limit 0,8' at line 1 |
注入的數(shù)據(jù)庫語句有問題 |
尤其要注意在"+x+"兩邊的語句的空格的問題 |
|
點(diǎn)擊部署按鈕無效 |
找到MyEclipse的工作路徑,到這個目錄中去"\.metadata\.plugins\org.eclipse.core.runtime\.settings"找一個含有deploy的.prefs文件刪除即可(com.genuitec.eclipse.ast.deploy.core.prefs)。重新啟動MyEclipse,又可以了. |
Type Action question!list cannot be found in the namespace / |
Window-->Preference-->Myeclipse -->Validation -->去掉struts2 Validator后的Build列勾確認(rèn) (如果還不行,可以把所有的build列勾去掉,沒什么用) |
|
以上這篇Java一些常見的出錯異常處理方法總結(jié)就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關(guān)文章
如何解決Spring in action @valid驗證不生效的問題
這篇文章主要介紹了如何解決Spring in action @valid驗證不生效的問題,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2021-06-06SpringCloud中的Feign服務(wù)間的調(diào)用詳解
這篇文章主要介紹了SpringCloud中的Feign服務(wù)間的調(diào)用詳解,Feign 是一個聲明式的 REST 客戶端,它能讓 REST 調(diào)用更加簡單,Feign 供了 HTTP 請求的模板,通過編寫簡單的接口和插入注解,就可以定義好 HTTP 請求的參數(shù)、格式、地址等信息,需要的朋友可以參考下2024-01-01Spring中WebClient的創(chuàng)建和使用詳解
這篇文章主要介紹了Spring中WebClient的創(chuàng)建和使用詳解,在Spring5中,出現(xiàn)了Reactive響應(yīng)式編程思想,并且為網(wǎng)絡(luò)編程提供相關(guān)響應(yīng)式編程的支持,如提供了WebFlux,它是Spring提供的異步非阻塞的響應(yīng)式的網(wǎng)絡(luò)框架,需要的朋友可以參考下2023-11-11