使用Olingo V4创建odata服务时出错

时间:2018-08-29 14:45:07

标签: java maven noclassdeffounderror olingo

我正在用我的Java代码构建一个odata服务,当我尝试运行它时,出现以下错误:

java.lang.ClassNotFoundException: org.apache.olingo.commons.api.edm.provider.CsdlEdmProvider

这是我在以下位置运行该应用程序的tomcat的完整日志:

ago 29, 2018 11:28:18 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
ADVERTENCIA: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:DemoService' did not find a matching property.
ago 29, 2018 11:28:18 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMACIÓN: Server version:        Apache Tomcat/9.0.8
ago 29, 2018 11:28:18 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMACIÓN: Server built:          Apr 27 2018 19:32:00 UTC
ago 29, 2018 11:28:18 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMACIÓN: Server number:         9.0.8.0
ago 29, 2018 11:28:18 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMACIÓN: OS Name:               Windows 10
ago 29, 2018 11:28:18 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMACIÓN: OS Version:            10.0
ago 29, 2018 11:28:18 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMACIÓN: Architecture:          amd64
ago 29, 2018 11:28:18 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMACIÓN: Java Home:             C:\Program Files\Java\jre1.8.0_161
ago 29, 2018 11:28:18 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMACIÓN: JVM Version:           1.8.0_161-b12
ago 29, 2018 11:28:18 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMACIÓN: JVM Vendor:            Oracle Corporation
ago 29, 2018 11:28:18 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMACIÓN: CATALINA_BASE:         C:\Users\l_lop\eclipse-workspace-photon\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
ago 29, 2018 11:28:18 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMACIÓN: CATALINA_HOME:         D:\Apache Software Foundation\apache-tomcat-9.0.8
ago 29, 2018 11:28:18 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMACIÓN: Command line argument: -Dcatalina.base=C:\Users\l_lop\eclipse-workspace-photon\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
ago 29, 2018 11:28:18 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMACIÓN: Command line argument: -Dcatalina.home=D:\Apache Software Foundation\apache-tomcat-9.0.8
ago 29, 2018 11:28:18 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMACIÓN: Command line argument: -Dwtp.deploy=C:\Users\l_lop\eclipse-workspace-photon\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
ago 29, 2018 11:28:18 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMACIÓN: Command line argument: -Djava.endorsed.dirs=D:\Apache Software Foundation\apache-tomcat-9.0.8\endorsed
ago 29, 2018 11:28:18 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMACIÓN: Command line argument: -Dfile.encoding=Cp1252
ago 29, 2018 11:28:18 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFORMACIÓN: La biblioteca nativa de Apache Tomcat basada en ARP que permite un rendimiento óptimo en entornos de desarrollo no ha sido hallada en java.library.path: [C:\Program Files\Java\jre1.8.0_161\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jre1.8.0_161/bin/server;C:/Program Files/Java/jre1.8.0_161/bin;C:/Program Files/Java/jre1.8.0_161/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\system32\config\systemprofile\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\dotnet\;C:\WINDOWS\System32\OpenSSH\;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Python27;C:\Users\l_lop\AppData\Local\Microsoft\WindowsApps;;C:\WINDOWS\system32;;.]
ago 29, 2018 11:28:18 AM org.apache.coyote.AbstractProtocol init
INFORMACIÓN: Initializing ProtocolHandler ["http-nio-8080"]
ago 29, 2018 11:28:18 AM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFORMACIÓN: Using a shared selector for servlet write/read
ago 29, 2018 11:28:18 AM org.apache.coyote.AbstractProtocol init
INFORMACIÓN: Initializing ProtocolHandler ["ajp-nio-8009"]
ago 29, 2018 11:28:18 AM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFORMACIÓN: Using a shared selector for servlet write/read
ago 29, 2018 11:28:18 AM org.apache.catalina.startup.Catalina load
INFORMACIÓN: Initialization processed in 695 ms
ago 29, 2018 11:28:18 AM org.apache.catalina.core.StandardService startInternal
INFORMACIÓN: Arrancando servicio [Catalina]
ago 29, 2018 11:28:18 AM org.apache.catalina.core.StandardEngine startInternal
INFORMACIÓN: Starting Servlet Engine: Apache Tomcat/9.0.8
ago 29, 2018 11:28:21 AM org.apache.jasper.servlet.TldScanner scanJars
INFORMACIÓN: Al menos un JAR, que se ha explorado buscando TLDs, aún no contenía TLDs. Activar historial de depuración para este historiador para una completa lista de los JARs que fueron explorados y de los que nos se halló TLDs. Saltarse JARs no necesarios durante la exploración puede dar lugar a una mejora de tiempo significativa en el arranque y compilación de JSP .
ago 29, 2018 11:28:24 AM org.apache.catalina.core.ContainerBase startInternal
GRAVE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/DemoService]]
    at java.util.concurrent.FutureTask.report(Unknown Source)
    at java.util.concurrent.FutureTask.get(Unknown Source)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:949)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:839)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1427)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1417)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.util.concurrent.AbstractExecutorService.submit(Unknown Source)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:943)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:258)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:770)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:682)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:350)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/DemoService]]
    at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:441)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1427)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1417)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.util.concurrent.AbstractExecutorService.submit(Unknown Source)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:943)
    ... 21 more
