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.
because of the way deployers work in AS-5.
I forgot to ask this - Which version of JBoss AS are you using? :)
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:
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.