The class cannot find an exception caused by:java.lang.NoClassDefFoundError

Source: Internet
Author: User

  Error Reason : When deploying the application, the server error, caused by:java.lang.ClassNotFoundException: Org.quartz.impl.JobDetailImpl, a class can not find, find the corresponding package found clearly a jar has been introduced, in a careful look found there are three similar jars, Com.alibaba.external:opensymphony.quartz,opensymphony:quartz,org.quartz-scheduler:quartz. Actually I want the package that Is Org.quartz-scheduler:quartz, there is I hope in the Org.quartz.impl.JobDetailImpl class, but found a problem opensymphony.quartz,opensymphony:quartz inside also have org . Quartz.impl package But there is no Jobdetailimpl class, but the JVM does not specify which jar to use when loading the class, such as the Org.quartz.impl package loaded into Opensymphony:quartz, but does not find Jobdetailimpl, and then An error has been made.

  workaround : Use MVN dependency:tree to get the dependency tree, find out which packages are indirectly referenced, Com.alibaba.external:opensymphony.quartz,opensymphony:quartz exclusions

            <Exclusions>                <exclusion>                    <groupId>Com.alibaba.external</groupId>                    <Artifactid>Opensymphony.quartz</Artifactid>                </exclusion>                <exclusion>                    <groupId>Opensymphony</groupId>                    <Artifactid>Quartz</Artifactid>                </exclusion>            </Exclusions>
View Code

The Org.quartz-scheduler:quartz can then be introduced.

The class cannot find an exception caused by:java.lang.NoClassDefFoundError

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.