运行Spring Boot应用程序时,嵌入式tomcat服务器无法启动。我刚刚在pom.xml中添加了所需的依赖项,并创建了一个简单的java POJO类。应用程序属性已经按照oracle数据库所需的jdbc配置以及Hibernate方言信息进行了设置。
#Properties for Oracle connection using Java config
oracle.username=XXXX
oracle.password=XXXX
oracle.url=jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=host.oracle.com)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=host.oracle.com)))
spring.jpa.database-platform=org.hibernate.dialect.Oracle10gDialect
spring.jpa.hibernate.ddl-auto=none
<?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>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.21.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.app.oracle</groupId>
<artifactId>OMBugDBAnalyzer</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>OMBugDBAnalyzer</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
package com.app.oracle.OMBugDBAnalyzer.config;
import oracle.jdbc.pool.OracleDataSource;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.sql.DataSource;
import java.sql.SQLException;
@Configuration
@ConfigurationProperties("oracle")
public class DBConfig {
private String username;
private String password;
private String url;
public void setUsername(String username) {
this.username = username;
}
public void setPassword(String password) {
this.password = password;
}
public void setUrl(String url) {
this.url = url;
}
@Bean
DataSource dataSource() throws SQLException {
OracleDataSource dataSource = new OracleDataSource();
dataSource.setUser(username);
dataSource.setPassword(password);
dataSource.setURL(url);
dataSource.setImplicitCachingEnabled(true);
dataSource.setFastConnectionFailoverEnabled(true);
return dataSource;
}
}
执行mvn spring-boot:run时的控制台日志
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.5.21.RELEASE)
2019-05-24 22:59:17.866 INFO 3704 --- [ main] c.a.o.O.OmBugDbAnalyzerApplication : Starting OmBugDbAnalyzerApplication on vijswami-mac with PID 3704 (/MyExperiments/OMBugDBAnalyzer/target/classes started by vijswami in /MyExperiments/OMBugDBAnalyzer)
2019-05-24 22:59:17.869 INFO 3704 --- [ main] c.a.o.O.OmBugDbAnalyzerApplication : No active profile set, falling back to default profiles: default
2019-05-24 22:59:17.906 INFO 3704 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@7b11b270: startup date [Fri May 24 22:59:17 IST 2019]; root of context hierarchy
2019-05-24 22:59:23.439 INFO 3704 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2019-05-24 22:59:23.455 INFO 3704 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2019-05-24 22:59:23.525 INFO 3704 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.0.12.Final}
2019-05-24 22:59:23.526 INFO 3704 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2019-05-24 22:59:23.528 INFO 3704 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist
2019-05-24 22:59:23.563 INFO 3704 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2019-05-24 22:59:28.449 INFO 3704 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect
2019-05-24 22:59:35.367 INFO 3704 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2019-05-24 22:59:35.559 INFO 3704 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2019-05-24 22:59:35.568 INFO 3704 --- [ main] c.a.o.O.OmBugDbAnalyzerApplication : Started OmBugDbAnalyzerApplication in 17.906 seconds (JVM running for 20.542)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 19.608 s
[INFO] Finished at: 2019-05-24T22:59:35+05:30
[INFO] ------------------------------------------------------------------------
2019-05-24 22:59:35.573 INFO 3704 --- [ Thread-4] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@7b11b270: startup date [Fri May 24 22:59:17 IST 2019]; root of context hierarchy
2019-05-24 22:59:35.574 INFO 3704 --- [ Thread-4] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
2019-05-24 22:59:35.574 INFO 3704 --- [ Thread-4] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
向pom添加Web依赖项
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
如果没有这个,你的应用程序就会停止,因为它已经完成了...
我刚刚开始使用microservices,我想创建一个简单的Eureka服务器来执行我的Serviceregistry。目前,我只想在localhost上运行服务器,稍后我想添加一个注册到其中的示例微服务。问题是,我在尝试启动Eureka服务器时出错。我在Eclipse中使用Spring和Maven在ubuntu vm中开发。 我的POM. xml如下所示: http://maven.apache
当我将keystore.jks添加到资源目录时,会出现这个错误。当我在命令行中运行spring-boot应用程序时,就面临着这一点。在IntelliJ中,IDEA应用程序运行没有任何问题。 2020-11-08 21:37:05.776错误2422--[main]O.S.Boot.SpringApplication:应用程序运行失败
说明:无法启动web服务器;嵌套的异常是org。springframework。靴子网状物服务器WebServerException:无法启动嵌入式Tomcat 启动Tomcat上下文时出错。例外情况: 组织。springframework。豆。工厂BeanCreationException。消息:创建在类路径资源[org/springframework/boot/actuate/autoconf
我需要启动spring boot的嵌入式tomcat服务器,并在调试模式下启动服务器
Spring应用程序使用Maven只包含Spring Web依赖项,给出“无法启动嵌入式Tomcat服务”的错误。 相同的项目在其他计算机上运行,就像预期的那样。 null
当我试图在eclipse oxygen中启动tomcat服务器(8.5.39)时,出现一个错误,显示: “-djava.endorsed.dirs=d:\server\apache-tomcat-8.5.39\endorsed不支持。endorsed标准和模块化的独立API将通过可升级模块的概念提供支持。” 当我从bin文件夹中的文件启动Tomcat服务器时,他成功地启动了,没有任何问题。我想从E