Cant add data to databases on Spring Boot using Heroku postgres - java

I've been trying to get a Rest Repository up and running using Heroku. However, while the tables I'm using are being added to the datasource, I am unable to upload any rows of data.
Shows that my tables are being added to postgres datasource
I don't get any error messages or issues deploying the service, I just can't add data.
I've looked around the internet for solutions currently application.properties is a mess of different bits of code that I've copied on all the guides for how to get a database running.
#spring.h2.console.enabled=true
#spring.datasource.url=jdbc:h2:mem:testdb
#spring.datasource.driverClassName=org.h2.Driver
#spring.datasource.username=sa
#spring.datasource.password=
#spring.h2.console.settings.web-allow-others=true
#spring.main.banner-mode=off
#logging.level.org.springframework=ERROR
spring.jpa.hibernate.ddl-auto=update
#spring.datasource.initialization-mode=always
spring.datasource.platform=postgres
#spring.datasource.url=postgres://npwovtbfrmcgap:8cb0a1d61d6608e756d4340bb79926156b43c5d602580ab21884d058b7adf230#ec2-52-23-14-156.compute-1.amazonaws.com:5432/deu5uhuf0in93s
#spring.datasource.url=${JDBC_DATABASE_URL}
#spring.datasource.username=${SPRING_DATABASE_USERNAME}
#spring.datasource.password=${SPRING_DATABASE_PASSWORD}
#spring.jpa.show-sql=true
#spring.jpa.generate-ddl=true
spring.datasource.driver-class-name=org.postgresql.Driver
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
spring.datasource.url=${JDBC_DATABASE_URL}
spring.datasource.username=${JDBC_DATABASE_USERNAME}
spring.datasource.password=${JDBC_DATABASE_PASSWORD}
spring.jpa.show-sql=false
spring.jpa.generate-ddl=true
For testing I used h2 and that worked fine with no issues. Even though I've been eyeing using JDBC _DATABASE for it's easy setup, I've made a Database Configuration file.
package com.example.chess.Config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import javax.sql.DataSource;
#Configuration
public class DatabaseConfig {
#Bean
#Primary
#ConfigurationProperties(prefix = "spring.datasource")
public DataSource dataSource()
{
return new org.apache.tomcat.jdbc.pool.DataSource();
}
}
There isn't a whole lot here, but from my understanding I shouldn't need one if I'm using a JDBC Database.
Some ideas that I have...
Heroku could be forcing me to use their guide on preparing a Spring Boot App for production
https://devcenter.heroku.com/articles/preparing-a-spring-boot-app-for-production-on-heroku
I could put better #GeneratedValue typing on the code for tables I have.
package com.example.chess.Model;
import javax.persistence.*;
#Entity
public class Chat {
#GeneratedValue
#Id
#Column
private int chatID;
#Column
private String chatMsg;
public int getChatID() {
return chatID;
}
public String getChatMsg() {
return chatMsg;
}
public void setChatID(int chatID) {
this.chatID = chatID;
}
public void setChatMsg(String chatMsg) {
this.chatMsg = chatMsg;
}
}
Past that I'm not really sure what to do. Any feedback is appreciated.
Thanks for all the help, however I still havent gotten it working. I used heroku logs to find more data. I also used spring.database.platform and spring.datasource.driver-class-name. the code for application properties has been updated.
2020-02-18T02:22:38.000000+00:00 app[api]: Build succeeded
2020-02-18T02:22:41.021726+00:00 app[web.1]: 2020-02-18 02:22:41.017 INFO 4 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$28f59fce] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-02-18T02:22:41.264675+00:00 app[web.1]:
2020-02-18T02:22:41.264732+00:00 app[web.1]: . ____ _ __ _ _
2020-02-18T02:22:41.264786+00:00 app[web.1]: /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
2020-02-18T02:22:41.264849+00:00 app[web.1]: ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
2020-02-18T02:22:41.264905+00:00 app[web.1]: \\/ ___)| |_)| | | | | || (_| | ) ) ) )
2020-02-18T02:22:41.264972+00:00 app[web.1]: ' |____| .__|_| |_|_| |_\__, | / / / /
2020-02-18T02:22:41.265009+00:00 app[web.1]: =========|_|==============|___/=/_/_/_/
2020-02-18T02:22:41.265886+00:00 app[web.1]: :: Spring Boot :: (v2.1.7.RELEASE)
2020-02-18T02:22:41.265938+00:00 app[web.1]:
2020-02-18T02:22:41.335856+00:00 app[web.1]: 2020-02-18 02:22:41.335 INFO 4 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : http://localhost:8888
2020-02-18T02:22:41.566210+00:00 app[web.1]: 2020-02-18 02:22:41.565 INFO 4 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Connect Timeout Exception on Url - http://localhost:8888. Will be trying the next url if available
2020-02-18T02:22:41.566423+00:00 app[web.1]: 2020-02-18 02:22:41.566 WARN 4 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Could not locate PropertySource: I/O error on GET request for "http://localhost:8888/application/default": Connection refused (Connection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused)
2020-02-18T02:22:41.570798+00:00 app[web.1]: 2020-02-18 02:22:41.570 INFO 4 --- [ main] com.example.chess.ChessApplication : No active profile set, falling back to default profiles: default
2020-02-18T02:22:42.945648+00:00 app[web.1]: 2020-02-18 02:22:42.943 INFO 4 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
2020-02-18T02:22:43.135659+00:00 app[web.1]: 2020-02-18 02:22:43.135 INFO 4 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 157ms. Found 4 repository interfaces.
2020-02-18T02:22:43.711365+00:00 app[web.1]: 2020-02-18 02:22:43.711 INFO 4 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=de70dafe-40e0-316f-93ef-ef4b324ee017
2020-02-18T02:22:43.965692+00:00 app[web.1]: 2020-02-18 02:22:43.965 INFO 4 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$cdb9cd1] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-02-18T02:22:44.025903+00:00 app[web.1]: 2020-02-18 02:22:44.025 INFO 4 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$28f59fce] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-02-18T02:22:44.561043+00:00 app[web.1]: 2020-02-18 02:22:44.560 INFO 4 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 37710 (http)
2020-02-18T02:22:44.670131+00:00 app[web.1]: 2020-02-18 02:22:44.669 INFO 4 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2020-02-18T02:22:44.670471+00:00 app[web.1]: 2020-02-18 02:22:44.670 INFO 4 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.22]
2020-02-18T02:22:45.421352+00:00 app[web.1]: 2020-02-18 02:22:45.421 INFO 4 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2020-02-18T02:22:45.421626+00:00 app[web.1]: 2020-02-18 02:22:45.421 INFO 4 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 3826 ms
2020-02-18T02:22:45.859027+00:00 app[web.1]: 2020-02-18 02:22:45.858 INFO 4 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2020-02-18T02:22:46.292693+00:00 app[web.1]: 2020-02-18 02:22:46.292 INFO 4 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2020-02-18T02:22:46.414129+00:00 app[web.1]: 2020-02-18 02:22:46.413 INFO 4 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
2020-02-18T02:22:46.414131+00:00 app[web.1]: name: default
2020-02-18T02:22:46.414131+00:00 app[web.1]: ...]
2020-02-18T02:22:46.563652+00:00 app[web.1]: 2020-02-18 02:22:46.563 INFO 4 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.3.10.Final}
2020-02-18T02:22:46.566628+00:00 app[web.1]: 2020-02-18 02:22:46.566 INFO 4 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2020-02-18T02:22:46.824490+00:00 app[web.1]: 2020-02-18 02:22:46.824 INFO 4 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.4.Final}
2020-02-18T02:22:47.331763+00:00 app[web.1]: 2020-02-18 02:22:47.331 INFO 4 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.PostgreSQLDialect
2020-02-18T02:22:47.616894+00:00 app[web.1]: 2020-02-18 02:22:47.616 INFO 4 --- [ main] o.h.e.j.e.i.LobCreatorBuilderImpl : HHH000421: Disabling contextual LOB creation as hibernate.jdbc.lob.non_contextual_creation is true
2020-02-18T02:22:47.624236+00:00 app[web.1]: 2020-02-18 02:22:47.623 INFO 4 --- [ main] org.hibernate.type.BasicTypeRegistry : HHH000270: Type registration [java.util.UUID] overrides previous : org.hibernate.type.UUIDBinaryType#37e4d7bb
2020-02-18T02:22:48.869877+00:00 app[web.1]: 2020-02-18 02:22:48.869 INFO 4 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2020-02-18T02:22:49.329464+00:00 app[web.1]: 2020-02-18 02:22:49.329 INFO 4 --- [ main] o.h.h.i.QueryTranslatorFactoryInitiator : HHH000397: Using ASTQueryTranslatorFactory
2020-02-18T02:22:50.308149+00:00 app[web.1]: 2020-02-18 02:22:50.307 INFO 4 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2020-02-18T02:22:50.411820+00:00 app[web.1]: 2020-02-18 02:22:50.409 WARN 4 --- [ main] aWebConfiguration$JpaWebMvcConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2020-02-18T02:22:50.461378+00:00 app[web.1]: 2020-02-18 02:22:50.461 INFO 4 --- [ main] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page: class path resource [static/index.html]
2020-02-18T02:22:51.073701+00:00 heroku[web.1]: State changed from starting to up
2020-02-18T02:22:50.863588+00:00 app[web.1]: 2020-02-18 02:22:50.863 INFO 4 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 37710 (http) with context path ''
2020-02-18T02:22:50.865846+00:00 app[web.1]: 2020-02-18 02:22:50.865 INFO 4 --- [ main] com.example.chess.ChessApplication : Started ChessApplication in 12.027 seconds (JVM running for 12.976)

