javaweb报错总结

1、

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sqlMapClient‘ defined in class path resource

[dao/spring-config-dao.xml]: Invocation of init method failed; nested exception is java.io.FileNotFoundException:

class path resource [Sqlmap-config.xml] cannot be opened because it does not exist

解决方法:加入从spring-config.xml进入配置文件,那么其他配置文件的classpath是spring-config所在的路径。

2、

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sqlMap‘ defined in class path resource

[dao/spring-config-dao.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException:

Failed to parse config resource: class path resource [dao/Sqlmap-config.xml]; nested exception is com.ibatis.common.xml.NodeletException:

Error parsing XML.  Cause: java.lang.RuntimeException: Error parsing XPath ‘/sqlMapConfig/sqlMap‘.

Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: org.xml.sax.SAXParseException:

The processing instruction target matching "[xX][mM][lL]" is not allowed.

这个异常解释为:xml文件不能被解析,一般出现这样的问题在于xml格式上,并且问题多出现在xml文件的头部。我就是出现了这个问题。昨天还可以正常运行的,今天来了就运行不了了,很奇怪,查看了下错误信息,找到了原因。这是因为我的xml文件头部有两行空行,第三行才开始写

<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd"> 
的。

总结:<?xml version="1.0" encoding="UTF-8"?>前面不要有任何其他字符,如空格、回车、换行这些否则就会出现上面的异常。

3、

org.springframework.jdbc.BadSqlGrammarException: SqlMapClient operation; bad SQL grammar []; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:

--- The error occurred while applying a parameter map.

--- Check the user.match-InlineParameterMap.

--- Check the statement (query failed).

--- Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 ‘from user   WHERE         username = ‘llx‘        AND     password = ‘llx‘‘ at line 1

数据库sql语法错误,修改sql语句

<sql id="Column_List_user">

id,

username,

password,

sex,

age,

isDelete,------》最后一个column多了一个逗号,汗,去掉逗号就ok了。

</sql>

4、。

java.lang.ClassCastException: java.lang.Integer cannot be cast to cm.llx.module.pojo.User

类型转换异常。可能ibatis中resultClass错误。

5、

org.springframework.web.servlet.PageNotFound [http-apr-8080-exec-9]   - No mapping found for HTTP request with URI [/bookborrow/lwb/user/userlist.do] in DispatcherServlet with name ‘dispatcher‘

需要在servlet配置文件中加入组件扫描,扫描controller。

6、

org.springframework.web.servlet.DispatcherServlet [localhost-startStop-1]   - Context initialization failed

Servlet配置文件有问题。

7.

Duplicate entry ‘1‘ for key 1

主键自增,但插入时却有id插入

http://xiao1227372602.iteye.com/blog/1684089

汗,在insert中不要id就行了。

  1. 。。

INFO  14-04-04 10:16 - org.springframework.web.context.support.XmlWebApplicationContext [localhost-startStop-1]   - Refreshing Root WebApplicationContext: startup date [Fri Apr 04 10:16:39 CST 2014]; root of context hierarchy

INFO  14-04-04 10:16 - org.springframework.beans.factory.xml.XmlBeanDefinitionReader [localhost-startStop-1]   - Loading XML bean definitions from ServletContext resource [/WEB-INF/classes/ctx-work-web.xml]

Could not open ServletContext resource [/WEB-INF/classes/ctx-work-web.xml]

Context initialization failed

项目开始可以运行,项目clean后,就不能运行了。Spring加载失败。 不能加载web.xml文件。原因: web.xml被clean掉了。

解决方法:svn更新。Clean下项目。

  1. Data too long for column ‘class_hour_fee‘ at row 1

数据库编码问题,插入数据有中文,将数据库和表改成utf-8即可。

ALTER TABLE `test` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin

或者字段真的太短了,改成text就可以了

  1. nested exception is org.springframework.web.multipart.MaxUploadSizeExceededException: Maximum upload size of 100000 bytes exceeded; nested exception is org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (237254) exceeds the configured maximum (100000)] with root cause

上次文件大小大于设置的大小,设置在dispatch-servlet

<!-- 这里申明的id必须为multipartResolver -->

