Reputation: 3635
I have an EJB Project with a @Singleton
EJB defined as:
@LocalBean
@Singleton
@Startup
public class DataModelBean implements DataModelBeanLocal {
I then have another EJB Project with another EJB:
@LocalBean
@Singleton
@Startup
@EJB(beanInterface=DataModelBeanLocal.class,name="DataModelBeanLocal")
@DependsOn("DataModelBeanLocal")
public class OutboundRouting implements OutboundRoutingLocal {
However the @DependsOn
is not working, I have tried a number of different values for the @DependsOn
with no success. The server fails to start with:
Deployment Error for module: Atlas: Exception while deploying the app : java.lang.RuntimeException: Invalid DependsOn dependency 'DataModelBeanLocal' for EJB OutboundRouting%%%EOL%%%
I am not sure what I should be doing here, any suggestions?
Upvotes: 3
Views: 10080
Reputation: 61
Define a Singleton with a name
@Singleton(name = "DataModelBeanLocal ")
@Startup
public class DataModelBean implements DataModelBeanLocal {
in your secound singleton you can now define the dependencies
@Singleton
@Startup
@DependsOn("DataModelBeanLocal")
public class OutboundRouting implements OutboundRoutingLocal {
In our Projekt it works fine
Upvotes: 6
Reputation: 570645
Try this instead:
@Singleton
@DependsOn("DataModelBean")
public class OutboundRouting { ... }
Upvotes: 3