Java Spring启动应用程序在运行时被卡住

Java Spring启动应用程序在运行时被卡住,java,spring,spring-boot,Java,Spring,Spring Boot,这是我的第一个spring启动应用程序。我运行了一个示例代码,它被困在“针对持久性单元'default'的初始化JPA EntityManagerFactory”中 下面是代码 package com.fredo.webservices.homefredoServcies; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootAppl

这是我的第一个spring启动应用程序。我运行了一个示例代码,它被困在“针对持久性单元'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'

如果你得到回应,试着打。您的服务器已启动并正在运行。在日志中,它说H2控制台在“/H2控制台”上可用。数据库位于“jdbc:h2:mem:b2c0eff5-9805-4a71-9f66-c6c863d910f5”

是否检查了本地主机:8080?因为日志显示,
在3.985秒内启动了HomeFredoServciesApplication
我实际上在8081端口运行它。当我在8080中运行它时,日志表明该端口已经在使用中。您可以通过在cmd 1上运行此命令来终止该端口。netstat-ano | findstr:端口号2。taskkill/PID PORT_NUMBER/F但根据您的日志,您的服务器在8080server上运行时不会停留在“Initialized JPA EntityManagerFactory for persistence unit'default'”位置,如果您仔细查看它的信息消息,请检查您的主机文件,并告知127.0.0.0是否映射到本地主机以外的其他地址。如果是这样的话,服务器会挂断试图到达映射地址的连接,通常是一些adobe地址,我删除了该条目一次,它就工作了是的……你是对的……因为我是Springtools的新手,我认为我被卡在那里了……然后我使用文本输出来检查它,它工作得很好……非常感谢