- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我的应用程序是 hadoop 和 rest 服务与 spring 框架的结合。我的目标是根据要求提供来自配置单元表的结果。但是当我运行应用程序时,在完成 mapreduce 和 hive 作业后出现以下错误:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'logsRepository': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void hello.logsRepository.logsRepositoryC(org.springframework.data.hadoop.hive.HiveOperations); nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.data.hadoop.hive.HiveOperations] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:292)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1185)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:700)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:120)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:616)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:306)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:877)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:866)
at hello.Application.main(Application.java:63)
... 6 more
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void hello.logsRepository.logsRepositoryC(org.springframework.data.hadoop.hive.HiveOperations); nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.data.hadoop.hive.HiveOperations] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:596)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:289)
... 22 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.data.hadoop.hive.HiveOperations] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1100)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:960)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:855)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:553)
... 24 more
我的代码:
应用程序.java
@ComponentScan
@EnableAutoConfiguration
public class Application {
private static final Log log = LogFactory.getLog(Application.class);
public static void main(String[] args) {
private static AbstractApplicationContext ctx;
public static void main(String[] args) {
ctx = new ClassPathXmlApplicationContext("META-INF/spring/hadoop-context.xml");
// shut down the context cleanly along with the VM
ctx.registerShutdownHook();
HiveTemplate template = ctx.getBean(HiveTemplate.class);
log.info(template.query("show tables;"));
logsRepository repository = ctx.getBean(logsRepository.class);
repository.processLogFile("/home/hduser/yarn/hive_data");
log.info("Count of password entries = " + repository.count());
SpringApplication.run(Application.class, args);
}
}
日志库.java
@Repository
public class logsRepository implements logsRepo {
private String tableName = "getlogs";
private HiveOperations hiveOperations;
@Autowired
public void logsRepositoryC (HiveOperations hiveOperations) {
this.hiveOperations = hiveOperations;
}
@Override
public Long count() {
return hiveOperations.queryForLong("select count(*) from " + tableName);
}
@Override
public void processLogFile(String inputFile) {
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("inputFile", inputFile);
hiveOperations.query("classpath:logs-analysis.hql", parameters);
}
}
hadoop-context.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:hdp="http://www.springframework.org/schema/hadoop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:batch="http://www.springframework.org/schema/batch"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/hadoop http://www.springframework.org/schema/hadoop/spring-hadoop.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch.xsd">
<context:property-placeholder location="hadoop.properties,hive.properties" />
<context:component-scan base-package="hello" />
<hdp:configuration>
fs.defaultFS=${hd.fs}
yarn.resourcemanager.address=${hd.rm}
mapreduce.framework.name=yarn
mapred.job.tracker=${hd.jt}
</hdp:configuration>
<hdp:script id="setupScript" location="copy-files.groovy">
<hdp:property name="localSourceFile" value="${localSourceFile}"/>
<hdp:property name="inputDir" value="${inputDir}"/>
<hdp:property name="outputDir" value="${outputDir}"/>
</hdp:script>
<hdp:script id="setupfile" location="copy-to-local.groovy">
<hdp:property name="outputDir" value="${outputDir}"/>
</hdp:script>
<hdp:job id="getlogsJob"
input-path="${inputDir}"
output-path="${outputDir}"
libs="${LIB_DIR}/gs-rest-service-0.1.0.jar"
mapper="hello.GetLogs.Map"
reducer="hello.GetLogs.Reduce" />
<hdp:hive-client-factory host="${hive.host}" port="${hive.port}"/>
<hdp:hive-template id="hiveTemplate" hive-client-factory-ref="hiveClientFactory" />
<hdp:hive-runner id="hiveRunner" hive-client-factory-ref="hiveClientFactory" run-at-startup="false" pre-action="hdfsScript">
<hdp:script location="logs-analysis.hql">
</hdp:script>
</hdp:hive-runner>
<hdp:script id="hdfsScript" language="groovy" location="set-hive-permissions.groovy"/>
<hdp:job-runner id="runner" run-at-startup="true" pre-action="setupScript,hdfsScript" post-action="setupfile,hiveRunner" job-ref="getlogsJob" />
</beans>
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework</groupId>
<artifactId>gs-rest-service</artifactId>
<version>0.1.0</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.0.0.RC3</version>
</parent>
<profiles>
<profile>
<id>hadoop22</id>
<properties>
<spring.hadoop.version>2.0.0.M5-hadoop22</spring.hadoop.version>
<hadoop.version>2.2.0</hadoop.version>
<hive.version>0.10.0</hive.version>
<hadoop.version.generic>2.0.0-cdh4.1.3</hadoop.version.generic>
<hadoop.version.mr1>2.0.0-mr1-cdh4.1.3</hadoop.version.mr1>
<hadoop.examples>hadoop-mapreduce-examples</hadoop.examples>
<mapreduce.framework>yarn</mapreduce.framework>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-mapreduce-client-jobclient</artifactId>
<version>${hadoop.version}</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</profile>
<profile>
<id>phd1</id>
<properties>
<spring.hadoop.version>1.0.2.RELEASE-phd1</spring.hadoop.version>
<hadoop.version>2.0.5-alpha-gphd-2.1.0.0</hadoop.version>
<hadoop.examples>hadoop-mapreduce-examples</hadoop.examples>
<mapreduce.framework>yarn</mapreduce.framework>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-mapreduce-client-jobclient</artifactId>
<version>${hadoop.version}</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>config</id>
<phase>package</phase>
<configuration>
<tasks>
<copy todir="target/appassembler/data">
<fileset dir="data"/>
</copy>
<copy todir="target/appassembler/etc">
<fileset dir="etc/phd1"/>
</copy>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>jdk.tools</groupId>
<artifactId>jdk.tools</artifactId>
<version>${java.version}</version>
<scope>system</scope>
<systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.2.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-hadoop</artifactId>
<version>2.0.0.M5</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<!-- <version>${spring.version}</version>-->
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<!-- <version>${spring.version}</version>-->
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<!-- <version>${spring.version}</version>-->
</dependency>
<!--<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
<version>2.2.0</version>
</dependency>-->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-hadoop-core</artifactId>
<version>2.0.0.M5</version>
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-metastore</artifactId>
<version>0.10.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-service</artifactId>
<version>0.10.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-common</artifactId>
<version>0.10.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-builtins</artifactId>
<version>0.10.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-jdbc</artifactId>
<version>0.10.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-shims</artifactId>
<version>0.10.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-serde</artifactId>
<version>0.10.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-contrib</artifactId>
<version>0.10.0</version>
</dependency>
</dependencies>
<properties>
<java.version>1.7</java.version>
<start-class>hello.Application</start-class>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<!-- <version>2.3.2</version> -->
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>appassembler-maven-plugin</artifactId>
<version>1.2.2</version>
<configuration>
<repositoryLayout>flat</repositoryLayout>
<configurationSourceDirectory>src/main/config</configurationSourceDirectory>
<copyConfigurationDirectory>true</copyConfigurationDirectory>
<extraJvmArguments>-Dmr.fw=${mapreduce.framework}</extraJvmArguments>
<programs>
<program>
<mainClass>hello.Application</mainClass>
</program>
</programs>
</configuration>
<executions>
<execution>
<id>package</id>
<goals>
<goal>assemble</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>config</id>
<phase>package</phase>
<configuration>
<!-- <tasks>
<copy todir="target/appassembler/data">
<fileset dir="data"/>
</copy>
</tasks>-->
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>
<url>http://repo.spring.io/libs-snapshot</url>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<url>http://repo.spring.io/libs-snapshot</url>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</project>
最佳答案
在我看来,您的 Spring Boot 应用程序不会加载您的 hadoop-context.xml 文件。尝试添加导入该文件的 @Configuration 类。
@Configuration
@ImportResource("classpath:META-INF/spring/hadoop-context.xml")
public class AppConfiguration {
}
关于java - org.springframework.beans.factory.NoSuchBeanDefinitionException : No qualifying bean of type [org. springframework.data.hadoop.hive.HiveOperations],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22034964/
Schema.org、Goodrelations-vocabulary.org 和 Productontology.org 之间有什么关系? Schema.org 告知,“W3C schema.org
大家好,我想知道包 org.ietf、org.omg、org.w3c 和 org 是如何实现的.xml 已进入 "official" Java classes ? 例如,默认 JDK 不会包含 Apa
首先,我试图用来自 Schema.org 的属性定义数据库表,例如,例如,我有一个名为“JobPosting”的表,它或多或少具有与 http://schema.org/JobPosting 中定义的
我有一个 org.w3c.dom.Document 被 org.dom4j.io.DOMReader 解析。 我想通过 org.w3c.dom.Element 搜索 dom4j DOM 文档。 比方说
我正在将我的应用程序部署到 Tomcat 6.0.20。 应用程序使用 Hibernate 作为 Web 层的 ORM、Spring 和 JSF。 我还从 main() 方法制作了简单的运行器来测试
我有一个使用 hibernate > 4 的 gradle 项目。如果我在 Apache tomcat 中运行我的 war 文件,我不会收到任何错误。但是当我在 Wildfly 8.2 中部署它时,出
我正在尝试将 JaCoCo 添加到我的 Android 以覆盖 Sonar Qube。但是在运行命令 ./gradlew jacocoTestReport 时,我收到以下错误。 Task :app:
如何在 emacs 组织模式中格式化日期? 例如,在下表中,我希望日期显示为“Aug 29”或“Wed, Aug 29”而不是“” #+ATTR_HTML: border="2" rules="all
我想使用 org 模式来写一本技术书籍。我正在寻找一种将外部文件中的现有代码插入到 babel 代码块中的方法,该代码块在导出为 pdf 时会提供很好的格式。 例如 #+BEGIN_SRC pytho
用作引用:https://support.google.com/webmasters/answer/146750?hl=en 您会注意到在“产品”下有一个属性类别,此外页面下方还有一个示例: Too
我读了这个Google doc .它说我们不使用列表中的产品。 那么对于产品列表(具有多页的类似产品的类别,如“鞋子”),推荐使用哪种模式? 我用这个: { "@context": "htt
我目前在做DBpedia数据集,想通过wikidata实现schema.org和DBpedia的映射。因此我想知道 schema.org 和 wikidata 之间是否存在任何映射。 最佳答案 我认为
我爱org-tables ,我用它们来记录各种事情。我现在正在为 Nix 记录一些单行代码(在阅读了 Domen Kožar 的 excellent guide 后,在 this year's Eur
如果看一下 Movie在 schema.org 中输入,actor 和 actors 属性都是允许的(actor 取代 actors)。但是 author 和 contributor 属性没有等效项。
我们有一些餐厅有多个地点或分支机构。我想包含正确的 Schema.org 标记,但找不到任何允许列出多个餐厅的内容。 每家餐厅都有自己的地址、电子邮件、电话和营业时间,甚至可能是“分店名称”。 两个分
我在一个页面中有多个综合评分片段。 有没有办法让其中之一成为默认值?将显示在搜索引擎结果中的那个? 谢谢大家! 更新:该网页本质上是品牌的页面。它包含品牌评论的总评分及其产品列表(每个产品的总评分)。
我提到了一些相关的职位,但并没有解决我的问题。因为我正在使用maven-jar-plugin-2.4 jar。 我正在使用JBoss Developer Studio 7.1.1 GA IDE,并且正
网站的根页面(即 http://example.com/ )的特殊之处在于它是默认的着陆页。它可能包含许多不同的对象类型。 它可能被认为是一个网站,或者一个博客等... 但它是否也应该被标记为给定对象
我想将一些文本放入一个 org 文件中,当我将内容导出到其中一种目标类型(在本例中为 HTML)时,该文件不会发布。有什么方法可以实现这个目标吗? 最佳答案 您可能想要使用 :noexport: 标签
org-mode 是否有一个键绑定(bind)可以在编号/项目符号列表项之间移动,就像您可以对标题一样? 喜欢的功能: org-forward-heading-same-level 大纲下一个可见标题
我是一名优秀的程序员,十分优秀!