ComponentAccessor throws ClassNotFound exception

Hi!
I’m having an issue connected to ComponentAccessor. Anytime I try to get a component, I get a runtime ClassNotFound exception. Below are my maven dependencies:

pom.xml dependencies org.springframework.boot spring-boot-starter-web
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-thymeleaf</artifactId>
    </dependency>

    <dependency>
        <groupId>com.atlassian.connect</groupId>
        <artifactId>atlassian-connect-spring-boot-starter</artifactId>
        <version>1.4.3</version>
    </dependency>

    <dependency>
        <groupId>com.atlassian.connect</groupId>
        <artifactId>atlassian-connect-spring-boot-jpa-starter</artifactId>
        <version>1.4.3</version>
    </dependency>

    <dependency>
        <groupId>com.atlassian.jira</groupId>
        <artifactId>jira-rest-java-client-core</artifactId>
        <version>5.0.4</version>
    </dependency>

    <dependency>
        <groupId>io.atlassian.fugue</groupId>
        <artifactId>fugue</artifactId>
        <version>4.7.1</version>
    </dependency>

    <dependency>
        <groupId>com.atlassian.jira</groupId>
        <artifactId>jira-core</artifactId>
        <version>7.6.1</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>com.atlassian.jira</groupId>
        <artifactId>jira-api</artifactId>
        <version>7.6.1</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>2.8.5</version>
    </dependency>

    <dependency>
        <groupId>nz.net.ultraq.thymeleaf</groupId>
        <artifactId>thymeleaf-layout-dialect</artifactId>
        <version>2.1.2</version>
    </dependency>
</dependencies>

And here is a snippet of my code:

code
SearchService searchService = ComponentAccessor.getComponentOfType(SearchService.class);
ApplicationUser currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser();

I’ve also tried to to use getComponent and getOSGiComponentInstanceOfType, but got the same result.
I should also mention that Intellij auto-imports and autocompletes stuff just fine, so ComponentAccessor and it’s static methods are visible.
I’ll be really grateful for any help.
Cheers,
Kamil

Hi,

Go to project settings → Maven
Make sure your “maven home directory” set to the maven of Atlassian SDK

Snipped from my intellij:

1 Like