zoukankan      html  css  js  c++  java
  • Java一些常见的出错异常处理

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

    1. 404错误

    description The requested resource (/Struts2_0100_Introduction/hello.action) is not available.

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

    2. Error configuring application listener of class org.springframework.web.context.ContextLoaderListener

    java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

    1.  

      端口写错了,端口是3306,我写成了8080

      问题描述

      问题情况

      问题解决

      严重: 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);

      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文件报错

       

      选择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+"两边的语句的空格的问题

      点击部署按钮无效

      找到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列勾去掉,没什么用)

           
  • 相关阅读:
    scrapy练习1
    sys.path.append()加入当前目录为环境变量
    同济:003.映射与函数3
    1-4 无监督学习(Unsupervised Learning)
    1-3.监督学习(supervised learning)
    同济:002.映射与函数2
    github访问过慢解决
    LeetCode OJ:Contains Duplicate(是否包含重复)
    LeetCode OJ:Maximum Product Subarray(子数组最大乘积)
    LeetCode OJ:Valid Anagram(有效字谜问题)
  • 原文地址:https://www.cnblogs.com/bb1119/p/5387057.html
Copyright © 2011-2022 走看看