2016-03-23 17 views
0

私はSpringBootを初めて使用しています。このspringboot webappを外部のTomcatサーバーにデプロイしようとすると、Tomcatが埋め込まれたspringbootを使用してwebappを正常に実行しました。 エラーが発生しましたMongoDBを使用してTomcatにSpringBoot Webアプリケーションをデプロイする際にエラーが発生しました。

データベースタイプNONEの組み込みデータベースドライバクラスを特定できません。組み込みデータベースが必要な場合は、サポートされているデータベースをクラスパスに入れてください。特定のプロファイルからロードするデータベース設定がある場合は、アクティブにする必要があります(プロファイルは現在アクティブではありません)。

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$JdbcTemplateConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private javax.sql.DataSource org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$JdbcTemplateConfiguration.dataSource; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration$NonEmbeddedConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active). 
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) ~[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE] 
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766) ~[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE] 
    at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361) ~[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE] 
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) ~[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE] 
    at org.springframework.boot.context.web.SpringBootServletInitializer.run(SpringBootServletInitializer.java:149) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE] 
    at org.springframework.boot.context.web.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:129) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE] 
    at org.springframework.boot.context.web.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:85) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE] 
    at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:175) [spring-web-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5456) [catalina.jar:7.0.54] 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:7.0.54] 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) [catalina.jar:7.0.54] 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) [catalina.jar:7.0.54] 
    at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_60] 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_60] 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_60] 
    at java.lang.Thread.run(Thread.java:745) [na:1.7.0_60] 
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private javax.sql.DataSource org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$JdbcTemplateConfiguration.dataSource; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration$NonEmbeddedConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active). 
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:573) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    ... 26 common frames omitted 
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration$NonEmbeddedConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active). 
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1192) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1116) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:545) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    ... 28 common frames omitted 
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active). 
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    ... 40 common frames omitted 
Caused by: org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active). 
    at org.springframework.boot.autoconfigure.jdbc.DataSourceProperties.getDriverClassName(DataSourceProperties.java:180) ~[spring-boot-autoconfigure-1.3.3.RELEASE.jar:1.3.3.RELEASE] 
    at org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$NonEmbeddedConfiguration.dataSource(DataSourceAutoConfiguration.java:121) ~[spring-boot-autoconfigure-1.3.3.RELEASE.jar:1.3.3.RELEASE] 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_60] 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_60] 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_60] 
    at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_60] 
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    ... 41 common frames omitted 

2016-03-23 11:55:09.834 INFO 8268 --- [ost-startStop-1] .b.l.ClasspathLoggingApplicationListener : Application failed to start with classpath: [file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/classes/, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/aopalliance-1.0.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/classmate-1.1.0.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/hibernate-validator-5.2.4.Final.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/jackson-annotations-2.6.5.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/jackson-core-2.6.5.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/jackson-databind-2.6.5.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/jboss-logging-3.3.0.Final.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/jcl-over-slf4j-1.7.16.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/jul-to-slf4j-1.7.16.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/log4j-over-slf4j-1.7.16.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/logback-classic-1.1.5.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/logback-core-1.1.5.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/mongo-java-driver-2.13.3.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/mysql-connector-java-5.1.38.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/slf4j-api-1.7.16.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/snakeyaml-1.16.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-aop-4.2.5.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-beans-4.2.5.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-boot-1.3.3.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-boot-autoconfigure-1.3.3.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-boot-starter-1.3.3.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-boot-starter-data-mongodb-1.3.3.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-boot-starter-logging-1.3.3.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-boot-starter-security-1.3.3.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-boot-starter-validation-1.3.3.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-boot-starter-web-1.3.3.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-context-4.2.5.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-core-4.2.5.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-data-commons-1.11.4.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-data-mongodb-1.8.4.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-expression-4.2.5.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-jdbc-4.2.5.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-orm-4.2.5.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-security-config-4.0.3.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-security-core-4.0.3.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-security-web-4.0.3.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-tx-4.2.5.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-web-4.2.5.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-webmvc-4.2.5.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/validation-api-1.1.0.Final.jar] 
2016-03-23 11:55:09.839 ERROR 8268 --- [ina-startStop-1] org.apache.catalina.core.ContainerBase : A child container failed during start 

