1

jira 활성 객체 구현에 초보자입니다. 내가 jTrick http://www.j-tricks.com/tutorials/active-objects-injectionJIRA 활성 객체 예외

사용하여 활성 객체를 구현하는 오류를 발견 "새로운 참조 LazyLoadedServletReference {기술자를 만들 수 없습니다 = com.atlassian.jira.demo.aoDemo : 주소 목록 (A 추가하는 서블릿과 목록 주소) [플러그인] com.atlassian.util.concurrent.LazyReference $ InitializationException : java.lang.NullPointerException : 플러그인 컨테이너 접근자가 null입니다. .jira.demo.aoDemo. 모듈 이름 : com.atlassian.jira.demo.Servlet.AddressServlet. " 내가 서블릿 생성자

종속성 코드

공공 AddressServlet에 종속성을 주입 IAOServiceImpl

public class IAOServiceImpl implements IAOService { 
private final ActiveObjects ao; 

public IAOServiceImpl(ActiveObjects ao) { 
    System.out.println("Initializing constructor impl"); 
    System.out.println("IAOServiceImpl constructor found active object ::"+ao); 
    this.ao=ao;   
} 
public ActiveObjects getActiveObjects() { 
    return this.ao; 
}} 

에 대한 IAOService.java

public interface IAOService { 
public ActiveObjects getActiveObjects();} 

코드에 대한

