7
respostas

Dificuldade para executar o Projeto Web

Oi Professor, boa tarde!

Gostaria de pedir sua ajuda.

Consegui baixar o código do Projeto Web e fiz a importação com sucesso para o Eclipse. Utilizando o plugin do maven conseguir dar o install no projeto (trazendo assim todas as dependências) e fiz o maven package (por meio das configurações do Run configurations). O Build foi realizado com sucesso conforme mensagem abaixo:

(...) [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 5.938 s [INFO] Finished at: 2017-06-19T16:41:38-03:00 [INFO] Final Memory: 19M/158M

[INFO] ------------------------------------------------------------------------

Em seguida, executei a classe br.com.caelum.alura.Application (Run as->Java Application). A classe executa sem levantar exceção ou mostrar erro, exibindo no final que a aplicação está executando:

2017-06-19 16:45:53.296 INFO 4524 --- [ restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)

2017-06-19 16:45:53.302 INFO 4524 --- [ restartedMain] br.com.caelum.alura.Application : Started Application in 6.844 seconds (JVM running for 7.375)

O problema é que acessando a porta que ele informa que o Tomcat iniciou (tentei http://localhost:8080/agenda-web-master e http://localhost:8080/agenda ) é exibida apenas a página em branco do Spring (Whitelabel Error Page)

Acredito que falte pouco, mas não estou conseguindo acessar a interface gráfica do Projeto Web. Poderia me auxiliar, por favor?

Obrigada!

7 respostas

Oi Vanessa, tente acessar a URL http://localhost:8080/, pois o spring não pega o nome do projeto como URL para acessar as páginas.

[]s

Oi Alex, obrigada pelo retorno.

Mesmo fazendo o acesso pela URL indicada não consigo exibir a tela inicial. Acho que falta alguma coisa, pois quando acesso http://localhost:8080, é exibida a mensagem no navegador:

Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback. Tue Jun 20 08:59:08 BRT 2017 There was an unexpected error (type=Not Found, status=404). /WEB-INF/views/index.jsp

Segundo essa exception ele não está conseguindo achar a página no local informado, se possível, limpe o console, do spring boot, executa novamente e me manda o log inteiro do console do spring boot para eu verificar se está acontecendo algum problema durante a configuração que o spring boot realiza para que a aplicação funcione, tudo bem?

Eu fiz o mesmo teste em computadores distintos, tanto Windows, Linux ou Mac e todos funcionaram, é justamente por esse motivo que eu preciso ver todo o processo de configuração quando você está executando o projeto.

[]s

Oi Alex, segue o registro completo do console do spring boot:


''' . _ /\ / ' () \ \ \ \ ( ( )__ | ' | '| | ' \/ ` | \ \ \ \ \/ __)| |)| | | | | || (_| | ) ) ) )

' |__| .|| ||| |__, | / / / /

||==============|__/=///_/ :: Spring Boot :: (v1.3.6.RELEASE)

2017-06-20 16:05:29.064 INFO 8332 --- [ restartedMain] br.com.caelum.alura.Application : Starting Application on pc10162 with PID 8332 (started by katia.santos in C:\Users\Dell 7010\Documents\workspace\agenda-web-master\agenda-web-master) 2017-06-20 16:05:29.068 INFO 8332 --- [ restartedMain] br.com.caelum.alura.Application : No active profile set, falling back to default profiles: default 2017-06-20 16:05:29.144 INFO 8332 --- [ restartedMain] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@c19c6b5: startup date [Tue Jun 20 16:05:29 BRT 2017]; root of context hierarchy 2017-06-20 16:05:30.971 INFO 8332 --- [ restartedMain] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring 2017-06-20 16:05:30.998 INFO 8332 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'appConfig' of type [class br.com.caelum.alura.config.AppConfig$$EnhancerBySpringCGLIB$$73784043] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2017-06-20 16:05:31.005 INFO 8332 --- [ restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 2017-06-20 16:05:31.116 INFO 8332 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$d9ddff4c] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2017-06-20 16:05:31.744 INFO 8332 --- [ restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http) 2017-06-20 16:05:31.756 INFO 8332 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service Tomcat 2017-06-20 16:05:31.757 INFO 8332 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.0.36 2017-06-20 16:05:32.135 INFO 8332 --- [ost-startStop-1] org.apache.jasper.servlet.TldScanner : At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. 2017-06-20 16:05:32.140 INFO 8332 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2017-06-20 16:05:32.140 INFO 8332 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 3001 ms 2017-06-20 16:05:32.545 INFO 8332 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/] 2017-06-20 16:05:32.548 INFO 8332 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/] 2017-06-20 16:05:32.548 INFO 8332 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/] 2017-06-20 16:05:32.549 INFO 8332 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/] 2017-06-20 16:05:32.549 INFO 8332 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/] 2017-06-20 16:05:32.808 INFO 8332 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default' 2017-06-20 16:05:32.818 INFO 8332 --- [ restartedMain] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [ name: default ...] 2017-06-20 16:05:32.884 INFO 8332 --- [ restartedMain] org.hibernate.Version : HHH000412: Hibernate Core {4.3.11.Final} 2017-06-20 16:05:32.886 INFO 8332 --- [ restartedMain] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found 2017-06-20 16:05:32.887 INFO 8332 --- [ restartedMain] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist 2017-06-20 16:05:33.114 INFO 8332 --- [ restartedMain] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {4.0.5.Final} 2017-06-20 16:05:33.502 INFO 8332 --- [ restartedMain] hsqldb.db..ENGINE : open start - state not modified 2017-06-20 16:05:33.587 INFO 8332 --- [ restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.HSQLDialect 2017-06-20 16:05:33.693 INFO 8332 --- [ restartedMain] o.h.h.i.ast.ASTQueryTranslatorFactory : HHH000397: Using ASTQueryTranslatorFactory 2017-06-20 16:05:33.917 INFO 8332 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000228: Running hbm2ddl schema update 2017-06-20 16:05:33.917 INFO 8332 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000102: Fetching database metadata 2017-06-20 16:05:33.919 INFO 8332 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000396: Updating schema 2017-06-20 16:05:33.956 INFO 8332 --- [ restartedMain] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000261: Table found: PUBLIC.PUBLIC.ALUNO 2017-06-20 16:05:33.956 INFO 8332 --- [ restartedMain] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000037: Columns: [modificacao, site, telefone, id_cliente, endereco, caminho_foto, nome, id, nota, desativado] 2017-06-20 16:05:33.956 INFO 8332 --- [ restartedMain] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000108: Foreign keys: [] 2017-06-20 16:05:33.956 INFO 8332 --- [ restartedMain] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000126: Indexes: [sys_idx_sys_pk_10092_10095] 2017-06-20 16:05:33.958 INFO 8332 --- [ restartedMain] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000261: Table found: PUBLIC.PUBLIC.DISPOSITIVO 2017-06-20 16:05:33.959 INFO 8332 --- [ restartedMain] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000037: Columns: [token] 2017-06-20 16:05:33.959 INFO 8332 --- [ restartedMain] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000108: Foreign keys: [] 2017-06-20 16:05:33.959 INFO 8332 --- [ restartedMain] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000126: Indexes: [sys_idx_sys_pk_10100_10101] 2017-06-20 16:05:33.961 INFO 8332 --- [ restartedMain] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000261: Table found: PUBLIC.PUBLIC.FIREBASE_CONFIG 2017-06-20 16:05:33.962 INFO 8332 --- [ restartedMain] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000037: Columns: [apikey, id, url] 2017-06-20 16:05:33.962 INFO 8332 --- [ restartedMain] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000108: Foreign keys: [] 2017-06-20 16:05:33.962 INFO 8332 --- [ restartedMain] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000126: Indexes: [sys_idx_sys_pk_10104_10105] 2017-06-20 16:05:33.963 INFO 8332 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000232: Schema update complete 2017-06-20 16:05:34.740 INFO 8332 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@c19c6b5: startup date [Tue Jun 20 16:05:29 BRT 2017]; root of context hierarchy 2017-06-20 16:05:34.811 INFO 8332 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/aluno/form]}" onto public org.springframework.web.servlet.ModelAndView br.com.caelum.alura.controller.AlunoController.form(br.com.caelum.alura.model.Aluno) 2017-06-20 16:05:34.812 INFO 8332 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/aluno/{id}],methods=[GET]}" onto public org.springframework.web.servlet.ModelAndView br.com.caelum.alura.controller.AlunoController.busca(java.lang.String) 2017-06-20 16:05:34.812 INFO 8332 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/aluno],methods=[GET]}" onto public org.springframework.web.servlet.ModelAndView br.com.caelum.alura.controller.AlunoController.lista() 2017-06-20 16:05:34.812 INFO 8332 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/aluno],methods=[POST]}" onto public java.lang.String br.com.caelum.alura.controller.AlunoController.salva(br.com.caelum.alura.model.Aluno,org.springframework.web.servlet.mvc.support.RedirectAttributes) 2017-06-20 16:05:34.813 INFO 8332 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/firebase],methods=[GET]}" onto public org.springframework.web.servlet.ModelAndView br.com.caelum.alura.controller.FirebaseController.config() throws java.io.IOException 2017-06-20 16:05:34.813 INFO 8332 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/firebase],methods=[POST]}" onto public java.lang.String br.com.caelum.alura.controller.FirebaseController.config(br.com.caelum.alura.firebase.FirebaseConfig,org.springframework.web.servlet.mvc.support.RedirectAttributes) throws java.io.IOException 2017-06-20 16:05:34.813 INFO 8332 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/]}" onto public java.lang.String br.com.caelum.alura.controller.SiteController.index() 2017-06-20 16:05:34.818 INFO 8332 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/api/aluno/{id}],methods=[DELETE]}" onto public org.springframework.http.ResponseEntity br.com.caelum.alura.rest.controller.AlunoRestController.remove(java.lang.String,java.lang.String) 2017-06-20 16:05:34.818 INFO 8332 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/api/aluno/{id}],methods=[GET],produces=[application/json;charset=UTF-8]}" onto public br.com.caelum.alura.dto.AlunoSync br.com.caelum.alura.rest.controller.AlunoRestController.busca(java.lang.String) 2017-06-20 16:05:34.818 INFO 8332 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/api/aluno],methods=[GET]}" onto public br.com.caelum.alura.dto.AlunoSync br.com.caelum.alura.rest.controller.AlunoRestController.lista() 2017-06-20 16:05:34.818 INFO 8332 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/api/aluno/diff],methods=[GET],produces=[application/json;charset=UTF-8]}" onto public br.com.caelum.alura.dto.AlunoSync br.com.caelum.alura.rest.controller.AlunoRestController.alteracoes(java.lang.String) 2017-06-20 16:05:34.819 INFO 8332 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/api/aluno/{id}],methods=[PUT],consumes=[application/json;charset=UTF-8],produces=[application/json;charset=UTF-8]}" onto public br.com.caelum.alura.dto.AlunoSync br.com.caelum.alura.rest.controller.AlunoRestController.insereOuAltera(java.lang.String,br.com.caelum.alura.model.Aluno,java.lang.String) 2017-06-20 16:05:34.819 INFO 8332 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/api/aluno],methods=[POST],consumes=[application/json;charset=UTF-8],produces=[application/json;charset=UTF-8]}" onto public br.com.caelum.alura.dto.AlunoSync br.com.caelum.alura.rest.controller.AlunoRestController.insere(br.com.caelum.alura.model.Aluno,java.lang.String) 2017-06-20 16:05:34.819 INFO 8332 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/api/aluno/lista],methods=[PUT],consumes=[application/json;charset=UTF-8],produces=[application/json;charset=UTF-8]}" onto public org.springframework.http.ResponseEntity br.com.caelum.alura.rest.controller.AlunoRestController.insereOuAlteraLista(java.util.List,java.lang.String) 2017-06-20 16:05:34.820 INFO 8332 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/api/firebase/dispositivo],methods=[POST]}" onto public org.springframework.http.ResponseEntity br.com.caelum.alura.rest.controller.FirebaseRestController.cadastraDispositivo(java.lang.String) 2017-06-20 16:05:34.821 INFO 8332 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest) 2017-06-20 16:05:34.821 INFO 8332 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) 2017-06-20 16:05:34.868 INFO 8332 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2017-06-20 16:05:34.868 INFO 8332 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2017-06-20 16:05:34.915 INFO 8332 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2017-06-20 16:05:35.221 INFO 8332 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729 2017-06-20 16:05:35.267 INFO 8332 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup 2017-06-20 16:05:35.392 INFO 8332 --- [ restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http) 2017-06-20 16:05:35.398 INFO 8332 --- [ restartedMain] br.com.caelum.alura.Application : Started Application in 6.747 seconds (JVM running for 8.138)


Muito obrigada!

Oi Vanessa, tentei compreender o motivo apenas com o log, mas tudo parece correto conforme você mencionou...

Se possível me manda exatamente como está o projeto, dessa forma eu vou executar no meu computador e vasculhar o motivo do problema, pode ser?

Oi Alex, muito obrigada por toda ajuda e paciência :)

1) Importei o projeto Maven pelo Eclipse Mars2;

2) Primeiro eu cliquei com o botão direito sobre o nome do projeto -> Run As -> Maven install;

3) Inclui o parâmetro package nas configurações do Maven Build (botão direito sobre o arquivo pom.xml do projeto -> Run As -> Run configurations);

4) Cliquei com o botão direito sobre o nome do projeto -> Run As -> Maven Buid (com a configuração 4 acima) - a mensagem final foi de BUILD SUCCESS;

5) Cliquei com o botão direito sobre a classe Application.java -> Run as -> Java Application - a mensagem final foi que a execução foi com sucesso e o Tomcat foi iniciado na porta 8080.

Versão da máquina Java na compilação e na execução: 1.8

Um abraço!

Opa Vanessa, que isso estamos aqui pra ajudar :)

Pois é, você fez o procedimento correto, de fato eu não consigo compreender de cara o motivo real de ter dado o problema. Eu precisaria investigar o projeto em si, pois pode estar faltando algum arquivo ou coisa do gênero...

Eu assumo que seja algo próximo disso, justamente pelo Spring ter conseguido mapear todo o projeto e estar falhando quando ele tenta achar o arquivo index.jsp. De todos os testes que fiz em outros computadores essa foi a primeira vez que aconteceu.

Uma abordagem que poderia ser feita seria baixar novamente o projeto e tentar importar ele novamente sem modificar nada. Nem precisa executar comandos do maven em si, pois o Eclipse já faz isso. Então, assim que fosse tudo importado já executaria a classe Application e verificaria se daria certo o acesso no endereço http://localhost:8080/.

Mas como mencionei em cima, se preferir pode subir o projeto no github e me mandar o link que eu dou uma olhada sem problemas :)

[]s