国产xxxx99真实实拍_久久不雅视频_高清韩国a级特黄毛片_嗯老师别我我受不了了小说

資訊專欄INFORMATION COLUMN

spring-boot-plus 常見問題解決 FAQ(十二)

RayKr / 2384人閱讀

摘要:常見問題解決編譯錯誤問題日志編譯錯誤編譯提示等日志錯誤解決檢查是否安裝插件安裝安裝運行錯誤問題錯誤不能連接解決檢查服務是否啟動檢查地址和端口號未知數據庫解決檢查是否新建數據庫默認的數據庫為,可在不同環境的配置文件中更改例如中

spring-boot-plus 常見問題解決 FAQ 編譯錯誤問題 log日志編譯錯誤
編譯提示log.info等日志錯誤
解決

檢查是否安裝lombok插件

idea安裝lombok

eclipse安裝lombok

運行錯誤問題 MySQL錯誤
2019-07-31 14:16:52.412 ERROR 14724 --- [           main] com.alibaba.druid.pool.DruidDataSource   : init datasource error, url: jdbc:mysql://localhost:3306/spring_boot_plus?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
不能連接mysql
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
解決

檢查MySQL服務是否啟動

檢查ip地址和端口號

未知數據庫
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown database "spring_boot_plus"
解決

檢查是否新建spring_boot_plus數據庫

默認的數據庫為spring_boot_plus,可在不同環境的配置文件中更改

例如:application-local.yml中的spring.datasource.url中更改數據庫名稱

Redis錯誤
org.springframework.data.redis.connection.PoolException: Could not get a resource from the pool; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to localhost:6379
不能連接redis

Unable to connect to localhost:6379

解決

啟動redis服務

redis默認端口號:6379

默認沒有設置密碼

請根據環境情況,進行配置

端口已被占用 Caused by: java.net.BindException: Address already in use: bind
Caused by: java.net.BindException: Address already in use: bind
    at sun.nio.ch.Net.bind0(Native Method) ~[na:1.8.0_191]
    at sun.nio.ch.Net.bind(Net.java:433) ~[na:1.8.0_191]
    at sun.nio.ch.Net.bind(Net.java:425) ~[na:1.8.0_191]
    at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223) ~[na:1.8.0_191]
    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) ~[na:1.8.0_191]
詳細錯誤日志
2019-08-02 23:23:41.350 ERROR 23380 --- [           main] org.apache.catalina.util.LifecycleBase   : Failed to start component [Connector[HTTP/1.1-8888]]

org.apache.catalina.LifecycleException: Protocol handler start failed
    at org.apache.catalina.connector.Connector.startInternal(Connector.java:1008) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.catalina.core.StandardService.addConnector(StandardService.java:227) [tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.addPreviouslyRemovedConnectors(TomcatWebServer.java:263) [spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
    at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:195) [spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.startWebServer(ServletWebServerApplicationContext.java:296) [spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:162) [spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552) [spring-context-5.1.8.RELEASE.jar:5.1.8.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) [spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:742) [spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:389) [spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:311) [spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1213) [spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1202) [spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]
    at io.geekidea.springbootplus.SpringBootPlusApplication.main(SpringBootPlusApplication.java:51) [classes/:na]
Caused by: java.net.BindException: Address already in use: bind
    at sun.nio.ch.Net.bind0(Native Method) ~[na:1.8.0_191]
    at sun.nio.ch.Net.bind(Net.java:433) ~[na:1.8.0_191]
    at sun.nio.ch.Net.bind(Net.java:425) ~[na:1.8.0_191]
    at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223) ~[na:1.8.0_191]
    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) ~[na:1.8.0_191]
    at org.apache.tomcat.util.net.NioEndpoint.initServerSocket(NioEndpoint.java:230) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:213) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup(AbstractEndpoint.java:1124) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:1210) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:585) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    at org.apache.catalina.connector.Connector.startInternal(Connector.java:1005) ~[tomcat-embed-core-9.0.21.jar:9.0.21]
    ... 14 common frames omitted