<bean id="multipartResolver"

class="org.springframework.web.multipart.commons.CommonsMultipartResolver">

<!-- one of the properties available; the maximum file size in bytes -->

<property name="maxUploadSize" value="10000000" />

</bean>

  1. Servlet.service() for servlet jsp threw exception

可能有个 标签括号掉了

12、An error occurred at line: 17 in the jsp file: /WEB-INF/page/outsch/class/add.jsp

path cannot be resolved to a variable

<form class="form-horizontal" role="form" action="<%=path%>/outsch/class/add.html" method="post">

错误原因,使用了<%=path%> ,但未加入

<%

String path = request.getContextPath();

String basePath = request.getScheme() + "://"

+ request.getServerName() + ":" + request.getServerPort()

+ path + "/";

%>

  1. javax.el.PropertyNotFoundException: Property ‘account‘ not found on type java.lang.String

解决办法

  1. <c:forEach items="productTypes" var="type">
  2. ${type.typeid }     ${type.name }       ${type.note }       <c:if test="${!empty type.parent }">${type.parent.name }</c:if>
  3. </c:forEach>

将items="productTypes"修改为

[html] view plaincopyprint?

  1. items="${productTypes }"解决问题。
  1. There is no statement named oa_institution.insertEntry in this SqlMap.

解决方法:1.你的sqlmap 文件中确实没有xxx这个statement ,很有可能某个字母写错了

2.sqlmap文件定义了namespace属性,此时在本文件中引用别的statement,就需要这样写:(你的namespace).(定义的statement 的id),如果把namespace属性漏了,就被报此异常

也可能没建立映射关系 在 sqlmap_config.xml 配置文件中

<sqlMap resource="dao/sqlmap/oa_term_class.xml" />

<sqlMap resource="dao/sqlmap/oa_term.xml" />

<sqlMap resource="dao/sqlmap/oa_institution.xml" />

<sqlMap resource="dao/sqlmap/oa_finance.xml" />

  1. Duplicate <sql>-include ‘oa_finance.Column_List‘ found

Sqlmap_config.xml配置文件中有重复,或者xxx.xml中有重复

16、Description Resource Path Location Type Java compiler level does not match the version of the instal

分类: eclipse2013-03-21 09:30 8102人阅读 评论(5) 收藏 举报

解决办法

在项目上右键Properties-》Project Facets,在打开的Project Facets页面中的Java下拉列表中,选择相应版本。
有可能是java1.6 改成java6之类的

17

The constructor BASE64Decoder() is not accessible due to restriction on required library

分类: Java2013-06-15 10:39 1124人阅读 评论(2) 收藏 举报

搭建G4Studio的开发环境出现这个错误:

Description Resource Path Location Type Access restriction: The constructor BASE64Decoder() is not accessible due to restriction on required library D:\java\Tomcat6\jdk\jre\lib\rt.jar G4Utils.java /G4Studio/JavaCode/org/g4studio/core/util line 805 Java Problem

百度找到答案,只需要在project build path中先移除JRE System Library,再添加库JRE System Library,重新编译后就一切正常了

18、Page directive: illegal to have multiple occurrences of contentType with different values (old: text/html; charset=utf-8,new: text/html;charset=utf-8)
原来是包含页面与被包含页面的@page指令里面的contentType不一致,仔细检查两个文件第一行的 @page,

包含页面的是: <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>

被包含页面: <%@ page language="java" contentType="text/html;charset=utf-8" pageEncoding="utf-8"%>

解决方法:果然contentType="text/html;和charset=utf-8"之间多了一个空格,把两个文件第一行的@page内容改为一致,再执行程序,运行通过。

19.java.lang.UnsupportedOperationException

引起异常代码:

1.String[] strs = new String[]{"a","b"};

2. List<String> strList = Arrays.asList(strs);

3. strList.add("c");

在第三行抛出的异常

经分析java源代码Arrys.asList();方法返回的不是平常熟悉的java.util.ArrayList类的对象。而是Arrays类的内部类的对象,而Arrays类里的内部类ArrayList没有实现AbstractList类的add方法,导致抛此异常! strList.add("c");这行代码调用的add方法实际上是这样的:

