Reasons for using axis to appear java.lang.NoClassDefFoundError

Source: Internet
Author: User
Tags web services

A Web Services service was published using axis, but the error shown in the following illustration appears when looking at the list of all services:

It's scary to see, but look, it's because Axis did not find the class when it loaded the class that provided the service. But this kind of deployment is not wrong, WSDD configuration is also sure that there is no fault, how can not find the class? This problem was later discovered because the class had a static block for initialization, which was directly caused by the fact that a class variable was not initialized in this initialization fast. But why not report nullpointerexception mistakes. Instead, it's a bunch of scary and inexplicable mistakes that just pop up.

Then I analyzed it, and I think (purely personal), the reason may be this:

When viewing the list of all services in the service through a browser, axis loads each service-providing class through the Class.forName method, and executes the static block if the loaded class has a static block. But if an error occurs (for example, the nullpointerexception mentioned above) when the block is executed, all Noclassdeffounderror errors are thrown. Therefore, as far as axis is concerned, as long as the class does not load successfully, even if the class exists, it is considered that the class is not found.

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.