2015-01-07 2 views
1

다음 Java 파일이있는 EJB 프로젝트를 만들었습니다. JBoss 5.1.0에는 배포하지 않으며 배포 오류는 아래의 Java 코드 뒤에 추가됩니다. 그러나 동일한 jar 파일이 JBoss AS 7.1에 배포됩니다. jar 파일이 JBoss 5.1에 배포되지 않는 이유는 무엇입니까?ejb 아카이브 jar의 Cyclically Dependent Stateless Bean이 JBoss 5.1.0에 배포되지 않음

빈 구현 BeanA는 BeanB의 로컬 인터페이스와 BeanB의 Bean 구현에 BeanA의 로컬 인터페이스가 있으므로 사이클입니다.

BeanALocalInterface.java

package com.xyz;  
import javax.ejb.Local;  
    @Local  
public interface BeanALocalInterface { 
    public void executeLocal(); 
} 

BeanA.java

package com.xyz; 
import javax.ejb.EJB; 
import javax.ejb.Stateless; 
@Stateless 
public class BeanA implements BeanALocalInterface { 
    @EJB private BeanBLocalInterface beanBLocalInterface; 
    public BeanA() {} 
    public void executeLocal() {System.out.println("executing in BeanA"); beanBLocalInterface.executeLocal();} 
    public void executeRemote() {System.out.println("executing in BeanA"); } 
} 

BeanBLocalInterface.java

package com.xyz; 
import javax.ejb.Local; 
@Local 
public interface BeanBLocalInterface { 
    public void executeLocal(); 
} 
,536,913 63,210

BeanB.java 주입 콩에 JBOSS 5.1.0에

11:59:31,557 INFO [JBossASKernel] Created KernelDeployment for: CyclicalBeans.jar 
11:59:31,557 INFO [JBossASKernel] installing bean: jboss.j2ee:jar=CyclicalBeans.jar,name=BeanA,service=EJB3 
11:59:31,557 INFO [JBossASKernel] with dependencies: 
11:59:31,557 INFO [JBossASKernel] and demands: 
11:59:31,573 INFO [JBossASKernel]  jndi:BeanB/local-com.xyz.BeanBLocalInterface 
11:59:31,573 INFO [JBossASKernel]  jboss.ejb:service=EJBTimerService 
11:59:31,573 INFO [JBossASKernel] and supplies: 
11:59:31,573 INFO [JBossASKernel]  jndi:BeanA/local-com.xyz.BeanALocalInterface 
11:59:31,588 INFO [JBossASKernel]  jndi:BeanA/local 
11:59:31,588 INFO [JBossASKernel]  Class:com.xyz.BeanARemoteInterface 
11:59:31,588 INFO [JBossASKernel]  jndi:BeanA/remote-com.xyz.BeanARemoteInterface 
11:59:31,588 INFO [JBossASKernel]  Class:com.xyz.BeanALocalInterface 
11:59:31,604 INFO [JBossASKernel]  jndi:BeanA/remote 
11:59:31,604 INFO [JBossASKernel] Added bean(jboss.j2ee:jar=CyclicalBeans.jar,name=BeanA,service=EJB3) to KernelDeployment of: CyclicalBeans.jar 
11:59:31,604 INFO [JBossASKernel] installing bean: jboss.j2ee:jar=CyclicalBeans.jar,name=BeanB,service=EJB3 
11:59:31,619 INFO [JBossASKernel] with dependencies: 
11:59:31,619 INFO [JBossASKernel] and demands: 
11:59:31,619 INFO [JBossASKernel]  jboss.ejb:service=EJBTimerService 
11:59:31,635 INFO [JBossASKernel]  jndi:BeanA/local-com.xyz.BeanALocalInterface 
11:59:31,635 INFO [JBossASKernel] and supplies: 
11:59:31,635 INFO [JBossASKernel]  Class:com.xyz.BeanBLocalInterface 
11:59:31,635 INFO [JBossASKernel]  jndi:BeanB/local-com.xyz.BeanBLocalInterface 
11:59:31,651 INFO [JBossASKernel]  jndi:BeanB/local 
11:59:31,651 INFO [JBossASKernel]  jndi:BeanB/remote 
11:59:31,666 INFO [JBossASKernel] Added bean(jboss.j2ee:jar=CyclicalBeans.jar,name=BeanB,service=EJB3) to KernelDeployment of: CyclicalBeans.jar 
11:59:31,666 INFO [EJB3EndpointDeployer] Deploy [email protected]{name=jboss.j2ee:jar=CyclicalBeans.jar,name=BeanA,service=EJB3_endpoint bean=org.jboss.ejb3.endpoint.deployers.impl.EndpointImpl properties=[container] constructor=null autowireCandidate=true} 
11:59:31,666 INFO [EJB3EndpointDeployer] Deploy [email protected]{name=jboss.j2ee:jar=CyclicalBeans.jar,name=BeanB,service=EJB3_endpoint bean=org.jboss.ejb3.endpoint.deployers.impl.EndpointImpl properties=[container] constructor=null autowireCandidate=true} 
11:59:31,744 WARN [HDScanner] Failed to process changes 
org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS): 

