本文介绍了与cloudera配置单元jdbc pom问题的春季启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 以下是我的pom.xml < dependency> < groupId> org.apache.hive< / groupId> < artifactId> hive-jdbc< / artifactId> < version> $ {cdh.hive.version}< / version> < /依赖关系> < dependency> < groupId> org.apache.hadoop< / groupId> < artifactId> hadoop-common< / artifactId> < version> $ {cdh.hadoop.version}< / version> < /依赖关系> < dependency> < groupId> org.springframework.boot< / groupId> < artifactId> spring-boot-starter-actuator< / artifactId> < /依赖关系> < dependency> < groupId> org.springframework.boot< / groupId> < artifactId> spring-boot-starter-web< / artifactId> < /依赖关系> 通过使用这个pom,我无法启动我的spring启动应用程序。我得到以下内容: pre $ lt; code> SLF4J:在 中找到绑定[jar:file:/ C:/用户/ amoghrao / .m2 / repository / org / slf4j / slf4j-log4j12 / 1.7.12 / slf4j-log4j12-1.7.12.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J:找到的绑定在[jar:file:/ C:/Users/amoghrao/.m2/repository/ch/qos/logback/logback-classic/1.1.3/logback-classic-1.1.3.jar!/ org / slf4j / impl / StaticLoggerBinder.class] SLF4J:有关说明,请参阅http://www.slf4j.org/codes.html#multiple_bindings。 SLF4J:实际绑定类型为[org.slf4j.impl.Log4jLoggerFactory] 线程main中的异常java.lang.IllegalArgumentException:LoggerFactory不是Logback LoggerContext,但Logback位于类路径中。删除Logback或竞争实现(从文件加载的类org.slf4j.impl.Log4jLoggerFactory:/ C:/Users/amoghrao/.m2/repository/org/slf4j/slf4j-log4j12/1.7.12/slf4j-log4j12-1.7 .12.jar)。如果您使用的是Weblogic,则需要在WEB-INF / weblogic.xml中将'org.slf4j'添加到prefer-application-packages。[org.slf4j.impl.Log4jLoggerFactory]类的对象必须是类ch.qos的一个实例.logback.classic.LoggerContext at org.springframework.util.Assert.isInstanceOf(Assert.java:339) at org.springframework.boot.logging.logback.LogbackLoggingSystem.getLoggerContext(LogbackLoggingSystem.java: at org.springframework.boot.logging.logback.LogbackLoggingSystem.getLogger(LogbackLoggingSystem.java:143) at org.springframework.boot.logging.logback.LogbackLoggingSystem.beforeInitialize(LogbackLoggingSystem.java: 89)。在org.springframework.boot.logging.LoggingApplicationListener.onApplicationStartedEvent(LoggingApplicationListener.java:152)。在org.springframework.boot.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:139)在org.springframework.context.event.SimpleApplicationEventM ulticaster.invokeListener(SimpleApplicationEventMulticaster.java:151)处org.springframework.boot.context.event.EventPublishingRunListener org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:128)。 publishEvent(EventPublishingRunListener.java:100)在org.springframework.boot.context.event.EventPublishingRunListener.started(EventPublishingRunListener.java:54)在org.springframework.boot.SpringApplication.run(SpringApplication。 at org.springframework.boot.SpringApplication.run(SpringApplication.java:957) at org.springframework.boot.SpringApplication.run(SpringApplication.java:946)在demo.ConfigServiceApplication.main(ConfigServiceApplication.java:10) 我使用 Stackoverflow发布链接解决上述问题但后来我得到以下问题: 线程main中的异常org.springframework.context.ApplicationContextException:无法启动嵌入容器;嵌套异常是java.lang.NoSuchMethodError:在org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh org.eclipse.jetty.servlet.ServletMapping.setDefault(Z)V (EmbeddedWebApplicationContext.java:133)$ $ b $ org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:474) mbeddedWebApplicationContext.java:118)在org.springframework.boot.SpringApplication.refresh(SpringApplication.java:686 )在org.springframework.boot.SpringApplication.run(SpringApplication.java:320) at org.springframework.boot.SpringApplication.run(SpringApplication.java:957) at org.springframework.boot.SpringApplication.run(SpringApplication.java:946) at demo.ConfigServiceApplication.main (ConfigServiceApplication.java:10)导致:java.lang.NoSuchMethodError:org.eclipse.jetty.servlet.Servl etMapping.setDefault(Z)V 。在org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory.addDefaultServlet(JettyEmbeddedServletContainerFactory.java:289)。在org.springframework.boot.context.embedded.jetty .JettyEmbeddedServletContainerFactory.configureWebAppContext(JettyEmbeddedServletContainerFactory.java:236) at org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory.getEmbeddedServletContainer(JettyEmbeddedServletContainerFactory.java:122) at org.springframework.boot.context .embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:157) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:130) 我很困惑要删除哪些依赖项以使其正常工作。 这个讨论我通过排除jetty解决了这个问题。 $ b $ p pom.xml : <! - hive jdbc - > < dependency> < groupId> org.apache.hive< / groupId> < artifactId> hive-jdbc< / artifactId> < version> 1.2.1< / version> <排除项> <排除> < groupId> org.eclipse.jetty.aggregate< / groupId> < artifactId> *< / artifactId> < /排除> < /排除> < /依赖关系> I am using spring boot rest controller and accessing my Hive table using JDBC.Following is my pom.xml<dependency> <groupId>org.apache.hive</groupId> <artifactId>hive-jdbc</artifactId> <version>${cdh.hive.version}</version> </dependency> <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-common</artifactId> <version>${cdh.hadoop.version}</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency>By using this pom I am unable to start my spring boot app. I get the followingSLF4J: Found binding in[jar:file:/C:/Users/amoghrao/.m2/repository/org/slf4j/slf4j-log4j12/1.7.12/slf4j-log4j12-1.7.12.jar!/org/slf4j/impl/StaticLoggerBinder.class]SLF4J: Found binding in [jar:file:/C:/Users/amoghrao/.m2/repository/ch/qos/logback/logback-classic/1.1.3/logback-classic-1.1.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]Exception in thread "main" java.lang.IllegalArgumentException: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation (class org.slf4j.impl.Log4jLoggerFactory loaded from file:/C:/Users/amoghrao/.m2/repository/org/slf4j/slf4j-log4j12/1.7.12/slf4j-log4j12-1.7.12.jar). If you are using Weblogic you will need to add 'org.slf4j' to prefer-application-packages in WEB-INF/weblogic.xml Object of class [org.slf4j.impl.Log4jLoggerFactory] must be an instance of class ch.qos.logback.classic.LoggerContext at org.springframework.util.Assert.isInstanceOf(Assert.java:339) at org.springframework.boot.logging.logback.LogbackLoggingSystem.getLoggerContext(LogbackLoggingSystem.java:151) at org.springframework.boot.logging.logback.LogbackLoggingSystem.getLogger(LogbackLoggingSystem.java:143) at org.springframework.boot.logging.logback.LogbackLoggingSystem.beforeInitialize(LogbackLoggingSystem.java:89) at org.springframework.boot.logging.LoggingApplicationListener.onApplicationStartedEvent(LoggingApplicationListener.java:152) at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:139) at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:151) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:128) at org.springframework.boot.context.event.EventPublishingRunListener.publishEvent(EventPublishingRunListener.java:100) at org.springframework.boot.context.event.EventPublishingRunListener.started(EventPublishingRunListener.java:54) at org.springframework.boot.SpringApplication.run(SpringApplication.java:277) at org.springframework.boot.SpringApplication.run(SpringApplication.java:957) at org.springframework.boot.SpringApplication.run(SpringApplication.java:946) at demo.ConfigServiceApplication.main(ConfigServiceApplication.java:10)I used Stackoverflow post Link to solve the above problem but then i get the following issueException in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is java.lang.NoSuchMethodError: org.eclipse.jetty.servlet.ServletMapping.setDefault(Z)Vat org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:133)at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:474)at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:686) at org.springframework.boot.SpringApplication.run(SpringApplication.java:320) at org.springframework.boot.SpringApplication.run(SpringApplication.java:957) at org.springframework.boot.SpringApplication.run(SpringApplication.java:946) at demo.ConfigServiceApplication.main(ConfigServiceApplication.java:10)Caused by: java.lang.NoSuchMethodError: org.eclipse.jetty.servlet.ServletMapping.setDefault(Z)V at org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory.addDefaultServlet(JettyEmbeddedServletContainerFactory.java:289) at org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory.configureWebAppContext(JettyEmbeddedServletContainerFactory.java:236) at org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory.getEmbeddedServletContainer(JettyEmbeddedServletContainerFactory.java:122) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:157) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:130)I am confused which dependencies to remove to make it work correctly. 解决方案 According to this discussion I resolved this by excluding jetty.Part of my pom.xml:<!-- hive jdbc--><dependency> <groupId>org.apache.hive</groupId> <artifactId>hive-jdbc</artifactId> <version>1.2.1</version> <exclusions> <exclusion> <groupId>org.eclipse.jetty.aggregate</groupId> <artifactId>*</artifactId> </exclusion> </exclusions></dependency> 这篇关于与cloudera配置单元jdbc pom问题的春季启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!