我在Ubuntu 15.10 64bit上遇到spring-boot:run
問題。在Windows 7 64bit上一切正常 - 應用程序啓動,也在Ubuntu 32bit上。Ubuntu 64bit上的彈簧啓動 - 無法啓動
在64位上,我可以編譯源代碼,但服務器沒有啓動(但我可以編譯源代碼並在Tomcat上部署)。控制檯日誌
[ERROR] org.springframework.boot.SpringApplication - Application startup failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultServletHandlerMapping' defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.HandlerMapping]: Factory method 'defaultServletHandlerMapping' threw exception; nested exception is java.lang.IllegalArgumentException: A ServletContext is required to configure default servlet handling
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:838) ~[spring-context-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537) ~[spring-context-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) ~[spring-boot-1.3.0.BUILD-SNAPSHOT.jar:1.3.0.BUILD-SNAPSHOT]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752) ~[spring-boot-1.3.0.BUILD-SNAPSHOT.jar:1.3.0.BUILD-SNAPSHOT]
at org.springframework.boot.SpringApplication.doRun(SpringApplication.java:347) ~[spring-boot-1.3.0.BUILD-SNAPSHOT.jar:1.3.0.BUILD-SNAPSHOT]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:295) ~[spring-boot-1.3.0.BUILD-SNAPSHOT.jar:1.3.0.BUILD-SNAPSHOT]
at pl.edu.pw.ii.wdialogu.Application.main(Application.java:62) [classes/:na]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.HandlerMapping]: Factory method 'defaultServletHandlerMapping' threw exception; nested exception is java.lang.IllegalArgumentException: A ServletContext is required to configure default servlet handling
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
... 16 common frames omitted
Caused by: java.lang.IllegalArgumentException: A ServletContext is required to configure default servlet handling
at org.springframework.util.Assert.notNull(Assert.java:115) ~[spring-core-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer.<init>(DefaultServletHandlerConfigurer.java:53) ~[spring-webmvc-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport.defaultServletHandlerMapping(WebMvcConfigurationSupport.java:450) ~[spring-webmvc-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$EnableWebMvcConfiguration$$EnhancerBySpringCGLIB$$a228cee9.CGLIB$defaultServletHandlerMapping$35(<generated>) ~[spring-boot-autoconfigure-1.3.0.BUILD-SNAPSHOT.jar:1.3.0.BUILD-SNAPSHOT]
at org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$EnableWebMvcConfiguration$$EnhancerBySpringCGLIB$$a228cee9$$FastClassBySpringCGLIB$$5d1b9162.invoke(<generated>) ~[spring-boot-autoconfigure-1.3.0.BUILD-SNAPSHOT.jar:1.3.0.BUILD-SNAPSHOT]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:318) ~[spring-context-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$EnableWebMvcConfiguration$$EnhancerBySpringCGLIB$$a228cee9.defaultServletHandlerMapping(<generated>) ~[spring-boot-autoconfigure-1.3.0.BUILD-SNAPSHOT.jar:1.3.0.BUILD-SNAPSHOT]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_66]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_66]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_66]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_66]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
... 17 common frames omitted
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 46.569s
[INFO] Finished at: Wed Jan 06 12:40:32 CET 2016
[INFO] Final Memory: 46M/442M
[INFO] ------------------------------------------------------------------------
Process finished with exit code 0
當我在Tomcat上部署* .war文件時,一切正常。我到處搜尋 - 沒有任何工作。將非常高興的任何幫助!
片段pom.xml文件(配置):
<parent>
<artifactId>spring-boot-starter-parent</artifactId>
<groupId>org.springframework.boot</groupId>
<version>1.3.0.BUILD-SNAPSHOT</version>
</parent>
<groupId>pl.edu.pw.ii.wdialogu</groupId>
<artifactId>wdialogu</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>wdialogu</name>
<prerequisites>
<maven>3.0.0</maven>
</prerequisites>
<properties>
<HikariCP.version>2.3.5</HikariCP.version>
<assertj-core.version>2.0.0</assertj-core.version>
<awaitility.version>1.4.0</awaitility.version>
<codahale-metrics.version>3.0.2</codahale-metrics.version>
<commons-io.version>2.4</commons-io.version>
<commons-lang.version>2.6</commons-lang.version>
<geronimo-javamail_1.4_mail.version>1.8.4</geronimo-javamail_1.4_mail.version>
<google-maps-services.version>0.1.6</google-maps-services.version>
<guava.version>18.0</guava.version>
<hibernate.version>4.3.7.Final</hibernate.version>
<!--<jackson.version>2.4.6</jackson.version>-->
<java.version>1.8</java.version>
<javax.inject.version>1</javax.inject.version>
<jhipster-loaded.version>0.12</jhipster-loaded.version>
<joda-time-hibernate.version>1.3</joda-time-hibernate.version>
<json-path.version>0.9.1</json-path.version>
<liquibase-hibernate.version>3.3</liquibase-hibernate.version>
<liquibase-slf4j.version>1.2.1</liquibase-slf4j.version>
<liquibase.version>3.1.1</liquibase.version>
<maven-enforcer-plugin.version>1.3.1</maven-enforcer-plugin.version>
<maven-sortpom-plugin.version>2.3.0</maven-sortpom-plugin.version>
<metrics-spring.version>3.0.2</metrics-spring.version>
<postgis.version>2.1.5</postgis.version>
<postgresql.version>9.4-1201-jdbc41</postgresql.version>
<reflections.version>0.9.9-RC1</reflections.version>
<run.addResources>false</run.addResources>
<sonar-maven-plugin.version>2.2</sonar-maven-plugin.version>
<!--<spring-boot-starter.version>1.2.5.RELEASE</spring-boot-starter.version>-->
<!--<spring-boot.version>1.2.5.RELEASE</spring-boot.version>-->
<!--<spring.version>4.0.1.RELEASE</spring.version>-->
<swagger-springmvc.version>0.8.8</swagger-springmvc.version>
<tt4j.version>1.1-SNAPSHOT</tt4j.version>
<usertype-core.version>3.2.0.GA</usertype-core.version>
</properties>
打開logback.xml文件(或log4j.properties)中的DEBUG日誌記錄,以便獲取更多信息最新錯誤。還要檢查所有操作系統上的maven版本,可能有一些差異。 – freakman
DEBUG在logback.xml中,我粘貼日誌。 Maven版本與在pom.xml中聲明相同。 –