java debugging and troubleshooting

Reference URL: http: //www.doc88.com/p-461115156632.html

 

一.Java程序调试与错误收集 
1.Web程序的调试与排错:尽量使用System.out.println();和打印hql语句的方式跟踪查错 
(1).非代码引起的报错 
①.jar包引起的错误:当从版本控制器上下载项目时,如果项目报错但是所有类文件
和配置文件和所有手动建的包都没有报错的情况时是因为项目中的jar包有错,修改或删 
除jar包即可 
②.编译器版本不合报错:当启动服务器或部署项目时控制台打印有:* 
java.lang.UnsupportedClassVersionError:Bad version number in .class file的异常语句时是因 
为当前MyEclipse使用的jdk版本和项目创建时的jdk版本不合而引起的,进入
MyEclipse>Window>Preferences>点击弹出的对话框左边的树形菜单中的"Java"项下的Comp 
iler项>点右边显示框中Compiler compliance level:右边的下拉列表并选择和创
建项目时的jdk版本相同的jdk版本号>点击右下角的"Apply"按钮>点击击右下角的"Ok 
"按钮即可 
③.当控制台或页面上打印org.apache.jasper.JasperException: The absolute uri: 
http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml o 
When r the jar files deployed with this application of the exception clause, because of the lack jar package jar or
bag the wrong version or configuration problems web.xml 
method: import JSTL jar package in the project after (the * .jar and * .tld put to / WEB-INF / lib directory) is
introduced into a JSP page <% @ taglib uri = "/  WEB-INF / lib / c.tld" prefix = "c"%>
method two: modify the web.xml (plus The following statement) <JSP-config> 

<taglib> <taglib-URI> http://java.sun.com/jstl/fmt </ taglib-URI> <taglib-LOCATION> /WEB-INF/tlds/fmt.t
LD </ taglib-LOCATION> </ taglib> 

<taglib> <taglib-URI> http://java.sun.com/jstl/fmt-rt </ taglib-URI> <taglib-LOCATION> / the WEB-INF / the tlds / FM
T-rt.tld </ taglib-LOCATION> </ taglib> 

<taglib-LOCATION> <taglib> <taglib-URI> http://java.sun.com/jstl/core </ taglib-URI> /WEB-INF/tlds/c.tld
</ taglib-LOCATION> < /taglib> 

<taglib><taglib-uri>http://java.sun.com/jstl/core-rt</taglib-uri><taglib-location>/WEB-INF/tlds/c-
rt.tld</taglib-location></taglib> 

<taglib><taglib-uri>http://java.sun.com/jstl/sql</taglib-uri><taglib-location>/WEB-INF/tlds/sql.tld
</taglib-location></taglib> 

<taglib><taglib-uri>http://java.sun.com/jstl/sql-rt</taglib-uri><taglib-location>/WEB-INF/tlds/sql-
rt.tld</taglib-location></taglib> 

<taglib><taglib-uri>http://java.sun.com/jstl/x</taglib-uri><taglib-location>/WEB-INF/tlds/x.tld</t
aglib-location></taglib> 

<taglib><taglib-uri>http://java.sun.com/jstl/x-rt</taglib-uri><taglib-location>/WEB-INF/tlds/x-rt.t
ld</taglib-location></taglib>

