By default the esb runs in a global class loading scope and will defer to the version of hibernate included in the AS.
To run with a scoped class loader you need to add something like the following into your deployment.xml file in the META-INF directory.
<loader-repository> com.example.domain:artifact=UniqueNameForArtifact <loader-repository-config> java2ParentDelegaton=false </loader-repository-config> </loader-repository>
Having said all this I should point out that exposing hibernate classes to a client suggests that something is wrong on the 4.0.5 server. This is an internal implementation detail and should really have been hidden from the client.
Thanks for your very fast reply! Your suggestion works perfect.
Just to mention, I now get following WARN during the deployment:
WARN [DeploymentInfo] Only the root deployment can set the loader repository, ignoring config=LoaderRepositoryConfig(repositoryName: de.xyz:loader=MyTest.esb, repositoryClassName: org.jboss.mx.loading.HeirarchicalLoaderRepository3, configParserClassName: org.jboss.mx.loading.HeirarchicalLoaderRepository3ConfigParser, repositoryConfig: java2ParentDelegaton=false)
You can only specify the classloader on the outer artifact. If you include your esb artifact in another artifact then it will use whichever classloader is configured for the outer one.
The error message would therefore imply that MyTest.esb is included within something else. Is this the case?
No, the .esb archive is the outer artifact.
Your suggestion also worked for me. It seems to me that I get the WARN output, but it doesn't have any effects. JBossESB is using my scoped classloader.
It can't be using it. If you get the warning then the deployer has refused to create the classloader as the deployment info is already associated with a parent classloader.
If you go to the jmx-console do you see the bean de.xyz:loader=MyTest.esb? Can you send me your esb artifact?
I am going to double check this on monday. Going on a short trip this weekend... I will post my results on monday.
Sorry. This was my fault, I saw this only once and I can't reproduce it. Now the deployment doesn't bring up any WARNs.
So thanks for your answers!