我非常关注这个
Spring Boot Quick Start
辅导的我一直做得很好,直到我进入会话#29,在那里我将我的服务连接到嵌入式ApacheDerbyDB,并实现GET和PUT命令。我基本上遵循了作者的代码,并有以下内容。
package io.javabrains.springbootstarter.topc;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
@Entity
public class Topic {
@Id
private String id;
private String name;
private String desc;
public Topic(){}
public Topic(String id, String name, String desc) {
super();
this.id = id;
this.name = name;
this.desc = desc;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}
------------------------------------
package io.javabrains.springbootstarter.topc;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class TopicService {
@Autowired
TopicRepository topicRepository;
private List<Topic> topics = new ArrayList<>(Arrays.asList(
new Topic("spring", "Spring Framework", "SF desc"),
new Topic("java", "Core Java", "CJ desc"),
new Topic("javascript", "Java Script", "JS desc")
));
public List<Topic> getAllTopics() {
// return topics;
List<Topic> topics = new ArrayList<>();
topicRepository.findAll().forEach(topics::add);
return topics;
}
public Topic getTopic(final String id) {
return topics.stream().filter(t -> t.getId().equals(id)).findFirst().get();
}
public void addTopic(final Topic topic) {
// topics.add(topic);
topicRepository.save(topic);
}
public void updateTopic(Topic topic, String id) {
for (Topic t : topics) {
if (t.getId().equals(id)) {
topics.set(topics.indexOf(t), topic);
break;
}
}
}
public void deleteTopic(String id) {
topics.removeIf(t -> t.getId().equals(id));
}
}
---------------------------------------------------------
package io.javabrains.springbootstarter.topc;
import org.springframework.data.repository.CrudRepository;
public interface TopicRepository extends CrudRepository<Topic, String> {
}
-----------------------------------------------
package io.javabrains.springbootstarter.topc;
import java.util.Arrays;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class TopicsController {
@Autowired
private TopicService topicService;
@RequestMapping("/topics")
public List<Topic> getAllTopics() {
return topicService.getAllTopics();
}
@RequestMapping("/topics/{id}")
public Topic getTopic(@PathVariable String id) {
return topicService.getTopic(id);
}
@RequestMapping(method=RequestMethod.POST, value="/topics")
public void addTopic(@RequestBody Topic topic) {
topicService.addTopic(topic);
}
@RequestMapping(method=RequestMethod.PUT, value="/topics/{id}")
public void updateTopic(@RequestBody Topic topic, @PathVariable String id) {
topicService.updateTopic(topic, id);
}
@RequestMapping(method=RequestMethod.DELETE, value="/topics/{id}")
public void deleteTopic(@PathVariable String id) {
topicService.deleteTopic(id);
}
}
当我开始服务时,我得到
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v3.2.5)
2024-05-18T14:33:23.772-04:00 INFO 70332 --- [course-api-data] [ main] i.j.s.CourseApiDataApplication : Starting CourseApiDataApplication using Java 17.0.11 with PID 70332 (/Users/cfouts/Documents/workspace-spring-tool-suite-4-4.22.1.RELEASE/course-api-data/target/classes started by cfouts in /Users/cfouts/Documents/workspace-spring-tool-suite-4-4.22.1.RELEASE/course-api-data)
2024-05-18T14:33:23.776-04:00 INFO 70332 --- [course-api-data] [ main] i.j.s.CourseApiDataApplication : No active profile set, falling back to 1 default profile: "default"
2024-05-18T14:33:24.306-04:00 INFO 70332 --- [course-api-data] [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2024-05-18T14:33:24.348-04:00 INFO 70332 --- [course-api-data] [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 35 ms. Found 1 JPA repository interface.
2024-05-18T14:33:24.762-04:00 INFO 70332 --- [course-api-data] [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port 8080 (http)
2024-05-18T14:33:24.778-04:00 INFO 70332 --- [course-api-data] [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2024-05-18T14:33:24.778-04:00 INFO 70332 --- [course-api-data] [ main] o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/10.1.20]
2024-05-18T14:33:24.834-04:00 INFO 70332 --- [course-api-data] [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2024-05-18T14:33:24.835-04:00 INFO 70332 --- [course-api-data] [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1012 ms
2024-05-18T14:33:25.078-04:00 INFO 70332 --- [course-api-data] [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2024-05-18T14:33:25.119-04:00 INFO 70332 --- [course-api-data] [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 6.4.4.Final
2024-05-18T14:33:25.145-04:00 INFO 70332 --- [course-api-data] [ main] o.h.c.internal.RegionFactoryInitiator : HHH000026: Second-level cache disabled
2024-05-18T14:33:25.322-04:00 INFO 70332 --- [course-api-data] [ main] o.s.o.j.p.SpringPersistenceUnitInfo : No LoadTimeWeaver setup: ignoring JPA class transformer
2024-05-18T14:33:25.343-04:00 INFO 70332 --- [course-api-data] [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2024-05-18T14:33:25.346-04:00 WARN 70332 --- [course-api-data] [ main] c.zaxxer.hikari.util.DriverDataSource : Registered driver with driverClassName=org.apache.derby.jdbc.EmbeddedDriver was not found, trying direct instantiation.
2024-05-18T14:33:25.599-04:00 INFO 70332 --- [course-api-data] [ main] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Driver does not support get/set network timeout for connections. (Feature not implemented: No details.)
2024-05-18T14:33:25.600-04:00 INFO 70332 --- [course-api-data] [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Added connection org.apache.derby.impl.jdbc.EmbedConnection@465134665 (XID = 166), (SESSIONID = 1), (DATABASE = memory:289b3e21-3d50-4500-b770-e6f9a0ab7601), (DRDAID = null)
2024-05-18T14:33:25.607-04:00 INFO 70332 --- [course-api-data] [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2024-05-18T14:33:25.653-04:00 WARN 70332 --- [course-api-data] [ main] com.zaxxer.hikari.pool.ProxyConnection : HikariPool-1 - Connection org.apache.derby.impl.jdbc.EmbedConnection@465134665 (XID = 166), (SESSIONID = 1), (DATABASE = memory:289b3e21-3d50-4500-b770-e6f9a0ab7601), (DRDAID = null) marked as broken because of SQLSTATE(0A000), ErrorCode(20000)
java.sql.SQLFeatureNotSupportedException: Feature not implemented: No details.
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:106) ~[derby-10.16.1.1.jar:na]
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:141) ~[derby-10.16.1.1.jar:na]
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:225) ~[derby-10.16.1.1.jar:na]
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:220) ~[derby-10.16.1.1.jar:na]
at org.apache.derby.impl.jdbc.Util.notImplemented(Util.java:289) ~[derby-10.16.1.1.jar:na]
at org.apache.derby.impl.jdbc.Util.notImplemented(Util.java:285) ~[derby-10.16.1.1.jar:na]
at org.apache.derby.impl.jdbc.EmbedConnection.createNClob(EmbedConnection.java:3728) ~[derby-10.16.1.1.jar:na]
at com.zaxxer.hikari.pool.HikariProxyConnection.createNClob(HikariProxyConnection.java) ~[HikariCP-5.0.1.jar:na]
at org.hibernate.engine.jdbc.env.internal.LobCreationHelper.canCreateNClob(LobCreationHelper.java:104) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
at org.hibernate.engine.jdbc.env.internal.LobCreationHelper.getSupportedContextualLobTypes(LobCreationHelper.java:72) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
at org.hibernate.engine.jdbc.env.internal.LobCreatorBuilderImpl.makeLobCreatorBuilder(LobCreatorBuilderImpl.java:51) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentImpl.<init>(JdbcEnvironmentImpl.java:306) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$1.execute(JdbcEnvironmentInitiator.java:328) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$1.execute(JdbcEnvironmentInitiator.java:277) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
at org.hibernate.jdbc.WorkExecutor.executeReturningWork(WorkExecutor.java:58) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
at org.hibernate.jdbc.AbstractReturningWork.accept(AbstractReturningWork.java:34) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcIsolationDelegate.delegateWork(JdbcIsolationDelegate.java:70) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.getJdbcEnvironmentUsingJdbcMetadata(JdbcEnvironmentInitiator.java:276) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:107) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:68) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:130) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:238) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:215) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
at org.hibernate.boot.model.relational.Database.<init>(Database.java:45) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.getDatabase(InFlightMetadataCollectorImpl.java:223) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.<init>(InFlightMetadataCollectorImpl.java:191) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:170) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1432) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1503) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:75) ~[spring-orm-6.1.6.jar:6.1.6]
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:390) ~[spring-orm-6.1.6.jar:6.1.6]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409) ~[spring-orm-6.1.6.jar:6.1.6]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396) ~[spring-orm-6.1.6.jar:6.1.6]
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:366) ~[spring-orm-6.1.6.jar:6.1.6]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1833) ~[spring-beans-6.1.6.jar:6.1.6]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1782) ~[spring-beans-6.1.6.jar:6.1.6]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:600) ~[spring-beans-6.1.6.jar:6.1.6]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522) ~[spring-beans-6.1.6.jar:6.1.6]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[spring-beans-6.1.6.jar:6.1.6]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.1.6.jar:6.1.6]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[spring-beans-6.1.6.jar:6.1.6]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.1.6.jar:6.1.6]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1234) ~[spring-context-6.1.6.jar:6.1.6]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:952) ~[spring-context-6.1.6.jar:6.1.6]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:624) ~[spring-context-6.1.6.jar:6.1.6]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.2.5.jar:3.2.5]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-3.2.5.jar:3.2.5]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456) ~[spring-boot-3.2.5.jar:3.2.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:334) ~[spring-boot-3.2.5.jar:3.2.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1354) ~[spring-boot-3.2.5.jar:3.2.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) ~[spring-boot-3.2.5.jar:3.2.5]
at io.javabrains.springbootstarter.CourseApiDataApplication.main(CourseApiDataApplication.java:10) ~[classes/:na]
Caused by: org.apache.derby.shared.common.error.StandardException: Feature not implemented: No details.
at org.apache.derby.shared.common.error.StandardException.newException(StandardException.java:299) ~[derbyshared-10.16.1.1.jar:na]
at org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory.java:170) ~[derby-10.16.1.1.jar:na]
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:75) ~[derby-10.16.1.1.jar:na]
... 52 common frames omitted
2024-05-18T14:33:26.226-04:00 INFO 70332 --- [course-api-data] [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000489: No JTA platform available (set 'hibernate.transaction.jta.platform' to enable JTA platform integration)
2024-05-18T14:33:26.457-04:00 WARN 70332 --- [course-api-data] [ main] o.h.t.s.i.ExceptionHandlerLoggedImpl : GenerationTarget encountered exception accepting command : Error executing DDL "create table topic (id varchar(255) not null, desc varchar(255), name varchar(255), primary key (id))" via JDBC [Syntax error: Encountered "desc" at line 1, column 47.]
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "create table topic (id varchar(255) not null, desc varchar(255), name varchar(255), primary key (id))" via JDBC [Syntax error: Encountered "desc" at line 1, column 47.]
at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:94) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlString(AbstractSchemaMigrator.java:574) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlStrings(AbstractSchemaMigrator.java:514) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.createTable(AbstractSchemaMigrator.java:315) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
at org.hibernate.tool.schema.internal.GroupedSchemaMigratorImpl.performTablesMigration(GroupedSchemaMigratorImpl.java:80) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.performMigration(AbstractSchemaMigrator.java:232) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.doMigration(AbstractSchemaMigrator.java:117) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:286) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.lambda$process$5(SchemaManagementToolCoordinator.java:145) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
at java.base/java.util.HashMap.forEach(HashMap.java:1421) ~[na:na]
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:142) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
at org.hibernate.boot.internal.SessionFactoryObserverForSchemaExport.sessionFactoryCreated(SessionFactoryObserverForSchemaExport.java:37) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
at org.hibernate.internal.SessionFactoryObserverChain.sessionFactoryCreated(SessionFactoryObserverChain.java:35) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:315) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:450) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1507) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:75) ~[spring-orm-6.1.6.jar:6.1.6]
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:390) ~[spring-orm-6.1.6.jar:6.1.6]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409) ~[spring-orm-6.1.6.jar:6.1.6]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396) ~[spring-orm-6.1.6.jar:6.1.6]
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:366) ~[spring-orm-6.1.6.jar:6.1.6]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1833) ~[spring-beans-6.1.6.jar:6.1.6]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1782) ~[spring-beans-6.1.6.jar:6.1.6]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:600) ~[spring-beans-6.1.6.jar:6.1.6]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522) ~[spring-beans-6.1.6.jar:6.1.6]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[spring-beans-6.1.6.jar:6.1.6]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.1.6.jar:6.1.6]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[spring-beans-6.1.6.jar:6.1.6]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.1.6.jar:6.1.6]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1234) ~[spring-context-6.1.6.jar:6.1.6]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:952) ~[spring-context-6.1.6.jar:6.1.6]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:624) ~[spring-context-6.1.6.jar:6.1.6]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.2.5.jar:3.2.5]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-3.2.5.jar:3.2.5]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456) ~[spring-boot-3.2.5.jar:3.2.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:334) ~[spring-boot-3.2.5.jar:3.2.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1354) ~[spring-boot-3.2.5.jar:3.2.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) ~[spring-boot-3.2.5.jar:3.2.5]
at io.javabrains.springbootstarter.CourseApiDataApplication.main(CourseApiDataApplication.java:10) ~[classes/:na]
Caused by: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "desc" at line 1, column 47.
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:103) ~[derby-10.16.1.1.jar:na]
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:230) ~[derby-10.16.1.1.jar:na]
at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:431) ~[derby-10.16.1.1.jar:na]
at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:360) ~[derby-10.16.1.1.jar:na]
at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2400) ~[derby-10.16.1.1.jar:na]
at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:86) ~[derby-10.16.1.1.jar:na]
at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:697) ~[derby-10.16.1.1.jar:na]
at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:637) ~[derby-10.16.1.1.jar:na]
at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:94) ~[HikariCP-5.0.1.jar:na]
at com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java) ~[HikariCP-5.0.1.jar:na]
at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:80) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
... 38 common frames omitted
Caused by: org.apache.derby.shared.common.error.StandardException: Syntax error: Encountered "desc" at line 1, column 47.
at org.apache.derby.shared.common.error.StandardException.newException(StandardException.java:299) ~[derbyshared-10.16.1.1.jar:na]
at org.apache.derby.shared.common.error.StandardException.newException(StandardException.java:294) ~[derbyshared-10.16.1.1.jar:na]
at org.apache.derby.impl.sql.compile.ParserImpl.parseStatementOrSearchCondition(ParserImpl.java:175) ~[derby-10.16.1.1.jar:na]
at org.apache.derby.impl.sql.compile.ParserImpl.parseStatement(ParserImpl.java:130) ~[derby-10.16.1.1.jar:na]
at org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:359) ~[derby-10.16.1.1.jar:na]
at org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:99) ~[derby-10.16.1.1.jar:na]
at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:1114) ~[derby-10.16.1.1.jar:na]
at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:689) ~[derby-10.16.1.1.jar:na]
... 42 common frames omitted
2024-05-18T14:33:26.460-04:00 INFO 70332 --- [course-api-data] [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2024-05-18T14:33:26.636-04:00 WARN 70332 --- [course-api-data] [ 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
2024-05-18T14:33:26.896-04:00 INFO 70332 --- [course-api-data] [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port 8080 (http) with context path ''
2024-05-18T14:33:26.904-04:00 INFO 70332 --- [course-api-data] [ main] i.j.s.CourseApiDataApplication : Started CourseApiDataApplication in 3.471 seconds (process running for 3.849)
这个错误是什么?我该如何解决?我显然是新手。
2024-05-18T14:33:26.457-04:00 WARN 70332 --- [course-api-data] [ main] o.h.t.s.i.ExceptionHandlerLoggedImpl : GenerationTarget encountered exception accepting command : Error executing DDL "create table topic (id varchar(255) not null, desc varchar(255), name varchar(255), primary key (id))" via JDBC [Syntax error: Encountered "desc" at line 1, column 47.]