<dependency>
<!-- Import dependency management from Spring Boot -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>1.1.8.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.5</version>
<!-- nothing here -->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>org.online.auth.conf.ApplicationMain</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
启动日志显示以下错误消息:
:: Spring Boot ::
2014-11-03 12:46:38.394 INFO 1264 --- [ main] org.online.auth.conf.ApplicationMain : Starting ApplicationMain on R9013DA2 with PID 1264 (C:\projects\online\online-authentication-rest\target\online-authentication-rest-0.0.1-SNAPSHOT-jar-with-dependencies.jar started by thomasa in C:\projects\online\online-authentication-rest\target)
2014-11-03 12:46:38.396 DEBUG 1264 --- [ main] o.s.boot.SpringApplication : Loading source class com.online.auth.conf.ApplicationMain
2014-11-03 12:46:38.412 DEBUG 1264 --- [ main] o.s.b.c.c.ConfigFileApplicationListener : Skipped config file 'file:./config/application.yml' resource not found
2014-11-03 12:46:38.416 DEBUG 1264 --- [ main] o.s.b.c.c.ConfigFileApplicationListener : Loaded config file 'classpath:/application.properties'
2014-11-03 13:36:23.613 INFO 9732 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@43738a82: startup date [Mon Nov 03 13:36:23 CET 2014]; root of context hierarchy
2014-11-03 13:36:23.614 DEBUG 9732 --- [ main] ationConfigEmbeddedWebApplicationContext : Bean factory for org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@43738a82: org.springframework.beans.factory.support.DefaultListableBeanFactory@25b485ba:
defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework .context.annotation.internalAutowiredAnnotationProcessor,
org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.conte xt.annotation.internalCommonAnnotationProcessor,applicationMain]; root of factory hierarchy
2014-11-03 13:36:23.787 INFO 9732 --- [ main] a.ConfigurationClassBeanDefinitionReader : Skipping bean definition for [BeanMethod:name=basicHttpCredentialsUtil,declaringClass=no.safetel.online.auth.AppConfigSpringSecur ity]: a definition for bean 'basicHttpCredentialsUtil' already exists.
This top-level bean definition is considered as an override.
2014-11-03 13:36:23.873 INFO 9732 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2014-11-03 13:36:23.888 DEBUG 9732 --- [ main] ationConfigEmbeddedWebApplicationContext : Unable to locate MessageSource with name 'messageSource': using default [org.springframework.context.support.DelegatingMessageSource@2dde1bff]
2014-11-03 13:36:23.888 DEBUG 9732 --- [ main] ationConfigEmbeddedWebApplicationContext : Using ApplicationEventMulticaster [org.springframework.context.event.SimpleApplicationEventMulticaster@15bbf42f]
2014-11-03 13:36:23.894 WARN 9732 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt
org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:124)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:476)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:109)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
我试图显式定义EmbeddedServletContainerFactory,但这只是给了我另一个异常,消息显示需要ServletContext来配置默认servlet处理
。
在这个问题上的任何帮助都将非常感谢!
编辑!
我试图通过实现BeanPostProcessor
来打印容器创建的每个bean:
@ComponentScan
@EnableAutoConfiguration(exclude = {
DataSourceAutoConfiguration.class,
DataSourceInitializer.class,
DataSourceTransactionManagerAutoConfiguration.class,
SecurityAutoConfiguration.class})
public class ApplicationMain extends SpringBootServletInitializer implements BeanPostProcessor {
public static void main(String[] args) {
ConfigurableApplicationContext context = SpringApplication.run(ApplicationMain.class, args);
}
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
System.out.println("\t\tbean: "+ beanName);
return bean;
}
2014-11-03 16:11:26.348 INFO 13548 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'metaDataSourceAdvisor' of type [class org.springframework.security.access.intercept.aopalliance.MethodSecurityMetadataSourceAdvisor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
bean: org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat
bean: tomcatEmbeddedServletContainerFactory
bean: org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration
bean: org.hibernate.validator.internal.constraintvalidators.NotNullValidator
bean: serverProperties
bean: org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration
2014-11-03 16:11:26.889 INFO 13548 --- [ main] .t.TomcatEmbeddedServletContainerFactory : Server initialized with port: 8080
2014-11-03 16:01:36.302 INFO 6704 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'metaDataSourceAdvisor' of type [class org.springframework.security.access.intercept.aopalliance.MethodSecurityMetadataSourceAdvisor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2014-11-03 16:01:36.310 WARN 6704 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt
org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:124)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:476)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:109)
在更彻底地阅读了文档之后,我终于想通了。Spring文档明确指出,您需要在pom.xml的build部分使用spring-boot-maven-plugin。
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
我还添加了一个声明main-class的属性:
<properties>
<start-class>org.online.auth.ApplicationMain</start-class>
</properties>
希望这能对其他人有所帮助。
问题内容: 我正在尝试像这样编译C ++程序: 但是我收到以下错误: 我不知道这个错误是什么意思。任何帮助将不胜感激。 问题答案: DSO在这里表示动态共享对象;由于错误消息指出命令行中缺少该消息,因此我想您必须将其添加到命令行中。 也就是说,尝试添加到命令行。
我使用Java Jersey框架(与Maven一起使用),并使用IntelliJ作为IDE。我遇到过这个运行时异常,它只发生在尝试从命令行运行代码时(使用maven编译,然后使用Java-JAR),但在IntelliJ中运行时不会发生,这很奇怪。 我有一些Java代码,它将尝试使HTTP访问某个远程URL,并尝试将返回的JSON读入某个Lombok POJO: 正如我之前提到的,奇怪的是,只有当我
问题内容: 最近,我不得不在PC上重新安装Linux Mint。我重新安装了所有库,例如GLFW,并遇到了从未见过的错误。不幸的是,由于无法找到对我有用的修复程序,我的google- fu技能似乎无法弥补这个错误。旁注:这些程序在我的旧安装中可以很好地编译,并且在运行Linux Mint 17.2的笔记本电脑上也可以完美地编译。 这是我用来编译的编译语句: 这是终端向我吐出的东西: 所以,如果有人
下面是完整的输出:-
问题内容: 我正在使用Java Jersey框架(与Maven),并使用IntelliJ作为我的IDE。我遇到了这个运行时异常,仅当我尝试从命令行运行代码(使用maven进行编译,然后使用java -jar)时才发生,而在IntelliJ中运行时却没有发生。 我有一些Java代码,这些代码将尝试在某个远程URL上进行HTTP GET,并尝试将返回的JSON读取到某些Lombok POJO中: 我不
问题内容: 我对使用Windows的Linux(使用Ubuntu 14.04 LTS 64位)非常陌生,并且正尝试移植到我现有的CUDA项目上。 通过链接时 我遇到以下错误: 答案似乎与本文中的解决方案密切相关(奇怪的链接错误:命令行中缺少DSO),尽管鉴于我对Linux的经验不足,所以我无法使其适应我的问题。 关于可能的问题有什么想法? 这是编译期间的完整输出:https : //gist.gi