Java EE DependsOn Local EJB

I have an EJB project with @SingletonEJB that is defined as:

@LocalBean
@Singleton 
@Startup
public class DataModelBean implements DataModelBeanLocal {

Then I have another EJB project with another EJB:

@LocalBean
@Singleton
@Startup 
@EJB(beanInterface=DataModelBeanLocal.class,name="DataModelBeanLocal")
@DependsOn("DataModelBeanLocal")
public class OutboundRouting implements OutboundRoutingLocal {

However, it @DependsOndoes not work, I have tried several different values ​​for @DependsOnwithout success. Server does not start with:

Deployment error for module: Atlas: application deployment exception: java.lang.RuntimeException: invalid DependsOn dependency 'DataModelBeanLocal' for EJB OutboundRouting %%% EOL %%%

I'm not sure what I should do here, any suggestions?

+3
source share
2 answers

Try this instead:

@Singleton
@DependsOn("DataModelBean")
public class OutboundRouting { ... }
+2
source

Singleton

@Singleton(name = "DataModelBeanLocal ")
@Startup
public class DataModelBean implements DataModelBeanLocal {

secound

@Singleton
@Startup 
@DependsOn("DataModelBeanLocal")
public class OutboundRouting implements OutboundRoutingLocal {

Projekt

+3

Source: https://habr.com/ru/post/1730173/


All Articles