</jsp-config>再在JSP文件中导入<%@ taglib uri="/WEB-INF/lib/c.tld" 
prefix="c"%> 
④.当代码、配置文件和路径都没有错时,但是它总是报以前的错或不出效果,是因
为服务器中任然还 残留 以前的代码,将服务器中的项目彻底删除后重新部署即可 
⑤.当两个页面同时访问同一个资源时(),如果代码完全一样但一个可以访问另一
个却不能访问(报404错)时,可能是因为另一个页面中有以下代码:<%String path=request 
.getContextPath();String 
basePath=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+pat
h+"/";%> <base href="<%=basePa 
th%>"> <meta http-equiv="pragma" content="no-cache"> <meta 
http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> 
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta 
http-equiv="description" content="This is my page"> 
⑥. When the page is accessed, if confirmed paths and pages are present but reported 404 errors, shut down the server and then start the test
a try (to restart the compiler does not work), or delete items from the server and compiler, re-import additional backup with a 
goal and redeploy, if re-deployment error, it is the xml file configuration errors, if no redeployment
is not being given to 
⑦.404 error Solution: when a program error occurs path 404, if it can not find what error, use the mouse
mark on looking into hyperlinks, look at the browser status bar at the bottom of the road and path is the current file into the relatively 
⑧. when redeploy the project to the server, if the console after deployment nothing is printed and when re-access items
when the purpose of the page path and page 404 there was an error report, shut down the server and then start to try (to restart the compiler will not do) 
⑨. 404/400 pages appear in a browser, check whether the Web properly deployed to the server and the browser's address
input column address and port number is correct depends on the project name> Propertics> MyEclipse> Web> Context  root
name> Web Context-root right is And / or project name, like, Jsp file can only be placed WebRoot
directory 
⑩. "Can not display the webpage" page in a browser, check the Tomcat service is up and running properly
address and browser address bar and enter the port number is correct, then check the deployment server 
11. 500/503 page appears in the browser, indicating syntax / logic errors, or open server 
12. when the server fails to start (ie: start and immediately shut down immediately when) is because the port the program has been another
reason for occupation, you can open the task Manager to end the occupation process of the port, you can also restart the computer to solve the problem 
13. mistake deploy the project to the server happens: When the project is deployed if deployed to a sudden when an error occurs,
the server on an existing project to delete and re-deploy them 

14.MyEclipse start Tomcat News Could not find the main class wrong :( means that Ant can not find
the main class, because MyEclipse point in ANT_HOME not) Window> Preferences> Ant> Runtime  >
click on the right shows Classpath tab key> box, select one of the Ant Home entries item > click the right
side of the Ant Home button Ant Home Entries pointing instead MyEclipse plugin directory (MyEclipse installation disk 
symbol: * \ Genuitec \ Common \ plugins ).. org.apache.ant_1.7 under * v200 ** \ lib 
15. the open when / (MyEclipse) compiler to restart the project / error codes (previously not being given (to reopen / restart
after a compiler error) or code and logic are not wrong, wrong click in front of splats suggesting Change 
workspace compliance and JRE to information 1.5), because the working space profile right, before clicking on the wrong
side of splats and then double-click the Change workspace compliance and Jre to 1.5 to 

note: as your Hibernate items When head, if the program is not error, can not find something wrong place logically be

将控制台打印的hql语句转换成sql语句后的语句复制到数据库中执行,以检查hql语句的错 
误 


