Spring boot 如何解决InfluxDBException:psring引导项目中的无效凭据

Spring boot 如何解决InfluxDBException:psring引导项目中的无效凭据,spring-boot,influxdb,findall,Spring Boot,Influxdb,Findall,我正在尝试在RestController中的Spring引导项目上运行findAll类型的方法,它应该连接到xdb。 该方法应该从流入表中获取所有数据,并将其保存在postgres表中。 这是我的XDB配置类: @Configuration public class InfluxDBConfig { @Value("${spring.influx.url}") private String influxDBUrl; @Value("${spring.influx

我正在尝试在RestController中的Spring引导项目上运行findAll类型的方法,它应该连接到xdb。 该方法应该从流入表中获取所有数据,并将其保存在postgres表中。 这是我的XDB配置类:

@Configuration
public class InfluxDBConfig {

@Value("${spring.influx.url}")
private String influxDBUrl;

@Value("${spring.influx.user}")
private String userName;

@Value("${spring.influx.password}")
private String password;

@Value("${spring.influx.database}")
private String database;

@Bean
public InfluxDB influxDB() throws Exception {

    KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
    trustStore.load(null, null);
    MySSLSocketFactory sf = new MySSLSocketFactory(trustStore);
    sf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);

    TrustManagerFactory trustManagerFactory = TrustManagerFactory
            .getInstance(TrustManagerFactory.getDefaultAlgorithm());
    trustManagerFactory.init(trustStore);
    TrustManager[] trustManagers = trustManagerFactory.getTrustManagers();

    OkHttpClient.Builder okhttpClientBuilder = new OkHttpClient.Builder();
    okhttpClientBuilder.sslSocketFactory(sf.sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]);

    InfluxDB influxDB = InfluxDBFactory.connect(influxDBUrl, userName, password, okhttpClientBuilder);
    try {
        influxDB.setDatabase(database).enableBatch(100, 2000, TimeUnit.MILLISECONDS);
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        influxDB.setRetentionPolicy("autogen");
    }
    influxDB.setLogLevel(InfluxDB.LogLevel.BASIC);
    return influxDB;
}
}

这是我在RestController类中实现的getAll方法:

@ApiOperation(value = "Finds all values of Monterotondo Marittimo without query in input", authorizations = {
        @Authorization(value = OAUTH_SCHEMA_NAME) })
@ApiResponses(value = { @ApiResponse(code = 401, message = "Unauthorized"),
        @ApiResponse(code = 403, message = "Forbidden") })
@GetMapping("/Monterotondo-Marittimo/all")
public List<MonterotondoMarittimoModel> getAll() {
    final String METHOD_NAME = "getAll(token)";
    try {
        startLog(METHOD_NAME);
        final List<MonterotondoMarittimoEntity> result = monterotondoMarittimoService.getAll();

        final List<MonterotondoMarittimoModel> response = ModelMapUtils.createObject(result,
                MonterotondoMarittimoModel.class);
        endLog(METHOD_NAME, response);
        return response;
    } catch (final Exception e) {
        errorLog(METHOD_NAME, e);
        throw e;
    }
}
访问流入数据库的凭据正确 但当我大摇大摆地尝试启动chimaata时,我得到了以下错误:

org.influxdb.InfluxDBException: Invalid credentials
我怎样才能解决这个问题? 也许我应该使用一个令牌,将其作为输入传递给该方法,我通常使用该方法来查询postman。但我不知道怎么做。 请帮帮我

### Application server ###
server.port=30223

### DATABASE POSTGRES LOCAL ###
#spring.jpa.hibernate.ddl-auto=update
#spring.datasource.url=jdbc:postgresql://localhost:5432/postgres
#spring.datasource.username=postgres
#spring.datasource.password=postgres

### INFLUX ###
spring.influx.url=https://xxxxx:30577
spring.influx.user=guixxx
spring.influx.password=abcxxxx123
spring.influx.database=xxx_db
org.influxdb.InfluxDBException: Invalid credentials