I need to add the classes bundled with the deployer to the classpath of a
VFSDeploymentUnit.
This code doesn't work:
public void deploy(VFSDeploymentUnit unit, JBossWebMetaData metaData) throws
DeploymentException {
| URL url = getClass().getClassLoader().getResource("/");
| VirtualFile vFile = VFS.getRoot(url);
| unit.addClassPath(vFile);
| }
getResource("/") returns a URL that looks like
vfsmemory://abc1t-caplls-fmgocucl-1-fmgoe37j-d/
But this code does work:
public void deploy(VFSDeploymentUnit unit, JBossWebMetaData metaData) throws
DeploymentException {
| BaseClassLoader classloader = (BaseClassLoader)getClass().getClassLoader();
| URL url = new URL(classloader.getName());
| VirtualFile vFile = VFS.getRoot(url);
| unit.addClassPath(vFile);
| }
BaseClassLoader.getName() happens to return
vfsfile:/C:/projects/jboss5/trunk/build/output/jboss-5.0.0.GA/server/default/deployers/jsfunit.deployer/
I'd rather not rely on casting to BaseClassLoader and calling getName(). Is there a
better way to do this?
Stan
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4183045#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...