在tomcat上进行Drools部署失败了

时间:2017-07-12 06:09:06

标签: java tomcat drools tomcat8 drools-kie-server

在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

我的环境详情:

  

i)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)

2 个答案:

答案 0 :(得分: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

答案 1 :(得分:0)

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

对于Eclipse,你应该这样做:

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

2)右键单击项目并单击“属性”,在左侧窗口中,单击“Java编译器”并取消选中“在Java构建路径上使用执行环境中的合规性”,这样您就可以选择list“Compiler compilance level”使用您在上一步中设置的相同版本。

对于NetBeans IDE,右键单击项目并选择“属性”然后转到源,然后可以将“源/二进制格式”更改为较高的enter image description here JDK版本。