How to force starting up a JBoss Service POJO in JBoss AS 7 ?
arduamonkey Jan 4, 2012 3:51 AMHi,
my newest task is to migrate our application (.ear) from JBoss 4.2.2.GA to JBoss 7.
I have already fixed several issues, but now I'm at some point not knowing how to proceed.
I have problems with starting up my JBoss Service (class annotated with @Service) on time.
Actually, our deplyomwent package is an .ear file consisiting of a .jar and a .sar.
In the .sar there are several MBeans (configured in its jboss-service.xml, working OK), but there are also some MBeans (POJOs annotated with @Service and @Managed) in the .jar file. Some of them need to be started at na early stage in order to be injected to some other beans (using @EJB annotation).
Code example:
JBossService MBean class:
@Service(objectName = "osc-ejb:service=spring-context-provider")
@Management(SpringContextProviderServiceBean.class)
@Local(SpringContextProvider.class)
public class SpringContextProviderServiceBeanImpl implements SpringContextProviderServiceBean, SpringContextProvider {
JBoss Session bean (where it's injected):
@Stateless
@Remote(ListOfferQueuedExecutorService.class)
@RemoteBinding(jndiBinding = "osc/ListOfferQueuedExecutorService/remote")
public class ListOfferQueuedExecutorServiceBean implements
ListOfferQueuedExecutorService {
private ListOfferQueuedExecutorService delegate;
@EJB
private SpringContextProvider springContextProvider;
Unfortunately it seems like the Service MBean is not started up on time (before injection into the other class).
17:27:59,593 ERROR [org.jboss.msc.service.fail] MSC00001: Failed to start service jboss.deployment.subunit."osc-ear-4.7.1-SNAPSHOT.ear"."osc-ejb-4.7.1-SNAPSHOT.jar".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.subunit."osc-ear-4.7.1-SNAPSHOT.ear"."osc-ejb-4.7.1-SNAPSHOT.jar".INSTALL: Failed to process phase INSTALL of subdeployment "osc-ejb-4.7.1-SNAPSHOT.jar" of deployment "osc-ear-4.7.1-SNAPSHOT.ear"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:121) [jboss-as-server-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_23]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_23]
at java.lang.Thread.run(Thread.java:662) [:1.6.0_23]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011058: Failed to install component ListOfferQueuedExecutorServiceBean
at org.jboss.as.ee.component.deployers.ComponentInstallProcessor.deploy(ComponentInstallProcessor.java:95)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115) [jboss-as-server-7.1.0.CR1b.jar:7.1.0.CR1b]
... 5 more
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS014544: No EJB found with interface of type 'de.xyz.osc.spring.provider.SpringContextProvider' for binding de.hrs.osc.ejb.avail.multi.ListOfferQueuedExecutorServiceBean/springContextProvider
at org.jboss.as.ejb3.deployment.processors.EjbInjectionSource.getResourceValue(EjbInjectionSource.java:85)
at org.jboss.as.ee.component.deployers.ComponentInstallProcessor.processBindings(ComponentInstallProcessor.java:240)
at org.jboss.as.ee.component.deployers.ComponentInstallProcessor.access$000(ComponentInstallProcessor.java:74)
at org.jboss.as.ee.component.deployers.ComponentInstallProcessor$1.handle(ComponentInstallProcessor.java:194)
at org.jboss.as.ee.component.ClassDescriptionTraversal.run(ClassDescriptionTraversal.java:54)
at org.jboss.as.ee.component.deployers.ComponentInstallProcessor.deployComponent(ComponentInstallProcessor.java:190)
at org.jboss.as.ee.component.deployers.ComponentInstallProcessor.deploy(ComponentInstallProcessor.java:93)
... 6 more
Any idea how I can force it to be started "on time"?
PS. Deploying it to jboss 4.2.2.GA works perfectly