(2).代码错误导致报的错 
①.当页面/控制台报错时(没有遇到过的错/看不懂的错),先看错误信息中的错误信息来
源于哪个类/方法/哪行代码,在根据那行代码多试几中方法 
②.保存时发生的错误:当jsp文件中的内容改变,要保存的时候,要先把第一行的
pageEncoding属性值设置为utf-8,否则将报错不能保存 
③.启动服务器报错,可能的错误有:配置文件有错,也可能是JSP页面中的标签有错
(此时它不一定报正在使用的程序的错,有可能报其他程序的错),可以在服务器的webapps 
目录下把标签有错的项目删除 
④.JavaBean引起的错误: 
JavaBean的属性名首字母必须小写,否则即使再dao层、server层和servlet中
可以取得其中的值,在Jsp页面中无论用什么方法都不能取得 
⑤.当不出现预想的效果时,如果确认不是浏览器缓存所致,但又找不出错误和原因
并浏览器状态栏左边出现有"网页上有错误"的消息时,双击此消息>单击弹出框中的"显示 
详细信息"按钮查看错误(其中的"行"和"错误"说明了错误的位置和原因) 
⑥.当在jsp页面中用<c:foreach>和EL表达式不能取到值时,应当首先检查是否导入
c:标签库,再检查JavaBean的所有属性名首字母是否是小写 
⑦. When importing a package error, if the package name and the confirmation when the mouse is placed on the package name Import tips at The 
the Java .... a Conflicts with time A of the type defined in the same file, represents the class name and import statement 
package name conflict 
⑧ when the console has java.lang.ClassNotFoundException appear: when an error, indicating that the project can not be found
when Servlet, web.xml is probably not configured or configuration error, if it is confirmed the configuration is not wrong but still reported the error 
, it Servlet web.xml node to delete the corresponding, but also the corresponding Servlet delete new re-
built 
⑨. when a jsp page have upload function, in the form to add a form
enctype = "multipart / form-data "property, but the addition of the attribute in form in the form jsp pages after, the form of
all controls (including 
the value of the hidden form fields) can not use a general method for obtaining in a servlet, it must be added to determine what is the normal
control that is control upload files, then other methods to obtain, so when used as a parameter passed in the form of hidden parameters 
must be added to pass in the form action attribute of the form, its method
is: action = "? servlet name = value" ( : At this hidden form must be used instead of action), then it can be used in the servlet
general method for obtaining the value of the 
acquisition value jsp page came 
⑩ When a servlet jsp page jump through servle then fled to another jsp page. , page garbled
When, because there is no setting request flow and coding scheme corresponding stream, the response.setContentType (in the servlet 
"text / HTML; charset = UTF-. 8"); Request.setCharacterEncoding ( "UTF-. 8"); 
11. The control when when there is an error table "... ... will intercept the string error" occurs, because the number of fields corresponding database
data is not long enough 
12. when a page have access to any 404 or when an error occurs in the server console start Tomcat print
when an error related to the statement, probably because xml configuration file web.xml or other configuration errors may also be because the imported jar
package

Conflict. 
13. When the console appears there com.microsoft.sqlserver.jdbc.SQLServerException: to host a
TCP / IP connection fails. java.net.ConnectException: Connection refused: connect when an error 
, probably because port numbers are not a database, open SQL Server SQL Server Configuration Manager 
IP address item 2005 network configuration protocol SQLEXPRESS of TCP / IP in All TCP ports are set, 
and the activities and projects which are set / yes and Listen All items in the agreement enabled, without delay, is enabled
with both set to yes / yes, and then restart the SQL Server 2005 service SQL Server (SQLEXPRESS) to 
14. when the jump from a servlet or Action query or modify the page, if reported 500 errors and control
the print station javax.el.PropertyNotFoundException: Property 'PropertyName' not found  on
... type, probably because the target page: values <c forEach> of items directly written with "" caused by
the string, the items "" EL value should be used, i.e. it should be items = "$ {List or Object} ", or the EL 
object / attribute name and a different javaBean (carefully check) 
15. If using <jsp: forward> before jsp files have data, file execution error occurs 
16. when the console appears there is java.lang. 
"org.objectweb.asm.CodeVisitor"'s signer information does not match signer information of 
other c 
lasses in the same package的安全异常时,是因为包冲突引起的 
17.当控制台出现有com.microsoft.sqlserver.jdbc.SQLServerException:Invalid object 
name'数据库名.dbo.表名/视图名'错误时,是因为数据库中不存在指定的表名 
18.当控制台出现有Could not instantiate bean class [完整的包名+类型]:Constructor 
threw exception;nested exception is java.lang.Error:Unresolved compi 
lation problem:The 一段报错的语句 cannot be resolved的错误异常时是因为
后台有报错的代码,改正报错的代码即可 
19.当控制台/页面报有java.lang.ClassCastException:...的错时,可能是因为数据类型
装换时不对,或javabean封装/转换不对 

3.总是在控制台提示"该连接已被关闭"时,是因为dao层的connection被声明为全局的(),
改connection为局部即可 

4.当重新部署项目到Tomcat报错或部署项目时选Tomcat不能Finish时,是因为Tomcat的
Path (the Window> the Preferences> MyEclipse> the Application the Servers> Tomcat> Tomcat 6.x> Tomcat 
Home Directory, Directory Base Tomcat, Tomcat temp directory path should Tomcat installation
path of the root directory, i.e. a directory ... Tomcat 6.0) is not selected from for 

error 5.Ajax occur: 
(1) when the console appears java.lang.SecurityException:. Script names may only contain  Java
when Identifiers of error, possibly because jsp page <script type = "text / Javascript  " s
rc = "dwr / interface / dwr / aDS.js"> </ script> error codes, this code can be the interface / after
the dwr / removed 
(2). when stored in the console web.xml appears java.lang when .reflecst.InvocationTargetException errors,
probably because in Ajax web.xml configuration node all <the servlet-name> An invoker-DWR </ servle 
T-name> wrong node, the node must dwr- 
(3) when the console appears with a warning:. '?? / / ?. js' '?? / / ?. js' Page not found pathInfo = requestUrl = (? represents the
time *** path) similar information,Because <script type on jsp page = "text / Javascrip

??. t "src =" / / * js "> </ script> tag in the src path errors 


: errors occur 6.CVS 
error (1) does not commit or submit: confirm that the client and server is connected or because the MyEclipse
version than the version on the CVS server, the first Update 
(2) when .Update or Commit failed, first of all see whether the computer on and connected to the server side of the firewall is turned off 
(3). when the customer end can be connected to the server-side (ie, able to ping and can share files) but can not download the project
/ Update / Commit is because when the server firewall is not closed 


error 7.Hibernate occur: 
(1) when connected to a New database. If the new connection is not successful, but the database, it may be because
the connection address entered connection URL entry at the port, and database name wrong, or when the connection suddenly pop up a
title for the 
error window and the error in the second line prompt the when TCP / IP connection to the host has failed ..., because
for the SQL Server configuration Manager / SQL Server configuration Manager in the (resource management 
manager window) SQL Server configuration Manager (local) / SQL Server 2005 network configuration / MSSQLS ERVER
of protocol TCP / IP status is disabled (TCP / IP status is disabled because the agreement of its properties is enabled 
with is No (should be), and is enabled IP address entry No (should be)) 
(2) can not be mapped to a table JavaBean error: 
①.当生成JavaBean找不到要生成到的项目时,是因为在导如Hibernate jar包时,到
步骤"选DB Drever右边的下拉选项中选创建的数据库连接名称"时没有选择所创建的数据 
库连接名称 
②.当生成JavaBean不能生成(生成失败)时,是因为项目中没有导入Hibernate jar包 
(3).当控制台出现有org.hibernate.MappingException:Unknown entity:entity.JavaBean的
错误时,说明没有在Hibernate.cfg.xml文件中加<mapping resource="entity/Jav 
aBean.hbm.xml"/>映射文件的标签 
(4).当控制台出现有org.hibernate.id.IdentifierGenerationException:ids for this class must 
be manually assigned before calling save():entity.NetBar的错误时 
,说明没有把Hibernate.cfg.xml文件中的主键生成器标签<generator 
class="assigned"/>中的assigned设为native 
(5).当控制台出现有Exception in thread "main" 
org.hibernate.HibernateException:/hibernate.cfg.xml not found的错误时,是因为
hibernate.cfg.xml没有放在src的根 
Directory, hibernate.cfg.xml file must be placed in the root directory of src can. 
(6) in association mapping many-to-have, when the console has appeared in the Thread Exception "main." 
Org.hibernate.LazyInitializationException: could not initialize proxy-the owning Ses 
when sion was closed in error, because there is no in many-to-one section of a multi-party hbm.xml file
configuration lazy point = "false" attribute (lazy loading is delayed, off delay is false when loaded) 
(7) when the console have appeared in the Thread Exception "main" org.hibernate.LazyInitializationException:. 
could not the initialize Proxy - owning the Session at the WAS closed mistake 
when instructions 
. (8) when console appears there is Exception in thread "main"

