"Craig R. McClanahan" wrote:
> Yesterday, I added an update to Embedded.start() to set "catalina.base" to
> the value of "catalina.home" if it's not already set.  That way, others
> won't get bit by this one.

Yes, I saw the commit message in CVS, which hinted that I should do it
manually with RC1. :-)

> It's certainly an odd symptom.  One potentially significant environmental
> difference is that Embedded does not set up the usual class loader
> hierarchy that org.apache.catalina.startup.Bootstrap does.  What is the
> class loader environment when you're running into this?

The parent classloader is set to the application classloader that JBoss
provides. The code I use to access the EmbeddedManager looks like this:
   protected WebApplication performDeploy(String ctxPath, String warUrl,
AbstractWebContainer.WebDescriptorParser webAppParser) throws Exception
   {
      String deployPath = ctxPath.equals("/") ? "" : ctxPath;
      ClassLoader ctxClassLoader =
Thread.currentThread().getContextClassLoader();
      Context ctx = mapper.deploy(deployPath, warUrl);
      ctx.setParentClassLoader(ctxClassLoader);
      ClassLoader scl = (ClassLoader) ctx.getLoader().getClassLoader();

      ServletContext servletCtx = ctx.getServletContext();
//      Element webXml = (Element) ctx.getAttribute("web-app.xml");
//      Element jbossWebXml = (Element)
ctx.getAttribute("jboss-web.xml");
      URL url = new URL(warUrl);
      WebApplication appInfo = new WebApplication(url.getFile(), url,
scl);
//      appInfo.setWebApp(webXml);
//      appInfo.setJbossWeb(jbossWebXml);
      appInfo.setAppData(ctx);

      return appInfo;
   }
and mapper.deploy looks like this:
   public Context deploy(String cxPath, String warUrl) throws
DeploymentException
   {
      if (warUrl.startsWith("file:"))
         warUrl = warUrl.substring(5);
      try
      {
         Context context = (Context) mBServ.invoke(catName,
"createContext", new Object[]{ cxPath,warUrl }, new String[]{
"java.lang.String", "java.lang.String" });
         StandardLoader loader = new
StandardLoader(Thread.currentThread().getContextClassLoader());
         context.setLoader(loader);
         context.setReloadable(true);
         deployHost.addChild(context);
         return context;
      } catch (RuntimeErrorException e)
      {
         e.getTargetError().printStackTrace();
         throw new DeploymentException(e.getLocalizedMessage());
      } catch (Exception e)
      {
         e.printStackTrace();
         throw new DeploymentException(e.getLocalizedMessage());
      }
   }
---
(Yes the parent CL is set twice, which is redundant, but shouldn't cause
any actual problems).

Any ideas on this? I'm developing this by mostly guessing how to do it
properly, so any more educated guesses would be appreciated :-) You have
no idea how much I want this to work! 8-)

/Rickard

-- 
Rickard Öberg
Software Development Specialist
xlurc - Xpedio Linköping Ubiquitous Research Center
Author of "Mastering RMI"
Email: [EMAIL PROTECTED]

Reply via email to