英文:
How to check for another running project on Eclipse?
问题
我正在使用Eclipse IDE来运行我的Spring Boot项目(后端部分),该项目在本地使用端口8080。当我尝试运行程序时,它会关闭程序并显示端口8080已被占用的错误。没有其他应用程序在使用端口8080,并且也没有其他控制台窗口,因此我无法关闭当前正在运行的占用端口8080的应用程序。以下是控制台窗口的日志:
:: Spring Boot :: (v2.3.3.RELEASE)
2020-09-24 19:31:44.942 INFO 4092 --- [ main] c.library_management.lms.LmsApplication : 正在启动 LmsApplication,进程ID为4092(位于D:\eclipse-workspace\lms目录下,由Electrical Engineer在D:\eclipse-workspace\lms中启动)
2020-09-24 19:31:44.948 INFO 4092 --- [ main] c.library_management.lms.LmsApplication : 未设置活动配置文件,回退至默认配置文件: default
2020-09-24 19:31:50.633 INFO 4092 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : 以DEFERRED模式引导Spring Data JPA仓库。
2020-09-24 19:31:51.947 INFO 4092 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : 在1092毫秒内完成了Spring Data仓库扫描。找到3个JPA仓库接口。
2020-09-24 19:31:59.953 INFO 4092 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : 使用端口8080(http)初始化了Tomcat。
2020-09-24 19:32:00.358 INFO 4092 --- [ main] o.apache.catalina.core.StandardService : 正在启动服务 [Tomcat]
2020-09-24 19:32:00.360 INFO 4092 --- [ main] org.apache.catalina.core.StandardEngine : 正在启动Servlet引擎:[Apache Tomcat/9.0.37]
2020-09-24 19:32:01.666 INFO 4092 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : 正在初始化Spring嵌入式WebApplicationContext
2020-09-24 19:32:01.667 INFO 4092 --- [ main] w.s.c.ServletWebServerApplicationContext : 根WebApplicationContext初始化完成,耗时16526毫秒
2020-09-24 19:32:05.077 INFO 4092 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : 正在初始化ExecutorService 'applicationTaskExecutor'
...(日志继续)
2020-09-24 19:32:26.862 INFO 4092 --- [ main] j.LocalContainerEntityManagerFactoryBean : 为持久化单元'default'关闭JPA EntityManagerFactory
...(日志继续)
2020-09-24 19:32:41.652 ERROR 4092 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
应用启动失败
***************************
描述:
Web服务器启动失败。端口8080已被占用。
操作:
找出并停止正在监听端口8080的进程,或者配置此应用程序以侦听其他端口。
英文:
I am using eclipse IDE to run my spring boot project(the backend part) which uses the port 8080 on localhost. When i try to run my program it shuts down the program saying port 8080 was already in use. There isn't any other application that is using the port 8080 and there is no other console window because of which i cannot shut down the currently running application that is using port 8080. PFB the logs from the console window:
:: Spring Boot :: (v2.3.3.RELEASE)
2020-09-24 19:31:44.942 INFO 4092 --- [ main] c.library_management.lms.LmsApplication : Starting LmsApplication on DESKTOP-GM2UUP2 with PID 4092 (D:\eclipse-workspace\lms\target\classes started by Electrical Engineer in D:\eclipse-workspace\lms)
2020-09-24 19:31:44.948 INFO 4092 --- [ main] c.library_management.lms.LmsApplication : No active profile set, falling back to default profiles: default
2020-09-24 19:31:50.633 INFO 4092 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFERRED mode.
2020-09-24 19:31:51.947 INFO 4092 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 1092ms. Found 3 JPA repository interfaces.
2020-09-24 19:31:59.953 INFO 4092 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2020-09-24 19:32:00.358 INFO 4092 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2020-09-24 19:32:00.360 INFO 4092 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.37]
2020-09-24 19:32:01.666 INFO 4092 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2020-09-24 19:32:01.667 INFO 4092 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 16526 ms
2020-09-24 19:32:05.077 INFO 4092 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2020-09-24 19:32:06.080 INFO 4092 --- [ task-1] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2020-09-24 19:32:06.793 WARN 4092 --- [ main] 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-09-24 19:32:08.214 INFO 4092 --- [ task-1] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.20.Final
2020-09-24 19:32:16.114 INFO 4092 --- [ task-1] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
2020-09-24 19:32:16.817 INFO 4092 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@5477a1ca, org.springframework.security.web.context.SecurityContextPersistenceFilter@6794ac0b, org.springframework.security.web.header.HeaderWriterFilter@77d680e6, org.springframework.security.web.authentication.logout.LogoutFilter@33a3c44a, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@222afc67, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@5cb5bb88, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@3a01773b, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@3ae9d1e2, org.springframework.security.web.session.SessionManagementFilter@5c1f6d57, org.springframework.security.web.access.ExceptionTranslationFilter@6014a9ba, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@65f2f9b0]
2020-09-24 19:32:21.739 INFO 4092 --- [ task-1] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2020-09-24 19:32:26.793 WARN 4092 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'; nested exception is org.springframework.boot.web.server.PortInUseException: Port 8080 is already in use
2020-09-24 19:32:26.862 INFO 4092 --- [ main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2020-09-24 19:32:31.239 INFO 4092 --- [ task-1] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2020-09-24 19:32:31.877 INFO 4092 --- [ task-1] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect
2020-09-24 19:32:41.109 INFO 4092 --- [ task-1] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2020-09-24 19:32:41.172 INFO 4092 --- [ task-1] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
Exception in thread "task-2" 2020-09-24 19:32:41.202 INFO 4092 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor'
2020-09-24 19:32:41.204 INFO 4092 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
java.lang.IllegalStateException: EntityManagerFactory is closed
at org.hibernate.internal.SessionFactoryImpl.validateNotClosed(SessionFactoryImpl.java:509)
at org.hibernate.internal.SessionFactoryImpl.getProperties(SessionFactoryImpl.java:503)
at org.springframework.boot.autoconfigure.orm.jpa.DataSourceInitializedPublisher.findDataSource(DataSourceInitializedPublisher.java:105)
at org.springframework.boot.autoconfigure.orm.jpa.DataSourceInitializedPublisher.publishEventIfRequired(DataSourceInitializedPublisher.java:97)
at org.springframework.boot.autoconfigure.orm.jpa.DataSourceInitializedPublisher.access$100(DataSourceInitializedPublisher.java:50)
at org.springframework.boot.autoconfigure.orm.jpa.DataSourceInitializedPublisher$DataSourceSchemaCreatedPublisher.lambda$postProcessEntityManagerFactory$0(DataSourceInitializedPublisher.java:200)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
2020-09-24 19:32:41.413 INFO 4092 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
2020-09-24 19:32:41.418 INFO 4092 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2020-09-24 19:32:41.629 INFO 4092 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-09-24 19:32:41.652 ERROR 4092 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Web server failed to start. Port 8080 was already in use.
Action:
Identify and stop the process that's listening on port 8080 or configure this application to listen on another port.
答案1
得分: 0
这可能是因为您可能先前已经运行了该项目(因此占用了端口),现在您正在尝试在没有关闭上一个项目的情况下再次运行它。使用此选项。
英文:
This can be because you might gave run the project first (so it occupied the port) and now you are trying to run it again without closing the last one.Use this Option
答案2
得分: 0
错误消息并不含糊,这不是会“错误地”发生的事情(当实际上并未使用该端口时说某个东西正在使用该端口)。该端口不必被你从Eclipse启动的某个东西使用。毫无疑问,某个东西已经在那个端口上进行监听。你只需找出它是什么。或者,你可以将你的应用程序设置为在不同的端口上运行。
英文:
The error message is not ambiguous, and that's not something that will occur "erroneously" (saying something is using the port when it's not actually in use). The port doesn't have to be used by something you started from Eclipse. There is no question that something is already listening on that port. You just have to figure out what it is. Alternatively, you could set up your application to run on a different port.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论