JSP common exceptions (in the collation)

Source: Internet
Author: User
Tags numeric value xml parser tld

Abnormal

Javax.servlet.jsp.JspException:Cannot Retrieve mapping for Action/login (/login is your action name)

Possible causes

The action is not defined in Struts-config.xml, or no matching action is found, such as using

Login.do processing, if the above exception occurs, look at the definition section in Struts-config.xml, which may sometimes be a wrong character or some inconsistent rule that can be checked using the Struts console tool.

--------------------------------------------------------------------------------------------------------------- --

Abnormal

Org.apache.jasper.JasperException:Cannot retrieve definition for form bean null

Possible causes

This exception is because struts does not find the form bean that the action expects according to the mapping in Struts-config.xml. Most of the cases may be due to a mismatch between the Name property set in Form-bean and the Name property set in action. In other words, the action and form should each have a name attribute and match exactly, including case. This error occurs when there is no Name property and an action association, and if the Name property is not specified in the action, then there is no Name attribute associated with the action. Of course, when the action makes certain controls, such as jumping to the corresponding JSP page based on the parameter value, rather than processing the form data, this is not using the name attribute, which is one of the ways to use the action.

--------------------------------------------------------------------------------------------------------------- --

Abnormal

No action instance for Path/xxxx could is created

Possible causes

Special tip: Because there are many situations that can lead to this error, it is recommended that you increase the log/debug level of your Web server so that you can see potential errors in trying to create an action class from more information. This action class you have already set up the association in Struts-config.xml (that is, added <action> tags). There are a number of reasons why the action class specified by the action tag's class attribute in Struts-config.xml cannot be found, for example, when locating a compiled. class file fails. Failure to places compiled. class file for the "action in the Classpath" (in WEB development, the position of class is in R web-inf/classes, so your action Clas s must be in this directory. For example, if your action class is located in Web-inf/classes/action/login.class, then the property type of the action in Struts-config.xml is Action.login). Spelling mistakes, This is also frequent and difficult to find, paying special attention to the case of the first letter and the name of the package.

--------------------------------------------------------------------------------------------------------------- --

Abnormal

Javax.servlet.jsp.JspException:No Getter method to property username of Bean Org.apache.struts.taglib.html.BEAN

Possible causes

There is not a variable in the bit form bean that defines the Getter method

This error occurs primarily in the form submission Formbean, when

--------------------------------------------------------------------------------------------------------------- --

Abnormal

Java.lang.noclassdeffounderror:org/apache/struts/action/actionform

Possible causes

This error mainly occurs when the corresponding Java. class file is not found in the classpath. If this error occurs when the Web application is running, it is primarily because the specified class file is not in the classpath of the Web server (/web-inf/classes and/web-inf/lib). In the above error, the reason is that the Actionform class cannot be found.

--------------------------------------------------------------------------------------------------------------- --

Abnormal

Javax.servlet.jsp.JspException:Exception creating Bean of Class Org.apache.struts.action.ActionForm: {1}

Possible causes

Instantiating struts-provided Actionform class directly instead of instantiating a class derived off actionform. This might occur implicitly if and specify that a Form-bean are this Struts Actionform class rather than specifying a child The This class is for the Form-bean. Not associating a actionform-descended class with an action can also leads to this error.

--------------------------------------------------------------------------------------------------------------- --

Abnormal

Javax.servlet.jsp.JspException:Cannot find Actionmappings or Actionformbeans collection

Possible causes

The <servlet> tag that does not identify the struts Actionservlet is either a map of the <sevlet-mapping> tag of the do extension or neither is declared in Web.xml. Typing or spelling errors in Struts-config.xml can also cause this anomaly to occur. For example, the closing symbol/> For a tag is missing. It is best to check with the Struts console tool.

In addition, Load-on-startup must be declared in Web.xml, which is either an empty tag or a numeric value that is used to prioritize the operation of the servlet, and the higher the value, the lower the priority.

Another concern with using Load-on-startup is that this exception can also be caused by precompiling a JSP file with struts.

--------------------------------------------------------------------------------------------------------------- --

Abnormal

Java.lang.NullPointerException at Org.apache.struts.util.RequestUtils.forwardURL (requestutils.java:1223)

Possible causes

The forward element in Struts-config.xml is missing the path attribute. For example, it should be the following form:

<forward name= "Userhome" path= "/user/userhome.jsp"/>

--------------------------------------------------------------------------------------------------------------- --

Abnormal

Javax.servlet.jsp.JspException:Cannot Find beans Org.apache.struts.taglib.html.BEAN in any scope

Probable causes

You tried to use the child elements of a form outside of the form tag of struts. This often happens when you use the HTML tag of struts after

Also note that you may inadvertently use a

Also, when you use Taglib to introduce an HTML tag library, the prefix value you use is not HTML.

