欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Java一些常见的出错异常处理方法总结

程序员文章站 2024-03-12 14:41:02
一些平时常见的错误及解决办法,我 是新手,每次遇到的错误都记录了下来。 1. 404错误 description the requested resource (/st...

一些平时常见的错误及解决办法,我 是新手,每次遇到的错误都记录了下来。

1. 404错误

description the requested resource (/struts2_0100_introduction/hello.action) is not available.

先检查manager deployments,使之能打开(出现nullpointerexception不能打开),主要是服务器在每次允许前备份,再修改了错误后不能及时更正。(如果是勾选的backup,要改成delete

Java一些常见的出错异常处理方法总结

2. error configuring application listener of class org.springframework.web.context.contextloaderlistener

java.lang.classnotfoundexception: org.springframework.web.context.contextloaderlistener

端口写错了,端口是3306,我写成Java一些常见的出错异常处理方法总结

了8080

Java一些常见的出错异常处理方法总结

问题描述

问题情况

问题解决

严重: standardserver.await: create[8005]:

java.net.bindexception: address already in use: jvm_bind

  • 独立运行的tomcat.exe没有关闭

  • 安装了其他的软件占用了8080端口

  • 关闭tomcat图标并结束掉tomcat进程

  • tomcat安装默认的端口是8080,方案一:更改tomcat的端口conf/service.xml,方案二:打开cmd命令提示符,输入 netstat -ano 找到8080端口占用的pid号,再到任务管理器详细信息中关掉pid号进程。

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);

Java一些常见的出错异常处理方法总结

errors occurred during the build.

errors running builder 'deploymentbuilder' on project '项目名'.

java.lang.nullpointerexception

此问题一般发生在myeclipse 保存文件并自动部署时候。写项目的时候,还没等部署好,关闭了了myeclipse 10,结果出现了这种情况。有一种产生此错误的原因是因为此项目不不是由myeclipse创建的,需要检查.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文件报错

Java一些常见的出错异常处理方法总结

选择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

注入的数据库语句有问题

尤其要注意在"+x+"两边的语句的空格的问题

Java一些常见的出错异常处理方法总结

点击部署按钮无效

找到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列勾确认

(如果还不行,可以把所有的build列勾去掉,没什么用)

以上这篇java一些常见的出错异常处理方法总结就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。