DEPLOYMENTS MISSING DEPENDENCIES: 
    Deployment "jboss.j2ee:jar=CyclicalBeans.jar,name=BeanA,service=EJB3" is missing the following dependencies: 
    Dependency "<UNKNOWN jboss.j2ee:jar=CyclicalBeans.jar,name=BeanA,service=EJB3>" (should be in state "Described", but is actually in state "** UNRESOLVED Demands 'jndi:BeanB/local-com.xyz.BeanBLocalInterface' **") 
    Deployment "jboss.j2ee:jar=CyclicalBeans.jar,name=BeanA,service=EJB3_endpoint" is missing the following dependencies: 
    Dependency "jboss.j2ee:jar=CyclicalBeans.jar,name=BeanA,service=EJB3" (should be in state "Configured", but is actually in state "PreInstall") 
    Deployment "jboss.j2ee:jar=CyclicalBeans.jar,name=BeanB,service=EJB3" is missing the following dependencies: 
    Dependency "<UNKNOWN jboss.j2ee:jar=CyclicalBeans.jar,name=BeanB,service=EJB3>" (should be in state "Described", but is actually in state "** UNRESOLVED Demands 'jndi:BeanA/local-com.xyz.BeanALocalInterface' **") 
    Deployment "jboss.j2ee:jar=CyclicalBeans.jar,name=BeanB,service=EJB3_endpoint" is missing the following dependencies: 
    Dependency "jboss.j2ee:jar=CyclicalBeans.jar,name=BeanB,service=EJB3" (should be in state "Configured", but is actually in state "PreInstall") 

DEPLOYMENTS IN ERROR: 
    Deployment "<UNKNOWN jboss.j2ee:jar=CyclicalBeans.jar,name=BeanA,service=EJB3>" is in error due to the following reason(s): ** UNRESOLVED Demands 'jndi:BeanB/local-com.xyz.BeanBLocalInterface' ** 
    Deployment "<UNKNOWN jboss.j2ee:jar=CyclicalBeans.jar,name=BeanB,service=EJB3>" is in error due to the following reason(s): ** UNRESOLVED Demands 'jndi:BeanA/local-com.xyz.BeanALocalInterface' ** 

     at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:993) 
     at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:939) 
     at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:873) 
     at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.checkComplete(MainDeployerAdapter.java:128) 
     at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:369) 
     at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:255) 
     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439) 
     at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317) 
     at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150) 
     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98) 
     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180) 
     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204) 
     at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) 
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) 
     at java.lang.Thread.run(Thread.java:662) 

답변

1

@IgnoreDependency 주석을 CyclicalBeans.jar을 배포하는 동안

package com.xyz; 
import javax.ejb.EJB; 
import javax.ejb.Stateless; 
@Stateless 
public class BeanB implements BeanBLocalInterface { 
    @EJB private BeanALocalInterface localInterface; 
    public BeanB() { } 
    public void executeLocal() { localInterface.executeLocal(); } 
    public void executeRemote() { System.out.println("executing in BeanB");} 
} 

오류 로그는이 문제를 해결합니다. 다음과 같이 BeanA.java 및 BeanB.java을 수정하십시오

BeanA.java

package com.xyz; 
import javax.ejb.EJB; 
import javax.ejb.Stateless; 
import org.jboss.ejb3.annotation.IgnoreDependency; 
@Stateless 
public class BeanA implements BeanALocalInterface { 
    @IgnoreDependency 
    @EJB(name="ejb/BeanBLocalInterface") private BeanBLocalInterface beanBLocalInterface; 
    public BeanA() {} 
    public void executeLocal() {System.out.println("executing in BeanA"); beanBLocalInterface.executeLocal();} 
    public void executeRemote() {System.out.println("executing in BeanA"); } 
} 

BeanB.java

package com.xyz; 
import javax.ejb.EJB; 
import javax.ejb.Stateless; 
import org.jboss.ejb3.annotation.IgnoreDependency; 

@Stateless 
public class BeanB implements BeanBLocalInterface { 
    @IgnoreDependency 
    @EJB(name="ejb/BeanALocalInterface ") private BeanALocalInterface localInterface; 
    public BeanB() { } 
    public void executeLocal() { localInterface.executeLocal(); } 
    public void executeRemote() { System.out.println("executing in BeanB");} 
} 

을 나는 다음과 같은 질문에 대답 링크에서 내 솔루션을 산출했다. answer link

+0

이 문제와 유사한 버그 : [EJBTHREE-1603] (https://issues.jboss.org/browse/EJBTHREE-1603) -> Cyclic @EJB 종속성이 더 이상 작동하지 않습니다. –

관련 문제