org.hibernate.PropertyAccessException: Exception Setting Property value with CGLIB 
(sethibernate.cglib.use_r 
eflection_optimizer = false for More info) when the setter of entity.Computer.setNetBar error
description 
(9) occurs when the console has org.hibernate.. HibernateException: Illegal attempt to Associate a 
Collection with two open sessions when the error, because the last layer dao not all methods 
have a closing session (ie: no session.close ();) 
(10) occurs when the console have java.. lang.OutOfMemoryError: PermGen space error when restart the server
can be 
. (11) when performing a dao layers method returns the correct result but the data in the database has not changed, it may be
a method dao layer does not execute transactions submitted the method of the commit (); 
(12) when the console appears IDS for the this class have the MUST ... BE Manually Assigned the before Calling. 
Hibernate method (): package .JavaBean name JavaBean is located; nested exception is org.h 
ibernate.id.IdentifierGenerationException:ids for this class must be manually 
assigned before calling Hibernate方法():JavaBean所在的包.JavaBean名Ca 
used by:org.hibernate.id.IdentifierGenerationException:ids for this class must be 
manually assigned before calling Hibernate方法():JavaBean所在的包 
.JavaBean名at org.hibernate.id.Assigned.generate(Assigned.java:33)的错误时,是因
为JavaBean的映射文件:*.hbm.xml中的id节点中的<generator/>节点的class属 
性的值不是native 
(13).当控制台出现有org.hibernate.exception.GenericJDBCException:could not execute 
query 
... ... 
Caused by:com.microsoft.sqlserver.jdbc.SQLServerException:只进结果集不支持请求的
操作的错误时,一般出现于分页查询的方法中,是因为传到方法中的排除量或其 
它参数小于0(为负数) 
(14) When using Hibernate or Hibernate other frames integration in the implementation of the save / update / delet / Other
Methods, if the execution result success (not reported abnormal), but the database has no effect (data changes), because 
the reason hibernate operation only submitted to the transaction, the transaction did not submit the results to the database (ie
not manually configure a transaction commit method (the transaction by session create / start (as long as you can call GET / the Save 
/ other methods of objects / methods can get / start transaction))) 
(15) when the page / console print.
org.springframework.dao.InvalidDataAccessResourceUsageException: could not the Execute 
Query; SQL [Hibernate SQL statement after the hql conversion]; nested 
Exception iS org.hibernate .exception.SQLGrammarException: could not execute query
exception (explained hql statement is right, so Hibernate was only installed for the sql statement), because the java 
column name Bean mapping files in the corresponding database of irregularities 
(16). when the console appears there * line * numbers or * unexpected token: * or AT * 
org.hibernate.hql.antlr.HqlBaseParser * (HqlBaseParser.java: *) AT org.hibernate.hql.ast.Quer 
yTranslatorImpl.parse(QueryTranslatorImpl.java:*)或
java.lang.reflect.InvocationTargetException换行
sun.reflect.NativeMethodAccessorImpl.invoke(Nativ 
eMethodAccessorImpl.java:39)换行
java.lang.reflect.Method.invoke(Method.java:597)的错误时,是hql语句有错引起的(可能是from

Written in written form or select a SELC 
ST / slect, etc.) 
Note 1: When the page / console reported an unknown error (never encountered before and with System.out.println () tracks can not
checking the wrong place, or when when different places call the same method, place a normal call and another 
when places are always being given), print out the relevant hql statement to see if the correct 
Note 2: when the console / printed page java.lang.reflect .InvocationTargetException or
java.lang.NoSuchMethodError: org.hibernate.hql.antlr.HqlBaseParser.recover (Lantlr / Rec 
ognitionException; Lantlr / the Collections / impl / BitSet;) V error, the error is because hql statement,
the first print-related hql statement to see if hql statement correct 

errors 8.Struts occur: 
(1) .struts2 errors: 
① when starting the server console or redeploy the project to the Load print Unable. 
configuration. the include--file: / dish Fu: /.../ metadata / .me_tcat / webapps / item name / the WEB-INF / classes / ST. 
ruts.xml:. 8: 32 struts2 exception statement is because other profile or resolution of the struts2.xml
no header file 
(2) .struts1 appear By mistake 
①.当控制台出现有java.lang.IllegalArgumentException: Path Demo.jsp does not start 
with a "/" character的错误时,是因为struts-config.xml文件中<forward 
name="Demo" path="/Demo.jsp"></forward>处的path属性没有/ 
②.当控制台出现有javax.servlet.jsp.JspException:Cannot find ActionMappings or 
ActionFormBeans collection并页面上出现org.apache.jasper.JasperExceptio 
n:An exception occurred processing JSP page/*.jsp at line *的错误时,是因为jsp
页面中使用的<html:form...>表单中的action="*.do"中缺少/ 
③.当控制台出现有java.lang.NoSuchMethodException:Action[/*/*] does not contain 
specified method (check logs)的错误时,是因为当前的jsp页面的表单中传的 
参数method的值在action中没有此名的方法 
④.当浏览器出现有HTTP Status 404-Invalid path was requested的字符串或者普通
404错误时,是因为当前jsp访问Action的方式不对,因为如果是页面中的html标签表单 
Hyper-links or html tags can be added .do access the Action, or not added, but if the generic label or
it must be added .do ordinary hyperlinks to access Action 
⑤. If you can identify a beginning without access Action page (such as adding pages of information) of the code is not
an error, but an error 500 or both in print org.apache.jasper.JasperExcepti console access 
on: / ... / ... / .... jsp (29, 1) attribute attribute invalid for tag form according to TLD like
when the information might be used in control because the page or form html tags (because HTM 
L controls are automatically bound FormBean of property values, and the page and no / do not need to have the appropriate
FormBean), the control or html form can be changed to an ordinary 


error 9.Spring appear: 
. ① when using Spring, so long as a layer of newspaper space anomaly, because Spring is not called to the layer interface injection corresponding
implementation class objects 
② when the page / console print the following statement error.
when: org.springframework.orm.hibernate3.HibernateQueryException: javaBean name is not mapped

[hql语句]; 
nested exception is 
org.hibernate.hql.ast.QuerySyntaxException:javaBean名 is not mapped [hql语句],是因为Spring
的配置文 
件中没有配置相应的javabean..hbm.xml文件所致 


