BladeX如何进行JMH基准测试

Blade 未结 1 1144
zkf
zkf 2020-05-15 14:09
1条回答
  •  smallchill
    smallchill (楼主)
    2020-05-15 14:31

    https://www.baidu.com/s?wd=springboot如何进行JMH基准测试

    作者追问:2020-05-15 14:31

    问题的关键是:每次运行代码,都要去连接nacos的配置

    Description:

    Application failed to connect to Nacos server: ""

    Action:

    Please check your Nacos server config

    <failure>

    com.alibaba.cloud.nacos.diagnostics.analyzer.NacosConnectionFailureException: java.lang.reflect.InvocationTargetException
    at com.alibaba.cloud.nacos.NacosConfigProperties.configServiceInstance(NacosConfigProperties.java:372)
    at com.alibaba.cloud.nacos.client.NacosPropertySourceLocator.locate(NacosPropertySourceLocator.java:67)
    at org.springframework.cloud.bootstrap.config.PropertySourceLocator.locateCollection(PropertySourceLocator.java:52)
    at org.springframework.cloud.bootstrap.config.PropertySourceLocator.locateCollection(PropertySourceLocator.java:47)
    at org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration.initialize(PropertySourceBootstrapConfiguration.java:101)
    at org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:623)
    at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:367)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:311)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1204)
    at launch.JmhSpringBootTest.init(JmhSpringBootTest.java:37)
    at launch.generated.JmhSpringBootTest_testDB_jmhTest._jmh_tryInit_f_jmhspringboottest0_0(JmhSpringBootTest_testDB_jmhTest.java:334)
    at launch.generated.JmhSpringBootTest_testDB_jmhTest.testDB_AverageTime(JmhSpringBootTest_testDB_jmhTest.java:138)
    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)
    at org.openjdk.jmh.runner.BenchmarkHandler$BenchmarkTask.call(BenchmarkHandler.java:453)
    at org.openjdk.jmh.runner.BenchmarkHandler$BenchmarkTask.call(BenchmarkHandler.java:437)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)


    回答: 2020-05-15 14:31

    没有生成红框内的SPI配置文件,所以nacos启动的时候报错。启动的时候整个项目先执行mvn clean compile,确保生成了这个配置文件,在启动系统

    image.png

    0 讨论(0)
提交回复