欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

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

 更新時(shí)間:2024年04月01日 15:21:01   作者:快樂敲代碼  
這篇文章主要介紹了解決elastic-job-ui在使用druid作為數(shù)據(jù)庫(kù)連接池時(shí)作業(yè)維度報(bào)錯(cuò)問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(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ù)注冊(cè)到了zk中,包括數(shù)據(jù)庫(kù)配置類的一些信息,

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

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

解決

處理也很簡(jiǎn)單,

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

另一種更簡(jiǎn)單,下載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)整下,不然你直接對(duì)他打包才幾兆,不完整

<?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里面打包包含了前端頁(yè)面

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)文章

  • springboot框架各個(gè)層次基礎(chǔ)詳解

    springboot框架各個(gè)層次基礎(chǔ)詳解

    這篇文章主要介紹了springboot框架各個(gè)層次基礎(chǔ),具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2024-08-08
  • java同步器AQS架構(gòu)AbstractQueuedSynchronizer原理解析

    java同步器AQS架構(gòu)AbstractQueuedSynchronizer原理解析

    這篇文章主要為大家介紹了java同步器AQS架構(gòu)AbstractQueuedSynchronizer的底層原理及源碼解析,有需要的朋友可以借鑒參考下,希望能有所幫助,祝大家多多進(jìn)步早日升職加薪
    2022-03-03
  • java快速排序和選擇排序?qū)崿F(xiàn)實(shí)例解析

    java快速排序和選擇排序?qū)崿F(xiàn)實(shí)例解析

    這篇文章主要為大家介紹了java快速排序和選擇排序?qū)崿F(xiàn)實(shí)例解析,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-11-11
  • springBoot整合redis做緩存具體操作步驟

    springBoot整合redis做緩存具體操作步驟

    緩存主要是將數(shù)據(jù)存在計(jì)算機(jī)的內(nèi)存當(dāng)中,以便于在使用的時(shí)候是可以實(shí)現(xiàn)快速讀取使用,它的快也是相對(duì)于硬盤讀取而言,這篇文章主要給大家介紹了關(guān)于springBoot整合redis做緩存的具體操作步驟,需要的朋友可以參考下
    2024-04-04
  • spring.profiles.active配置使用小結(jié)

    spring.profiles.active配置使用小結(jié)

    spring.profiles.active?配置使得應(yīng)用程序能夠在不同的環(huán)境中使用不同的配置,本文主要介紹了spring.profiles.active配置使用小結(jié),具有一定的參考價(jià)值,感興趣的可以了解一下
    2024-07-07
  • 零基礎(chǔ)寫Java知乎爬蟲之進(jìn)階篇

    零基礎(chǔ)寫Java知乎爬蟲之進(jìn)階篇

    前面幾篇文章,我們都是簡(jiǎn)單的實(shí)現(xiàn)了java爬蟲抓取內(nèi)容的問題,那么如果遇到復(fù)雜情況,我們還能繼續(xù)那么做嗎?答案當(dāng)然是否定的,之前的僅僅是入門篇,都是些基礎(chǔ)知識(shí),給大家練手用的,本文我們就來點(diǎn)高大上的東西
    2014-11-11
  • Spring框架JdbcTemplate數(shù)據(jù)庫(kù)事務(wù)管理完全注解方式

    Spring框架JdbcTemplate數(shù)據(jù)庫(kù)事務(wù)管理完全注解方式

    這篇文章主要介紹了Spring框架JdbcTemplate數(shù)據(jù)庫(kù)事務(wù)管理及完全注解方式,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2022-05-05
  • Java中避免過多if-else的幾種方法

    Java中避免過多if-else的幾種方法

    這篇文章主要介紹了Java中避免過多if-else的幾種方法,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-11-11
  • Spring之ShutDown?Hook死鎖現(xiàn)象解讀

    Spring之ShutDown?Hook死鎖現(xiàn)象解讀

    這篇文章主要介紹了Spring之ShutDown?Hook死鎖現(xiàn)象解讀,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-04-04
  • RocketMQ消息中間件超詳細(xì)解讀

    RocketMQ消息中間件超詳細(xì)解讀

    這篇文章主要介紹了RocketMQ消息中間件超詳細(xì)解讀,RocketMQ作為一款純java、分布式、隊(duì)列模型的開源消息中間件,支持事務(wù)消息、順序消息、批量消息、定時(shí)消息、消息回溯等,本文就來詳細(xì)解讀一下,需要的朋友可以參考下
    2023-05-05

最新評(píng)論