无法从Eclipse Spring Boot应用程序访问localhost:8080。

huangapple go评论81阅读模式
英文:

Unable to access localhost:8080 from eclipse springboot application

问题

我正在运行一个简单的 Spring Boot 演示应用程序。

但是,在从浏览器访问 localhost:8080 时,我看到"无法访问该站点"的错误。可能是什么问题呢?即使端口没有被占用(通过 netstat 检查)。

以下是显示的日志:

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

2020-10-12 19:45:54.694  INFO 19756 --- [           main] com.example.demo.DemoApplication         : 正在启动 DemoApplication,PID 为 19756(位于 C:\Users\abc\Downloads\demo\demo\target\classes,由 rsoni 在 C:\Users\abc\Downloads\demo\demo 中启动)
2020-10-12 19:45:54.695  INFO 19756 --- [           main] com.example.demo.DemoApplication         : 激活的配置文件为:@spring.profiles.active@
2020-10-12 19:45:54.791  INFO 19756 --- [           main] com.example.demo.DemoApplication         : 在 0.312 秒内启动了 DemoApplication(JVM 运行时间为 0.869 秒)

application.properties-- 它只包含以下属性:

pom XML

如果您需要更多帮助,请随时问我。

英文:

I am running a simple springboot demoapplication
无法从Eclipse Spring Boot应用程序访问localhost:8080。

But while accessing the localhost:8080 from browser, I see "Site can't be reached error".
What could be the issue here.
Even the port is not occupied(checked via netstat).
Below are the logs, displayed:-

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

2020-10-12 19:45:54.694  INFO 19756 --- [           main] com.example.demo.DemoApplication         : Starting DemoApplication on 8-UJLOP with PID 19756 (C:\Users\abc\Downloads\demo\demo\target\classes started by rsoni in C:\Users\abc\Downloads\demo\demo)
2020-10-12 19:45:54.695  INFO 19756 --- [           main] com.example.demo.DemoApplication         : The following profiles are active: @spring.profiles.active@
2020-10-12 19:45:54.791  INFO 19756 --- [           main] com.example.demo.DemoApplication         : Started DemoApplication in 0.312 seconds (JVM running for 0.869)

Application.properties-- it only has the below mentioned property

无法从Eclipse Spring Boot应用程序访问localhost:8080。

pom XML

无法从Eclipse Spring Boot应用程序访问localhost:8080。

无法从Eclipse Spring Boot应用程序访问localhost:8080。

答案1

得分: 0

将以下依赖项添加到 pom.xml 中成功:-

spring-boot-starter-web

英文:

Adding the following dependency to pom.xml worked:-

spring-boot-starter-web

huangapple
  • 本文由 发表于 2020年10月12日 22:29:15
  • 转载请务必保留本文链接:https://go.coder-hub.com/64319837.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定