java.lang.NoClassDefFoundError: org/apache/commons/discovery/tools/DiscoverSingleton

后端 未结 2 739
梦如初夏
梦如初夏 2021-02-18 18:01

I have create a registration form in jsp file with jsf and I try to connect it with a web service in order to pass through this the elements to a database.

When I press

相关标签:
2条回答
  • 2021-02-18 18:19

    java.lang.NoClassDefFoundError: org/apache/commons/discovery/tools/DiscoverSingleton

    This just means that the mentioned class (or a JAR file containing the class) is missing in the webapp's runtime classpath.

    As the package name hints, the class is part of Apache Commons Discovery which is available for download at http://commons.apache.org/discovery. If you just drop its JAR file(s) in /WEB-INF/lib of your webapp (which is covered by webapp's runtime classpath), then this error should disappear.

    Note that this problem has nothing to do with JSF/JSP, let alone Java EE. It's just basic Java. The root cause of the exception also hints that; it's of the java.lang package.

    0 讨论(0)
  • 2021-02-18 18:25

    The specified classes are missing from the project classpath at the time of execution of the test.

    The solution is to add the following dependency to your pom:

    <dependency>
        <groupId>commons-discovery</groupId>
        <artifactId>commons-discovery</artifactId>
        <version>0.5</version>
        <scope>test</scope> 
    </dependency>
    
    0 讨论(0)
提交回复
热议问题