我有一个连接到apachephoenix的web应用程序;因此,我将phoenix-5.0.0-hbase-2.0-client.jar添加到dependencies中,它在本地的intellij中运行得非常好,但是当我在服务器中启动tomcat时,我得到以下错误消息:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:714)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1125)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1859)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NoSuchMethodError: org.glassfish.jersey.servlet.internal.Utils.store(Lorg/glassfish/jersey/server/ResourceConfig;Ljavax/servlet/ServletContext;)V
at org.glassfish.jersey.servlet.init.JerseyServletContainerInitializer.addServletWithExistingRegistration(JerseyServletContainerInitializer.java:310)
at org.glassfish.jersey.servlet.init.JerseyServletContainerInitializer.onStartupImpl(JerseyServletContainerInitializer.java:170)
at org.glassfish.jersey.servlet.init.JerseyServletContainerInitializer.onStartup(JerseyServletContainerInitializer.java:143)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5154)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 10 more
07-Feb-2021 09:10:32.298 SEVERE [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Error deploying web application directory
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:747)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:714)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1125)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1859)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
当我从projects lib文件夹中删除phoenix-5.0.0-hbase-2.0-client.jar时,问题就解决了!服务器操作系统是centos。我不使用Spring Boot,gradle或maven。
1条答案
按热度按时间xmq68pz91#
欢迎来到地狱!jar文件
phoenix-5.0.0-HBase-2.0-client.jar
包含相当于170个jar文件(下面作为maven列出)groupId:artifactId:version
). 具体来说,它包含了jersey 1.19,而您已经有了jersey 2.15。每当你的类路径上有同一个库的多个版本时,你就会得到与你的问题相同的链接错误。一个jersey库(可能是2.15)试图加载依赖项,但该依赖项来自另一个版本(可能是1.19)。解决办法是不要用像这样的肥jar
phoenix-5.0.0-HBase-2.0-client.jar
,但使用maven或其他系统来处理依赖关系。他们可能仍然会弄错(例如com.sun.xml.bind和org.glassfish.jaxb的版本)jaxb-core
包含相同的类,但maven不知道),但结果比手动依赖关系管理要好得多。在你的情况下,如果你只是需要
org.apache.phoenix.jdbc.PhoenixDriver
你需要包括Phoenix核心神器,让maven来做剩下的。您将得到许多无用的依赖项(例如,您可以立即排除
jetty-*
依赖项,因为它们是jetty servlet容器的库,以及hbase-server
如果你连接到一个外部的),但希望不会有冲突。