Caused by: java.lang.NoClassDefFoundError: org/apache/olingo/commons/api/edm/provider/CsdlEdmProvider
    at java.lang.Class.getDeclaredFields0(Native Method)
    at java.lang.Class.privateGetDeclaredFields(Unknown Source)
    at java.lang.Class.getDeclaredFields(Unknown Source)
    at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:110)
    at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:267)
    at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:135)
    at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:67)
    at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:328)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:768)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:299)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4989)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    ... 27 more
Caused by: java.lang.ClassNotFoundException: org.apache.olingo.commons.api.edm.provider.CsdlEdmProvider
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1292)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1121)
    ... 40 more

ago 29, 2018 11:28:24 AM org.apache.catalina.core.ContainerBase startInternal
GRAVE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: A child container failed during start
    at java.util.concurrent.FutureTask.report(Unknown Source)
    at java.util.concurrent.FutureTask.get(Unknown Source)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:949)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:258)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:770)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:682)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:350)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492)
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:958)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:839)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1427)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1417)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.util.concurrent.AbstractExecutorService.submit(Unknown Source)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:943)
    ... 13 more

ago 29, 2018 11:28:24 AM org.apache.catalina.startup.Catalina start
GRAVE: The required Server component failed to start so Tomcat is unable to start.
org.apache.catalina.LifecycleException: A child container failed during start
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:958)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:258)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:770)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:682)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:350)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492)

ago 29, 2018 11:28:24 AM org.apache.coyote.AbstractProtocol pause
INFORMACIÓN: Pausing ProtocolHandler ["http-nio-8080"]
ago 29, 2018 11:28:24 AM org.apache.coyote.AbstractProtocol pause
INFORMACIÓN: Pausing ProtocolHandler ["ajp-nio-8009"]
ago 29, 2018 11:28:24 AM org.apache.catalina.core.StandardService stopInternal
INFORMACIÓN: Parando servicio [Catalina]
ago 29, 2018 11:28:24 AM org.apache.coyote.AbstractProtocol destroy
INFORMACIÓN: Destroying ProtocolHandler ["http-nio-8080"]
ago 29, 2018 11:28:24 AM org.apache.coyote.AbstractProtocol destroy
INFORMACIÓN: Destroying ProtocolHandler ["ajp-nio-8009"]

这是我的pom.xml文件:

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>my.group.id</groupId>
    <artifactId>DemoService</artifactId>
    <packaging>war</packaging>
    <version>4.0.0</version>

    <name>DemoService Maven Webapp</name>

    <properties>
        <javax.version>2.5</javax.version>
        <odata.version>4.0.0</odata.version>
        <slf4j.version>1.7.7</slf4j.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>${javax.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.olingo</groupId>
            <artifactId>odata-server-api</artifactId>
            <version>${odata.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.olingo</groupId>
            <artifactId>odata-server-core</artifactId>
            <version>${odata.version}</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.olingo</groupId>
            <artifactId>odata-commons-api</artifactId>
            <version>${odata.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.olingo</groupId>
            <artifactId>odata-commons-core</artifactId>
            <version>${odata.version}</version>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>${slf4j.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.11</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20180813</version>
        </dependency>
    </dependencies>
</project>

到目前为止,根据我的研究,有关java.lang.NoClassDefFoundError的问题是,在大多数情况下,类加载器在运行时找不到类(在本例中为.jar)。 我现在正在使用Eclipse Photon,但是Eclipse Oxygen也遇到了同样的问题。 还使用了Tomcat 8和9。 这是我正在关注的教程tutorial 我非常感谢有关如何解决此问题的任何提示

0 个答案:

没有答案