This content has been marked as final.
Show 3 replies
-
1. Re: Cannot use @Depends in EJB depending on another EAR depl
jaikiran Sep 5, 2009 1:06 PM (in response to dode)We have an @Service EJB3 deployed as EAR that does not only depend on a service, but also on classes provided by another EAR deployment.
There's no direct way of specifying a @Depends on a class. Are you adding a @Depends on the EAR "deployment"? Please post the @Depends you are using. I am not sure adding a @Depends on the EAR "deployment" is going to work because of the way deployers work in AS-5. -
2. Re: Cannot use @Depends in EJB depending on another EAR depl
jaikiran Sep 5, 2009 1:07 PM (in response to dode)"jaikiran" wrote:
because of the way deployers work in AS-5.
I forgot to ask this - Which version of JBoss AS are you using? :) -
3. Re: Cannot use @Depends in EJB depending on another EAR depl
dode Sep 7, 2009 5:51 AM (in response to dode)Thanks for your response.
I forgot to mention that we are using JBoss 4.2.
We were assuming that if we make a dependency of the service to the other EAR deployment, JBoss would even wait loading the classes of that service until the EAR it depends on is deployed.
But it seems the classes are loaded as soon as the deployer sees the deployment and dependencies are handled after that.
Regarding the XML deployment descriptor, we eventually saw that it actually is possible to replace @Depends of an @Service bean with a<depends> inside a <service>
in jboss.xml, but it behaves exactly like the @Depends so we concluded the above: Classloading cannot be controlled with dependencies on services.
It seems however that there are solutions for our problem is JBoss 5 with custom metadata files, but upgrading is not an option right now.
We have solved the issue now by moving the deployment the service depends on to a separate EAR which is, due to its name, "classloaded" and deployed before the service.
We actually use a @Depends on the EAR deployment, which works fine:@Depends(value="jboss.j2ee:service=EARDeployment,url='beans.ear'")
I'm a bit surprised that this works because I read somewhere that EAR deployments cannot be used as dependencies since they are not services - but the JMX name clearly suggests that and it works.
Cheers,
Torsten