本文介绍了启动spring boot openshift应用程序时出错:无法启动嵌入式Tomcat的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用此链接创建了一个DIY应用,其中汤姆猫8& springboot.我通过上面的链接修改了代码,使其可以访问mongodb而不是postgres.我一直在努力尝试启动示例应用程序.谁能帮我解决这个错误.

I have used this link to create a DIY app with tomcat 8 & springboot. I modified the code from the above link to make it access mongodb instead of postgres. I have been banging my head to trying figuring out to start the sample application. Can anyone help me with this error.

.openshift/action_hooks/deploy

#!/bin/bash

set -x

if [ ! -d $OPENSHIFT_DATA_DIR/m2/repository ]
then
    mkdir -p $OPENSHIFT_DATA_DIR/m2/repository
fi

if [ ! -d $OPENSHIFT_DATA_DIR/logs ]
then
    mkdir -p $OPENSHIFT_DATA_DIR/logs
fi

if [ ! -d $OPENSHIFT_DATA_DIR/apache-maven-3.3.9 ]
then
    wget -P $OPENSHIFT_DATA_DIR http://mirror.cc.columbia.edu/pub/software/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
    tar xvf $OPENSHIFT_DATA_DIR/apache-maven*.tar.gz --directory $OPENSHIFT_DATA_DIR
    rm -f $OPENSHIFT_DATA_DIR/apache-maven*.tar.gz
fi


export JAVA_HOME=/etc/alternatives/java_sdk_1.8.0
export M2=$OPENSHIFT_DATA_DIR/apache-maven-3.3.9/bin
export MAVEN_OPTS="-Xms384m -Xmx412m"
export PATH=$JAVA_HOME/bin:$PATH

cd $OPENSHIFT_REPO_DIR


$M2/mvn --version
$M2/mvn -s settings.xml clean install

开始

#!/bin/bash

source $OPENSHIFT_CARTRIDGE_SDK_BASH

set -x

export JAVA_HOME=/etc/alternatives/java_sdk_1.8.0
export PATH=$JAVA_HOME/bin:$PATH