Try adding dialect , driver-class name and database-platform as you have commented those.

Finally fixed it. Boy do I feel dumb, the problem was in the angular frontend I was posting and getting from localhost:8080.
$http.get("http://localhost:8080/letter").then(function (response){
$scope.letter = response.data;
});
$scope.postLetter = function(letter)
{
var data = {
contactName: contactName,
email: email,
message: message
};
$http.post("http://localhost:8080/letter", JSON.stringify(data));
location.reload();
};
Thanks again for everyone who tried helping.

Related

I deployed my spring boot project with jar file on my server and can't access it

I deployed my spring boot project with jar file on my lightsail server. I think it deployed fine however, I can't access it.
Chrome says,
This site can’t be reached {ip} refused to connect.
Try:
Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_REFUSED
internal tomcat log
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.7.0)
2022-06-21 05:37:40.476 INFO 7028 --- [ main] com.--Application : Starting MyApplication using Java 17.0.3 on ip-172-26-7-171 with PID 7028 (/home/ubuntu/My.jar started by root in /home/ubuntu)
2022-06-21 05:37:40.483 INFO 7028 --- [ main] com.--Application : The following 1 profile is active: "prod"
2022-06-21 05:37:42.758 INFO 7028 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2022-06-21 05:37:42.883 INFO 7028 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 100 ms. Found 1 JPA repository interfaces.
2022-06-21 05:37:44.472 INFO 7028 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 80 (http)
2022-06-21 05:37:44.501 INFO 7028 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2022-06-21 05:37:44.502 INFO 7028 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.63]
2022-06-21 05:37:44.694 INFO 7028 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2022-06-21 05:37:44.695 INFO 7028 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 3508 ms
2022-06-21 05:37:45.661 INFO 7028 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2022-06-21 05:37:46.006 INFO 7028 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2022-06-21 05:37:46.121 INFO 7028 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2022-06-21 05:37:46.275 INFO 7028 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.6.9.Final
2022-06-21 05:37:46.658 INFO 7028 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2022-06-21 05:37:46.910 INFO 7028 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL55Dialect
2022-06-21 05:37:48.039 INFO 7028 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2022-06-21 05:37:48.055 INFO 7028 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2022-06-21 05:37:48.995 WARN 7028 --- [ main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2022-06-21 05:37:49.637 WARN 7028 --- [ main] org.thymeleaf.templatemode.TemplateMode : [THYMELEAF][main] Template Mode 'HTML5' is deprecated. Using Template Mode 'HTML' instead.
2022-06-21 05:37:50.173 INFO 7028 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Will secure any request with [org.springframework.security.web.session.DisableEncodeUrlFilter#3d1f558a, org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter#6abdec0e, org.springframework.security.web.context.SecurityContextPersistenceFilter#3762c4fc, org.springframework.security.web.header.HeaderWriterFilter#4b4ee511, org.springframework.security.web.csrf.CsrfFilter#38f77cd9, org.springframework.security.web.authentication.logout.LogoutFilter#2ae62bb6, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#5762658b, org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter#6ca372ef, org.springframework.security.web.authentication.ui.DefaultLogoutPageGeneratingFilter#28f4f300, org.springframework.security.web.authentication.www.BasicAuthenticationFilter#6aa3bfc, org.springframework.security.web.savedrequest.RequestCacheAwareFilter#59fbb34, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter#1b6924cb, org.springframework.security.web.authentication.AnonymousAuthenticationFilter#2b5c4f17, org.springframework.security.web.session.SessionManagementFilter#5a034157, org.springframework.security.web.access.ExceptionTranslationFilter#4483d35, org.springframework.security.web.access.intercept.FilterSecurityInterceptor#6fc1020a]
2022-06-21 05:37:50.300 INFO 7028 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 80 (http) with context path ''
2022-06-21 05:37:50.332 INFO 7028 --- [ main] com.--Application : Started MyApplication in 10.965 seconds (JVM running for 12.248)
This is my firewall settings on lightsail.
/home/ubuntu# lsof -i -nP | grep LISTEN | awk '{print $(NF-1)" "$1}' | sort -u
*:22 sshd
127.0.0.1:33060 ssh
127.0.0.1:80 java
127.0.0.53:53 systemd-r
Do I have to edit firewall setting?
I remove server.address=localhost from application.properties and it works well.

Is possible to use LocalDateTime as a RequestParam in Kotlin?

I'm learning Kotlin, doing a simple API Rest with Spring Boot. My problem is that I'm trying to use LocalDateTime as #RequestParam but it just not working as it does in Java.
This is my code:
import org.springframework.format.annotation.DateTimeFormat
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.bind.annotation.RestController
import java.time.LocalDateTime
#RestController
#RequestMapping("/flights")
class FlightController(private val flightService : FlightService) {
#GetMapping
fun getFlights(#RequestParam #DateTimeFormat(pattern = "hh:mma") departure : LocalDateTime?): List<Flight> {
return flightService.getFlights()
}
}
When I do an HTTP call this is the error I see in the console:
Resolved [org.springframework.web.method.annotation.MethodArgumentTypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'java.time.LocalDateTime'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [#org.springframework.web.bind.annotation.RequestParam #org.springframework.format.annotation.DateTimeFormat java.time.LocalDateTime] for value '09:00am'; nested exception is java.lang.IllegalArgumentException: Parse attempt failed for value [09:00am]]
(In this case, I tried 09:00am as RequestParam)
I think it is a problem with Jackson not being able to parse the JSON to LocalDateTime, anybody knows if there is a solution?
Thank you guys
(Edited)
Here is the full stacktrace:
OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.5.1)
2021-06-18 11:34:42.650 INFO 16396 --- [ main] c.e.f.FlightsKotlinApplicationKt : Starting FlightsKotlinApplicationKt using Java 16.0.1 on ar-it14622 with PID 16396
2021-06-18 11:34:42.652 INFO 16396 --- [ main] c.e.f.FlightsKotlinApplicationKt : No active profile set, falling back to default profiles: default
2021-06-18 11:34:43.238 INFO 16396 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2021-06-18 11:34:43.293 INFO 16396 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 46 ms. Found 1 JPA repository interfaces.
2021-06-18 11:34:43.689 INFO 16396 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2021-06-18 11:34:43.696 INFO 16396 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-06-18 11:34:43.696 INFO 16396 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.46]
2021-06-18 11:34:43.838 INFO 16396 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-06-18 11:34:43.839 INFO 16396 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1145 ms
2021-06-18 11:34:43.971 INFO 16396 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2021-06-18 11:34:44.009 INFO 16396 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.32.Final
2021-06-18 11:34:44.104 INFO 16396 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2021-06-18 11:34:44.183 INFO 16396 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2021-06-18 11:34:44.440 INFO 16396 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2021-06-18 11:34:44.464 INFO 16396 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL8Dialect
2021-06-18 11:34:44.780 INFO 16396 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2021-06-18 11:34:44.788 INFO 16396 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2021-06-18 11:34:45.092 WARN 16396 --- [ main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2021-06-18 11:34:45.396 INFO 16396 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2021-06-18 11:34:45.404 INFO 16396 --- [ main] c.e.f.FlightsKotlinApplicationKt : Started FlightsKotlinApplicationKt in 3.084 seconds (JVM running for 3.901)
2021-06-18 11:34:54.426 INFO 16396 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2021-06-18 11:34:54.426 INFO 16396 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2021-06-18 11:34:54.427 INFO 16396 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms
2021-06-18 11:34:54.484 WARN 16396 --- [nio-8080-exec-1] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.web.method.annotation.MethodArgumentTypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'java.time.LocalDateTime'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [#org.springframework.web.bind.annotation.RequestParam #org.springframework.format.annotation.DateTimeFormat java.time.LocalDateTime] for value '09:00am'; nested exception is java.lang.IllegalArgumentException: Parse attempt failed for value [09:00am]]
And my build.gradle.kts (maybe can be helpful):
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.ir.backend.js.compile
plugins {
id("org.springframework.boot") version "2.5.1"
id("io.spring.dependency-management") version "1.0.11.RELEASE"
kotlin("jvm") version "1.5.10"
kotlin("plugin.spring") version "1.5.10"
kotlin("plugin.jpa") version "1.5.10"
}
group = "com.learning"
version = "0.0.1-SNAPSHOT"
java.sourceCompatibility = JavaVersion.VERSION_16
configurations {
compileOnly {
extendsFrom(configurations.annotationProcessor.get())
}
}
repositories {
mavenCentral()
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.apache.logging.log4j:log4j-api-kotlin:1.0.0")
implementation("org.apache.logging.log4j:log4j-api:2.11.1")
implementation("org.apache.logging.log4j:log4j-core:2.11.1")
runtimeOnly("mysql:mysql-connector-java")
annotationProcessor("org.projectlombok:lombok")
testImplementation("org.springframework.boot:spring-boot-starter-test")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.5")
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "16"
}
}
tasks.withType<Test> {
useJUnitPlatform()
}
A time-of-day alone is not enough information to instantiate a LocalDateTime. That class represents a date with a time-of-day. You are missing the date portion.
You commented that you tried using LocalTime but failed. I am guessing that your string inputs do not match the format used for the AM/PM indicators expected by by your JVM’s current default Locale. Various cultures may use “am”, “AM”, “A.M.”, or something else. Solutions include:
Specify a Locale explicitly rather than rely implicitly on the JVM’s current default locale.
Use standard ISO 8601 formats. These are used by default in the java.time classes when parsing/generating date-time text values. So no need to specify a formatting pattern. For time-of-day, use 24-hour clock with padding zero on hour, and no AM/PM. Ex: 23:45 and 03:27.
I suggest you practice using the java.time classes in some simple throwaway code, without the complexities of Spring.
Date-time handling is not as simple and trivial a matter as you may intuit. Indeed, your intuitive quotidian understanding of date-time is a hindrance, such as leading you to use to AM/PM rather than using 24-hour clock. Take time to search Stack Overflow to learn more about java.time classes.

Repository returns empty list from PostgreSQL database

My Spring Boot Application connects to a PostgreSQL database but it didn't create the tables which i have implemented as entities. That's why I set up the tables by myself with test data.
When I use dataRepository.findAll() to access the data, it returns an empty list.
So as far as I understood, I think it connects to my database, because I get no errors, but it looks like the schemas don't work properly.
I'm pretty sure this is a "configuration" problem, but I was not able to figure out what it is.
PS: I have another project with quite the same settings and code(just another database on the same server) which works perfectly fine.
My gradle.build file:
plugins {
id 'org.springframework.boot' version '2.1.6.RELEASE'
id 'java'
}
apply plugin: 'io.spring.dependency-management'
apply plugin: 'war'
group = 'de.dari'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '8'
repositories {
mavenCentral()
maven { url "http://htmlunit.sourceforge.net" }
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
//implementation 'org.springframework.boot:spring-boot-starter-data-rest'
compile("net.sourceforge.htmlunit:htmlunit:2.35.0")
compileOnly 'org.projectlombok:lombok:1.18.8'
annotationProcessor 'org.projectlombok:lombok:1.18.8'
runtimeOnly 'org.postgresql:postgresql'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
My application.properties file:
spring.datasource.url=jdbc:postgresql://webaddress.com:5432/b-one
spring.datasource.username=username
spring.datasource.password=secretPassword
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
An Example Entity:
#Entity
public class Data {
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
#NotNull
private String value;
/*
* Blank Constructor + Getters and Setters down here
*/
}
Simple CRUD-Repository:
public interface DataRepository extends CrudRepository<Data, Long> {
}
Controller:
#Autowired
DataRepository dataRepository;
#GetMapping("/test")
public String test() {
return dataRepository.findAll().toString();
}
Yeah so I don't get any error messages and the logs weren't helpful for me but maybe you want to get a glimpse on them.
Console-Output:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.6.RELEASE)
2019-08-26 16:23:53.225 INFO 10220 --- [ main] de.dari.bone.REST.Application : Starting Application on GamingPC with PID 10220 (started by Deniz Cuhadari in C:\Users\Deniz Cuhadari\OneDrive - inc\Projects\b-one\b-one.REST)
2019-08-26 16:23:53.230 INFO 10220 --- [ main] de.dari.bone.REST.Application : No active profile set, falling back to default profiles: default
2019-08-26 16:23:54.083 INFO 10220 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
2019-08-26 16:23:54.202 INFO 10220 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 110ms. Found 6 repository interfaces.
2019-08-26 16:23:54.568 INFO 10220 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$24d7df9e] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-08-26 16:23:54.878 INFO 10220 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2019-08-26 16:23:54.907 INFO 10220 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-08-26 16:23:54.908 INFO 10220 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.21]
2019-08-26 16:23:55.057 INFO 10220 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-08-26 16:23:55.057 INFO 10220 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1757 ms
2019-08-26 16:23:55.226 INFO 10220 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2019-08-26 16:23:55.650 INFO 10220 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2019-08-26 16:23:55.711 INFO 10220 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2019-08-26 16:23:55.793 INFO 10220 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.3.10.Final}
2019-08-26 16:23:55.795 INFO 10220 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2019-08-26 16:23:55.947 INFO 10220 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.4.Final}
2019-08-26 16:23:56.098 INFO 10220 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.PostgreSQLDialect
2019-08-26 16:24:02.271 INFO 10220 --- [ main] o.h.e.j.e.i.LobCreatorBuilderImpl : HHH000421: Disabling contextual LOB creation as hibernate.jdbc.lob.non_contextual_creation is true
2019-08-26 16:24:02.278 INFO 10220 --- [ main] org.hibernate.type.BasicTypeRegistry : HHH000270: Type registration [java.util.UUID] overrides previous : org.hibernate.type.UUIDBinaryType#7e49ded
2019-08-26 16:24:03.329 INFO 10220 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2019-08-26 16:24:03.946 INFO 10220 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2019-08-26 16:24:03.987 WARN 10220 --- [ main] aWebConfiguration$JpaWebMvcConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2019-08-26 16:24:04.051 INFO 10220 --- [ main] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page: class path resource [static/index.html]
2019-08-26 16:24:04.162 INFO 10220 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2019-08-26 16:24:04.165 INFO 10220 --- [ main] de.dari.bone.REST.Application : Started Application in 11.503 seconds (JVM running for 12.75)
2019-08-26 16:24:09.762 INFO 10220 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2019-08-26 16:24:09.762 INFO 10220 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2019-08-26 16:24:09.769 INFO 10220 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 7 ms
2019-08-26 16:24:09.905 INFO 10220 --- [nio-8080-exec-1] o.h.h.i.QueryTranslatorFactoryInitiator : HHH000397: Using ASTQueryTranslatorFactory

