ORDS "java -jar ords.war" 命令错误

ORDS "java -jar ords.war" command error

我正在遵循此指南:https://docs.oracle.com/cd/E56351_01/doc.30/e87809/getting-started-with-RESTful-services.htm#AELIG90200

但我卡在了 "F.2 Create a RESTful Service from a SQL Query"。

在安装 Oracle REST 数据服务的文件夹中,我在命令提示符下输入以下命令:

java -jar ords.war user test_developer "SQL Developer"

我收到了这个错误:

java.lang.NoClassDefFoundError: javax/xml/bind/ValidationEventHandler
        at java.base/java.lang.Class.getDeclaredFields0(Native Method)
        at java.base/java.lang.Class.privateGetDeclaredFields(Unknown Source)
        at java.base/java.lang.Class.getDeclaredFields(Unknown Source)
        at oracle.dbtools.injector.impl.__Reflections.constantFields(__Reflectio                           ns.java:30)
        at oracle.dbtools.injector.impl.InjectorImpl$Builder.add(InjectorImpl.ja                           va:356)
        at oracle.dbtools.injector.impl.InjectorImpl$Builder.add(InjectorImpl.ja                           va:378)
        at oracle.dbtools.injector.impl.InjectorImpl$Builder.add(InjectorImpl.ja                           va:310)
        at oracle.dbtools.common.di.Services$Builder.add(Services.java:409)
        at oracle.dbtools.common.di.Services$Builder.load(Services.java:474)
        at oracle.dbtools.common.app.ApplicationContext.loadServices(Application                           Context.java:167)
        at oracle.dbtools.cmdline.Commands.main(Commands.java:345)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Nativ                           e Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknow                           n Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Un                           known Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at oracle.dbtools.jarcl.Entrypoint.main(Entrypoint.java:58)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.ValidationEventHandl                           er
        at java.base/java.lang.ClassLoader.findClass(Unknown Source)
        at oracle.dbtools.jarcl.JarClassLoader.findClass(JarClassLoader.java:63)
        at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
        at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
        ... 16 more
java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
        at java.base/java.lang.Class.getDeclaredFields0(Native Method)
        at java.base/java.lang.Class.privateGetDeclaredFields(Unknown Source)
        at java.base/java.lang.Class.getDeclaredFields(Unknown Source)
        at oracle.dbtools.injector.impl.__Reflections.constantFields(__Reflectio                           ns.java:30)
        at oracle.dbtools.injector.impl.InjectorImpl$Builder.add(InjectorImpl.ja                           va:356)
        at oracle.dbtools.injector.impl.InjectorImpl$Builder.add(InjectorImpl.ja                           va:378)
        at oracle.dbtools.injector.impl.InjectorImpl$Builder.add(InjectorImpl.ja                           va:310)
        at oracle.dbtools.common.di.Services$Builder.add(Services.java:409)
        at oracle.dbtools.common.di.Services$Builder.load(Services.java:474)
        at oracle.dbtools.common.app.ApplicationContext.loadServices(Application                           Context.java:167)
        at oracle.dbtools.cmdline.Commands.main(Commands.java:345)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Nativ                           e Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknow                           n Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Un                           known Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at oracle.dbtools.jarcl.Entrypoint.main(Entrypoint.java:58)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
        at java.base/java.lang.ClassLoader.findClass(Unknown Source)
        at oracle.dbtools.jarcl.JarClassLoader.findClass(JarClassLoader.java:63)
        at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
        at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
        ... 16 more
java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
        at java.base/java.lang.Class.getDeclaredFields0(Native Method)
        at java.base/java.lang.Class.privateGetDeclaredFields(Unknown Source)
        at java.base/java.lang.Class.getDeclaredFields(Unknown Source)
        at oracle.dbtools.injector.impl.__Reflections.constantFields(__Reflectio                           ns.java:30)
        at oracle.dbtools.injector.impl.InjectorImpl$Builder.add(InjectorImpl.ja                           va:356)
        at oracle.dbtools.injector.impl.InjectorImpl$Builder.add(InjectorImpl.ja                           va:378)
        at oracle.dbtools.injector.impl.InjectorImpl$Builder.add(InjectorImpl.ja                           va:310)
        at oracle.dbtools.common.di.Services$Builder.add(Services.java:409)
        at oracle.dbtools.common.di.Services$Builder.load(Services.java:474)
        at oracle.dbtools.common.app.ApplicationContext.loadServices(Application                           Context.java:167)
        at oracle.dbtools.cmdline.Commands.main(Commands.java:345)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Nativ                           e Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknow                           n Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Un                           known Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at oracle.dbtools.jarcl.Entrypoint.main(Entrypoint.java:58)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
        at java.base/java.lang.ClassLoader.findClass(Unknown Source)
        at oracle.dbtools.jarcl.JarClassLoader.findClass(JarClassLoader.java:63)
        at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
        at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
        ... 16 more
null
java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Nativ                           e Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknow                           n Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Un                           known Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at oracle.dbtools.jarcl.Entrypoint.main(Entrypoint.java:58)
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/ValidationEventHandler
        at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.base/java.lang.Class.privateGetDeclaredConstructors(Unknown Sour                           ce)
        at java.base/java.lang.Class.getDeclaredConstructors(Unknown Source)
        at oracle.dbtools.injector.impl.__Reflections.getConstructorsAnnotatedWi                           th(__Reflections.java:56)
        at oracle.dbtools.injector.impl.Constructors.getInjectConstructors(Const                           ructors.java:39)
        at oracle.dbtools.injector.impl.DependencyGraph.annotatedConstructor(Dep                           endencyGraph.java:416)
        at oracle.dbtools.injector.impl.DependencyGraph.dependencies(DependencyG                           raph.java:204)
        at oracle.dbtools.injector.impl.DependencyGraph.graph(DependencyGraph.ja                           va:297)
        at oracle.dbtools.injector.impl.DependencyGraph.<init>(DependencyGraph.j                           ava:55)
        at oracle.dbtools.injector.impl.DependencyGraph.<init>(DependencyGraph.j                           ava:37)
        at oracle.dbtools.injector.impl.DependencyGraph$Builder.build(Dependency                           Graph.java:490)
        at oracle.dbtools.injector.impl.InjectorImpl$Builder.build(InjectorImpl.                           java:385)
        at oracle.dbtools.injector.impl.InjectorImpl$Builder.build(InjectorImpl.                           java:310)
        at oracle.dbtools.common.di.Services$Builder.build(Services.java:416)
        at oracle.dbtools.common.di.Services$Builder.build(Services.java:431)
        at oracle.dbtools.conf.ConfigurationSettings.injectConfigurationSettingV                           alues(ConfigurationSettings.java:48)
        at oracle.dbtools.common.app.ApplicationContext.<init>(ApplicationContex                           t.java:98)
        at oracle.dbtools.common.app.ApplicationContext.<init>(ApplicationContex                           t.java:48)
        at oracle.dbtools.cmdline.Commands.main(Commands.java:345)
        ... 5 more
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.ValidationEventHandl                           er
        at java.base/java.lang.ClassLoader.findClass(Unknown Source)
        at oracle.dbtools.jarcl.JarClassLoader.findClass(JarClassLoader.java:63)
        at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
        at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
        ... 24 more

这是为什么?以及如何修复它?

Java 9 的问题并在

中解决

你的问题可以通过发出这个

来解决

java -jar --add-modules java.xml.bind ords.war 用户 test_developer "SQL Developer"

此外,如果您想使用 ORDS 构建 RESTful 服务,您还可以使用 SQL Developer 并简单地连接到支持 REST 的模式并使用连接树中的 REST 功能.我讲这个here