运行 tomee 7.0.3 与 jdk 9

run tomee 7.0.3 with jdk 9

自从我迁移到 Oracle JDK 9.

后,我遇到了 Tomee 问题

我的 tomee 不会以这些错误消息开始:

Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
    at org.apache.openejb.config.ConfigurationFactory.<init>(ConfigurationFactory.java:222)
    at org.apache.openejb.config.ConfigurationFactory.<init>(ConfigurationFactory.java:177)
    at org.apache.openejb.config.ConfigurationFactory.<init>(ConfigurationFactory.java:158)
    at org.apache.tomee.catalina.TomcatWebAppBuilder.<init>(TomcatWebAppBuilder.java:331)
    at org.apache.tomee.catalina.TomcatLoader.initialize(TomcatLoader.java:212)
    at org.apache.tomee.catalina.ServerListener.lifecycleEvent(ServerListener.java:168)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94)
    at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:395)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:108)
    ... 8 more
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
    at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:466)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:563)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
    ... 17 more

24-Sep-2017 12:40:14.287 INFO [main] jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke Initialization processed in 1525 ms
24-Sep-2017 12:40:14.288 SEVERE [main] jdk.internal.reflect.NativeMethodAccessorImpl.invoke The required Server component failed to start so Tomcat is unable to start.

那我该怎么办?

对了,我把答案放上去应该

经过一番搜索,我找到了这个

所以我通过在第 287 行 catalina.(sh/bat) 中添加以下行来解决这个问题

# Add ee modules
JAVA_OPTS="$JAVA_OPTS --add-modules java.se.ee"