코드 (IAOServ 얼음 aoService) {
if (aoService! = null) {
this.aoService = aoService; else this.aoService = null; }

플러그인에서 atlassian-plugin-scanner 기능을 비활성화합니다.

이 문제를 해결하려면 저를 도우십시오.

또한 플러그인 설명자 파일에서 ao 모듈에 대해서도 언급합니다.

플러그인 디스크립터 번호 :

<ao key="ao-module"> 
<description>Configuration of active object service</description> 
<entity>sample.AddressEntity</entity> 

<component-import key="ao" name="Active Objects service" interface="com.atlassian.activeobjects.external.ActiveObjects"> 
<description>Component to access Active Objects functionality from the plugin</description></component-import> 

치어 코드

<pluginArtifact> 
    <groupId>com.atlassian.activeobjects</groupId> 
    <artifactId>activeobjects-plugin</artifactId> 
    <version>${ao.version}</version> 
</pluginArtifact> 
<pluginArtifact> 
    <groupId>com.atlassian.activeobjects</groupId> 
    <artifactId>activeobjects-jira-spi</artifactId> 
    <version>${ao.version}</version> 
</pluginArtifact> 

Ao.version 0.18

예외 스택

인 515,

[INFO] talledLocalContainer] 2016년 9월 14일 11 : 26 : 37,451 HTTP-NIO-2990-간부 -2- DEBUG 관리 686x211x1 1x1imyf 172.17.20.51 /rest/plugins/1.0/com.atlassian. jira.demo.aoDemo 키 [caactiveobjects.osgi.OsgiServiceUtilsImpl] 서비스 인터페이스와 net.java.ao.schema.TableNameConverter [email protected] 및 속성 {com.atlassian 등록. plugin.key = com.atlassian.jira.demo.aoDemo} [INFO] [talledLocalContainer] 2016-09-14 11 : 26 : 37,453 http-nio-2990-exec-2 DEBUG 관리자 686x211x1 1x1imyf 172.17.20.51 /나머지/플러그인/1.0/com.atlassian.jira.demo .aoDemo-key [c.a.activeobjects.osgi.OsgiServiceUtilsImpl] 등록 서비스 com.atlassian.activeobjects.config.internal.DefaultActiveObjectsConfiguration @ 인터페이스 com.atlassian.activeobjects.config.ActiveObjectsConfiguration 및 특성 com.atlassian.plugin.key = {} com.atlassian.jira.demo.aoDemo [INFO] talledLocalContainer] 2016년 9월 14일와 7e886a2b 11 : 26 : 37,457 http-nio-2990-exec-2 디버그 관리자 686x211x1 1x1imyf 172.17.20.51 /rest/plugins/1.0/com.atlassian.jira.demo.aoDemo-key [caactiveobjects.osgi.ActiveObjectsServiceFactory] 26 : 37,463 HTTP-NIO-2990-간부 -2- DEBUG 관리 686x211x1 1x1imyf [INFO] [talledLocalContainer] 2016년 9월 14일 11 com.atlassian.jira.demo.aoDemo]의 부착 구성 모듈 기억 onPluginModuleEnabledEvent 172.17.20.51 /rest/plugins/1.0/com.atlassian.jira.demo.aoDemo-key [caactiveobjects.osgi.ActiveObjectsServiceFactory] onPluginEnabledEvent는 [com.atlassian.jira.demo.aoDemo] [INFO] talledLocalContainer에 부착 바운드 ] 2016-09-14 11 : 26 : 37,463 http-nio-2990-exec-2 디버그 관리자 686x211x1 1x1imyf 172.17.20.51 /rest/plugins/1.0/com.atlassian.jira.demo.aoDemo-key [ caactobjects.osgi.TenantAwareActiveObjects] init 번들 [정보] [talledLocalContainer] 2016-09-14 11 : 26 : 37,464 http-nio-2990-exec-2 디버그 관리자 686x211x1 1x1imyf 172.17.20.51 /rest/plugins/1.0/com.atlassian.jira.demo.aoDemo-key[caactiveobjects.osgi.TenantAwareActiveObjects] 번들 [com.atlassian.jira.demo.aoDemo] JiraTenantImpl {ID = '시스템'} [INFO] talledLocalContainer] 2016년 9월 14일 11 AO 새로운 약속을로드 : 26 : 37,464 http-nio-2990-exec-2 디버그 관리 686x211x1 1x1imyf 172.17.20.51 /rest/plugins/1.0/com.atlassian.jira.demo.aoDemo-key [caactobjects.osgi.TenantAwareActiveObjects] setAoConfiguration [com .atlassian.jira.demo.aoDemo] [INFO] [talledLocalContainer] 2016-09-14 11 : 26 : 37,464 http-nio-2990-exec-2 디버그 관리 686x211x1 1x1imyf 172.17.20.51 /rest/plugins/1.0 /com.atlassian.jira.demo.aoDemo-key [caactobjects.osgi.TenantAwareActiveObjects] 번들 [com.atla [정보] [talledLocalContainer] 2016-09-14 11 : 26 : 37,474 활성 객체 - 초기화 - JiraTenantImpl {id = '시스템'} - 0 디버그 관리자
[ca.aira.demo.aoDemo] ActiveObjects를 생성하는 [] [talledLocalContainer] 2016-09-14 11 : 26 : 37,488 active-objects-init-JiraTenantImpl {id = 'activeobjects.osgi.TenantAwareActiveObjects] 번들 [com.atlassian.jira.demo.aoDemo] 시스템 '} - 0 DEBUG 관리
[caactiveobjects.osgi.TenantAwareActiveObjects] 번들 [com.atlassian.jira.demo.aoDemo] 생성 ActiveObjects [INFO] [talledLocalContainer] 2016년 9월 14일 11 : 26 : 47,872 HTTP -nio-2990-exec-9 오류 관리자 686x226x1 1x1imyf 172.1 7.20.51/플러그인은 [caplugin.servlet.DefaultServletModuleManager] 새로운 참조 LazyLoadedServletReference {디스크립터를 생성 할 수 없습니다 = com.atlassian.jira.demo.aoDemo은/서블릿/addressservlet : 어드레스 목록 (A 서블릿이 추가 및 목록 주소), s[email protected]3a0a701} 이 [정보] [talledLocalContainer] com.atlassian.util.concurrent.LazyReference $ InitializationException가 : java.lang.NullPointerException이 : 플러그인 컨테이너 접근이 없는. 플러그인 : com.atlassian.jira.demo.aoDemo. 모듈 이름 : com.atlassian.jira.demo.Servlet.AddressServlet.[INFO] [talledLocalContainer] com.atlassian.util.concurrent.LazyReference.get에서 com.atlassian.util.concurrent.LazyReference.getInterruptibly (LazyReference.java:149) [INFO] talledLocalContainer (LazyReference에서. 자바 : 112) [INFO] talledLocalContainer] com.atlassian.plugin.servlet.DefaultServletModuleManager.getInstance (DefaultServletModuleManager.java:374) [INFO] talledLocalContainer] 에서 com.atlassian.plugin.servlet.DefaultServletModuleManager에서. getServlet (DefaultServletModuleManager.java:351) [정보] [talledLocalContainer] 에 com.atlassian.plugin.servlet.DefaultServletModuleManager.getServlet (DefaultServletModuleManager.java:171) [정보] [talledLocalContainer] com.atlassian.plugin.servlet.ServletModuleContainerServlet.service (ServletModuleContainerServlet.java:36) [INFO] talledLocalContainer] javax.servlet.http.HttpServlet.service (HttpServlet.java:725)에서 [INFO에서 ] [talledLocalContainer] 70 ... 여과 [INFO] talledLocalContainer] com.atlassian.labs.httpservice.resource.ResourceFilter.doFilter (ResourceFilter.java:59)에서 [INFO] talledLocalContainer] ... (38) 여과 [INFO] [talledLocalContainer] com.atlassian.jira.security.JiraSecurityFilter.doFilter (JiraSecurityFilter.java:70) [INFO] talledLocalContainer] 91 ... 여과 [INFO] [talledLocalContainer]를,617에서의 451,515,java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1142) [INFO] talledLocalContainer] java.util.concurrent.ThreadPoolExecutor $ Worker.run (ThreadPoolExecutor.java:617) [INFO]에서 talledLocalContainer ]에서 org.apache.tomcat.util.threads.TaskThread $ WrappingRunnable.run (TaskThread.java:61) [정보] [talledLocalContainer]에서 java.lang.Thread.run (Thread.java:745) [정보 ] [talledLocalContainer] 발생 원인 : java.lang.NullPointerException : 플러그인 컨테이너 접근 자 이 null입니다. 플러그인 : com.atlassian.jira.demo.aoDemo. 모듈 이름 : com.atlassian.jira.demo.Servlet.AddressServlet. [INFO] [talledLocalContainer] com.google.common.base.Preconditions.checkNotNull (Preconditions.java:250) [INFO] talledLocalContainer] com.atlassian.plugin.module.ClassPrefixModuleFactory.createModule에서 (ClassPrefixModuleFactory에서. 자바 32) [INFO] talledLocalContainer] com.atlassian.plugin.module.PrefixDelegatingModuleFactory.createModule (PrefixDelegatingModuleFactory.java:88) [INFO] talledLocalContainer]에서 com.atlassian.plugin.servlet.descriptors에서. ServletModuleDescriptor.getModule (ServletModuleDescriptor.java:43) [정보] [talledLocalContainer] at com.atlassian.plugin.servlet.DelegatingPluginServlet. (DelegatingPluginServlet.java:30) [INF O] talledLocalContainer] com.atlassian.plugin.servlet.DefaultServletModuleManager $ LazyLoadedServletReference.create (DefaultServletModuleManager.java:456) [INFO] talledLocalContainer] 위치에 com.atlassian.util.concurrent.LazyReference $ Sync.run (AT LazyReference.java:325) [INFO] talledLocalContainer] com.atlassian.util.concurrent.LazyReference.getInterruptibly (LazyReference.java:143) [INFO]에서 [talledLocalContainer] ... (211) 이상의

