I am developing a plugin for Bitbucket using atlassian-sdk. When I try to use GitCommandFactory, I run into the below error:
"AOP configuration seems to be invalid: tried calling method [public
abstract com.atlassian.bitbucket.scm.git.command.GitCommandFactory
com.atlassian.bitbucket.scm.git.GitScm.getCommandFactory()] on target
[com.atlassian.stash.internal.scm.git.DefaultGitScm@321c944]; nested
exception is java.lang.IllegalArgumentException: object is not an
instance of declaring class"
This is the line of code that throws the error:
GitCommandFactory gitCommandFactory = gitScm.getCommandFactory();
A glimpse of my class and the constructor:
@ComponentImport
private final PullRequestService pullRequestService;
@ComponentImport
private final GitScm gitScm;
@ComponentImport
private final GitScmConfig gitScmConfig;
@ComponentImport
private final EventPublisher eventPublisher;
@Autowired
private ApplicationContext applicationContext;
private Logger loggerLocal;
@Autowired
public SquashServlet(PullRequestService pullRequestService, GitScm gitScm, GitScmConfig gitScmConfig, EventPublisher eventPublisher) throws Exception{
super();
this.pullRequestService = pullRequestService;
this.gitScm = gitScm;
this.gitScmConfig = gitScmConfig;
this.eventPublisher = eventPublisher;
FileHandler handler = new FileHandler("BitBuckSquash.log",true);
this.loggerLocal = java.util.logging.Logger.getLogger("com.atlassian.kaushik.plugin.servlet");
loggerLocal.addHandler(handler);
}
How do I solve this issue? What am I doing wrong?