dev@glassfish.java.net

Re: [_at_GFv3] value of system property catalina.base

From: Amy Roh <Amelia.Roh_at_Sun.COM>
Date: Wed, 26 Mar 2008 12:24:24 -0700

Byron Nevins wrote:
> We should not be using any System Properties for stuff like this. If
> you can inject ServerEnvironment -- then we can easily add something
> like this:
>
> @Inject
> ServerEnvironment env;
>
> .....
>
> File f = env.getCatalinaBase();

Yup. I have just committed
_embedded.setCatalinaHome(ServerEnvironment.getDomainRoot()) where
ServerEnvironment is injected in WebContainer.

Amy

>
>
> Amy Roh wrote:
>> Jeanfrancois Arcand wrote:
>>> Salut,
>>>
>>> Sahoo wrote:
>>>> 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;
>>>> }
>>>> ...
>>>> }
>>>
>>> In v2, it was defaulting to
>>>
>>> instance.getInstancesRoot();
>>>
>>> Seems that code is no longer configured in v3 (not sure why). So the
>>> missing piece is in (from v2 workspace):
>>>
>>> com.sun.enterprise.web.WebContainerLifeCycle
>>>
>>>
>>>>
>>>> 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.
>>>
>>> This is a new requirement. Can you file an issue? We gonna need a
>>> Factory to accommodate your scenario.
>>>
>>>
>>>> 2. catalina.base should be set appropriately to avoid unpredictable
>>>> behavior.
>>>
>>> File an issue as well ;-) That one can probably be workarounded by
>>> adding the -Dcatalina.home=.... on the command line.
>>
>> Yes, please assign this to me.
>>
>> Thanks,
>> Amy
>>
>>>
>>> A+
>>>
>>> -- Jeanfrancois
>>>
>>>
>>>>
>>>> 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
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>
>