最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

解決elastic-job-ui在使用druid作為數(shù)據(jù)庫連接池時(shí)作業(yè)維度報(bào)錯(cuò)問題

 更新時(shí)間:2024年04月01日 15:21:01   作者:快樂敲代碼  
這篇文章主要介紹了解決elastic-job-ui在使用druid作為數(shù)據(jù)庫連接池時(shí)作業(yè)維度報(bào)錯(cuò)問題,具有很好的參考價(jià)值,希望對大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教

問題說明

我們項(xiàng)目中使用到了elastic-job,然后自己封裝了個(gè)sdk,

方便使用,里面的數(shù)據(jù)源配置是常用的druid+mysql的組合,在操作中,發(fā)現(xiàn)elastic-job-ui可視化控制臺(tái)會(huì)報(bào)錯(cuò)無法使用。

深究其原因是因?yàn)?,各個(gè)服務(wù)把定時(shí)任務(wù)注冊到了zk中,包括數(shù)據(jù)庫配置類的一些信息,

但是elastic-job-ui源碼中沒有引入對應(yīng)的pom依賴,

導(dǎo)致他在去zk獲取了定時(shí)任務(wù)的配置類信息后,需要想這些信息轉(zhuǎn)換成對應(yīng)的類對象操作時(shí),沒法成功轉(zhuǎn)換。

解決

處理也很簡單,

一種是項(xiàng)目中包裝的sdk不使用druid連接池即可,可以使用HikariCP,實(shí)測是沒問題

另一種更簡單,下載elastic-job-ui源碼,在pom依賴中引入druid依賴接口(我們用這個(gè),省的改項(xiàng)目代碼,引用的地方太多了)

實(shí)操

下載源碼,使用的示最新的3.0.2版本

https://github.com/apache/shardingsphere-elasticjob-ui/tree/3.0.2

1、引入依賴和配置

引入druid依賴,順便mysql的也引入和配置下application,省的我們手動(dòng)配置mysql依賴文件了

另外他這個(gè)build也調(diào)整下,不然你直接對他打包才幾兆,不完整

<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one or more
  ~ contributor license agreements.  See the NOTICE file distributed with
  ~ this work for additional information regarding copyright ownership.
  ~ The ASF licenses this file to You under the Apache License, Version 2.0
  ~ (the "License"); you may not use this file except in compliance with
  ~ the License.  You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
<parent>
    <groupId>org.apache.shardingsphere</groupId>
    <artifactId>shardingsphere-elasticjob-lite-ui</artifactId>
    <version>3.0.2</version>
</parent>
<artifactId>shardingsphere-elasticjob-lite-ui-backend</artifactId>
<name>${project.artifactId}</name>

<dependencies>
    <dependency>
        <groupId>org.apache.shardingsphere.elasticjob</groupId>
        <artifactId>elasticjob-lite-lifecycle</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
    </dependency>
    <dependency>
        <groupId>org.apache.openjpa</groupId>
        <artifactId>openjpa</artifactId>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-dbcp2</artifactId>
    </dependency>
    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
    </dependency>
    <dependency>
        <groupId>org.postgresql</groupId>
        <artifactId>postgresql</artifactId>
    </dependency>
    <dependency>
        <groupId>javax.activation</groupId>
        <artifactId>javax.activation-api</artifactId>
    </dependency>
    <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>8.0.13</version>
    </dependency>
    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>druid-spring-boot-starter</artifactId>
        <version>1.1.22</version>
    </dependency>

    <dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
    </dependency>
    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-core</artifactId>
    </dependency>
    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-impl</artifactId>
    </dependency>
    <dependency>
        <groupId>com.auth0</groupId>
        <artifactId>java-jwt</artifactId>
    </dependency>
</dependencies>

<build>
    <finalName>shardingsphere-elasticjob-lite-ui</finalName>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <configuration>
                <encoding>${project.build.sourceEncoding}</encoding>
                <outputDirectory>${project.build.outputDirectory}</outputDirectory>
                <resources>
                    <resource>
                        <targetPath>${project.build.directory}/classes/public</targetPath>
                        <directory>${project.parent.basedir}/shardingsphere-elasticjob-lite-ui-frontend/dist</directory>
                    </resource>
                    <resource>
                        <targetPath>${project.build.directory}/classes</targetPath>
                        <directory>src/main/resources</directory>
                    </resource>
                </resources>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <version>${spring-boot.version}</version>
        </plugin>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>repackage</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

application.properties文件直接加入mysql配置選擇