spring RequestMappingHandlerMapping not working

I´m starting with Spring Boot for that I´m following a tutorial. In the tutorial, they created the controller with the #RequestMapping and GET method, once they have run the application, in the console is displayed something like this:
s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/rooms], methods
= GET}" onto java.util.List<..//more lines
But in my case I got an error:
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)
Why the Mapping is not created?
This is the controller:
package com.frankmoley.london.data.webservice;
import com.frankmoley.london.data.entity.Room;
import com.frankmoley.london.data.repository.RoomRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
#RestController
public class RoomController {
#Autowired
private RoomRepository repository;
#RequestMapping(value="/rooms", method= RequestMethod.GET)
List<Room> findAll(#RequestParam(required=false) String roomNumber){
List<Room> rooms = new ArrayList<>();
if(null==roomNumber){
Iterable<Room> results = this.repository.findAll();
results.forEach(room-> {rooms.add(room);});
}else{
Room room = this.repository.findByNumber(roomNumber);
if(null!=room) {
rooms.add(room);
}
}
return rooms;
}
}
Entity:
package com.frankmoley.london.data.entity;
import javax.persistence.*;
#Entity
#Table(name = "ROOM")
public class Room {
#Id
#Column(name = "ROOM_ID")
#GeneratedValue(strategy = GenerationType.AUTO)
private long id;
#Column(name = "NAME")
private String name;
#Column(name = "ROOM_NUMBER")
private String number;
#Column(name = "BED_INFO")
private String info;
//getters and setters
}
Repository:
package com.frankmoley.london.data.repository;
import com.frankmoley.london.data.entity.Room;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
#Repository
public interface RoomRepository extends CrudRepository<Room, Long> {
Room findByNumber(String number);
}
Following are my logs:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.8.RELEASE)
2019-09-09 21:41:37.074 INFO 25569 --- [ main] SpringRest.spring_rest.Application : Starting Application on prashant-ubuntu with PID 25569 (/home/prashant/workspace/egen/spring-rest/target/spring-rest-1.0.0.jar started by prashant in /home/prashant/workspace/egen/spring-rest/target)
2019-09-09 21:41:37.077 INFO 25569 --- [ main] SpringRest.spring_rest.Application : No active profile set, falling back to default profiles: default
2019-09-09 21:41:37.715 INFO 25569 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
2019-09-09 21:41:37.796 INFO 25569 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 68ms. Found 1 repository interfaces.
2019-09-09 21:41:38.389 INFO 25569 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$d6eeeeff] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-09-09 21:41:38.696 INFO 25569 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2019-09-09 21:41:38.735 INFO 25569 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-09-09 21:41:38.735 INFO 25569 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.24]
2019-09-09 21:41:38.837 INFO 25569 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-09-09 21:41:38.837 INFO 25569 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1701 ms
2019-09-09 21:41:39.124 INFO 25569 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2019-09-09 21:41:39.415 INFO 25569 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2019-09-09 21:41:39.463 INFO 25569 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2019-09-09 21:41:39.525 INFO 25569 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.3.11.Final}
2019-09-09 21:41:39.526 INFO 25569 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2019-09-09 21:41:39.662 INFO 25569 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.4.Final}
2019-09-09 21:41:39.866 INFO 25569 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
2019-09-09 21:41:40.463 INFO 25569 --- [ main] o.h.h.i.QueryTranslatorFactoryInitiator : HHH000397: Using ASTQueryTranslatorFactory
2019-09-09 21:41:40.559 INFO 25569 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2019-09-09 21:41:41.041 INFO 25569 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2019-09-09 21:41:41.114 WARN 25569 --- [ main] aWebConfiguration$JpaWebMvcConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2019-09-09 21:41:41.380 INFO 25569 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2019-09-09 21:41:41.382 INFO 25569 --- [ main] SpringRest.spring_rest.Application : Started Application in 4.703 seconds (JVM running for 5.103)
2019-09-09 21:42:03.922 INFO 25569 --- [nio-8080-exec-2] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2019-09-09 21:42:03.922 INFO 25569 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2019-09-09 21:42:03.934 INFO 25569 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : Completed initialization in 12 ms
Hibernate: select employee0_.id as id1_0_, employee0_.email as email2_0_, employee0_.name as name3_0_, employee0_.salary as salary4_0_ from employee employee0_
you can clearly see that there aren't any references of RequestMappingHandlerMapping
But still the service is hosted at "/".
I have used the following URL:
http://localhost:8080/employees/springEntityManagerJpa
With other spring application which is not spring boot, the URL is as follows:
http://localhost:8080/spring-rest/api/employees/springEntityManagerJpa
I assume your is the similar case. May be the service is up, but you are providing the wrong endpoints. Just remove the context path. In my case I removed /spring-rest/api
Hope this helps!!!

