dev@glassfish.java.net

[_at_GFv3] value of system property catalina.base

From: Sahoo <Sahoo_at_sun.com>
Date: Wed, 26 Mar 2008 22:15:51 +0530

Hi,

What should be the value of system property catalina.base in GlassFish
runtime? It seems to be defaulting to current working directory and
causing problems when current working directory has a directory called
conf in it. Look at the following code in
web/webtier/.../org.apache.catalina.core.StandardContext.java:

    private File getConfigBase() {
        File configBase =
            new File(System.getProperty("catalina.base"), "conf");
        if (!configBase.exists()) {
            return null;
        }
        ...
   }

If there is a conf dir in CWD, then this code takes very different code
path and I eventually get the following exception while deploying a
simple web application in v3. The cause of the instantiation exception
is that WebModule does not have a default constructor and HK2 needs for
injection purpose. You should be able to reproduce this problem by
running java -jar glassfish-10.0-SNAPSHOT.jar in a directory which has a
conf subdir in it.

So, there are two problems:
1. If WebModule needs to be injected, then it must either have a default
constructor or provide a Factory that can instantiate it.
2. catalina.base should be set appropriately to avoid unpredictable
behavior.

WARNING: Error storing config file
java.lang.InstantiationException: com.sun.enterprise.web.WebModule
        at java.lang.Class.newInstance0(Class.java:335)
        at java.lang.Class.newInstance(Class.java:303)
        at
org.apache.catalina.core.StandardServer.storeAttributes(StandardServer.java:1062)
        at
org.apache.catalina.core.StandardServer.storeAttributes(StandardServer.java:1020)
        at
org.apache.catalina.core.StandardServer.storeContext(StandardServer.java:852)
        at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4884)
        at com.sun.enterprise.web.WebModule.start(WebModule.java:338)
        at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:973)
        at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:957)
        at
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:688)
        at
com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:3036)
        at
com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2657)
        at
com.sun.enterprise.web.WebApplication.start(WebApplication.java:72)
        at
com.sun.enterprise.web.WebApplication.start(WebApplication.java:63)
        at
com.sun.enterprise.v3.server.ApplicationLifecycle.startModules(ApplicationLifecycle.java:669)
        at
com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:282)
        at
com.sun.enterprise.v3.deployment.DeployCommand.execute(DeployCommand.java:285)
        at
com.sun.enterprise.v3.admin.CommandRunner.doCommand(CommandRunner.java:206)
        at
com.sun.enterprise.v3.admin.CommandRunner.doCommand(CommandRunner.java:93)
        at
com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:178)
        at
com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:134)
        at
com.sun.grizzly.http.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:605)
        at
com.sun.grizzly.http.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:536)
        at
com.sun.grizzly.http.DefaultProcessorTask.process(DefaultProcessorTask.java:785)
        at
com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:130)
        at
com.sun.enterprise.v3.services.impl.HttpProtocolFilter.execute(HttpProtocolFilter.java:99)
        at
com.sun.enterprise.v3.services.impl.GlassfishProtocolChain.executeProtocolFilter(GlassfishProtocolChain.java:61)
        at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:78)
        at
com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
        at
com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
        at
com.sun.grizzly.util.WorkerThreadImpl.run(WorkerThreadImpl.java:179)

Thanks,
Sahoo