10.SSH出现的错误: 
(1).SSH2出现的错误 
①.当控制台打印有
org.springframework.dao.InvalidDataAccessApiUsageException:Write operations are not allowed 
in read-only mode (FlushMode.NEVER) - t 
urnyour Session into FlushMode.AUTO or remove 'readOnly' marker from 
transaction definition的错误时,是因为Spring中的Hibernate的org.springframewor 
k.orm.hibernate3.support.OpenSessionInViewFilter打开后flushMode的默认值
是MANUAL(手动)的,此时要将其改为AUTO(自动),可以在配置Hibernate的过滤节点<fi 
lter>下加
<init-param><param-name>flushMode</param-name><param-value>AUTO</param-value></init
-param>试试 
②.当用页面的<form>或<a href>访问/调用action时,如果访问的路径和struts.xml
中<package>节点下的namespace的值相同也和<package>节点下<action>节点中的name 
的值是相同的,但就是报404/其它错误时先看applicationContext.xml中的创建
的action对象的id值是否和struts.xml中<package>节点下的<action>节点中的class的 
值是否相同,如果是相同的也还报这个错,再看web.xml中配置的struts2的过滤
方式:<filter-mapping>节点下的<url-pattern>节点的值是否是/*或/action 
③.当执行到层的insert/update/delete方法时,如果控制台打印执行成功且没有报
错但数据库中的数据没有改变时,是因为事务没有配置对的问题 
④.配置Spring时,如果确定配置无错且和以前配的一模一样,但是它总是报以前出
现过的错或无效果时,是因为服务器中任然还 残留 以前的代码,将服务器中的项目彻底删 
除后重新部署即可 
⑤.当控制台/页面打印java.lang.RuntimeException:Invalid action class configuration 
that references an unknown class named [className ] error, since str 
does not match the target and action statements uts2 profile configured / return, in short, is the configuration file
and program configuration conflicts caused 
Note 1: When the Page / Control Taiwan reported an unknown error (never encountered before and () are used to track System.out.println
when not checked the wrong place, or when you call the same method in a different place, a place normally call the other 
place has always when being given), print out the relevant hql statement to see if the correct 
Note 2: when the console / page printed java.lang.reflect.InvocationTargetException or
java.lang.NoSuchMethodError: org.hibernate.hql.antlr.HqlBaseParser.recover (Lantlr 
/ RecognitionException; Lantlr / the Collections / impl / BitSet;) V of error, because hql language
sentence errors, the first print-related hql statement to see if there is hql statement correct 

errors (2) .SSH1 appears 
① when. Print console java.lang.NullPointerException null pointer exception, possibly in Spring Note

册Struts时只注册了:<bean name="Struts中<action节点的path属性的值" class= 
"Struts的action的路径"></bean>节点而没有将Spring中已创建的服务层或其
它层的实现类对象注入到Spring中注册Struts时的<bean>节点中,也可能是Struts的配置 
文件中<action-mappings>节点下的<action>节点中的type属性的值没有改为
org.springframework.web.struts.DelegatingActionProxy 
②.当控制台什么也没有打印,而浏览器打印有HTTP Status 500 - No action instance 
for path /项目名 could be created的错误时,是因为既没有导入Spring 2.0 We 
b Libraries jar包也没有在Struts中的<message-resources节点下加<plug-in 
className="org.springframework.web.struts.ContextLoaderPlugIn"><set-propert 
y property="contextConfigLocation" 
value="/WEB-INF/classes/applicationContext.xml"/></plug-in>节点 
③.当控制台打印java.lang.ClassNotFoundException: 
When org.springframework.web.struts.ContextLoaderPlugIn error, because there is no import Spring jar package
check 2 the Spring 
.0Web i.e. without introducing the Libraries items Spring 2.0 Web Libraries jar package 
④ When the console Printing java.lang.IllegalStateException.: the WebApplicationContext found NO: NO 
? ContextLoaderListener Registered mistake, it may be Struts configuration file did not 
have to configure <the Plug-in 
className = "org.springframework.web.struts.ContextLoaderPlugIn"> <the SET-Property 
Property = "contextConfigLocation" value = "/ the WEB-INF / Clas 
SES / applicationContext.xml" /> </ the Plug-in> 
Note 1: when the page / console reported an unknown error (never encountered before and with System.out.println () are tracked
can not check the wrong place, or when you call the same method in a different place, a place where the normal call and the other 
when a place was always being given), print out the relevant hql statement to see if the correct 
Note 2: when the console / printed page or java.lang.reflect.InvocationTargetException
java.lang.NoSuchMethodError: org.hibernate.hql.antlr.HqlBaseParser.recover (Lantlr 
/ RecognitionException; Lantlr / the Collections / impl / BitSet;) V of error, because hql language
sentence errors, the first print-related hql statement, hql statement to see if the correct 


error 11.Ext occur: 
(1) when the desired effect does not occur, if not confirmed due to the browser cache, but can not find the error and the cause and Liu
left the browser status bar appears when the "error on page" message, double-click the message> click the pop-up box "show Details 
" button to view the error (one of the "line" and "wrong" describes the location and cause of errors) 
(2) when using Ext, if it is determined the code is not wrong, but without the desired results, may not be introduced into the jar package or not
there js introduction of imported, or did not Ext components rendered to div: ie no renderTo: "div of id value ", or 
without creating new keywords, or because the code is missing or what symbols (,;:" "() {} [] and so on), or code
in the wrong order, or style files described include Ext and when the character library file descriptor * / adapter / ext / ext- base.js the 
sequence is not in * / ext-all.js of Before the introduction of, in the case of the above are no effect is because when the browser's cache
reason, again deleted from the server and then deploy the project to 
(3) When using a hyperlink or a button's onclick event pop Ext, but just pop moment on the pin Ext lost (destroyed), and

Continued to the next step to locate a different path, and its value is # ie it is positioned so as to maintain the current position
rendering of Ext

(4).当用javascript(Ajax/Ext)调用其它层的方法时,如果总是进不了方法,先检查javascript
中使用的其它层的对象名和dwr中<create>节点的javascript的值是否一样,再检 
查调用的方法所传的参数和其它层中方法的参数的个数和类型是否相对应 
(5).当控制台出现有java.lang.SecurityException:class "org.objectweb.asm.CodeVisitor"'s 
signer information does not match signer information of other clas 
ses in the same package的安全异常时,是因为包冲突引起的,将导入的json中的
commons-collections.jar删除试试 
(6).当控制台出现有org.hibernate.LazyInitializationException:failed to lazily initialize a 
collection of role:包名(entity).一个javaBean名.javaBean名adjus 
tsForAfterjavaBean名,no session or session was closed延时加载的错误时,是因为将
HashMap转化为JSon时,HashMap中的数据不是String或基本数据类型,HashMap中的 
数据不不能为对象型 
(7).呈现Ext时如果在页面的前面和后面都同时出现相同的Ext界面,是因为js中多写了
renderTo property 


12.JavaScript debugging: 
(1) When using js, if re-change the contents of the js and then running has no effect on any of the page, change the contents of the
print process js a string (alert ( "string") ;), refresh the page after saving will have the effect of 


laws: 
1. MyEclipse because sometimes "silly", so if the case can confirm all the code is correct but the effect is still not
out of it, then redeploy, start the server, Close MyEclipse restart 
2. to determine whether the value of a List / set, can not be used in conjunction with .equals (null), should be used in combination .size (); 
3. when the edit window Chinese distortion, right-click the current edit window explorer packet corresponding to the class / direct Right
-click the package where the class> Properties> resource> Text file Other radio button is selected in the encoding and 
select UTF-8 to its drop-down list of 


two .ASP. NET program debugging and error collection 
document.all.Image1.src = document.all.FileUpload1.value; 
with (document.all) 

Image1.src = FileUpload1.value; 

error: one time I put on a written code the document.all.Image1.src = FileUpload1.value ; Resulting in
the wrong 


three .SQL Server debugging and error collection 
1. When the console print " '' Incorrect syntax near" because the SQL statement has a full-width space 
2. When the console print "truncated string or binary data.", Because the insertion of a field data length is too large
(larger than the length of the fields defined)

3.当数据库连接不上时先检查SQL Server配置管理器/SQL Server configuration manager中
各项的配置 
SQL Server配置管理器(本地)/SQL Server Configuration Manager(Local)节点下的SQL本地
客户端配置/SQL Native Client Configuration节点中客户端协议/Client Protoc 
ols中的TCP/IP项中的已启用/Enabled的值可为是(Yes)/否(No)、默认端口/Default Port
的值可更改. 
SQL Server配置管理器(本地)/SQL Server Configuration Manager(Local)节点下的SQL 
Server 2005网络配置/SQL Server 2005 Network Configuration节点下的"服务名(SQ 
LEXPRESS)+的协议"/Protocols for 服务名(SQLEXPRESS)节点中TCP/IP项中协议/Protocol
下的已启用/Enabled的值最好为是(Yes),不行时再改为否(No)、无延迟的值最好为否 
(No),不行时再改为是(Yes)、全部监听的值为是、IP地址/IP Addresses下的所有的活动
/Active的值为是(Yes)、激活/Enabled的值可为是(Yes)/否(No)、TCP动态端口/两项TC 
P Dynamic Ports的值可随意 
n.当安装SQL Server2000时,如果重新装了系统都还总是提示"本计算机上已存在实例"类型
的语句时,重新改过用户名即可重新安装 


四.Oracle程序调试与错误收集 
1.使用SQL Plus时如果出现ERROR: ORA-12541:TNS:没有监听器,是因为监听器服务没有启
动,控制面板>管理工具>服务>将OracleOraHome92TNSListener的服务启动即可 
如果出现ERRORORA-12500:TNS:监听程序无法启动专用服务器进程,
是因为数据库对应的服务没有启动,控制面板>管理工具>服务>将OracleServiceSID(SID为数 
据库实例名)的服务启动即可 


五.MySQL出现的错误 
1.当建表时弹出错误提示对话框并提示"Can't create table 'tableName' (errno:150)时,是因
为当前表中关联了另一张不存在的表(注:一定要是150错误才是此原因)

Guess you like

Origin www.cnblogs.com/runtojiajia/p/11091202.html