When classloader is used, the following error occurs: Java. Lang. noclassdeffounderror

Source: Internet
Author: User

When classloader is used to load resources, the following errors often occur:

Exception in thread "Main" Java. Lang. noclassdeffounderror: COM/tools/result
At java. Lang. Class. getdeclaredconstructors0 (native method)
At java. Lang. Class. privategetdeclaredconstructors (class. Java: 2328)
At java. Lang. Class. getconstructor0 (class. Java: 2640)
At java. Lang. Class. newinstance0 (class. Java: 321)
At java. Lang. Class. newinstance (class. Java: 303)
At com. Npower. dm. Tools. Backup. startup. Main (startup. Java: 78)

Solution:

Do not add useless classes in the same package

During packaging, you only need to call startup. Java instead of other classes,

Classloader will find it and load it after finding it

If the classloader is packed and loaded, it will be repeated, so the above situation occurs.

 

I found that what I said may not be clear. I found that it is also very knowledgeable to describe an event. I will strengthen it later!

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.