2019-08-02 23:23:41.356  INFO 23380 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2019-08-02 23:23:41.362  WARN 23380 --- [           main] o.a.c.loader.WebappClassLoaderBase       : The web application [ROOT] appears to have started a thread named [lettuce-eventExecutorLoop-1-1] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 sun.misc.Unsafe.park(Native Method)
 java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
 java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
 java.util.concurrent.LinkedBlockingQueue.poll(LinkedBlockingQueue.java:467)
 io.netty.util.concurrent.SingleThreadEventExecutor.takeTask(SingleThreadEventExecutor.java:252)
 io.netty.util.concurrent.DefaultEventExecutor.run(DefaultEventExecutor.java:64)
 io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906)
 io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
 io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
 java.lang.Thread.run(Thread.java:748)
2019-08-02 23:23:41.363  WARN 23380 --- [           main] o.a.c.loader.WebappClassLoaderBase       : The web application [ROOT] appears to have started a thread named [Druid-ConnectionPool-Create-1916224178] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 sun.misc.Unsafe.park(Native Method)
 java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
 java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
 com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2672)
2019-08-02 23:23:41.364  WARN 23380 --- [           main] o.a.c.loader.WebappClassLoaderBase       : The web application [ROOT] appears to have started a thread named [Druid-ConnectionPool-Destroy-1916224178] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 java.lang.Thread.sleep(Native Method)
 com.alibaba.druid.pool.DruidDataSource$DestroyConnectionThread.run(DruidDataSource.java:2768)
2019-08-02 23:23:41.377  INFO 23380 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with "debug" enabled.
2019-08-02 23:23:41.383 ERROR 23380 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

The Tomcat connector configured to listen on port 8888 failed to start. The port may already be in use or the connector may be misconfigured.

Action:

Verify the connector"s configuration, identify and stop any process that"s listening on port 8888, or configure this application to listen on another port.

2019-08-02 23:23:41.410  INFO 23380 --- [           main] o.s.s.c.ThreadPoolTaskScheduler          : Shutting down ExecutorService "taskScheduler"
2019-08-02 23:23:41.413  INFO 23380 --- [           main] o.s.s.c.ThreadPoolTaskScheduler          : Shutting down ExecutorService
2019-08-02 23:23:41.414  INFO 23380 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService "applicationTaskExecutor"
2019-08-02 23:23:41.417  INFO 23380 --- [           main] com.alibaba.druid.pool.DruidDataSource   : {dataSource-1} closing ...
2019-08-02 23:23:41.421  INFO 23380 --- [           main] com.alibaba.druid.pool.DruidDataSource   : {dataSource-1} closed

Process finished with exit code 1
解決
修改端口: application.local.yml中的port,默認端口8888

或者kill掉對應端口的進程

Mac/linux:kill端口

Windows:找到對應的java程序,結束任務

Spring Boot Admin不能訪問問題
你的主機中的軟件中止了一個已建立的連接
2019-07-31 16:33:37.205 ERROR 6696 --- [ctor-http-nio-2] o.s.w.s.adapter.HttpWebHandlerAdapter    : [f4aeb71d] Error [java.io.IOException: 你的主機中的軟件中止了一個已建立的連接。] for HTTP GET "/applications", but ServerHttpResponse already committed (200 OK)
解決
8888端口:與當前項目端口一致

yaml配置

spring:
  boot:
    admin:
      client:
        url: "http://localhost:8888"
management:
  endpoints:
    web:
      exposure:
        include: "*"
  endpoint:
    health:
      show-details: ALWAYS

properties配置

spring.boot.admin.client.url=http://localhost:8888
management.endpoints.web.exposure.include=*
management.endpoint.health.show-details=ALWAYS
Swagger問題 不能訪問swagger頁面
{"code":404,"data":null,"msg":"你請求的路徑不存在","time":"2019-08-01 12:56:27"}
解決

檢查WebMvcConfig.java類中是否排除了swagger靜態資源

