2012-01-10 76 views
0

我爲AS 6本地主機部署我的耳朵一個獨立的JBoss時,爲什麼我收到以下錯誤有點糊塗:指定的參考是由多於一個EJB匹配 - EJB 3.1

「了java.lang.RuntimeException :指定的參考(ForecastUtilityLocal')是由多於一個EJB」匹配 - 詳見下文...

DEPLOYMENTS IN ERROR: Deployment "vfs:///C:/jboss/jboss-6.0.0.Final/server/default/deploy/ear-1.0.0.ear" is in error due to the following reason(s): java.lang.RuntimeException: Specified reference [EJB Reference: beanI erface 'com.ls.forecast.ejb.util.ForecastUtilityLocal', beanName 'null', mappedName 'null', lookupName 'null', owning unit '[email protected]{org.jboss.metadata.ejb.jboss.JBossEnte riseBeanMetaData.ExpectedReturnEngineServiceImpl}'] was matched by more than one EJB: [[email protected]{ForecastCacheManager}, org.jboss.metadata.ejb. [email protected]{ForecastUtility}]. Specify beanName explciitly or ensure beanInterface is unique.

at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:1228) [:2.2.0.GA] 
    at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:905) [:2.2.0.GA] 
    at org.jboss.system.server.profileservice.deployers.MainDeployerPlugin.checkComplete(MainDeployerPlugin.java:87) [:6.0.0.Final] 
    at org.jboss.profileservice.deployment.ProfileDeployerPluginRegistry.checkAllComplete(ProfileDeployerPluginRegistry.java:107) [:0.2.2] 
    at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:135) [:6.0.0.Final] 
    at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:56) [:6.0.0.Final] 
    at org.jboss.bootstrap.impl.base.server.AbstractServer.startBootstraps(AbstractServer.java:827) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5] 
    at org.jboss.bootstrap.impl.base.server.AbstractServer$StartServerTask.run(AbstractServer.java:417) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5] 
    at java.lang.Thread.run(Thread.java:619) [:1.6.0_20] 

這個EJB標註有@Singleton所以怎麼可能有不止一個實例嗎?

@Singleton 
@Local(ForecastUtilityLocal.class) 
public class ForecastUtility implements ForecastUtilityLocal { 

private static final Logger logger = LoggerFactory 
     .getLogger(ForecastUtility.class); 

@EJB 
private CacheHelperLocal cacheHelper; 
.... 
} 

這是例如在不同的EJB引用,如:

@Singleton 
@Startup 
@Local(CacheHelperLocal.class) 
public class CacheHelper implements CacheHelperLocal { 

@EJB 
private ForecastModelUtilityLocal forecastModelUtility; 

@EJB 
private ConnectionManagerLocal connectionManager; 

@EJB 
private ForecastCacheManagerLocal forecastCacheManager; 

@EJB 
private ForecastUtilityLocal forecastUtility; 
... 
} 

回答

1

檢查你沒有把意外@Local(ForecastUtilityLocal.class)另一個EJB。