I am trying to get the hang of OSGi. Had it working before but suddenly the following stacktrace shows up. I have jira-core added as a dependency in my pom.xml and my constructor looks like this. What could be the problem causing this? Running atlas-clean didn't help.
Please let me know if you need any other details.
@Inject public ManualTriggerAction(@ComponentImport JiraAuthenticationContext jiraAuthenticationContext, @ComponentImport ApplicationProperties applicationProperties, @ComponentImport GroupManager groupManager, @ComponentImport I18nResolver i18nResolver) { this.jiraAuthenticationContext = jiraAuthenticationContext; this.applicationProperties = applicationProperties; this.groupManager = groupManager; this.i18nResolver = i18nResolver; }
NoSuchBeanDefinitionException: No unique bean of type [com.atlassian.jira.security.JiraAuthenticationContext] is defined: Unsatisfied dependency of type [interface com.atlassian.jira.security.JiraAuthenticationContext]: expected at least 1 matching bean
Community moderators have prevented the ability to post new answers.
I don't see anything obviously wrong from what you've done except that you said you added a jira-core
dependency, which you should not need. The jira-api
dependency should be good enough for this.
Are you using the Atlassian Spring Scanner to get your dependencies? If so then you might need to use @Scanned
to get its attention. There seems to be a pull request in flight that would remove that requirement.
@Chris Fuller the @Scanned annotation is in place, this is not solving my problem. The jira-api dependency is included as well. Please check my class definition,
... import com.atlassian.jira.security.JiraAuthenticationContext; import com.atlassian.jira.security.groups.GroupManager; import com.atlassian.jira.user.ApplicationUser; import com.atlassian.jira.web.action.JiraWebActionSupport; import com.atlassian.plugin.spring.scanner.annotation.component.Scanned; import com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport; import com.atlassian.sal.api.message.I18nResolver; import javax.inject.Inject; @Scanned public class ManualTriggerAction extends JiraWebActionSupport {...}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hrmm, very strange.
I would suggest one of the following strategies:
META-INF
, like MANIFEST.MF
and plugin-components/imports
to confirm whether or not it has the right information in there.Without access to the actual source or plugin jar, it's hard to guess what the reason for this would be.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Coming in late on this but you should not modify the spring scanner.xml for this service.
Use the static ComponentAccessor method:
JiraAuthenticationContext jac = ComponentAccessor.getJiraAuthenticationContext()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I fixed this by adding the following to src/main/resources/META-INF/spring/scanner.xml. Strange that without this file, the problem was only occurring in classes extending the JiraWebActionSupport (in my case). It would be nice if anyone could clarify this a bit more. Why is this file exactly needed and what is its function?
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:atlassian-scanner="http://www.atlassian.com/schema/atlassian-scanner" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.atlassian.com/schema/atlassian-scanner http://www.atlassian.com/schema/atlassian-scanner/atlassian-scanner.xsd"> <atlassian-scanner:scan-indexes/> </beans>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.