无法运行我的 Springboot/Oracle 应用程序。端口问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/42068612/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 03:23:07  来源:igfitidea点击:

Can't run my Springboot/Oracle application. Port problems

oraclespring-boot

提问by Martin Erlic

I'm trying to run my Springboot application. I need to connect to my Oracle database but I'm getting an error related to the port that it is installed on. It's an Oracle 11g Express Edition installation. Should I then change the port of my Oracle installation and if so, how?

我正在尝试运行我的 Springboot 应用程序。我需要连接到我的 Oracle 数据库,但我收到一个与安装它的端口相关的错误。这是一个 Oracle 11g Express Edition 安装。然后我是否应该更改我的 Oracle 安装的端口,如果是,如何更改?

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

Description:

The Tomcat connector configured to listen on port 8080 failed to start. The port may already be in use or the connector may be misconfigured.

Action:

Verify the connector's configuration, identify and stop any process that's listening on port 8080, or configure this application to listen on another port.

2017-02-06 13:58:27.402  INFO 6432 --- [           main] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@45a48c09: startup date [Mon Feb 06 13:58:15 CET 2017]; root of context hierarchy
2017-02-06 13:58:27.404  INFO 6432 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans on shutdown
2017-02-06 13:58:27.406  INFO 6432 --- [           main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2017-02-06 13:58:27.406  INFO 6432 --- [           main] .SchemaDropperImpl$DelayedDropActionImpl : HHH000477: Starting delayed drop of schema as part of SessionFactory shut-down'
Hibernate: drop table tmt.users cascade constraints
2017-02-06 13:58:27.516 ERROR 6432 --- [           main] .SchemaDropperImpl$DelayedDropActionImpl : HHH000478: Unsuccessful: drop table tmt.users cascade constraints
Hibernate: drop sequence tmt.id_seq
2017-02-06 13:58:27.528 ERROR 6432 --- [           main] .SchemaDropperImpl$DelayedDropActionImpl : HHH000478: Unsuccessful: drop sequence tmt.id_seq
[WARNING] 
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run(AbstractRunMojo.java:527)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.boot.context.embedded.tomcat.ConnectorStartFailedException: Connector configured to listen on port 8080 failed to start
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.checkThatConnectorsHaveStarted(TomcatEmbeddedServletContainer.java:213)
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:189)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:297)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:145)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:544)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:784)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:329)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1235)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1224)
    at cz.nnit.TmtApplication.main(TmtApplication.java:14)
    ... 6 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 27.689 s
[INFO] Finished at: 2017-02-06T13:58:27+01:00
[INFO] Final Memory: 56M/482M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.0.0.BUILD-SNAPSHOT:run (default-cli) on project tmt: An exception occurred while running. null: InvocationTargetException: Connector configured to listen on port 8080 failed to start -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Process finished with exit code 1

回答by Praveen Kumar K S

Solution to your Question

Two Possible ways
1. Please change your Oracle Port to some other Port like 8081 or 9080.
2. Change the Tomcat Port in Spring-Boot application properties file.
3. Add the below following lines in src/main/resources/application.properties

您的问题的解决方案

两种可能的方法
1. 请将您的 Oracle 端口更改为其他端口,例如 8081 或 9080。
2. 在 Spring-Boot 应用程序属性文件中更改 Tomcat 端口。
3. 在 src/main/resources/ application.properties 中添加以下几行

server.port=8081.

回答by Siick

I had the same problem because i closed Eclipse suddenly with my springboot app still running and the JAVA process was still running in background. That's why the port was in use in my case.

我遇到了同样的问题,因为我突然关闭了 Eclipse,我的 springboot 应用程序仍在运行并且 JAVA 进程仍在后台运行。这就是为什么在我的情况下使用端口的原因。