2017-03-01 70 views
1

我正在开发一个使用atlassian-sdk的Bitbucket插件。当我尝试使用GitCommandFactory,我碰到下面的错误:如何解决“AOP配置似乎无效”的错误?

"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 
[[email protected]]; nested 
exception is java.lang.IllegalArgumentException: object is not an 
instance of declaring class" 

这是代码引发错误行:

GitCommandFactory gitCommandFactory = gitScm.getCommandFactory(); 

我班的一瞥和构造:

@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); 
} 

我该如何解决这个问题?我究竟做错了什么?

回答

1

修复了这个问题。这是由于不兼容的依赖关系。

我不得不在pom.xml中添加与我的bitbucket版本相同的版本号,并且它工作正常。

<dependency> 
     <groupId>com.atlassian.bitbucket.server</groupId> 
     <artifactId>bitbucket-git-api</artifactId> 
     <scope>provided</scope> 
     <version>${bitbucket.version}</version> 
    </dependency> 
相关问题