--------------------------------------------------------------------------------------------------------------- --

Abnormal

Javax.servlet.jsp.JspException:Missing Message for key xx.xx.xx

Probable causes

The value pair for this key is not defined in the resource file applicationresources.properties. When you use Eclipse, you often encounter situations where, when a project is recompiled,

Eclipse automatically deletes the resource files in the classes directory.

Resource file Applicationresources.properties classpath should not be placed in the Web-inf/classes directory, of course, in Struts-config.xml

Definition

--------------------------------------------------------------------------------------------------------------- --

Abnormal

Cannot find under key Org.apache.struts.action.MESSAGE

Possible causes

Obviously, this error occurs when a resource file is being used, and struts does not find the resource file.

Implicitly trying to use message, are not available (such as using empty html:options tag instead of specify Ing

The options in their body--this assumes options are specified in Applicationresources.properties file)

XML parser Issues--too many, too few, incorrect/incompatible versions

--------------------------------------------------------------------------------------------------------------- --

Abnormal

Strange and seemingly random characters in HTML and on screens, but not in original JSP or servlet.

Possible causes

Html:form tags and standard HTML tags that mix and use struts are incorrect.

The encoding style used is not supported on this page.

--------------------------------------------------------------------------------------------------------------- --

Abnormal

"Document contained no data" in Netscape

No data rendered (completely empty) page in Microsoft Internet Explorer

Possible causes

A derived class that uses an action does not implement the Perform () method or the Execute () method. Implemented in Struts1.0 is the Perform () method, which is implemented in Struts1.1

Execute () method, but Struts1.1 backward-compatible perform () method.

But you use Struts1.1 to create a derived class of action and implement the Execute () method, and if you run in Struts1.0, you get the Document contained no

Data "error message in Netscape or a completely empty (no HTML whatsoever) page rendered in Microsoft Internet Explorer." Of

Error message.

--------------------------------------------------------------------------------------------------------------- ------------

Abnormal

ServletException:BeanUtils.populate

Solution

A Javax.servlet.ServletException:BeanUtils.populate exception was encountered while uploading files with struts.

My actionservlet did not use beanutils these tools classes. Later, carefully check the code found in the JSP file form forgot to add enctype= "Multipart/form-data"; Out. So write a program to encounter errors or anomalies should be considered in many aspects of the possibility of the problem, think of the system hint information outside of things.

--------------------------------------------------------------------------------------------------------------- -------------

1. After defining the action, if name is specified, a formbean with the same name must be defined to perform a form mapping.

2. If the action is defined, the "No input attribute for mapping path ..." appears when the page is submitted. Error, you need to define the page for the change in its input property.

3. "Batch Update row count wrong: ..." appears if new data is inserted. Error, the type of key specified in XXX.hbm.xml is of the original type (int, long).

Because this type automatically assigns a value, which often makes the system think that the record already exists, the correct approach is to use the Java.lang.Integer or Java.lang.Long object.

4. If the "argument type Mismatch" error occurs when inserting data, you may have used special objects such as date, because struts cannot automatically convert from string to date type.

So, you need to manually convert the string to the date type in the action.

5. In hibernate, query's iterator () is much faster than the list () method.

6. If a "equal symbol expected" error occurs, your strtus tag contains another label or variable, such as:

Or

Such a situation ...

--------------------------------------------------------------------------------------------------------------- ------------

Error:

Exception in thread ' main ' org.hibernate.exception.SQLGrammarException:Could not execute JDBC batch update

Reasons and Solutions:

Because Hibernate tools (or the eclipse itself, database Explorer) generate the *.hbn.xml tool that contains catalog= "* *" (* representing the name of the databases)

property, you can delete the property.

--------------------------------------------------------------------------------------------------------------- ------------

Error:

Org.hibernate.ObjectDeletedException:deleted object would is re-saved by cascade (remove deleted object from associations )

Reasons and Solutions:

Method 1 Delete The cascade of the Set Square

Method 2 after resolving the association relationship, delete the

Method 3 adds Cascade to Many-to-one but the value cannot be none

Last resort:

Check to see if hashcode equals used the ID as the only marked option; I have no problem with Uuid.hex, but with native, I can't. Delete AH.

--------------------------------------------------------------------------------------------------------------- -------------

Problem:

Today, with Tomcat 5.5.12, found that the original very good use of the system can not be used, repeated tests found that the page can not contain taglib, otherwise, the following prompts will appear:

HTTP Status 500-type Exception

Message

Description The server encountered an internal error () is prevented it from fulfilling this request.

exception

Org.apache.jasper.JasperException:/index.jsp (1,1) Unable to read TLD "Meta-inf/tlds/struts-bean.tld" from JAR file

"File:*****/web-inf/lib/struts.jar":

Reason:

