用了宝塔快速部署 报了如下错误 是因为创建数据库失败吗?
shikisummer opened this issue · 3 comments
2024-01-05 14:11:56.113 INFO 60772 --- [ main] c.y.webserver.WebServerApplication : Starting WebServerApplication v0.0.1-SNAPSHOT using Java 11.0.21 on 6af1d0c27dd4 with PID 60772 (/www/wwwroot/webServer/WebServer-0.0.1-SNAPSHOT.jar started by root in /www/wwwroot/webServer)
2024-01-05 14:11:56.116 INFO 60772 --- [ main] c.y.webserver.WebServerApplication : No active profile set, falling back to 1 default profile: "default"
2024-01-05 14:11:56.738 INFO 60772 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2024-01-05 14:11:56.754 INFO 60772 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 7 ms. Found 0 JPA repository interfaces.
2024-01-05 14:11:57.152 INFO 60772 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'com.dtflys.forest.springboot.ForestAutoConfiguration' of type [com.dtflys.forest.springboot.ForestAutoConfiguration$$EnhancerBySpringCGLIB$$f23007b1] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2024-01-05 14:11:57.193 INFO 60772 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'forestConfigurationProperties' of type [com.dtflys.forest.springboot.properties.ForestConfigurationProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2024-01-05 14:11:57.334 INFO 60772 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean '(inner bean)#3f67593e' of type [com.dtflys.forest.config.SpringForestProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2024-01-05 14:11:57.336 INFO 60772 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean '(inner bean)#1115ec15' of type [com.dtflys.forest.reflection.SpringForestObjectFactory] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2024-01-05 14:11:57.337 INFO 60772 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean '(inner bean)#43b9fd5' of type [com.dtflys.forest.interceptor.SpringInterceptorFactory] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2024-01-05 14:11:57.341 INFO 60772 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'forestConfiguration' of type [com.dtflys.forest.config.ForestConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2024-01-05 14:11:57.350 INFO 60772 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'forestConverterBeanListener' of type [com.dtflys.forest.spring.ConverterBeanListener] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2024-01-05 14:11:57.365 INFO 60772 --- [ main] c.d.f.scanner.ClassPathClientScanner : [Forest] Created Forest Client Bean with name 'wechatNoticeClient' and Proxy of 'com.yyandywt99.webserver.service.WechatNoticeClient' client interface
2024-01-05 14:11:57.655 INFO 60772 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8081 (http)
2024-01-05 14:11:57.663 INFO 60772 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2024-01-05 14:11:57.663 INFO 60772 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.79]
2024-01-05 14:11:57.724 INFO 60772 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2024-01-05 14:11:57.724 INFO 60772 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1556 ms
2024-01-05 14:11:57.892 INFO 60772 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2024-01-05 14:11:58.195 INFO 60772 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2024-01-05 14:11:58.376 WARN 60772 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceScriptDatabaseInitializer' defined in class path resource [org/springframework/boot/autoconfigure/sql/init/DataSourceInitializationConfiguration.class]: Invocation of init method failed; nested exception is org.springframework.jdbc.datasource.init.ScriptStatementFailedException: Failed to execute SQL script statement #4 of class path resource [sql/create-table.sql]: create table IF NOT EXISTS usertable ( nameId int auto_increment comment 'name ??? id' primary key, name varchar(20) not null comment '??????', password varchar(20) default '123456' null comment '????????????', userText text null comment '???????????????', userImage text null, credit int default 0 not null comment '??????', updateTime datetime null comment '????????????', remindText text null comment '??????????????????', remindSwitch tinyint default 0 null comment '????????????', remindTime varchar(20) default '0 30 11 * * ?' null comment '????????????', registerTime datetime null comment '????????????', displayItem varchar(10) default '????????????' null comment '????????????', displayDay varchar(20) default '2022-10-06' not null comment '??????????????????', displayLogo varchar(20) default '???????????????????' not null comment '??????logo', displayUrl varchar(50) default 'http://121.37.243.173/#/' not null comment '?????????????????????', constraint usertable_nameId_uindex unique (nameId), constraint usertable_name_uindex unique (name) ); nested exception is java.sql.SQLSyntaxErrorException: Invalid default value for 'displayItem'
2024-01-05 14:11:58.376 INFO 60772 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2024-01-05 14:11:58.391 INFO 60772 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
2024-01-05 14:11:58.393 INFO 60772 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2024-01-05 14:11:58.403 INFO 60772 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2024-01-05 14:11:58.419 ERROR 60772 --- [ main] o.s.boot.SpringApplication : Application run failed
这个错误是由于应用在执行 SQL 脚本时,发现了一个名为 displayItem 的字段有一个无效的默认值。建议检查一下 sql/create-table.sql 文件中的 displayItem 字段的定义,看看是否存在问题。
解决了 启动jar包时,使用-Dfile.encoding=utf-8 指定字符集即可解决。
nohup java -Dfile.encoding=utf-8 -jar -Xmx1024M -Xms256M /www/wwwroot/webServer/WebServer-0.0.1-SNAPSHOT.jar --spring.datasource.password=密码 --spring.datasource.username=webserver> output.log 2>&1 &
好