public boolean add(E e) {

add(size(), e);

return true;

}

public void add(int index, E element) {

throw new UnsupportedOperationException();

}

解决方法:

String[] strs = new String[]{"a","b"};

List<String> strList = new ArrayList<String>(Arrays.asList(strs));

strList.add("c");

时间: 2024-07-29 08:49:14

javaweb报错总结的相关文章

JavaWeb: 报错信息The superclass &quot;javax.servlet.http.HttpServlet&quot; was not found on the Java Build Path

JavaWeb: 报错信息The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path 好久不写Jsp,今天建立了一个Javaweb工程,并在eclipse中配置了Web容器Tomcat.原本开心的新建jsp页面,添加一个简单的Java类.可是,JSP页面顶端出现“红色”的报错信息:The superclass "javax.servlet.http.HttpServl

Maven项目红色叹号+JavaWeb: 报错信息The superclass &amp;quot;javax.servlet.http.HttpServlet&amp;quot; was not found on the Java B

昨天写的关于解决JavaWeb: 报错信息The superclass "javax.servlet.http.HttpServlet" was not found on the Java的方案非常好的攻克了这个错误,可是它没有全然的解决我的问题,Maven项目依旧有一个红色叹号存在.红色叹号存在的原因是:.classpath配置文件引用了某jar包,可是lib里却不存在此jar.我所遇到的问题又是一种新的情况,jar存在lib里存在,但还是报题目中的两个错误.细致研究发现我的java

JavaWeb:报错信息The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path 解决办法

JavaWeb: 报错信息The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path 好久不写Jsp,今天建立了一个Javaweb工程,并在eclipse中配置了Web容器Tomcat.原本开心的新建jsp页面,添加一个简单的Java类.可是,JSP页面顶端出现"红色"的报错信息:The superclass "javax.servlet.http

Maven项目红色叹号+JavaWeb: 报错信息The superclass &quot;javax.servlet.http.HttpServlet&quot; was not found on the Java B

<pre name="code" class="html"><span style="font-size:24px;">昨天写的关于解决JavaWeb: 报错信息<strong>The superclass "javax.servlet.http.HttpServlet" was not found on the Java</strong>的方案很好的解决了这个错误,但是它没有完

eclipse:报错信息The superclass &quot;javax.servlet.http.HttpServlet&quot; was not found on the Java Build Path

JavaWeb: 报错信息The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path 今天建立了一个Javaweb工程,并在eclipse中配置了Web容器Tomcat.JSP页面顶端出现“红色”的报错信息:The superclass "javax.servlet.http.HttpServlet" was not found on the Java Bu

eclipse:报错信息The superclass “javax.servlet.http.HttpServlet” was not found on the Java Build Path

JavaWeb: 报错信息The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path 今天建立了一个Javaweb工程,并在eclipse中配置了Web容器Tomcat.JSP页面顶端出现“红色”的报错信息:The superclass "javax.servlet.http.HttpServlet" was not found on the Java Bu

Eclipse导入JavaWeb项目报错:The superclass &quot;javax.servlet.http.HttpServlet&quot; was not found on the Java Build Path

JavaWeb项目中写的JSP页面需要Web容器解析处理成HTML才能展示到前端浏览器,解析JSP需要Web容器.JSP页面顶端出现“红色”的报错信息:The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path. javax.servlet.http.HttpServlet是Web容器Tomcat包中的类,将需要的jar包导入项目中就能解决这个问题. 下面是具体的解决方法: 右

关于intellij idea 中javaweb项目中使用jstl报错500错误问题

问题截图如下 taglib红色说明项目中没有导入jstl相关jar包 在tomcat中运行后,报错如下 解决办法 1.找到相关jar包(jstl.jar/standard.jar)拷贝到项目的lib目录下 2.在modules添加这两个jar包到工程的 lib中 3.在artifacts导入到output中 一切OK!

解决JavaWeb项目报错:The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

明明有项目和文件,而且别的项目都可以运行,偏偏这个不能用,报错The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.,开始很紧张,现在说下我的解决办法. 找到Services工具栏 然后右击这个Tomcat v9.0 Server at localhost 选择Add and Remove 重新rem