ClassNotFoundException for jira-api classes in wired tests

Whenever I reference a class from the com.atlassian.jira.user package in my wire tests, I get ClassNotFoundException. For example, given the following code:


import com.atlassian.jira.user.util.UserManager;
import com.atlassian.plugins.osgi.test.AtlassianPluginsTestRunner;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;

import java.util.Arrays;

public class MyITest {
    private final UserManager userManager;

    public MyITest(UserManager userManager) {
        this.userManager = userManager;

    public void shouldWork() {
        System.out.println("USER IS: " + userManager.getUserByKey("admin"));
        System.out.println("CLASS IS: " + userManager.getUserByKey("admin").getClass());
        System.out.println("INTERFACES: " + Arrays.toString(userManager.getUserByKey("admin").getClass().getInterfaces()));
        try {
            System.out.println("FORNAME " + Class.forName("com.atlassian.jira.user.ApplicationUser"));
        } catch (ClassNotFoundException e) {

The output looks like:

[INFO] [talledLocalContainer] USER IS: admin(admin)
[INFO] [talledLocalContainer] CLASS IS: class com.atlassian.jira.user.DelegatingApplicationUser
[INFO] [talledLocalContainer] INTERFACES: [interface com.atlassian.jira.user.ApplicationUser]
[INFO] [talledLocalContainer] java.lang.ClassNotFoundException: com.atlassian.jira.user.ApplicationUser not found by [285]

If the code has a “hard” dependency on ApplicationUser, the test blows up when loading the test class with NoClassDefFoundError.

What am I doing wrong? How can I solve it?

I found the solution. It seems to go away when I add Import-Package under bundle-instructions in atlassian-plugin.xml, like this:

        <vendor name="${}" url="${project.organization.url}"/>

I ran into this too in the context of Confluence. The fix is apparently the same as documented here:

I’m however not sure if this is the right solution to the issue. Wouldn’t it be better to use <component-import […] /> or Spring decorators to have the dependency being resolved? If not, is there any suggested read to better get accustomed to why this applies to the user package here while for other cases you’d use spring decorators/component-import?