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

Spring boot应用程序在运行时卡住

鲁鸿朗
2023-03-14

这是我的第一个spring boot应用程序。我运行了一个示例代码,它被困在“针对持久性单元“default”初始化的JPA EntityManagerFactory”中。

下面是代码

package com.fredo.webservices.homefredoServcies;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class HomeFredoServciesApplication {

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

}

下面是日志

 .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.3.0.RELEASE)

2020-06-07 20:58:15.807  INFO 1496 --- [  restartedMain] c.f.w.h.HomeFredoServciesApplication     : Starting HomeFredoServciesApplication on ANGU with PID 1496 (C:\Users\ASUS\Desktop\java ms\home-fredoServcies\target\classes started by Angu in C:\Users\ASUS\Desktop\java ms\home-fredoServcies)
2020-06-07 20:58:15.811  INFO 1496 --- [  restartedMain] c.f.w.h.HomeFredoServciesApplication     : No active profile set, falling back to default profiles: default
2020-06-07 20:58:15.881  INFO 1496 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2020-06-07 20:58:15.882  INFO 1496 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2020-06-07 20:58:16.799  INFO 1496 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFERRED mode.
2020-06-07 20:58:16.822  INFO 1496 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 13ms. Found 0 JPA repository interfaces.
2020-06-07 20:58:17.861  INFO 1496 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2020-06-07 20:58:17.876  INFO 1496 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2020-06-07 20:58:17.877  INFO 1496 --- [  restartedMain] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.35]
2020-06-07 20:58:18.038  INFO 1496 --- [  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2020-06-07 20:58:18.038  INFO 1496 --- [  restartedMain] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2156 ms
2020-06-07 20:58:18.100  INFO 1496 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2020-06-07 20:58:18.335  INFO 1496 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
2020-06-07 20:58:18.342  INFO 1496 --- [  restartedMain] o.s.b.a.h2.H2ConsoleAutoConfiguration    : H2 console available at '/h2-console'. Database available at 'jdbc:h2:mem:b2c0eff5-9805-4a71-9f66-c6c863d910f5'
2020-06-07 20:58:18.548  INFO 1496 --- [  restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2020-06-07 20:58:18.629  INFO 1496 --- [         task-1] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [name: default]
2020-06-07 20:58:18.674  WARN 1496 --- [  restartedMain] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2020-06-07 20:58:18.720  INFO 1496 --- [         task-1] org.hibernate.Version                    : HHH000412: Hibernate ORM core version 5.4.15.Final
2020-06-07 20:58:18.966  INFO 1496 --- [         task-1] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
2020-06-07 20:58:19.203  INFO 1496 --- [         task-1] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
2020-06-07 20:58:19.210  INFO 1496 --- [  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729
2020-06-07 20:58:19.317  INFO 1496 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2020-06-07 20:58:19.322  INFO 1496 --- [  restartedMain] DeferredRepositoryInitializationListener : Triggering deferred initialization of Spring Data repositories…
2020-06-07 20:58:19.324  INFO 1496 --- [  restartedMain] DeferredRepositoryInitializationListener : Spring Data repositories initialized!
2020-06-07 20:58:19.344  INFO 1496 --- [  restartedMain] c.f.w.h.HomeFredoServciesApplication     : Started HomeFredoServciesApplication in 3.985 seconds (JVM running for 4.795)
2020-06-07 20:58:19.554  INFO 1496 --- [         task-1] o.h.e.t.j.p.i.JtaPlatformInitiator       : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2020-06-07 20:58:19.562  INFO 1496 --- [         task-1] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'

共有2个答案

终洛华
2023-03-14

如果您收到响应,请尝试http://localhost:8080/h2-console。您的服务器已启动并正在运行。在日志中,它显示H2控制台可在“/h2控制台”处使用。数据库可在“jdbc: h2: mem: b2c0eff5-9805-4a71-9f66-c6c863d910f5”处使用

孙辰阳
2023-03-14

我对Eclipse和Spring工具在调试模式下运行配置启动的应用程序也有同样的问题。

断点引用某些已删除块代码上的一行,删除错误断点后,应用程序再次正确启动新。

窗口-

 类似资料: