使用MongoDB将SpringBoot Web应用程序部署到tomcat中时出错

萨蒂亚吉特

我是SpringBoot的新手。尝试将Spring Boot Webapp部署到外部Tomcat服务器时,我已经使用带有嵌入式tomcat的springboot成功执行了webapp。我有波纹管错误

无法确定数据库类型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的Spring Boot 1.3.3。任何帮助都是好的-因为在将Spring Boot应用程序作为WAR部署到外部服务器时,有人遇到类似的问题吗?

这是我的文件
pom.xml

 <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

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
然后马库斯

关键是,它spring-boot-starter-security正在拉动spring-jdbc依赖关系。这种依赖关系会触发,DataSourceAutoConfiguration以创建DataSource您尚未明确定义的,它会假设内存中有一个像H2,HSQLDB或Derby之类的文件。但是,这些不在您的类路径中,因此启动失败。

现在,您有2个解决此问题的方法。第一个是DataSourceAutoConfiguration通过将其添加为注释exclude显式禁用@SpringBootApplication

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

专业提示:您还应该删除@Configuration@ComponentScan以及@EnableAutoConfiguration那些被暗示@SpringBootApplication

另一个选择是spring-jdbcspring-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>

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

启动孩子将Spring Boot Web应用程序部署到Tomcat 9时出错

使用 Tomcat 和 Mysql 将应用程序部署到 Heroku 时出错

使用Ninject将Web api 2应用程序部署到Azure时出错

将应用程序部署到Windows Phone时出错

将Angular应用程序部署到Heroku时出错

将 Django 应用程序部署到 Heroku 时出错

无法将Web应用程序从Eclipse部署到tomcat

应用程序与 buildpack 不兼容:将 django 应用程序部署到 heroku 时出错

502使用CLI将烧瓶应用程序部署到弹性beantalk时出错

将Node js应用程序部署到Cloudbees ClickStart时出错

将Tornado应用程序部署到AWS Lambda时出错

将Spring Boot应用程序部署到Heroku时出错

将 asp.net Core REACT 应用程序部署到 AWS Beanstalk 时 IdentityServer 出错

将Meteor应用程序部署到Heroku时出错-如何更改NODE版本

将应用程序部署到测试服务器时出错?

将 Django-React 应用程序部署到 Heroku 时出错

将Ionic应用程序部署到Android Phone(Ionic 4)时出错

将ASP.NET核心应用程序部署到Azure App Service时出错

将Django应用程序部署到Heroku时出错-TypeError:类型'PosixPath'的参数不可迭代

将 Rails 4 应用程序部署到 Heroku redis 时出错

在将 Angular 应用程序部署到 heroku 和运行 ng serve 时出错?

如何使Netbeans将Java Web应用程序部署到Tomcat的根目录(例如/)而不是/ MyProject?

将Web应用程序从本地计算机部署到远程tomcat服务器

将Java Web应用程序部署到远程tomcat的最简单方法是什么

使用IntelliJ IDEA部署到Tomcat时,我的应用程序放在哪里?

将示例GWT应用程序部署到Tomcat

将多个应用程序部署到Tomcat

将 grails 2.5.5 应用程序部署到 tomcat 7

将Spring Boot应用程序部署到Tomcat 8