私はJDK7と春ブーツ1.3.3を使用しています。 WARを外部サーバーに展開する際に誰かが同様の問題を抱えているので、どんな助けでも良いはずです。ここで

は私のファイル

<project.......> 
    <modelVersion>4.0.0</modelVersion> 
    <packaging>war</packaging> 
    <groupId>SpringBootDemo</groupId> 
    <artifactId>SpringBootDemo</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <name>SpringBootDemo Maven Webapp</name> 
    <url>http://maven.apache.org</url> 
    <parent> 
    <groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-starter-parent</artifactId> 
    <version>1.3.3.RELEASE</version> 
</parent> 

<dependencies> 

    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-web</artifactId> 
    </dependency> 
    <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-tomcat</artifactId> 
      <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-data-mongodb</artifactId> 
    </dependency> 

    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-test</artifactId> 
     <scope>test</scope> 
    </dependency> 

    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-security</artifactId> 
    </dependency> 

    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-logging</artifactId> 
    </dependency> 


</dependencies> 
<build> 
     <finalName>SpringBootDemo</finalName> 
     <plugins> 
      <plugin> 
       <groupId>org.springframework.boot</groupId> 
       <artifactId>spring-boot-maven-plugin</artifactId> 
      </plugin> 
     </plugins> 
     </build> 
    </project> 

ApplicatationStart.java

package com.springDemo; 
@Configuration 
@ComponentScan(basePackages="com.springDemo") 
@EnableAutoConfiguration 
@SpringBootApplication 
public class ApplicatationStart extends SpringBootServletInitializer { 

@Override 
protected SpringApplicationBuilder configure(SpringApplicationBuilder   application) { 
    return application.sources(ApplicatationStart.class); 
} 

public static void main(String[] args) throws Exception { 
    SpringApplication.run(ApplicatationStart.class, args); 
    } 

} 

application.properties
のpom.xmlある

server.contextPath =/springDemo 
#for mongo db 
spring.data.mongodb.uri=mongodb://localhost/admin 
#spring.data.mongodb.host=localhost 
#spring.data.mongodb.port=27017 
# security properties 
security.basic.enabled=false 
management.security.enabled=false 
+0

warを外部コンテナに配備するときにapplication.propertiesがロードされているかどうか確認できますか? – sag

+1

'@ContentScan'と' @ EnableAutoConfiguration'( '@ SpringBootApplication'が' @ SpringBootApplication'アノテーションに 'exclude = DataSourceAutoConfiguration.class'を追加することによって暗示されています)を削除します。セキュリティは' spring-jdbc'依存関係を引っ張ります。ターンはデータソースの開始をトリガーするでしょう。もし必要ならば、あなたの 'application.properties'に明示的に設定してください。 –

+0

ありがとうM. Deinum。それは – Satyajit

答えて

1

要点は、spring-boot-starter-securityspring-jdbcの依存関係を引き出していることです。この依存関係は、DataSourceAutoConfigurationDataSourceを作成するようにトリガーします。これは、明示的に定義していないので、H2、HSQLDB、またはDerbyのようなメモリ上にあると仮定します。しかしそれらはあなたのクラスパス上にないので起動が失敗します。

これを解決する2つのオプションがあります。 1つ目の方法は、を@SpringBootApplicationアノテーションに追加することで、DataSourceAutoConfigurationを明示的に無効にします。

@SpringBootApplication(exclude= DataSourceAutoConfiguration.class) 
public class ApplicatationStart extends SpringBootServletInitializer { ... } 

プロヒント:あなたはまた、これらのよう@Configuration@ComponentScan@EnableAutoConfiguration@SpringBootApplicationによって暗示されて削除する必要があります。

spring-jdbc依存関係をspring-boot-starter-security依存関係から除外することもできます。

<dependency> 
    <groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-starter-security</artifactId> 
    <excludes> 
     <exclude> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-jdbc</artifactId> 
     </exclude> 
    </excludes> 
</dependency> 
関連する問題