@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
    registry.addResourceHandler("swagger-ui.html")
            .addResourceLocations("classpath:/META-INF/resources/");
    registry.addResourceHandler("/webjars/**")
            .addResourceLocations("classpath:/META-INF/resources/webjars/");
}
LocalDateTime日期類使用問題
Caused by: java.sql.SQLFeatureNotSupportedException
Caused by: java.sql.SQLFeatureNotSupportedException
    at com.alibaba.druid.pool.DruidPooledResultSet.getObject(DruidPooledResultSet.java:1771)
    at org.apache.ibatis.type.LocalDateTimeTypeHandler.getNullableResult(LocalDateTimeTypeHandler.java:38)
    at org.apache.ibatis.type.LocalDateTimeTypeHandler.getNullableResult(LocalDateTimeTypeHandler.java:28)
    at org.apache.ibatis.type.BaseTypeHandler.getResult(BaseTypeHandler.java:81)
org.springframework.dao.InvalidDataAccessApiUsageException: Error attempting to get column "create_time" from result set.  Cause: java.sql.SQLFeatureNotSupportedException
; null; nested exception is java.sql.SQLFeatureNotSupportedException

    at org.springframework.jdbc.support.SQLExceptionSubclassTranslator.doTranslate(SQLExceptionSubclassTranslator.java:96)
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
    at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
    at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)
    at com.sun.proxy.$Proxy134.selectOne(Unknown Source)
    at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:166)
    at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:89)
    at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:62)
    at com.sun.proxy.$Proxy139.getSysLogById(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)

問題原因是JDK8的LocalDate、LocalTime、LocalDateTime日期類型,druid數據源尚不支持

druid issues

目前解決辦法

更換數據源

在mybatis-plus生成代碼中配置,將日期類型生成為DateType.ONLY_DATE,數據庫中的日期類型生成為Date

// 全局配置
GlobalConfig gc = new GlobalConfig();
gc.setDateType(DateType.ONLY_DATE); // 設置日期類型為Date

mybatis-plus dateType配置

運維部署問題 項目打包后,依賴包丟失

spring-boot-plus.jar只有100多kb

此時依賴包未打包到主jar中,檢查pom.xml配置

spring-boot-plus項目中,pom.xml沒有直接繼承spring-boot-starter-parent

而是導入spring-boot-dependencies依賴

這樣做的好處是,項目可以繼承自己的父pom

使用這種方式,進行打包,默認情況下,會導致依賴包丟失,需進行以下配置

    org.springframework.boot
    spring-boot-maven-plugin
    
        io.geekidea.springbootplus.SpringBootPlusApplication
    
    
        
            
                repackage
            
        
    

mainClass:項目啟動類

repackage:重新打包

文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。

轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/76093.html

相關文章

  • spring-boot-plus運維部署(八)

    摘要:運維部署線上部署打包環境為打包后的目錄設置線上數據庫等敏感信息啟動服務啟動日志 spring-boot-plus運維部署 線上部署 打包環境為prod mvn clean package -Pprod 打包后的目錄 cd target/spring-boot-plus-1.2.0.RELEASE-prod 設置線上數據庫、Redis等敏感信息 vim spring-boot-plus/...

    Berwin 評論0 收藏0
  • spring-boot-plus后臺快速開發框架1.0.0.RELEASE發布了

    摘要:是一套集成常用開發組件的后臺快速開發框架每個人都可以獨立快速高效地開發項目官網地址主要特性集成常用開發組件集公共配置日志等集成快速操作快速生成后臺代碼集成,可自動生成文檔集成權限控制集成緩存集成消息隊列集成連接池,性能和慢查詢檢 Introduction spring-boot-plus是一套集成spring boot常用開發組件的后臺快速開發框架 Purpose 每個人都可以獨立、快...

    104828720 評論0 收藏0

發表評論

0條評論

RayKr

|高級講師

TA的文章

閱讀更多
最新活動
閱讀需要支付1元查看
<