Updated the jar under the project's Lib folder and released Servlet.jar and Jsp-api.jar.

Solve:

Removing the Jsp-api.jar will solve the problem.

--------------------------------------------------------------------------------------------------------------- --------------

Error: Java.lang.NullPointerException

Cause: Discovery of DAO instances, manage instances, etc. that need to be injected is not injected (commonly known as null pointer exception)

Resolve: This time, you should check the log file; The default is the application server log file, such as Tomcat is [Tomcat installation directory]/logs; you will find that you are prompted:

May be:

Org.springframework.beans.factory.BeanCreationException:Error creating Bean with Name ' SF ' defined in ServletContext

Resource [/web-inf/applicationcontext.xml]: Initialization of Bean failed; Nested exception is

Org.hibernate.HibernateException:could not configure from Url:file:src/hibernate.cfg.xml

Org.hibernate.HibernateException:could not configure from Url:file:src/hibernate.cfg.xml

............................

caused By:java.io.filenotfoundexception:src/hibernate.cfg.xml

May be:

Org.springframework.beans.factory.BeanCreationException:Error creating Bean with Name ' sessionfactory ' defined in

ServletContext resource [/web-inf/applicationcontext.xml]: Initialization of Bean failed; Nested exception is

Org.hibernate.mappingexception:resource:com/mcc/coupon/model/userrole.hbm.xml not found

Org.hibernate.mappingexception:resource:com/mcc/coupon/model/userrole.hbm.xml not found

Then you know the reason is because the configuration file parsing error, this through the Web page is not visible.

More is the persistence of the mapping file out of the error, resulting in not being resolved, of course, you need the function can not be used.

--------------------------------------------------------------------------------------------------------------- -------------

Error:

Standardwrappervalve[action]: Servlet.service () for Servlet action threw exception

Javax.servlet.jsp.JspException:Cannot Retrieve mapping for Action/settlementtypemanage

Or:

Type Status

Message Servlet action isn't available

Description The requested resource (Servlet action isn't available) is not available.

Reason: ditto

--------------------------------------------------------------------------------------------------------------- -------------

Error

STANDARDWRAPPERVALVE[JSP]: Servlet.service () for Servlet JSP threw exception

Java.lang.ClassNotFoundException:org.apache.struts.taglib.bean.CookieTei

Interface Error Specific Description:

org.apache.jasper.JasperException:Failed to load or instantiate Tagextrainfo class: Org.apache.struts.taglib.bean.CookieTei

Reasons and Solutions:

< scheme one > your "HTML:" The labels that start with are not in a

< two > Restart your application server, automatically does not have this problem

--------------------------------------------------------------------------------------------------------------- -------------

Error

ERROR [Engine] standardwrappervalve[jsp]: Servlet.service () for Servlet JSP threw exception

Java.lang.IllegalStateException:getOutputStream () has already been called for this response

Reason

This is the Out.write ("") in the servlet code generated by the Web container, which conflicts with the Response.getoutputstream () that is invoked in the JSP.
The servlet specification describes that you cannot call both Response.getoutputstream () and Response.getwriter (), regardless of which one you first call, and the second time you call should throw IllegalStateException, because in the JSP, out variable is obtained through Response.getwriter, in the program both uses the Response.getoutputstream, and uses out the variable, therefore appears above error.


Solution:
1. Add in the program:
Out.clear ();
out = Pagecontext.pushbody ();

2. Do not write content between%][% including spaces and line breaks
3. When the page is written to the picture, you need flush ()
OutputStream Output=response.getoutputstream ();
Output.flush ();

--------------------------------------------------------------------------------------------------------------- --

Abnormal

Java.lang.IllegalArgumentException:Illegal Group Reference

Possible causes

Java-reported exception when using ReplaceAll ("", "$") which contains $ characters. Some say it is a bug in the JDK, but the specific reason has not been specifically explained. View the constituent code of the ReplaceAll () there are a few estimates of the problem that are here:

Char Nextchar = replacement.charat (cursor);
if (Nextchar = = '////') {
cursor++;
Nextchar = Replacement.charat (cursor);
Result.append (Nextchar);
cursor++;
else if (Nextchar = = ' $ ') {
Skip past $
cursor++;

Workaround: Rewrite "$" as//$

--------------------------------------------------------------------------------------------------------------- --

Abnormal

Java.lang.StringIndexOutOfBoundsException:String index out of range:-1

Possible causes: array out of bounds because there is no judgment as to whether the field to take is enough to specify the number of characters

Solution:

For example, if you want to take the first 10 characters of a result set string, do string length judgments first

String str=rs.getstring ("Title");
Str=str.trim ();
if (Str.length () >10) str= str.substring (0,10);//Use the substring (0,10) method to remove the first 10 characters. may be substring (0,9)
else str= str.substring (0,str.length ());


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.