sofastack / sofa-tracer

SOFATracer is a component for the distributed system call trace. And through a unified traceId logging the logs of various network calls in the invoking link. These logs can be used for quick discovery of faults, service governance, etc.
Apache License 2.0
1.1k stars 372 forks source link

不使用sofa boot,使用spring boot parent,依赖tracer-sofa-boot-starter时启动报错 #448

Open dkwdjq opened 3 years ago

dkwdjq commented 3 years ago

公司内部项目无法替换依赖的parent为sofa boot,只能使用spring boot parent,在这种情况下想要使用tracer-sofa-boot-starter,怎么解决

nobodyiam commented 3 years ago

I think you could import sofaboot-dependencies in dependencyManagement, e.g.

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.alipay.sofa</groupId>
        <artifactId>sofaboot-dependencies</artifactId>
        <version>${sofa.boot.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
glmapper commented 2 years ago

@dkwdjq can you provide more info for this issue, such as exception stack.

vacuityv commented 1 year ago

有办法解决吗

khotyn commented 1 year ago

@vacuityv 参考前面 @nobodyiam 反馈的方式试一下,如果有问题的话,可以把错误信息贴到这里。

vacuityv commented 1 year ago

错误信息如下: [2023-06-08 14:59:37.252] [TID: N/A] [,] [ERROR] - org.springframework.boot.SpringApplication.reportFailure(SpringApplication.java:821) - Application run failed java.lang.NoSuchMethodError: org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent.(Lorg/springframework/boot/SpringApplication;[Ljava/lang/String;Lorg/springframework/core/env/ConfigurableEnvironment;)V at com.alipay.sofa.boot.listener.SofaBootstrapRunListener.onApplicationEvent(SofaBootstrapRunListener.java:130) ~[sofa-boot-3.10.0.jar:3.10.0] at com.alipay.sofa.boot.listener.SofaBootstrapRunListener.onApplicationEvent(SofaBootstrapRunListener.java:51) ~[sofa-boot-3.10.0.jar:3.10.0] at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176) ~[spring-context-5.3.15.jar:5.3.15] at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169) ~[spring-context-5.3.15.jar:5.3.15] at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143) ~[spring-context-5.3.15.jar:5.3.15] at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131) ~[spring-context-5.3.15.jar:5.3.15] at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:85) ~[spring-boot-2.6.3.jar:2.6.3] at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:66) ~[spring-boot-2.6.3.jar:2.6.3] at java.util.ArrayList.forEach(ArrayList.java:1259) ~[?:1.8.0_312] at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:120) ~[spring-boot-2.6.3.jar:2.6.3] at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:114) ~[spring-boot-2.6.3.jar:2.6.3] at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:65) ~[spring-boot-2.6.3.jar:2.6.3] at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:338) [spring-boot-2.6.3.jar:2.6.3] at org.springframework.boot.SpringApplication.run(SpringApplication.java:296) [spring-boot-2.6.3.jar:2.6.3] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303) [spring-boot-2.6.3.jar:2.6.3] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292) [spring-boot-2.6.3.jar:2.6.3]

各位大佬有空帮忙看下 @khotyn

nobodyiam commented 1 year ago

@vacuityv this was solved via https://github.com/sofastack/sofa-boot/pull/944, you may use more recent versions, e.g. 3.18.0