The Boots Bootique - Java Spring Course - UI not loading and API not responding

https://www.codecademy.com/courses/learn-spring/projects/spring-data-jpa-the-boots-bootique
Windows 11
Google Chrome Version 94.0.4606.61 (Official Build) (64-bit)

I made it to checkpoint 6: List All the Boots

Port 4001 keeps refusing the connection and the website UI disappears after a minute. There is also no table appearing in the UI.

I checked my code for compilation errors:
I compiled my code by CDing to the project folder and using mvn compile to check if I had errors. I initially did, but the problem persists even now that I get Build Successful from maven.

I checked the endpoint using curl in the browser bash terminal and I keep getting connection refused:

$ curl http://localhost:4001/api/v1/boots/
curl: (7) Failed to connect to localhost port 4001: Connection refused

I recreated the project in IntelliJ IDEA and when I run my Spring Boot Server and curl the same endpoint I get the correct output:

[{"id":1,"type":"CHELSEA","size":10.5,"quantity":6,"material":"leather"},{"id":2,"type":"GOGO","siz
                    e":6.5,"quantity":6,"material":"rubber"},{"id":3,"type":"GOGO","size":7.5,"quantity":16,"material":
                    "r...

You can see the blank UI, the failed curl command, and the tail end of the maven build success message.


EDIT 1:

Now the UI is loading but accessing the endpoint is responding with a long SQLGrammerException. See pic attached

Here is the full text of the exception:

$ curl http://localhost:4001/api/v1/boots/
{"timestamp":"2021-09-26T23:40:46.463+00:00","status":500,"error":"Internal Server Error","trace":"org.springframework.dao.InvalidDataAccessResourceUsageException: could not prepare statement; SQL [select boot0_.id as id1_0_, boot0_.material as material2_0_, boot0_.quantity as quantity3_0_, boot0_.size as size4_0_, boot0_.type as type5_0_ from boots boot0_]; nested exception is org.hibernate.exception.SQLGrammarException: could not prepare statement\n\tat org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:259)\n\tat org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:233)\n\tat org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:551)\n\tat org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:61)\n\tat org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:242)\n\tat org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:152)\n\tat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)\n\tat org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:174)\n\tat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)\n\tat org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)\n\tat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)\n\tat org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)\n\tat com.sun.proxy.$Proxy95.findAll(Unknown Source)\n\tat com.codecademy.boots.controllers.BootController.getAllBoots(BootController.java:42)\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n\tat java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat java.base/java.lang.reflect.Method.invoke(Method.java:566)\n\tat org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:197)\n\tat org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:141)\n\tat org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:106)\n\tat org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:894)\n\tat org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808)\n\tat org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)\n\tat org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1060)\n\tat org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962)\n\tat org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)\n\tat org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:626)\n\tat org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:733)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)\n\tat org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)\n\tat org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)\n\tat org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)\n\tat org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)\n\tat org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)\n\tat org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)\n\tat org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542)\n\tat org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)\n\tat org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)\n\tat org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)\n\tat org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357)\n\tat org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374)\n\tat org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)\n\tat org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893)\n\tat org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1707)\n\tat org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)\n\tat org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)\n\tat java.base/java.lang.Thread.run(Thread.java:829)\nCaused by: org.hibernate.exception.SQLGrammarException: could not prepare statement\n\tat org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:63)\n\tat org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)\n\tat org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113)\n\tat org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:186)\n\tat org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareQueryStatement(StatementPreparerImpl.java:151)\n\tat org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:2103)\n\tat org.hibernate.loader.Loader.executeQueryStatement(Loader.java:2040)\n\tat org.hibernate.loader.Loader.executeQueryStatement(Loader.java:2018)\n\tat org.hibernate.loader.Loader.doQuery(Loader.java:948)\n\tat org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:349)\n\tat org.hibernate.loader.Loader.doList(Loader.java:2849)\n\tat org.hibernate.loader.Loader.doList(Loader.java:2831)\n\tat org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2663)\n\tat org.hibernate.loader.Loader.list(Loader.java:2658)\n\tat org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:506)\n\tat org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:400)\n\tat org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:219)\n\tat org.hibernate.internal.SessionImpl.list(SessionImpl.java:1414)\n\tat org.hibernate.query.internal.AbstractProducedQuery.doList(AbstractProducedQuery.java:1625)\n\tat org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1593)\n\tat org.hibernate.query.Query.getResultList(Query.java:165)\n\tat org.hibernate.query.criteria.internal.compile.CriteriaQueryTypeQueryAdapter.getResultList(CriteriaQueryTypeQueryAdapter.java:76)\n\tat org.springframework.data.jpa.repository.support.SimpleJpaRepository.findAll(SimpleJpaRepository.java:356)\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n\tat java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat java.base/java.lang.reflect.Method.invoke(Method.java:566)\n\tat org.springframework.data.repository.core.support.RepositoryMethodInvoker$RepositoryFragmentMethodInvoker.lambda$new$0(RepositoryMethodInvoker.java:289)\n\tat org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:137)\n\tat org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:121)\n\tat org.springframework.data.repository.core.support.RepositoryComposition$RepositoryFragments.invoke(RepositoryComposition.java:524)\n\tat org.springframework.data.repository.core.support.RepositoryComposition.invoke(RepositoryComposition.java:285)\n\tat org.springframework.data.repository.core.support.RepositoryFactorySupport$ImplementationMethodExecutionInterceptor.invoke(RepositoryFactorySupport.java:531)\n\tat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)\n\tat org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:156)\n\tat org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:131)\n\tat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)\n\tat org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:80)\n\tat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)\n\tat org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)\n\tat org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388)\n\tat org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)\n\tat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)\n\tat org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:137)\n\t... 58 more\nCaused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Table \"BOOTS\" not found; SQL statement:\nselect boot0_.id as id1_0_, boot0_.material as material2_0_, boot0_.quantity as quantity3_0_, boot0_.size as size4_0_, boot0_.type as type5_0_ from boots boot0_ [42102-200]\n\tat org.h2.message.DbException.getJdbcSQLException(DbException.java:453)\n\tat org.h2.message.DbException.getJdbcSQLException(DbException.java:429)\n\tat org.h2.message.DbException.get(DbException.java:205)\n\tat org.h2.message.DbException.get(DbException.java:181)\n\tat org.h2.command.Parser.readTableOrView(Parser.java:7628)\n\tat org.h2.command.Parser.readTableFilter(Parser.java:1970)\n\tat org.h2.command.Parser.parseSelectFromPart(Parser.java:2827)\n\tat org.h2.command.Parser.parseSelect(Parser.java:2959)\n\tat org.h2.command.Parser.parseQuerySub(Parser.java:2817)\n\tat org.h2.command.Parser.parseSelectUnion(Parser.java:2649)\n\tat org.h2.command.Parser.parseQuery(Parser.java:2620)\n\tat org.h2.command.Parser.parsePrepared(Parser.java:868)\n\tat org.h2.command.Parser.parse(Parser.java:843)\n\tat org.h2.command.Parser.parse(Parser.java:815)\n\tat org.h2.command.Parser.prepareCommand(Parser.java:738)\n\tat org.h2.engine.Session.prepareLocal(Session.java:657)\n\tat org.h2.engine.Session.prepareCommand(Session.java:595)\n\tat org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1235)\n\tat org.h2.jdbc.JdbcPreparedStatement.<init>(JdbcPreparedStatement.java:76)\n\tat org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:352)\n\tat com.zaxxer.hikari.pool.ProxyConnection.prepareStatement(ProxyConnection.java:337)\n\tat com.zaxxer.hikari.pool.HikariProxyConnection.prepareStatement(HikariProxyConnection.java)\n\tat org.hibernate.engine.jdbc.internal.StatementPreparerImpl$5.doPrepare(StatementPreparerImpl.java:149)\n\tat org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:176)\n\t... 98 more\n","message":"could not prepare statement; SQL [select boot0_.id as id1_0_, boot0_.material as material2_0_, boot0_.quantity as quantity3_0_, boot0_.size as size4_0_, boot0_.type as type5_0_ from boots boot0_]; nested exception is org.hibernate.exception.SQLGrammarException: could not prepar

I think the relevant part has to do with the BOOTS table not being found.

Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Table \"BOOTS\" not found; SQL statement:
select boot0_.id as id1_0_, boot0_.material as material2_0_, boot0_.quantity as quantity3_0_, boot0_.size as size4_0_, boot0_.type as type5_0_ from boots boot0_ [42102-200]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:453)...

EDIT 2:

Okay, so the Boots table does exist in local testing.

1 Like

I have the same problem. What did you do to get the ui working again?

I think there’s a problem with the underlying platform the lesson is using to run the code. I spoke to the team and last I heard they identified the issue, but I don’t know if it is fixed yet or if it is close to being fixed. The good news is that this means we weren’t just too stupid to solve it :laughing: