Solucionado (ver solução)
Solucionado
(ver solução)
2
respostas

Minha API está vzia

Fiz a instalação do JAVA , rodei o arquivo jar mas quando tento acessar o localhost:8080/api/autores aparece apenas [] na página. Fiz a instalação do SQL e coloquei o parâmetro de senha quando executei o .jar

Segue o log:

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

2017-08-13 12:13:45.110  INFO 6292 --- [           main] br.com.caelum.cdcreact.Boot              : Starting Boot v1.0.0-SNAPSHOT on DESKTOP-UEE8S3P with PID 6292 (C:\Users\maria\Downloads\cdcreact.jar started by maria in C:\Users\maria\Downloads)
2017-08-13 12:13:45.110  INFO 6292 --- [           main] br.com.caelum.cdcreact.Boot              : No active profile set, falling back to default profiles: default
2017-08-13 12:13:45.195  INFO 6292 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@2602b178: startup date [Sun Aug 13 12:13:45 BRT 2017]; root of context hierarchy
2017-08-13 12:13:46.895  INFO 6292 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Overriding bean definition for bean 'beanNameViewResolver' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]]
2017-08-13 12:13:47.754  INFO 6292 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$373a80b8] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-08-13 12:13:48.644  INFO 6292 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2017-08-13 12:13:48.665  INFO 6292 --- [           main] o.apache.catalina.core.StandardService   : Starting service Tomcat
2017-08-13 12:13:48.667  INFO 6292 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.0.30
2017-08-13 12:13:50.725  INFO 6292 --- [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-08-13 12:13:50.863  INFO 6292 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2017-08-13 12:13:50.863  INFO 6292 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 5668 ms
2017-08-13 12:13:51.505  INFO 6292 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean        : Mapping servlet: 'dispatcherServlet' to [/]
2017-08-13 12:13:51.514  INFO 6292 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'characterEncodingFilter' to: [/*]
2017-08-13 12:13:51.515  INFO 6292 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2017-08-13 12:13:51.515  INFO 6292 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2017-08-13 12:13:51.517  INFO 6292 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'requestContextFilter' to: [/*]
2017-08-13 12:13:51.963  INFO 6292 --- [           main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2017-08-13 12:13:51.988  INFO 6292 --- [           main] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [
        name: default
        ...]
2017-08-13 12:13:52.139  INFO 6292 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate Core {4.3.11.Final}
2017-08-13 12:13:52.142  INFO 6292 --- [           main] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found
2017-08-13 12:13:52.145  INFO 6292 --- [           main] org.hibernate.cfg.Environment            : HHH000021: Bytecode provider name : javassist
2017-08-13 12:13:52.507  INFO 6292 --- [           main] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
Sun Aug 13 12:13:52 BRT 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Sun Aug 13 12:13:52 BRT 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Sun Aug 13 12:13:52 BRT 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Sun Aug 13 12:13:52 BRT 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Sun Aug 13 12:13:52 BRT 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Sun Aug 13 12:13:52 BRT 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Sun Aug 13 12:13:52 BRT 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Sun Aug 13 12:13:52 BRT 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Sun Aug 13 12:13:52 BRT 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Sun Aug 13 12:13:52 BRT 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
2017-08-13 12:13:52.928  INFO 6292 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
2017-08-13 12:13:53.276  INFO 6292 --- [           main] o.h.h.i.ast.ASTQueryTranslatorFactory    : HHH000397: Using ASTQueryTranslatorFactory
2017-08-13 12:13:53.592  INFO 6292 --- [           main] org.hibernate.tool.hbm2ddl.SchemaUpdate  : HHH000228: Running hbm2ddl schema update
2017-08-13 12:13:53.592  INFO 6292 --- [           main] org.hibernate.tool.hbm2ddl.SchemaUpdate  : HHH000102: Fetching database metadata
2017-08-13 12:13:53.592  INFO 6292 --- [           main] org.hibernate.tool.hbm2ddl.SchemaUpdate  : HHH000396: Updating schema
2017-08-13 12:13:53.614  INFO 6292 --- [           main] o.hibernate.tool.hbm2ddl.TableMetadata   : HHH000261: Table found: cdc_react.autor
2017-08-13 12:13:53.614  INFO 6292 --- [           main] o.hibernate.tool.hbm2ddl.TableMetadata   : HHH000037: Columns: [senha, nome, id, email]
2017-08-13 12:13:53.614  INFO 6292 --- [           main] o.hibernate.tool.hbm2ddl.TableMetadata   : HHH000108: Foreign keys: []
2017-08-13 12:13:53.630  INFO 6292 --- [           main] o.hibernate.tool.hbm2ddl.TableMetadata   : HHH000126: Indexes: [primary]
2017-08-13 12:13:53.630  INFO 6292 --- [           main] o.hibernate.tool.hbm2ddl.TableMetadata   : HHH000261: Table found: cdc_react.livro
2017-08-13 12:13:53.630  INFO 6292 --- [           main] o.hibernate.tool.hbm2ddl.TableMetadata   : HHH000037: Columns: [preco, titulo, autor_id, id]
2017-08-13 12:13:53.630  INFO 6292 --- [           main] o.hibernate.tool.hbm2ddl.TableMetadata   : HHH000108: Foreign keys: [fk_jiba630fqnramd9goavw4xor0]
2017-08-13 12:13:53.630  INFO 6292 --- [           main] o.hibernate.tool.hbm2ddl.TableMetadata   : HHH000126: Indexes: [fk_jiba630fqnramd9goavw4xor0, primary]
2017-08-13 12:13:53.630  INFO 6292 --- [           main] org.hibernate.tool.hbm2ddl.SchemaUpdate  : HHH000232: Schema update complete
2017-08-13 12:13:54.401  INFO 6292 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@2602b178: startup date [Sun Aug 13 12:13:45 BRT 2017]; root of context hierarchy
2017-08-13 12:13:54.569  INFO 6292 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/api/autores],methods=[GET],produces=[application/json]}" onto public java.lang.Iterable<br.com.caelum.cdcreact.models.Autor> br.com.caelum.cdcreact.controllers.AutorController.lista()
2017-08-13 12:13:54.574  INFO 6292 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/api/autores],methods=[POST],consumes=[application/json]}" onto public java.lang.Iterable<br.com.caelum.cdcreact.models.Autor> br.com.caelum.cdcreact.controllers.AutorController.salva(br.com.caelum.cdcreact.controllers.forms.AutorForm)
2017-08-13 12:13:54.576  INFO 6292 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/api/livros],methods=[GET],produces=[application/json]}" onto public java.lang.Iterable<br.com.caelum.cdcreact.models.Livro> br.com.caelum.cdcreact.controllers.LivrosController.lista()
2017-08-13 12:13:54.577  INFO 6292 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/api/livros],methods=[POST],consumes=[application/json]}" onto public java.lang.Iterable<br.com.caelum.cdcreact.models.Livro> br.com.caelum.cdcreact.controllers.LivrosController.salva(br.com.caelum.cdcreact.controllers.forms.LivroForm)
2017-08-13 12:13:54.581  INFO 6292 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2017-08-13 12:13:54.582  INFO 6292 --- [           main] 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-08-13 12:13:54.645  INFO 6292 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-08-13 12:13:54.646  INFO 6292 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-08-13 12:13:54.721  INFO 6292 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-08-13 12:13:55.125  INFO 6292 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2017-08-13 12:13:55.278  INFO 6292 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2017-08-13 12:13:55.289  INFO 6292 --- [           main] br.com.caelum.cdcreact.Boot              : Started Boot in 10.679 seconds (JVM running for 11.335)
2017-08-13 12:14:17.172  INFO 6292 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring FrameworkServlet 'dispatcherServlet'
2017-08-13 12:14:17.172  INFO 6292 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization started
2017-08-13 12:14:17.193  INFO 6292 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization completed in 21 ms
2 respostas
solução!

Mariana, creio que talvez a senha não tenha sido reconhecida, pode tentar novamente com este formato?

java -Dspring.datasource.password=senhaAqui -jar cdcreact-1.0.0-SNAPSHOT.jar

Fala gente... como apago os dados que digitei na API? quero zerar todos os dados.

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software