5

通过tomcat启动drools服务时出现错误。

12-Jul-2017 11:16:42.203 INFO [http-nio-8090-exec-1] org.apache.catalina.core.ApplicationContext.log HTMLManager: start: Starting web application '/kie-drools-wb-7.0.0.Final-tomcat8'
12-Jul-2017 11:17:07.252 SEVERE [http-nio-8090-exec-1] org.apache.catalina.core.ApplicationContext.log FAIL - Application at context path [/kie-drools-wb-7.0.0.Final-tomcat8] could not be started
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/kie-drools-wb-7.0.0.Final-tomcat8]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
    at org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:1307)
    at org.apache.catalina.manager.HTMLManagerServlet.start(HTMLManagerServlet.java:665)
    at org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:211)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.java:136)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:595)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.ServiceConfigurationError: Error instantiating :org.apache.deltaspike.core.api.provider.BeanManagerProvider
    at org.jboss.weld.util.ServiceLoader.createInstance(ServiceLoader.java:310)
    at org.jboss.weld.util.ServiceLoader.prepareInstance(ServiceLoader.java:246)
    at org.jboss.weld.util.ServiceLoader.loadService(ServiceLoader.java:214)
    at org.jboss.weld.util.ServiceLoader.loadServiceFile(ServiceLoader.java:182)
    at org.jboss.weld.util.ServiceLoader.reload(ServiceLoader.java:162)
    at org.jboss.weld.util.ServiceLoader.iterator(ServiceLoader.java:288)
    at org.jboss.weld.util.collections.ImmutableSet$BuilderImpl.addAll(ImmutableSet.java:150)
    at org.jboss.weld.environment.servlet.WeldServletLifecycle.createDeployment(WeldServletLifecycle.java:286)
    at org.jboss.weld.environment.servlet.WeldServletLifecycle.initialize(WeldServletLifecycle.java:159)
    at org.jboss.weld.environment.servlet.EnhancedListener.onStartup(EnhancedListener.java:61)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5196)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 33 more
Caused by: java.lang.UnsupportedClassVersionError: javax/inject/Provider : Unsupported major.minor version 52.0 (unable to load class [javax.inject.Provider]) (unable to load class [javax.enterprise.inject.Instance]) (unable to load class [javax.enterprise.inject.spi.CDI])
    at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2280)
    at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:811)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1254)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:270)
    at org.apache.deltaspike.core.util.ClassUtils.loadClassForName(ClassUtils.java:147)
    at org.apache.deltaspike.core.util.ClassUtils.tryToLoadClassForName(ClassUtils.java:127)
    at org.apache.deltaspike.core.api.provider.BeanManagerProvider.<clinit>(BeanManagerProvider.java:73)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at org.jboss.weld.util.ServiceLoader.createInstance(ServiceLoader.java:308)
    ... 44 more

我的环境详细信息:

一)CentOS 7.2,

ii) jdk1.7.0_67,

iii) apache-tomcat-8.5.16,

iv) kie-drools-wb-7.0.0.Final-tomcat8.war

编辑1:

我的服务器中没有 Java 8

[root@hostname ~]# sudo find / -type f -name java -print 2>/dev/null | xargs -i echo {} -version | bash
bash: line 1: /var/lib/alternatives/java: Permission denied
java version "1.7.0_141"
OpenJDK Runtime Environment (rhel-2.6.10.1.el7_3-x86_64 u141-b02)
OpenJDK 64-Bit Server VM (build 24.141-b02, mixed mode)
java version "1.7.0_141"
OpenJDK Runtime Environment (rhel-2.6.10.1.el7_3-x86_64 u141-b02)
OpenJDK 64-Bit Server VM (build 24.141-b02, mixed mode)
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)
4

2 回答 2

1

您需要:

1) 更改您的依赖项列表以仅引用 JDK 1.7 兼容库

2) 使用 JDK 1.8 安装和运行您的应用程序

如消息中所述,问题在于 ClassLoader 无法加载类 javax.inject.Provider、javax.enterprise.inject.Instance 和/或 javax.enterprise.inject.spi.CDI,因为它们已被编译使用 Java 1.8。您可以尝试查找相应 jar 的旧版本,但这可能会导致与您的实际代码不兼容。我建议您将生产 JDK 升级到最新的 1.8 分支。

顺便说一句,JDK 1.7 已经结束,不应再使用:http ://www.oracle.com/technetwork/java/eol-135779.html#Java6-end-public-updates

于 2017-07-19T15:53:50.547 回答
0

您需要在 1.8 版本的 Java 上运行和编译您的应用程序。

对于 Eclipse,您应该这样做:

1) 点击“Window > Preferences”,在出现的窗口左侧,在“Java”下,点击“Installed JREs”,点击“Add...”导航到包含JDK的文件夹。

2)右键单击项目并单击“属性”,在窗口左侧,单击“Java编译器”并取消选中“在Java构建路径上使用来自执行环境的合规性”,即允许您选择列表“编译器”编译级别”使用您在上一步中设置的相同版本。

对于 NetBeans IDE,右键单击项目并选择 Properties 然后转到源,然后您可以将 Source/Binary Format 更改为更高的在此处输入图像描述JDK 版本。

于 2017-07-17T04:22:30.767 回答