Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Não consigo executar o projeto devido a porta 8080

Quando eu clico na opção Run As... e escolho o item 1 Java Application ele abre uma janela chamada Select Java Application onde possui um campo chamado Select type (? = any character, * = any String, TZ = TimeZone): onde possui dois asterisco e abaixo, possui uma serie de classes, uma que já vem marcada é a Attacher - net.bytebuddy.agent e que quando aperto no botão ok, ele não informa nada o console fica vazio.

Contudo, quando estou na classe main, e aperto a tecla F11 ele dá o seguinte erro:


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

2021-04-17 15:45:12.131  INFO 3192 --- [           main] br.com.alura.forum.ForumApplication      : Starting ForumApplication using Java 1.8.0_271 on DESKTOP-KGAC66P with PID 3192 (D:\Documentos\Alura\6.SpringRest\1-Aula\forum\forum\target\classes started by Anderson in D:\Documentos\Alura\6.SpringRest\1-Aula\forum\forum)
2021-04-17 15:45:12.139  INFO 3192 --- [           main] br.com.alura.forum.ForumApplication      : No active profile set, falling back to default profiles: default
2021-04-17 15:45:13.488  INFO 3192 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2021-04-17 15:45:13.503  INFO 3192 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2021-04-17 15:45:13.503  INFO 3192 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.45]
2021-04-17 15:45:13.589  INFO 3192 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2021-04-17 15:45:13.589  INFO 3192 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1361 ms
2021-04-17 15:45:13.808  INFO 3192 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2021-04-17 15:45:14.011  WARN 3192 --- [           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
2021-04-17 15:45:14.012  INFO 3192 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'
2021-04-17 15:45:14.016  INFO 3192 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2021-04-17 15:45:14.028  INFO 3192 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-04-17 15:45:14.045 ERROR 3192 --- [           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.

Já olhei o gerenciador de tarefas do windows procurando pelo PID do processo que está usando está porta, contudo, não há nenhum programa usando a porta 8080.

1 resposta
solução!

Oi Anderson,

Verifica na aba Console do Eclipse se a aplicação já está executando, e clica no "quadradinho vermelho" para finalizar:

E quando for rodar a aplicação clique com o botão direito em cima da classe ForumApplication e vá na opção: Run As -> Java Application: