当前位置: 首页 > 知识库问答 >
问题:

无法为Spring Boot Rest Api启动Apache Tomcat V9.0服务器

楚权
2023-03-14

我是春靴新手。我正在Java1.8编译器上使用spring Boot2.2、Hibernate5和MySQL构建一个rest API。当我在apache tomcat V8.0服务器上运行spring boot rest API应用程序时,服务器启动,应用程序运行并显示索引页。在构建(clean install)我的应用程序并尝试在服务器上运行它之后,服务器拒绝启动,错误为“server Tomcat V8.0 server at localhost failed to start”。拜托,这是什么原因?

以下是完整的错误:

Dec 12, 2019 8:42:12 AM org.apache.catalina.startup.VersionLoggerListener 
log
INFO: Server version name:   Apache Tomcat/9.0.27
Dec 12, 2019 8:42:12 AM org.apache.catalina.startup.VersionLoggerListener 
log
INFO: Server built:          Oct 7 2019 09:57:22 UTC
Dec 12, 2019 8:42:12 AM org.apache.catalina.startup.VersionLoggerListener 
log
INFO: Server version number: 9.0.27.0
Dec 12, 2019 8:42:12 AM org.apache.catalina.startup.VersionLoggerListener 
log
INFO: OS Name:               Windows 10
Dec 12, 2019 8:42:12 AM org.apache.catalina.startup.VersionLoggerListener 
log
INFO: OS Version:            10.0
Dec 12, 2019 8:42:12 AM org.apache.catalina.startup.VersionLoggerListener 
log
INFO: Architecture:          amd64
Dec 12, 2019 8:42:12 AM org.apache.catalina.startup.VersionLoggerListener 
log
INFO: Java Home:             C:\Program Files\Java\jdk1.8.0_171\jre
Dec 12, 2019 8:42:12 AM org.apache.catalina.startup.VersionLoggerListener 
log
INFO: JVM Version:           1.8.0_171-b11
Dec 12, 2019 8:42:12 AM org.apache.catalina.startup.VersionLoggerListener 
log
INFO: JVM Vendor:            Oracle Corporation
Dec 12, 2019 8:42:12 AM org.apache.catalina.startup.VersionLoggerListener 
log
INFO: CATALINA_BASE: C:\Users\Harry\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0 
Dec 12, 2019 8:42:12 AM org.apache.catalina.startup.VersionLoggerListener 
log
INFO: CATALINA_HOME:         C:\Program Files (x86)\Apache Software 
Foundation\Tomcat 9.0 
Dec 12, 2019 8:42:12 AM org.apache.catalina.startup.VersionLoggerListener 
log INFO: Command line argument: Dcatalina.base=C:\Users\Harry\workspace\.metadata\.plugins\org.eclipse.wst.ser 
ver.core\tmp0
Dec 12, 2019 8:42:12 AM org.apache.catalina.startup.VersionLoggerListener 
log
INFO: Command line argument: -Dcatalina.home=C:\Program Files (x86)\Apache 
Software Foundation\Tomcat 9.0
Dec 12, 2019 8:42:12 AM org.apache.catalina.startup.VersionLoggerListener 
log INFO: Command line argument: Dwtp.deploy=C:\Users\Harry\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
Dec 12, 2019 8:42:12 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=C:\Program Files (x86)\Apache Software Foundation\Tomcat 9.0\endorsed
 Dec 12, 2019 8:42:12 AM org.apache.catalina.startup.VersionLoggerListener log
 INFO: Command line argument: -Dfile.encoding=Cp1252
 Dec 12, 2019 8:42:12 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
 INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: 
 [C:\Program Files\Java\jdk1.8.0_171\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/ProgramFiles/Java/jdk1.8.0_171/bin/../jre/bin/server;C:/ProgramFiles/Java/jdk1.8.0_171/bin/../jre/bin;C:/ProgramFiles/Java/jdk1.8.0_171/bin/../jre/lib/amd64;C:\oraclexe\app\oracle\product\11.2.0\server\bin;C:\ProgramFiles\Java\jdk1.8.0_171\bin;C:\Program Files (x86)\CommonFiles\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\ProgramFiles\Microsoft VSCode\bin;C:\xampp\php;C:\ProgramData\ComposerSetup\bin;C:\WINDOWS\System32\penSSH\;C:\Program Files\nodejs\;C:\Users\Harry\workspace\apache-maven-3.6.2\bin;C:\Program Files\Microsoft VSCode\bin;C:\Users\Harry\AppData\Roaming\Composer\vendor\bin;C:\Users\Harry\appData\Local\Microsoft\WindowsApps;C:\Users\Harry\AppData\Roaming\npm;C:\Users\Harry\AppData\Local\Programs\Python\Python37-32;C:\Users\Harry\AppData\Local\Programs\Python\Python37-32\Scripts;;C:\Program Files (x86)\eclipse;;.]