Errors creating multiple database entities in Spring/hibernate

Attempting to make a spring application with multiple databases in spring-boot. MY orm is hibernate and below I have a copy of my application.properties files and my print trace. Thanks for any help in advance:
spring.ds_toner.url = jdbc:mysql://localhost:3306/toner_stock?useSSL=false
spring.ds_toner.username=toner
spring.ds_toner.password=toner
spring.ds_toner.driver-class-name=com.mysql.jdbc.Driver
spring.ds_manager.url=jdbc:mysql://localhost:3306/toner_manager?useSSL=false
spring.ds_manager.username=toner
spring.ds_manager.password=toner
spring.ds_manager.driver-class-name= com.mysql.jdbc.Driver
spring.ds_buyer.url= jdbc:mysql://localhost:3306/toner_buyer?useSSL=false
spring.ds_buyer.username=toner
spring.ds_buyer.password=toner
spring.ds_buyer.driver-class-name= com.mysql.jdbc.Driver
spring.jpa.hibernate.ddl-auto=update
spring.jpa.hibernate.show-sql=true
spring.jpa.hibernate.dialect= org.hibernate.dialect.MySQL55Dialect
spring.jpa.properties.hibernate.current_session_context_class=org.springframework.orm.hibernate5.SpringSessionContext
Print Trace:
/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/java "-javaagent:/Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar=52449:/Applications/IntelliJ IDEA CE.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/lib/packager.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/lib/tools.jar:/Users/ronaldpitt/Desktop/TonerStock/target/classes:/Users/ronaldpitt/.m2/repository/org/springframework/boot/spring-boot-starter-web/1.5.2.RELEASE/spring-boot-starter-web-1.5.2.RELEASE.jar:/Users/ronaldpitt/.m2/repository/org/springframework/boot/spring-boot-starter/1.5.2.RELEASE/spring-boot-starter-1.5.2.RELEASE.jar:/Users/ronaldpitt/.m2/repository/org/springframework/boot/spring-boot/1.5.2.RELEASE/spring-boot-1.5.2.RELEASE.jar:/Users/ronaldpitt/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/1.5.2.RELEASE/spring-boot-autoconfigure-1.5.2.RELEASE.jar:/Users/ronaldpitt/.m2/repository/org/springframework/boot/spring-boot-starter-logging/1.5.2.RELEASE/spring-boot-starter-logging-1.5.2.RELEASE.jar:/Users/ronaldpitt/.m2/repository/ch/qos/logback/logback-classic/1.1.11/logback-classic-1.1.11.jar:/Users/ronaldpitt/.m2/repository/ch/qos/logback/logback-core/1.1.11/logback-core-1.1.11.jar:/Users/ronaldpitt/.m2/repository/org/slf4j/jul-to-slf4j/1.7.24/jul-to-slf4j-1.7.24.jar:/Users/ronaldpitt/.m2/repository/org/slf4j/log4j-over-slf4j/1.7.24/log4j-over-slf4j-1.7.24.jar:/Users/ronaldpitt/.m2/repository/org/yaml/snakeyaml/1.17/snakeyaml-1.17.jar:/Users/ronaldpitt/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/1.5.2.RELEASE/spring-boot-starter-tomcat-1.5.2.RELEASE.jar:/Users/ronaldpitt/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.5.11/tomcat-embed-core-8.5.11.jar:/Users/ronaldpitt/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/8.5.11/tomcat-embed-el-8.5.11.jar:/Users/ronaldpitt/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/8.5.11/tomcat-embed-websocket-8.5.11.jar:/Users/ronaldpitt/.m2/repository/org/hibernate/hibernate-validator/5.3.4.Final/hibernate-validator-5.3.4.Final.jar:/Users/ronaldpitt/.m2/repository/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final.jar:/Users/ronaldpitt/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.8.7/jackson-databind-2.8.7.jar:/Users/ronaldpitt/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.8.0/jackson-annotations-2.8.0.jar:/Users/ronaldpitt/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.8.7/jackson-core-2.8.7.jar:/Users/ronaldpitt/.m2/repository/org/springframework/spring-web/4.3.7.RELEASE/spring-web-4.3.7.RELEASE.jar:/Users/ronaldpitt/.m2/repository/org/springframework/spring-aop/4.3.7.RELEASE/spring-aop-4.3.7.RELEASE.jar:/Users/ronaldpitt/.m2/repository/org/springframework/spring-context/4.3.7.RELEASE/spring-context-4.3.7.RELEASE.jar:/Users/ronaldpitt/.m2/repository/org/springframework/spring-webmvc/4.3.7.RELEASE/spring-webmvc-4.3.7.RELEASE.jar:/Users/ronaldpitt/.m2/repository/org/springframework/spring-expression/4.3.7.RELEASE/spring-expression-4.3.7.RELEASE.jar:/Users/ronaldpitt/.m2/repository/org/springframework/spring-core/4.3.7.RELEASE/spring-core-4.3.7.RELEASE.jar:/Users/ronaldpitt/.m2/repository/org/springframework/boot/spring-boot-starter-thymeleaf/1.5.2.RELEASE/spring-boot-starter-thymeleaf-1.5.2.RELEASE.jar:/Users/ronaldpitt/.m2/repository/org/thymeleaf/thymeleaf-spring4/2.1.5.RELEASE/thymeleaf-spring4-2.1.5.RELEASE.jar:/Users/ronaldpitt/.m2/repository/nz/net/ultraq/thymeleaf/thymeleaf-layout-dialect/1.4.0/thymeleaf-layout-dialect-1.4.0.jar:/Users/ronaldpitt/.m2/repository/org/codehaus/groovy/groovy/2.4.9/groovy-2.4.9.jar:/Users/ronaldpitt/.m2/repository/org/hibernate/hibernate-core/5.2.9.Final/hibernate-core-5.2.9.Final.jar:/Users/ronaldpitt/.m2/repository/org/jboss/logging/jboss-logging/3.3.0.Final/jboss-logging-3.3.0.Final.jar:/Users/ronaldpitt/.m2/repository/org/hibernate/javax/persistence/hibernate-jpa-2.1-api/1.0.0.Final/hibernate-jpa-2.1-api-1.0.0.Final.jar:/Users/ronaldpitt/.m2/repository/org/javassist/javassist/3.21.0-GA/javassist-3.21.0-GA.jar:/Users/ronaldpitt/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar:/Users/ronaldpitt/.m2/repository/org/jboss/spec/javax/transaction/jboss-transaction-api_1.2_spec/1.0.1.Final/jboss-transaction-api_1.2_spec-1.0.1.Final.jar:/Users/ronaldpitt/.m2/repository/org/jboss/jandex/2.0.3.Final/jandex-2.0.3.Final.jar:/Users/ronaldpitt/.m2/repository/com/fasterxml/classmate/1.3.3/classmate-1.3.3.jar:/Users/ronaldpitt/.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar:/Users/ronaldpitt/.m2/repository/org/hibernate/common/hibernate-commons-annotations/5.0.1.Final/hibernate-commons-annotations-5.0.1.Final.jar:/Users/ronaldpitt/.m2/repository/org/springframework/data/spring-data-commons/1.13.1.RELEASE/spring-data-commons-1.13.1.RELEASE.jar:/Users/ronaldpitt/.m2/repository/org/springframework/spring-beans/4.3.7.RELEASE/spring-beans-4.3.7.RELEASE.jar:/Users/ronaldpitt/.m2/repository/org/slf4j/slf4j-api/1.7.24/slf4j-api-1.7.24.jar:/Users/ronaldpitt/.m2/repository/org/slf4j/jcl-over-slf4j/1.7.24/jcl-over-slf4j-1.7.24.jar:/Users/ronaldpitt/.m2/repository/org/springframework/boot/spring-boot-starter-data-jpa/1.5.2.RELEASE/spring-boot-starter-data-jpa-1.5.2.RELEASE.jar:/Users/ronaldpitt/.m2/repository/org/springframework/boot/spring-boot-starter-aop/1.5.2.RELEASE/spring-boot-starter-aop-1.5.2.RELEASE.jar:/Users/ronaldpitt/.m2/repository/org/aspectj/aspectjweaver/1.8.9/aspectjweaver-1.8.9.jar:/Users/ronaldpitt/.m2/repository/org/springframework/boot/spring-boot-starter-jdbc/1.5.2.RELEASE/spring-boot-starter-jdbc-1.5.2.RELEASE.jar:/Users/ronaldpitt/.m2/repository/org/apache/tomcat/tomcat-jdbc/8.5.11/tomcat-jdbc-8.5.11.jar:/Users/ronaldpitt/.m2/repository/org/apache/tomcat/tomcat-juli/8.5.11/tomcat-juli-8.5.11.jar:/Users/ronaldpitt/.m2/repository/org/springframework/spring-jdbc/4.3.7.RELEASE/spring-jdbc-4.3.7.RELEASE.jar:/Users/ronaldpitt/.m2/repository/javax/transaction/javax.transaction-api/1.2/javax.transaction-api-1.2.jar:/Users/ronaldpitt/.m2/repository/org/springframework/data/spring-data-jpa/1.11.1.RELEASE/spring-data-jpa-1.11.1.RELEASE.jar:/Users/ronaldpitt/.m2/repository/org/springframework/spring-orm/4.3.7.RELEASE/spring-orm-4.3.7.RELEASE.jar:/Users/ronaldpitt/.m2/repository/org/springframework/spring-tx/4.3.7.RELEASE/spring-tx-4.3.7.RELEASE.jar:/Users/ronaldpitt/.m2/repository/org/springframework/spring-aspects/4.3.7.RELEASE/spring-aspects-4.3.7.RELEASE.jar:/Users/ronaldpitt/.m2/repository/mysql/mysql-connector-java/5.1.39/mysql-connector-java-5.1.39.jar:/Users/ronaldpitt/.m2/repository/org/hibernate/hibernate-entitymanager/5.2.9.Final/hibernate-entitymanager-5.2.9.Final.jar:/Users/ronaldpitt/.m2/repository/net/bytebuddy/byte-buddy/1.6.6/byte-buddy-1.6.6.jar:/Users/ronaldpitt/.m2/repository/org/thymeleaf/thymeleaf-spring3/3.0.3.RELEASE/thymeleaf-spring3-3.0.3.RELEASE.jar:/Users/ronaldpitt/.m2/repository/org/thymeleaf/thymeleaf/2.1.5.RELEASE/thymeleaf-2.1.5.RELEASE.jar:/Users/ronaldpitt/.m2/repository/org/unbescape/unbescape/1.1.0.RELEASE/unbescape-1.1.0.RELEASE.jar com.ronone.Application
objc[6848]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/java (0x10eb834c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x1103f14e0). One of the two will be used. Which one is undefined.
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.5.2.RELEASE)
2017-05-11 21:12:08.760 INFO 6848 --- [ main] com.ronone.Application : Starting Application on Ronalds-MacBook-Pro.local with PID 6848 (/Users/ronaldpitt/Desktop/TonerStock/target/classes started by ronaldpitt in /Users/ronaldpitt/Desktop/TonerStock)
2017-05-11 21:12:08.763 INFO 6848 --- [ main] com.ronone.Application : No active profile set, falling back to default profiles: default
2017-05-11 21:12:09.015 INFO 6848 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#77be656f: startup date [Thu May 11 21:12:09 EDT 2017]; root of context hierarchy
2017-05-11 21:12:10.645 INFO 6848 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$578c281f] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-05-11 21:12:11.075 INFO 6848 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2017-05-11 21:12:11.108 INFO 6848 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2017-05-11 21:12:11.110 INFO 6848 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.11
2017-05-11 21:12:11.267 INFO 6848 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2017-05-11 21:12:11.267 INFO 6848 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 2258 ms
2017-05-11 21:12:11.465 INFO 6848 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2017-05-11 21:12:11.471 INFO 6848 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2017-05-11 21:12:11.472 INFO 6848 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2017-05-11 21:12:11.473 INFO 6848 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2017-05-11 21:12:11.473 INFO 6848 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2017-05-11 21:12:11.532 WARN 6848 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Tomcat.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.tomcat.jdbc.pool.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).
2017-05-11 21:12:11.534 INFO 6848 --- [ main] o.apache.catalina.core.StandardService : Stopping service Tomcat
2017-05-11 21:12:11.547 WARN 6848 --- [ost-startStop-1] o.a.c.loader.WebappClassLoaderBase : The web application [ROOT] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.lang.Object.wait(Native Method)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:43)
2017-05-11 21:12:11.561 INFO 6848 --- [ main] utoConfigurationReportLoggingInitializer :
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2017-05-11 21:12:11.569 ERROR 6848 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Cannot determine embedded database driver class for database type NONE
Action:
If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).
The reason for the exception is
Cannot determine embedded database driver class for database type NONE.
If you want an embedded database please put a supported one on the
classpath. If you have database settings to be loaded from a particular
profile you may need to active it (no profiles are currently active).
Spring autoconfiguration is creating only one DataSource and expects properties as
spring.datasource.url=jdbc:mysql://localhost/test
spring.datasource.username=dbuser
spring boot reference
You do not set these properties, so spring tries to create a datasource without url, which leads to the exception.
You need to create additional DataSources yourself, you may find this post helpfull.

Categories

Resources