Madhavi vasantala
Madhavi vasantala

Reputation: 1

App failed to start with exception: "Field tracing in MockServiceImpl required a bean of type 'brave.Tracing' that could not be found"

We have upgraded our project to Spring 3.0 After that the application is failing to start and throwing the below error.

My pom.xml has below dependencies `

       <dependency>
           <groupId>io.micrometer</groupId>
            <artifactId>micrometer-tracing</artifactId>
            <version>1.1.7</version>
        </dependency>
        <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-tracing-bridge-brave</artifactId>
            <version>1.1.7</version>
        </dependency>
        <dependency>
            <groupId>io.zipkin.reporter2</groupId>
            <artifactId>zipkin-reporter-brave</artifactId>
            <version>2.16.3</version>
        </dependency>`

My Class file:

`import brave.Tracing;

@Service
@Generated

public class MockServiceImpl implements MockService 
{


public static final String Y = "Y";
@Autowired
Tracing tracing;
@Autowired
ScenarioRunner scenarioRunner;
@Autowired
ObjectMapper objectMapper;

public void publishMockOutput(Message<GenericRecord> msg, MockInfo info) {
        String scenarioId = tracing.tracer().currentSpan().context().traceIdString() 
   ;

    }

`

my application.yml

`management:
  tracing:
   sampling:
     probability: 1.0
       enabled: false
  zipkin:
    tracing:
      endpoint: my endpoint url

`

Can someone help how to resolve this error?

Upvotes: -1

Views: 100

Answers (1)

Madhavi vasantala
Madhavi vasantala

Reputation: 1

Issue resolved by making the below change to application.yml

Before:

 management:
  tracing:
   sampling:
     probability: 1.0
       enabled: false

After:

management:
  tracing:
   sampling:
     probability: 1.0
       enabled: true

Upvotes: 0

Related Questions