2017-03-01 1114 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> 
相關問題