cd $OPENSHIFT_REPO_DIR
nohup java -Xms384m -Xmx412m -jar target/*.jar --server.port=${OPENSHIFT_DIY_PORT} --server.address=${OPENSHIFT_DIY_IP} --spring.profiles.active=openshift &

停止

#!/bin/bash

source $OPENSHIFT_CARTRIDGE_SDK_BASH

PID=$(ps -ef | grep java.*\.jar | grep -v grep | awk '{ print $2 }')

if [ -z "$PID" ]
then
    client_result "Application is already stopped"
else
    kill $PID
fi

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.test</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>demo</name>
    <description>Demo project for Spring Boot</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.3.6.RELEASE</version>
        <relativePath/>
    </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>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-rest</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-mongodb</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <start-class>demo.Application</start-class>
        <java.version>1.8</java.version>
        <tomcat.version>8.0.9</tomcat.version>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

application-openshift.properties

spring.datasource.url = jdbc:mongodb://${OPENSHIFT_MONGODB_DB_HOST}:${OPENSHIFT_MONGODB_DB_PORT}/${OPENSHIFT_APP_NAME}
spring.datasource.username = ${OPENSHIFT_MONGODB_DB_USERNAME}
spring.datasource.password = ${OPENSHIFT_MONGODB_DB_PASSWORD}

logging.file = ${OPENSHIFT_DATA_DIR}/logs/app.log
logging.level. = INFOgi

openshift控制台中的错误

org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat
remote:     at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:133) ~[spring-boot-1.3.6.RELEASE.jar!/:1.3.6.RELEASE]
remote:     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532) ~[spring-context-4.2.7.RELEASE.jar!/:4.2.7.RELEASE]
remote:     at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) ~[spring-boot-1.3.6.RELEASE.jar!/:1.3.6.RELEASE]
remote:     at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:760) [spring-boot-1.3.6.RELEASE.jar!/:1.3.6.RELEASE]
remote:     at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:360) [spring-boot-1.3.6.RELEASE.jar!/:1.3.6.RELEASE]
remote:     at org.springframework.boot.SpringApplication.run(SpringApplication.java:306) [spring-boot-1.3.6.RELEASE.jar!/:1.3.6.RELEASE]
remote:     at org.springframework.boot.SpringApplication.run(SpringApplication.java:1185) [spring-boot-1.3.6.RELEASE.jar!/:1.3.6.RELEASE]
remote:     at org.springframework.boot.SpringApplication.run(SpringApplication.java:1174) [spring-boot-1.3.6.RELEASE.jar!/:1.3.6.RELEASE]
remote:     at demo.Application.main(Application.java:10) [demo-0.0.1-SNAPSHOT.jar!/:0.0.1-SNAPSHOT]
remote:     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_111]
remote:     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_111]
remote:     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_111]
remote:     at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_111]
remote:     at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:54) [demo-0.0.1-SNAPSHOT.jar!/:0.0.1-SNAPSHOT]
remote:     at org.springframework.boot.loader.Launcher.launch(Launcher.java:104) [demo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
remote:     at org.springframework.boot.loader.Launcher.launch(Launcher.java:61) [demo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
remote:     at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52) [demo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
remote: Caused by: org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat
remote:     at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.java:99) ~[spring-boot-1.3.6.RELEASE.jar!/:1.3.6.RELEASE]
remote:     at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.<init>(TomcatEmbeddedServletContainer.java:76) ~[spring-boot-1.3.6.RELEASE.jar!/:1.3.6.RELEASE]
remote:     at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getTomcatEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:457) ~[spring-boot-1.3.6.RELEASE.jar!/:1.3.6.RELEASE]
remote:     at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:168) ~[spring-boot-1.3.6.RELEASE.jar!/:1.3.6.RELEASE]
remote:     at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:160) ~[spring-boot-1.3.6.RELEASE.jar!/:1.3.6.RELEASE]
remote:     at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:130) ~[spring-boot-1.3.6.RELEASE.jar!/:1.3.6.RELEASE]
remote:     ... 16 common frames omitted
remote: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.boot.autoconfigure.web.HttpMessageConverters org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.messageConverters; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private final java.util.List org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration.converters; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'mappingJackson2HttpMessageConverter' defined in class path resource [org/springframework/boot/autoconfigure/web/JacksonHttpMessageConvertersConfiguration$MappingJackson2HttpMessageConverterConfiguration.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [com.fasterxml.jackson.databind.ObjectMapper]: Error creating bean with name 'objectMapper' defined in class path resource [org/springframework/boot/autoconfigure/data/rest/SpringBootRepositoryRestMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.fasterxml.jackson.databind.ObjectMapper]: Factory method 'objectMapper' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'config' defined in class path resource [org/springframework/boot/autoconfigure/data/rest/SpringBootRepositoryRestMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.rest.core.config.RepositoryRestConfiguration]: Factory method 'config' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'resourceMappings' defined in class path resource [org/springframework/boot/autoconfigure/data/rest/SpringBootRepositoryRestMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.rest.core.mapping.ResourceMappings]: Factory method 'resourceMappings' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'persistentEntities' defined in class path resource [org/springframework/boot/autoconfigure/data/rest/SpringBootRepositoryRestMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.mapping.context.PersistentEntities]: Factory method 'persistentEntities' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaMappingContext': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': 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.orm.jpa.JpaBaseConfiguration.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 (the profiles "openshift" are currently active).; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'objectMapper' defined in class path resource [org/springframework/boot/autoconfigure/data/rest/SpringBootRepositoryRestMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.fasterxml.jackson.databind.ObjectMapper]: Factory method 'objectMapper' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'config' defined in class path resource [org/springframework/boot/autoconfigure/data/rest/SpringBootRepositoryRestMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.rest.core.config.RepositoryRestConfiguration]: Factory method 'config' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'resourceMappings' defined in class path resource [org/springframework/boot/autoconfigure/data/rest/SpringBootRepositoryRestMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.rest.core.mapping.ResourceMappings]: Factory method 'resourceMappings' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'persistentEntities' defined in class path resource [org/springframework/boot/autoconfigure/data/rest/SpringBootRepositoryRestMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.mapping.context.PersistentEntities]: Factory method 'persistentEntities' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaMappingContext': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': 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.orm.jpa.JpaBaseConfiguration.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 (the profiles "openshift" are currently active).

更新

我将springboot版本更新为1.4.1.RELEASE,现在例外有所不同.它抱怨嵌入式容器

I updated the springboot version to 1.4.1.RELEASE and now the exception is different. Its complaining about the Embedded Container

    remote:  :: Spring Boot ::        (v1.4.1.RELEASE)
remote:
remote: 2016-11-03 08:54:00.024  INFO 93239 --- [           main] demo.Application                         : Starting Application v0.0.1-SNAPSHOT on ex-std-node853.prod.rhcloud.com with PID 93239 (/var/lib/openshift/581a74472d5271129a0000a6/app-root/runtime/repo/target/demo-0.0.1-SNAPSHOT.jar started by 581a74472d5271129a0000a6 in /var/lib/openshift/581a74472d5271129a0000a6/app-root/runtime/repo)
remote: 2016-11-03 08:54:00.025  INFO 93239 --- [           main] demo.Application                         : The following profiles are active: openshift
remote: 2016-11-03 08:54:00.469  INFO 93239 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@15380c2: startup date [Thu Nov 03 08:54:00 EDT 2016]; root of context hierarchy
remote: 2016-11-03 08:54:12.437  INFO 93239 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Overriding bean definition for bean 'managementServletContext' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.actuate.autoconfigure.EndpointWebMvcHypermediaManagementContextConfiguration; factoryMethodName=managementServletContext; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/actuate/autoconfigure/EndpointWebMvcHypermediaManagementContextConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration; factoryMethodName=managementServletContext; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.class]]
remote: 2016-11-03 08:54:13.579  INFO 93239 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
remote: 2016-11-03 08:54:14.202  INFO 93239 --- [           main] .RepositoryConfigurationExtensionSupport : Spring Data JPA - Could not safely identify store assignment for repository candidate interface demo.repository.CustomerRepository.
remote: 2016-11-03 08:54:15.764  INFO 93239 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
remote: 2016-11-03 08:54:19.720  INFO 93239 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$ee91494e] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
remote: 2016-11-03 08:54:23.293  WARN 93239 --- [           main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is java.lang.NoClassDefFoundError: org/apache/catalina/SessionIdGenerator
remote: 2016-11-03 08:54:23.337 ERROR 93239 --- [           main] o.s.boot.SpringApplication               : Application startup failed
remote:
remote: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is java.lang.NoClassDefFoundError: org/apache/catalina/SessionIdGenerator
remote:     at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:137) ~[spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE]
remote:     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:535) ~[spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
remote:     at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE]
remote:     at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761) [spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE]
remote:     at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371) [spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE]
remote:     at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE]
remote:     at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186) [spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE]
remote:     at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175) [spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE]
remote:     at demo.Application.main(Application.java:10) [classes!/:0.0.1-SNAPSHOT]
remote:     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_111]
remote:     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_111]
remote:     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_111]
remote:     at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_111]
remote:     at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [demo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
remote:     at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [demo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
remote:     at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [demo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
remote:     at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:58) [demo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
remote: Caused by: java.lang.NoClassDefFoundError: org/apache/catalina/SessionIdGenerator
remote:     at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.prepareContext(TomcatEmbeddedServletContainerFactory.java:190) ~[spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE]
remote:     at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:176) ~[spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE]
remote:     at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:164) ~[spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE]
remote:     at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:134) ~[spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE]
remote:     ... 16 common frames omitted
remote: Caused by: java.lang.ClassNotFoundException: org.apache.catalina.SessionIdGenerator
remote:     at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_111]
remote:     at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_111]
remote:     at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:89) ~[demo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
remote:     at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_111]
remote:     ... 20 common frames omitted
remote:
remote: -------------------------

推荐答案

您正在尝试使用数据库,但是尚未向Spring Boot提供任何相关信息来连接数据库. Spring Boot 1.3.x不支持Mongo 3.x,您需要先升级到Spring Boot 1.4

You are attempting to use a database but you haven't provided any relevant information to Spring Boot to connect to it. Spring Boot 1.3.x does not support Mongo 3.x, you need to upgrade to Spring Boot 1.4 first

这篇关于启动spring boot openshift应用程序时出错:无法启动嵌入式Tomcat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-03 18:58