Java Se: Summary of common exceptions

Source: Internet
Author: User
Tags java se

No developer dares to say that there is no problem with the program they are developing, and no one dares to say that they are not experiencing problems during the development process. When a problem is encountered, the problem is usually fixed by debugging according to the exception, error, or message in the log.

Of course, some common problems, or need to summarize, once again encountered such a problem, we know how to deal with it, the following list some of the problems encountered during the development process.

Nullponitexception

This anomaly can be said to be the most common anomaly. When this problem is encountered, most of the time is due to the absence of a null value to judge, in this case, you have to add a null value processing.

However, when we are looking at the problem, it is important not only to deal with the null value, but also to investigate why the data is empty. I've dealt with a problem that occurs when the console accesses a JMS resource, and when the nullpointexception is found, the data obtained is NULL. However, this value is not expected to be null in the actual case. This means that there are other potential problems that exist.

ClassNotFoundException

This class is also better understood. But finding the cause of the problem is not easy. If you want to easily find out the cause of this problem, you need to know something about ClassLoader's knowledge. This error occurs when the class is loaded, loaded with the string name of the class, and looks for the class from the ClassLoader search.

When this problem occurs, you may have the following reasons:

1) Under the search path, there should be a class or a jar, but not.

2) Search path error, this corresponds to ClassLoader use error or classloader the search path is not set correctly.

3) for applications that use OSGi, the search path has this class, but it is not found, it is necessary to check from the Manfist file whether the package is located in the Export-package.

Java Se: Summary of common exceptions

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.