ESB4.x/AS 5 classloading
beve Apr 16, 2009 10:05 AMIn the ESB a .esb archive may contain action classes that the ESB needs to have access to and load. The same goes for resources in these archives.
There is also the case were there are services that provide services to other esb services. For example, there is a smooks.esb that provides a SmooksAction which provides data transformation. To use the SmooksAction, a user creates an .esb archive and referenses the SmooksAction from the ESB configuration. They will also need to specify that their .esb archive depends on smooks.esb which they specify in the file deployment.xml.
This worked well with JBoss AS 4.x but with AS 5 this does not work and I think some sort of classloading configuration will be needed simliar to OSGI where a .esb archive might need to contain a META-INF/jboss-classloading.xml file and declare what packages/modules it imports/exports.
Without any configuration this is what happens upon deployment :
java.lang.RuntimeException: java.lang.RuntimeException: Failed to find action class 'org.jboss.soa.esb.smooks.SmooksAction'. at org.jboss.soa.esb.listeners.config.Configuration.create(Configuration.java:138) at org.jboss.soa.esb.listeners.deployers.mc.EsbDeployment.start(EsbDeployment.java:112) ... // Cut out some of the stacktrace to make it more readable /Daniel ... Caused by: java.lang.RuntimeException: Failed to find action class 'org.jboss.soa.esb.smooks.SmooksAction'. at org.jboss.soa.esb.listeners.config.mappers.XMLBeansModel.getContractPublisher(XMLBeansModel.java:378) at org.jboss.soa.esb.listeners.config.mappers.XMLBeansModel.getServicePublishers(XMLBeansModel.java:351) at org.jboss.soa.esb.listeners.config.model.Model101SchemaParser$Model101Adapter.getServicePublishers(Model101SchemaParser.java:116) at org.jboss.soa.esb.listeners.config.Configuration.create(Configuration.java:117) ... 53 more Caused by: java.lang.ClassNotFoundException: org.jboss.soa.esb.smooks.SmooksAction at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:242) at org.jboss.soa.esb.util.ClassUtil.forName(ClassUtil.java:93) at org.jboss.soa.esb.listeners.config.mappers.XMLBeansModel.getContractPublisher(XMLBeansModel.java:376) ... 56 more 08:46:16,523 INFO [EsbDeployment] Destroying ESB Deployment 'transformation-pojo-quickstart' 08:46:16,586 ERROR [ProfileServiceBootstrap] Failed to load profile: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS): DEPLOYMENTS IN ERROR: Deployment "jboss.esb.vfszip:/opt/jboss/as/jboss-5.0.1.GA/server/default/deploy/transformation-pojo-quickstart.esb/" is in error due to the following reason(s): java.lang.ClassNotFoundException: org.jboss.soa.esb.smooks.SmooksAction
The org.jboss.soa.esb.smooks.SmooksAction class lives in smooks.esb. Now the transformation-pojo-quickstart.esb does state that it depends on smooks.esb but this does not give it access to the classes from smooks.esb as far as I can tell (from server.log):
2009-04-16 10:59:14,468 DEBUG [org.jboss.soa.esb.listeners.deployers.mc.EsbConfigParser] (main) Parsed ESB configuration'EsbMetaData [archiveName='transformation-pojo-quickstart.esb/META-INF/jboss-esb.xml', deploymentName='transformation-pojo-quickstart', dependencies='[ jboss.esb.quickstart.destination:service=Queue,name=quickstart_simple_transformation_Response, jboss.esb.quickstart.destination:service=Queue,name=quickstart_transform_pojo_gw, jboss.esb:deployment=smooks.esb, jboss.esb.quickstart.destination:service=Queue,name=quickstart_transform_pojo_esb]']'
Now, if smooks.esb contains a META-INF/jboss-classloading.xml that exports the org.jboss.soa.esb.smooks.SmooksAction will that mean that this deployment, the transformation-pojo-quickstart.esb, will have access to that class?
I'm thinking no, as the quickstart does to say that it requires access to the package. Just becasue smooks.esb exports a class does not mean that other deployment will see it.
So if .esb archives are to be able to get deployed as is, we may need to inquire the services that it depends on and add the equivalent ClassLoadingMetaData during deployment.
I'll start by trying to manually add a jboss-classloading.xml to the quickstart and see if that works.
If anyone has comments or suggestions they are always welcome.