user899757
user899757

Reputation: 351

Specified reference was matched by more than one EJB - EJB 3.1

I am little confused as to why I am getting the following error when deploying my ear to a standalone jboss AS 6 localhost:

"java.lang.RuntimeException: Specified reference (ForecastUtilityLocal') was matched by more than one EJB" - see details below...

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 'ComponentDeploymentContext@23001552{org.jboss.metadata.ejb.jboss.JBossEnte riseBeanMetaData.ExpectedReturnEngineServiceImpl}'] was matched by more than one EJB: [org.jboss.metadata.ejb.jboss.JBossSessionBean31MetaData@63db1386{ForecastCacheManager}, org.jboss.metadata.ejb. oss.JBossSessionBean31MetaData@ee01f6d1{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]

This EJB is annotated with @Singleton so how can there be more than one instance?

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

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

@EJB
private CacheHelperLocal cacheHelper;
....
}

It is for example referenced in a different EJB such as:

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

Upvotes: 0

Views: 344

Answers (1)

alexsmail
alexsmail

Reputation: 5813

Check that you didn't put accidentally @Local(ForecastUtilityLocal.class) on another EJB.

Upvotes: 1

Related Questions