try
{
builder = BeanMetaDataBuilderFactory.createBuilder("ClientContainer",
"org.jboss.ejb3.client.ClientContainer");
VFSClassLoaderFactory factory = new VFSClassLoaderFactory("ClientLauncherClassPath");
ArrayList<String> roots = new ArrayList<String>();
// Create the classpath
log.info("Setting up classpath from: ");
for(String path : classPath)
{
log.info(path);
mount(path);
roots.add(path);
}
for(String path : extraClassPath)
{
log.info(path);
mount(path);
roots.add(path);
}
log.info("End classpath");
factory.setRoots(roots);
beanFactories.add(factory);
// ClientContainer(xml, mainClass, applicationClientName, jndiEnv);
String classLoaderName = factory.getContextName();
if(classLoaderName == null)
classLoaderName = factory.getName() + ":" + factory.getVersion();
String metaDataJndiName = applicationClientName + "/metaData";
ValueMetaData xmlMD = new JndiDependencyValueMetaData(metaDataJndiName, jndiEnv, classLoaderName);
builder.addConstructorParameter(JBossClientMetaData.class.getName(), xmlMD);
//builder.addConstructorParameter(JBossClientMetaData.class.getName(), xml);
builder.addConstructorParameter(Class.class.getName(), mainClassName);
builder.addConstructorParameter(String.class.getName(), applicationClientName);
builder.addConstructorParameter(Properties.class.getName(), jndiEnv);
// Use vfs class loader as the ClientContainer class loader
ValueMetaData classLoader = builder.createInject(classLoaderName);
builder.setClassLoader(classLoader);
BeanMetaData clientContainerMD = builder.getBeanMetaData();
AbstractKernelDeployment deployment = new AbstractKernelDeployment();
deployment.setName(factory.getName() + ":" + factory.getVersion());
addBeanMetaData(beanFactories, beans, clientContainerMD);
deployment.setBeanFactories(beanFactories);
if(beans.size() > 0)
deployment.setBeans(beans);
deploy(deployment);