+0

코드의 전체 예제를 게시 할 수 있습니까? –

+0

예. 이것이 내 코드입니다.'final final ActiveObjects ao; \t \t public ActiveServiceImpl() { \t \t this.ao = ComponentAccessor.getOSGiComponentInstanceOfType (ActiveObjects.class); \t \t System.out.println ("---------------------------------------- --------------------------------- "); \t \t System.out.println ("ActiveObject 인스턴스는"+ this.ao); \t} \t \t 공공 무효는 addEntity (문자열 이름, 문자열 주소, 문자열 국가) { \t \t \t} \t' –

+0

1 코드를 추가하는 대신에 원래의 질문을 수정 주실 래요 주석에 삽입 (줄 끝은 제거됩니다)? 2 - 게시 한 코드가 실제로 작동하지 않는다고 말한 "activeobject.create()"에 대한 호출을 실제로 표시하지 않습니다. 3 전체 예외 게시 (전체 예외 유형 및 스택 추적의 후속 행 포함) 도움이 될 것입니다. –

답변

0

ComponentAccessor.getOSGIComponentInstanceOfType을 호출하는 대신 ActiveObject를 서블릿의 생성자에 삽입해야합니다.어쨌든 이것은 권장 디자인 패턴이며 at least one source은 주사를 사용하지 않고 AO에 액세스하는 것이 위에서 설명한 것과 유사한 방식으로 중단됨을 제안합니다.

이 현상은 GetOSGIComponentInstanceOfType이 플러그인에 대해 모르는 기본 JIRA (Pico) 컨테이너에서 단일 AO 컨텍스트를 반환하고있는 반면, 플러그인 자체 엔티티에 대해 구성된 AO를 원하기 때문에 발생한다고 생각합니다.

서블릿은 이미 자동 배선되어 있으므로 위의 링크와 같이 별도의 <component>을 생성 할 필요가 없습니다. 서블릿에 생성자 인수로 ActiveObjects를 추가하고 나중에 사용할 수 있도록 클래스에 저장하면됩니다. 용도.

+1

안녕 스콧! 솔루션이 작동하지 않습니다. 액티브 오브젝트를 서블릿 생성자 서블릿을 찾을 수 없음 (404) 예외로 던졌습니다. jira에서 AO를 사용하기위한 템플릿을 만들 수 있습니까? –

+0

로그를 확인하십시오. 404가 표시되는 것은 플러그인이 문서화되어야하는 이유 때문에 초기화되지 않았기 때문일 수 있습니다. 일반적으로 MCVE를 게시하는 것은 질문자의 책임입니다 (http://stackoverflow.com/help/mcve). –

+0

안녕하세요 스콧 나는 활성 개체를 구현하는 논리를 변경하지만 여전히 성공하지 못합니다. 이 문제를 해결하십시오. –