Dec 12, 2019 8:42:13 AM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["http-nio-8083"]
Dec 12, 2019 8:42:13 AM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["ajp-nio-8012"]
Dec 12, 2019 8:42:13 AM org.apache.catalina.startup.Catalina load INFO: Server initialization in [1,929] milliseconds
Dec 12, 2019 8:42:13 AM org.apache.catalina.core.StandardService startInternal INFO: Starting service [Catalina]
Dec 12, 2019 8:42:13 AM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet engine: [Apache Tomcat/9.0.27]
Dec 12, 2019 8:42:27 AM org.apache.catalina.core.ApplicationContext log INFO: 2 Spring WebApplicationInitializers detected on classpath

 .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
'  |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.2.2.RELEASE)
 2019-12-12 08:42:30.969  INFO 22232 --- [main] c.a.e.SpringBootApplications: Starting SpringBootApplications v0.0.1-SNAPSHOT on Harry with PID 22232(C:\Users\Harry\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0 wtpwebapps\ecclesiamainframe\WEB-INF\classes started by Harry in C:\ProgramFiles (x86)\eclipse) 2019-12-12 08:42:30.993  INFO 22232 --- [main] c.a.e.SpringBootApplications    : No active profile set, falling back to default profiles: default 2019-12-12 08:42:35.300  INFO 22232 --- [main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPArepositories in DEFAULT mode.
 2019-12-12 08:42:35.720  INFO 22232 ---[main].s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 349ms. Found 1 JPA repository interfaces.
 2019-12-12 08:42:37.814  INFO 22232 --- [main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
 2019-12-12 08:42:38.008  INFO 22232 --- [main] o.a.c.c.C.[.[.[/ecclesiamainframe]       : Initializing Spring embedded WebApplicationContext
 2019-12-12 08:42:38.008  INFO 22232 --- [main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 6786 ms
 2019-12-12 08:42:38.622  WARN 22232 --- [main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
 2019-12-12 08:42:38.664  INFO 22232 --- [main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
 2019-12-12 08:42:38.682 ERROR 22232 --- [main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

 Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

Reason: Failed to determine a suitable driver class


 Action:

Consider the following:
If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).
 <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/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion>
 <groupId>com.app</groupId>
 <artifactId>ecclesiamainframe</artifactId>
 <packaging>war</packaging>
 <version>0.0.1-SNAPSHOT</version>
 <name>ecclesiamainframe Maven Webapp</name>
 <url>http://maven.apache.org</url>

 <parent>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-parent</artifactId>
   <version>2.2.2.RELEASE</version>
 </parent>

 <dependencies>
   <dependency>
   <groupId>junit</groupId>
   <artifactId>junit</artifactId>
   <scope>test</scope>
 </dependency>

<!-- exclude tomcat jdbc connection pool, use HikariCP -->
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-data-jpa</artifactId>
 <exclusions>
    <exclusion>
        <groupId>org.apache.tomcat</groupId>
        <artifactId>tomcat-jdbc</artifactId>
     </exclusion>
 </exclusions>
</dependency>


<dependency>
    <groupId>com.zaxxer</groupId>
    <artifactId>HikariCP</artifactId>
</dependency>

<!-- exclude tomcat-jdbc , spring boot will use use HikariCP automatically -->
<dependency>
  <groupId>org.hibernate</groupId>
  <artifactId>hibernate-hikaricp</artifactId>
</dependency>

<dependency>
  <groupId>org.slf4j</groupId>
  <artifactId>slf4j-api</artifactId>
</dependency>
 <dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-web</artifactId>
  <exclusions>
    <exclusion>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-tomcat</artifactId>
    </exclusion>
  </exclusions>
</dependency>

 <dependency>
  <groupId>mysql</groupId>
  <artifactId>mysql-connector-java</artifactId>
</dependency>

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

 <dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-tomcat</artifactId>
  <scope>providedRuntime</scope>
</dependency>
<!--  
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-tomcat</artifactId>
    <scope>provided</scope>
</dependency>
-->
 <dependency> 
     <groupId>javax.servlet</groupId> 
        <artifactId>javax.servlet-api</artifactId>  
     <scope>provided</scope> 
 </dependency>
 <dependency>
  <groupId>org.projectlombok</groupId>
  <artifactId>lombok</artifactId>
</dependency>

<dependency>
  <groupId>com.vladmihalcea</groupId>
  <artifactId>hibernate-types-52</artifactId>
  <version>2.8.0</version>
 </dependency> 

</dependencies>

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

</project>
        #Database connection Properties
        spring.datasource.url=jdbc:mysql://localhost:3306/ecclesia_mainframe_db
        #?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC&characterEncoding=UTF-8&autoReconnect=yes

        #database credential
        spring.datasource.username = devteam
        spring.datasource.password = softmysql2019
        server.port=8090
        spring.datasource.driver-class-name = com.mysql.cj.jdbc.Driver

        #The SQL dialect makes Hibernate generate better SQL for the chosen database
        spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect

        #spring.datasource.hikari.connection-timeout=200000
        #spring.datasource.hikari.maximum-pool-size=3000

        #Turn Statistics on and log SQL stmts

        spring.jpa.show-sql=true
        spring.jpa.properties.hibernate.format_sql=true

        #If want to see very extensive logging
        spring.jpa.properties.hibernate.generate_statistics=true
        logging.level.org.hibernate.type=trace
        logging.level.org.hibernate.stat=debug

        #Schema will be created using schema.sql and data.sql files
        #spring.jpa.hibernate.ddl-auto=none


        #Hibernate ddl auto (create, create-drop, validate, update)
        spring.jpa.hibernate.ddl-auto=update

共有1个答案

越姚石
2023-03-14

可以清理您的Tomcat服务器。在Eclipse中,右键单击服务器并单击clean以清除以前的项目。或者在Eclipse中删除服务器并添加另一个Tomcat实例

 类似资料:
  • 问题内容: 码头工人给我一个困难时期。我按照以下说明进行操作,以便在运行由strato.de托管的Ubuntu 14.04的虚拟服务器上安装docker。 执行此行直接将我带入此错误消息: 安装完成后,我安装了上述两个软件包。现在我的问题是我无法让docker运行。 结果是: 结果是 和 结果是 有人对缺少哪些依赖项有任何线索吗?还有什么可能出问题了?码头工人是否提供任何日志? 我正在来回寻找解决

  • 当收到来自服务器的数据报文时,显示错误日志:

  • 我有一个spring boot可执行罐,装在数字海洋水滴中。我可以使用现在我想让我作为一个服务运行。 我已经创建了文件/etc/systemd/system/myapp。用这些内容服务 然后使其在系统启动时启动 我正在尝试启动服务 但是我得到了这个错误 无法启动myapp.service:未知单位:myapp.service详情请参阅系统日志和'systemctl statusmyapp.serv

  • 好吧,这就是问题所在。我做,但我没有从或获得新的日志消息。 舱单: null 活动代码: 我试过什么: 将所有“cont”更改为“this” StartService(新意图(cont,FlashService.class)); null 更新: 完整活动代码:

  • 问题内容: 我已经安装了rails和mysql。我还安装了mysql2 gem。我通过命令rails new try_cms -d mysql创建了Rails应用程序。创建成功。但是,当我尝试使用rails server命令运行WEBrick服务器时,出现以下错误。 提前致谢。 问题答案: 尝试运行此命令(在此处查看类似的问题)

  • 我正在亚马逊EC2和ubuntu上运行Kafka。首先,我尝试运行zookeeper服务器并创建一个测试主题。最终目的是将spark与Kafka结合起来进行情感分析。 当我尝试启动zookeeper服务器时,我收到以下警告,并且进程似乎没有结束,即键入此命令后,我没有看到shell提示:bin/zookeeper服务器启动。sh配置/zookeeper。属性 警告配置中未定义配置或未定义仲裁,以独

  • 我无法重启服务器。 开始时,我杀死了所有进程并重新启动了服务器。我收到了成功的消息,但应用程序不起作用。我再次停止并启动了服务。现在系统显示服务器上正在运行另一个进程,如下所示。 你能帮我查一下这个问题吗?

  • 我已经按照指示从:https://cloud.spring.io/spring-cloud-static/Dalston.SR5/multi/multi_spring-cloud-eureka-server.html 没有成功,就不知道会错过什么。 我有一些代码演示:https://github.com/dbranco/eureka-server 我期待着运行:gradlew bootRun并能够