## Uncomment the following property to allow adding DataSource dynamically.
dynamic.datasource.allowed-driver-classes={'org.h2.Driver','org.postgresql.Driver','com.mysql.cj.jdbc.Driver'}

2、打包

直接用這個(gè)打好的jar包,直接運(yùn)行即可,jar里面打包包含了前端頁面

3、訪問

java -jar運(yùn)行完這個(gè)jar包后,直接訪問 http://127.0.0.1:8088/#/ 即可看到可視化控制臺(tái)

賬號(hào)密碼都是默認(rèn)的root

總結(jié)

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • Spring Boot 集成MyBatis 教程詳解

    Spring Boot 集成MyBatis 教程詳解

    這篇文章主要介紹了Spring Boot 集成MyBatis 教程詳解,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下
    2017-04-04
  • 詳解Servlet3.0新特性(從注解配置到websocket編程)

    詳解Servlet3.0新特性(從注解配置到websocket編程)

    Servlet3.0的出現(xiàn)是servlet史上最大的變革,其中的許多新特性大大的簡化了web應(yīng)用的開發(fā),為廣大勞苦的程序員減輕了壓力,提高了web開發(fā)的效率。
    2017-04-04
  • quartz時(shí)間表達(dá)式Cron詳解

    quartz時(shí)間表達(dá)式Cron詳解

    這篇文章介紹了quartz時(shí)間表達(dá)式Cron,文中通過示例代碼介紹的非常詳細(xì)。對大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2021-12-12
  • System 類 和 Runtime 類的常用用法介紹

    System 類 和 Runtime 類的常用用法介紹

    這篇文章主要介紹了System 類 和 Runtime 類的常用用法,有需要的朋友可以參考一下
    2014-01-01
  • Java多線程編程中的線程死鎖的問題解決

    Java多線程編程中的線程死鎖的問題解決

    線程死鎖是多線程編程中的一個(gè)常見問題,它發(fā)生在多個(gè)線程互相等待對方釋放資源的情況下,導(dǎo)致程序無法繼續(xù)執(zhí)行,本文就來介紹一下Java多線程編程中的線程死鎖的問題解決,感興趣的可以了解一下
    2023-08-08
  • SpringBoot發(fā)送各種復(fù)雜格式郵件的示例詳解

    SpringBoot發(fā)送各種復(fù)雜格式郵件的示例詳解

    本文主要介紹了如何使用JavaMailSender接口和MimeMessageHelper類,在SpringBoot實(shí)現(xiàn)發(fā)送帶有附件,嵌入資源,抄送和密送的復(fù)雜郵件,需要的可以了解下
    2024-11-11
  • java String的深入理解

    java String的深入理解

    這篇文章主要介紹了java String的深入理解的相關(guān)資料,希望通過本文大家能理解String的用法,需要的朋友可以參考下
    2017-09-09
  • Java中Calendar日歷類型常見方法詳解

    Java中Calendar日歷類型常見方法詳解

    Calendar是Java中常用的時(shí)間處理工具之一,它提供了很多日歷類型常見方法,下面是一些常用的方法及對應(yīng)的代碼和運(yùn)行結(jié)果,感興趣的朋友一起看看吧
    2023-11-11
  • Java利用釘釘機(jī)器人實(shí)現(xiàn)發(fā)送群消息

    Java利用釘釘機(jī)器人實(shí)現(xiàn)發(fā)送群消息

    這篇文章主要為大家詳細(xì)介紹了Java語言如何通過釘釘機(jī)器人發(fā)送群消息通知,文中的示例代碼講解詳細(xì),感興趣的小伙伴可以了解一下
    2022-09-09
  • mybatis-plus?查詢傳入?yún)?shù)Map,返回List<Map>方式

    mybatis-plus?查詢傳入?yún)?shù)Map,返回List<Map>方式

    這篇文章主要介紹了mybatis-plus?查詢傳入?yún)?shù)Map,返回List<Map>方式,具有很好的參考價(jià)值,希望對大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2021-12-12

最新評(píng)論

沁阳市| 聂拉木县| 高清| 遵义县| 九江市| 田东县| 海林市| 茶陵县| 娱乐| 普兰县| 河间市| 敦煌市| 仙桃市| 萝北县| 东乌珠穆沁旗| 南皮县| 天台县| 青海省| 西峡县| 新巴尔虎左旗| 新津县| 余姚市| 大田县| 武鸣县| 肇庆市| 静乐县| 神农架林区| 镇安县| 定结县| 沛县| 神池县| 西充县| 乐亭县| 华亭县| 定兴县| 阿图什市| 泽库县| 方城县| 封开县| 苏尼特右旗| 河津市|