一些平時常見的錯誤及解決辦法,我 是新手,每次遇到的錯誤都記錄了下來。
1. 404錯誤
description The requested resource (/Struts2_0100_Introduction/hello.action) is not available.
先檢查Manager Deployments,使之能打開(出現(xiàn)NullPointerException不能打開),主要是服務器在每次允許前備份,再修改了錯誤后不能及時更正。(如果是勾選的Backup,要改成delete)
2. Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
端口寫錯了,端口是3306,我寫成了8080
問題描述 |
問題情況 |
問題解決 |
嚴重: 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包沒有引入 |
重新構建項目,添加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對象轉換成List |
無法解決,找了很多,都說的可以轉化,但是我用的不行。 我這里就把object對象轉換成了String對象,再來放進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 保存文件并自動部署時候。寫項目的時候,還沒等部署好,關閉了了myeclipse 10,結果出現(xiàn)了這種情況。有一種產生此錯誤的原因是因為此項目不不是由myeclipse創(chuàng)建的,需要檢查.project 文件,并且添加com.genuitec.eclipse.j2eedt.core.webnature。 |
1、首先關閉MyEclipse工作空間。 2、然后刪除工作空間下的"/.metadata/.plugins/org.eclipse.core.runtime/.settings/com.genuitec.eclipse.ast.deploy.core.prefs"
取消myeclipse的自動部署: 右鍵點擊項目 ->properties -> Builders,將DeploymentBuilder勾選去除. |
Js文件報錯
|
|
選擇js右鍵->MyEclipse->Exclude From Validation 勾選 |
Eclipse里面的J2EE項目放到MyEclipse里面運行,servlet文件報錯 |
|
選中一個servlet報錯的地方,添加一個javaee.jar包進來 |
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+"兩邊的語句的空格的問題 |
|
點擊部署按鈕無效 |
找到MyEclipse的工作路徑,到這個目錄中去".metadata.pluginsorg.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列勾確認 (如果還不行,可以把所有的build列勾去掉,沒什么用) |
|
|
|
以上這篇Java一些常見的出錯異常處理方法總結就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持服務器之家。