Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialStefan Novak
6,791 PointsTables aren't created
Hey guys,
I've copied and pasted Chris's code from Github, everything works fine, I even get the same boot logs as he does, but when I log into the H2 Console and refresh, I don't have the Gif and Category tables.
Any heads ups? Thanks.
Here's the log for reference if you want it
19:50:15: Executing task 'bootRun'...
Support for builds using Gradle older than 2.6 was deprecated and will be removed in 5.0. You are currently using Gradle version 2.2. You should upgrade your Gradle build to use Gradle 2.6 or later.
Support for builds using Gradle older than 2.6 was deprecated and will be removed in 5.0. You are currently using Gradle version 2.2. You should upgrade your Gradle build to use Gradle 2.6 or later.
Support for builds using Gradle older than 2.6 was deprecated and will be removed in 5.0. You are currently using Gradle version 2.2. You should upgrade your Gradle build to use Gradle 2.6 or later.
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:findMainClass
:bootRun
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.3.3.RELEASE)
2019-04-16 19:50:21.165 INFO 14244 --- [ main] com.teamtreehouse.giflib.Application : Starting Application on Stefan with PID 14244 (E:\Projects\Java\Spring\treehouse-giflib-hibernate-68d1926\build\classes\main started by StefanNovak96 in E:\Projects\Java\Spring\treehouse-giflib-hibernate-68d1926)
2019-04-16 19:50:21.167 INFO 14244 --- [ main] com.teamtreehouse.giflib.Application : No active profile set, falling back to default profiles: default
2019-04-16 19:50:21.323 INFO 14244 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@15b3e5b: startup date [Tue Apr 16 19:50:21 BST 2019]; root of context hierarchy
2019-04-16 19:50:21.929 INFO 14244 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2019-04-16 19:50:21.964 INFO 14244 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$14882e4f] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-04-16 19:50:22.357 INFO 14244 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2019-04-16 19:50:22.378 INFO 14244 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2019-04-16 19:50:22.381 INFO 14244 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.0.32
2019-04-16 19:50:22.500 INFO 14244 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-04-16 19:50:22.500 INFO 14244 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1180 ms
2019-04-16 19:50:22.776 INFO 14244 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2019-04-16 19:50:22.779 INFO 14244 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2019-04-16 19:50:22.780 INFO 14244 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2019-04-16 19:50:22.780 INFO 14244 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2019-04-16 19:50:22.780 INFO 14244 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2019-04-16 19:50:22.950 INFO 14244 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.2.1.Final}
2019-04-16 19:50:22.951 INFO 14244 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2019-04-16 19:50:22.952 INFO 14244 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist
2019-04-16 19:50:23.094 INFO 14244 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2019-04-16 19:50:23.329 INFO 14244 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
2019-04-16 19:50:23.750 INFO 14244 --- [ main] rmationExtractorJdbcDatabaseMetaDataImpl : HHH000262: Table not found: Category
2019-04-16 19:50:23.751 INFO 14244 --- [ main] rmationExtractorJdbcDatabaseMetaDataImpl : HHH000262: Table not found: Category
Hibernate: create table Category (id bigint generated by default as identity, colorCode varchar(255), name varchar(255), primary key (id))
2019-04-16 19:50:23.759 INFO 14244 --- [ main] rmationExtractorJdbcDatabaseMetaDataImpl : HHH000262: Table not found: Gif
2019-04-16 19:50:23.760 INFO 14244 --- [ main] rmationExtractorJdbcDatabaseMetaDataImpl : HHH000262: Table not found: Gif
Hibernate: create table Gif (id bigint generated by default as identity, bytes blob, dateUploaded timestamp, description varchar(255), favorite boolean not null, hash varchar(255), username varchar(255), category_id bigint, primary key (id))
Hibernate: alter table Gif add constraint FKt16b4v65tfuwm5dqwpss1bx3v foreign key (category_id) references Category
2019-04-16 19:50:23.911 INFO 14244 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@15b3e5b: startup date [Tue Apr 16 19:50:21 BST 2019]; root of context hierarchy
2019-04-16 19:50:23.996 INFO 14244 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/categories/{categoryId}]}" onto public java.lang.String com.teamtreehouse.giflib.web.controller.CategoryController.category(java.lang.Long,org.springframework.ui.Model)
2019-04-16 19:50:23.999 INFO 14244 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/categories/{categoryId}],methods=[POST]}" onto public java.lang.String com.teamtreehouse.giflib.web.controller.CategoryController.updateCategory()
2019-04-16 19:50:23.999 INFO 14244 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/categories]}" onto public java.lang.String com.teamtreehouse.giflib.web.controller.CategoryController.listCategories(org.springframework.ui.Model)
2019-04-16 19:50:24.000 INFO 14244 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/categories/{categoryId}/edit]}" onto public java.lang.String com.teamtreehouse.giflib.web.controller.CategoryController.formEditCategory(java.lang.Long,org.springframework.ui.Model)
2019-04-16 19:50:24.000 INFO 14244 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/categories/add]}" onto public java.lang.String com.teamtreehouse.giflib.web.controller.CategoryController.formNewCategory(org.springframework.ui.Model)
2019-04-16 19:50:24.000 INFO 14244 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/categories],methods=[POST]}" onto public java.lang.String com.teamtreehouse.giflib.web.controller.CategoryController.addCategory()
2019-04-16 19:50:24.001 INFO 14244 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/categories/{categoryId}/delete],methods=[POST]}" onto public java.lang.String com.teamtreehouse.giflib.web.controller.CategoryController.deleteCategory(java.lang.Long)
2019-04-16 19:50:24.005 INFO 14244 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/gifs/{gifId}.gif]}" onto public byte[] com.teamtreehouse.giflib.web.controller.GifController.gifImage(java.lang.Long)
2019-04-16 19:50:24.005 INFO 14244 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/gifs/{gifId}],methods=[POST]}" onto public java.lang.String com.teamtreehouse.giflib.web.controller.GifController.updateGif()
2019-04-16 19:50:24.005 INFO 14244 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/gifs/{gifId}/delete],methods=[POST]}" onto public java.lang.String com.teamtreehouse.giflib.web.controller.GifController.deleteGif(java.lang.Long)
2019-04-16 19:50:24.005 INFO 14244 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/gifs/{gifId}/favorite],methods=[POST]}" onto public java.lang.String com.teamtreehouse.giflib.web.controller.GifController.toggleFavorite(java.lang.Long)
2019-04-16 19:50:24.005 INFO 14244 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/search]}" onto public java.lang.String com.teamtreehouse.giflib.web.controller.GifController.searchResults(java.lang.String,org.springframework.ui.Model)
2019-04-16 19:50:24.006 INFO 14244 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/]}" onto public java.lang.String com.teamtreehouse.giflib.web.controller.GifController.listGifs(org.springframework.ui.Model)
2019-04-16 19:50:24.007 INFO 14244 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/gifs/{dgifI}/edit]}" onto public java.lang.String com.teamtreehouse.giflib.web.controller.GifController.formEditGif(java.lang.Long,org.springframework.ui.Model)
2019-04-16 19:50:24.007 INFO 14244 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/gifs/{gifId}]}" onto public java.lang.String com.teamtreehouse.giflib.web.controller.GifController.gifDetails(java.lang.Long,org.springframework.ui.Model)
2019-04-16 19:50:24.008 INFO 14244 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/gifs],methods=[POST]}" onto public java.lang.String com.teamtreehouse.giflib.web.controller.GifController.addGif()
2019-04-16 19:50:24.008 INFO 14244 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/upload]}" onto public java.lang.String com.teamtreehouse.giflib.web.controller.GifController.formNewGif(org.springframework.ui.Model)
2019-04-16 19:50:24.008 INFO 14244 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/favorites]}" onto public java.lang.String com.teamtreehouse.giflib.web.controller.GifController.favorites(org.springframework.ui.Model)
2019-04-16 19:50:24.011 INFO 14244 --- [ 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)
2019-04-16 19:50:24.012 INFO 14244 --- [ 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)
2019-04-16 19:50:24.035 INFO 14244 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2019-04-16 19:50:24.035 INFO 14244 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2019-04-16 19:50:24.077 INFO 14244 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2019-04-16 19:50:24.462 INFO 14244 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2019-04-16 19:50:24.464 INFO 14244 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Bean with name 'dataSource' has been autodetected for JMX exposure
2019-04-16 19:50:24.471 INFO 14244 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Located MBean 'dataSource': registering with JMX server as MBean [org.apache.tomcat.dbcp.dbcp2:name=dataSource,type=BasicDataSource]
2019-04-16 19:50:24.537 INFO 14244 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2019-04-16 19:50:24.541 INFO 14244 --- [ main] com.teamtreehouse.giflib.Application : Started Application in 3.599 seconds (JVM running for 3.942)
1 Answer
Erick Luna
21,077 PointsHi Stefan, try commenting this line in app.properties file
giflib.db.url = jdbc:h2:mem:giflib
then uncomment this line in the same file:
giflib.db.url = jdbc:h2:tcp://localhost/~/Code/screencasts/giflib-hibernate/data/giflib
and make sure to choose "Generic H2 (Server)" in your browser while startingg the database server, it works for me.
Stefan Novak
6,791 PointsStefan Novak
6,791 PointsWith further tinkering, I'm beginning to believe the URL is the problem.
For some reason the Github repo has 2 giflib.db.url properties. When I delete the 'giflib.db.url = jdbc:h2:mem:giflib' one, my app doesn't boot.
However the major thing I see is that the giflib.db.url of my Data directory (giflif.db.url = jdbc:h2:tcp://localhost/E:/Projects/Java/Spring/treehouse-giflib-hibernate-68d1926/data/giflib) is coming up as UNUSED. Could this be why no matter how many times I refresh, new tables aren't created?
PS. I made a mistake of not adding the /data/giflib directory at the end of my URL string, however fixing that didn't solve the issue.