Wednesday, May 25th, 2022 10:18 AM

Springboot collibra-integration-library issues

I have installed the library in local maven repository and updated the build.gradle to use maven local repository as suggested in the spring boot integration documentation. But its not detecting the collibra built-in classes when I am trying to access them in the code. Can some someone please help on this.

711 Messages

 • 

19.2K Points

3 years ago

368 Messages

3 years ago

Hello Vamsikrishna,

Thanks for trying the Collibra Integration Library.

To be able to use it in a Gradle project, the following needs to be done:

  1. Install the Collibra Integration Library in your local Maven repository using the following command as specified in the documentation:
    mvn org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install-file -Dfile=<path-to-jar-file>

  2. Update the build.gradle file to include the following:

     repositories {
         mavenCentral()
         mavenLocal()
         ...
     }
    
     dependencies {
         implementation 'com.collibra.marketplace:collibra-integration-library:<library_version>'
         ...
     }
    

where:

  • <library_version> should be replaced with the respective Collibra Integration Library version that was installed in step 1.
  1. Set the required properties as specified in the documentation (e.g. the Collibra instance URL)
  2. Rebuild the project

3 years ago

Thanks for the reply. I have followed the same steps given. And I tried to call ApiClient buildClient method as mentioned in the document given below.

private final ApiClient apiClient;
@Autowired
public Constructor(ApiClient apiClient){
 this.apiClient = apiClient;
}
...
AssetsApi assetsApi = apiClient.buildClient(AssetsApi.class);
AssetImpl myAssetDetails = assetsApi.getAsset
(myUUID); // this method corresponds to 
the GET /assets/{assetId} endpoint.

But When I try to bring up the tomcat in local, its giving the following error.

Field apiClient in .***. required a bean of type ‘com.collibra.marketplace.library.generated.core.ApiClient’ that could not be found.

The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)

Action:

Consider defining a bean of type ‘com.collibra.marketplace.library.generated.core.ApiClient’ in your configuration.

Also I don’t see any properties to be set for ApiClient in the documentation, do we need to set any?

368 Messages

3 years ago

Hello Vamsikrishna,

Thanks for the update.

Can you please try using the attached Java class?
Once the test method is called, it should print the asset name for the provided asset ID.

sample.java

Additionally, can you please confirm that:

  • A Spring Boot project is being used
  • The SpringBootApplication annotation also scans the com.collibra base package:
    @SpringBootApplication(scanBasePackages = {"com.collibra", ...})

Regarding the properties, there are no specific properties that should be set to use the ApiClient. For more information, you can refer to the " Configuration Properties" section of the Collibra Integration Library documentation.

3 years ago

Thank you for the quick responses! I had used the same code which is given by you.

I am using a spring boot project only and also tested the sample end points in localhost. Its working fine. Only with Collibra library integration, I am getting that error.
I have tried including the scan base packages for both springbootapplication and componentscan also. But still same result when I try to bring up the localhost.

Any update?
I am getting the same error when I used the same class as it is also.

Description:

Parameter 0 of constructor in com.xxx.xxx…Sample required a bean of type ‘com.collibra.marketplace.library.generated.core.ApiClient’ that could not be found.

Action:

Consider defining a bean of type ‘com.collibra.marketplace.library.generated.core.ApiClient’ in your configuration.

368 Messages

3 years ago

Hello Vamsikrishna,

Thanks for the information provided.

To confirm, when calling the test method from the provided Java class, using the same Spring Boot project (e.g. from the controller, does it work please?

Also, can you please confirm that when adding the following annotation to the main class, the package name of you application (e.g. my.custom.package.name) was also added?

@SpringBootApplication(scanBasePackages = {"com.collibra", "my.custom.package.name"})

Additionally, can you please confirm that the class where the ApiClient is being used, is annotated with a @Component / @Service / any other Spring Boot annotation?

Loading...