geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luciano Salotto" <lsalo...@gmail.com>
Subject Re: setting classpath for geronimo (problem with setenv.bat)
Date Fri, 25 Apr 2008 16:08:55 GMT
Just in case someone else fall into this this was the problem

Given the way we extended classloader for WAS 6, access to the resources was
done with this code

    URL url = ClassLoader.getSystemResource(filename);

This is done in several classes on the app, and I thought I had changed them
all, the way to access the resources is this

    ClassLoader loader = Thread.currentThread().getContextClassLoader();
      URL url= loader.getResource(filename);

Thanks again

Luciano



On Fri, Apr 25, 2008 at 1:03 PM, Luciano Salotto <lsalotto@gmail.com> wrote:

> My apologies for making you guys waste your time, I found that there was a
> problem in our code that was causing this exception.
> Again thanks very much for your help
>
> Luciano
>
>
> On Thu, Apr 24, 2008 at 5:45 PM, Luciano Salotto <lsalotto@gmail.com>
> wrote:
>
>> Hey David,
>> I'm working Xasima in the same team, so I'm trying to solve same issue
>> here. I followed the steps in the wiki to locate the files in the class path
>> by adding a GBean entry in the geronimo-aplication.xml like this
>>
>>  <sys:gbean name="BHData"
>> class="org.apache.geronimo.system.sharedlib.SharedLib">
>>       <attribute name="classesDirs">var/bhData</attribute>
>>       <reference name="ServerInfo">
>>             <name>ServerInfo</name>
>>       </reference>
>>   </sys:gbean>
>>
>> When I debug application start, I can see that this works and the files
>> are retreived and properly parsed. However after that (somewhere else on
>> server startup wich I can't trace) the server fails to start with following
>> exception
>>
>>
>> org.apache.geronimo.kernel.config.LifecycleException: start of
>> default/BH/1.0/car failed
>>     at
>> org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:547)
>>     at
>> org.apache.geronimo.kernel.config.SimpleConfigurationManager$$FastClassByCGLIB$$ce77a924.invoke(<generated>)
>>     at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
>>     at
>> org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
>>     at
>> org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:124)
>>     at
>> org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:830)
>>     at
>> org.apache.geronimo.gbean.runtime.RawInvoker.invoke(RawInvoker.java:57)
>>     at
>> org.apache.geronimo.kernel.basic.RawOperationInvoker.invoke(RawOperationInvoker.java:35)
>>     at
>> org.apache.geronimo.kernel.basic.ProxyMethodInterceptor.intercept(ProxyMethodInterceptor.java:96)
>>     at
>> org.apache.geronimo.kernel.config.EditableConfigurationManager$$EnhancerByCGLIB$$1971fefa.startConfiguration(<generated>)
>>     at
>> org.apache.geronimo.system.main.EmbeddedDaemon.doStartup(EmbeddedDaemon.java:161)
>>     at
>> org.apache.geronimo.system.main.EmbeddedDaemon.execute(EmbeddedDaemon.java:83)
>>     at
>> org.apache.geronimo.kernel.util.MainConfigurationBootstrapper.main(MainConfigurationBootstrapper.java:45)
>>     at
>> org.apache.geronimo.cli.AbstractCLI.executeMain(AbstractCLI.java:67)
>>     at org.apache.geronimo.cli.daemon.DaemonCLI.main(DaemonCLI.java:30)
>> Caused by: org.apache.geronimo.kernel.config.InvalidConfigException:
>> Unknown start exception
>>     at
>> org.apache.geronimo.kernel.config.ConfigurationUtil.startConfigurationGBeans(ConfigurationUtil.java:514)
>>     at
>> org.apache.geronimo.kernel.config.ConfigurationUtil.startConfigurationGBeans(ConfigurationUtil.java:485)
>>     at
>> org.apache.geronimo.kernel.config.KernelConfigurationManager.start(KernelConfigurationManager.java:187)
>>     at
>> org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:530)
>>     ... 14 more
>> Caused by: org.apache.geronimo.gbean.InvalidConfigurationException:
>> Configuration default/BH_BHUI.war/1.0/car failed to start due to the
>> following reasons:
>>   The service
>> J2EEApplication=default/BH/1.0/car,j2eeType=WebModule,name=BHUI.war did not
>> start because ContainerBase.addChild: start: LifecycleException:
>> java.io.IOException: Context did not start for an unknown reason
>>
>>     at
>> org.apache.geronimo.kernel.config.ConfigurationUtil.startConfigurationGBeans(ConfigurationUtil.java:477)
>>     ... 17 more
>> [] received stop signal
>>
>> Any ideas why this could be happening? Got to say I'm working with G2.0
>> (which comes with WAS CE)
>>
>> Thanks in advance
>>
>> Luciano
>>
>>
>> On Wed, Apr 16, 2008 at 9:53 PM, David Jencks <david_jencks@yahoo.com>
>> wrote:
>>
>>>
>>> On Apr 16, 2008, at 7:42 AM, Xasima Xirohata wrote:
>>>
>>> Hello, I have an EAR that expect to load a bunch of  parameters from
>>> special 'property' folder (folder/performance-prop.property,
>>> folder/logging-prop.property and so on).
>>> The resolving of these properties is done in the following manner
>>>                      url =
>>> ClassLoader.getSystemResource("relativePathToPropertyFile");
>>> so classes just look into classpath for the  relative path of certain
>>> property file, and the only I need is to put this property folder into
>>> classpath of the application server.
>>>
>>>
>>> This seems to me to be a really strange way of exposing application
>>> specific data and I'm very surprised that any application server caters to
>>> this method.  Why would you want to have to modify the classpath of the app
>>> server (not your app, the app server) in order to expose what is quite
>>> clearly application specific data?  This seems extraordinarily non-modular
>>> to me.
>>>
>>>
>>> When testing this EAR with WAS 6.1, I just set the path to this
>>> 'property' folder using VirtualMashine/Process Definition/ClassPath tab
>>> in WAS 6.1 administration console.
>>> When migrate to Geronimo 2.1 (bundled with jetty6, java 1.5 vm),  I have
>>> experienced the following difficulties.
>>> I haven't found any way to add some data to classpath from Geronimo
>>> Administration Console, so I tried to set up this manually.
>>> I created the 'setenv.bat' in the %geronimo_home%/bin  with the following
>>> content
>>>                      set
>>> GERONIMO_OPTS="-Djava.ext.dirs=C:\path2propertiesfolder1;C:\path2propertyfolder2"
>>> (actually I have several properties folder),
>>> but this didn't help so I have pass this options directly into the
>>> geronimo.bat where @REM Execute Java with the applicable properties
>>>
>>> I've noticed that Administration Console  (
>>> http://localhost:8080/console/portal/Server/Java%20System%20Info) never
>>> lists the values that set up with such an approach.
>>> The file var/log/geronimo.log doesn't list them as well, although when a
>>> deploying occurs, this values appear into deployer.log. Thus it seems that
>>> geronimo_opts really is used only at deployment.
>>>
>>> But no above efforts are  sufficient to make this folder visible for my
>>> application.
>>>
>>> I know that this is possible to set up classpath using eclipse plugin. We
>>> have tested this with WAS CE 1.x (server -> open ->
>>> edit-launch-configuration-properties ->  user entries -> advanced ->
add
>>> folder).
>>> I wonder what's the proper approach to set up the same with no eclipse
>>> assistance.
>>>
>>> I guess the following ways to do this that probably may help, although
>>> haven't tried them yet
>>> 1) packed the PropertiesFolder as jar and place into
>>> %geronimo_home%/lib/endorsed
>>> 2) packed the folder as jar and write a deployment plan to install this
>>> into geronimo repository in the similar way as for common DB-Pool. After
>>> this we probably need to declare  special dependency in regular EAR
>>> application / geronimo-application .xml onto  group-artifact-resourcejar to
>>> list this as resource.
>>> 3) use some special way to deploy (install) application with custom
>>> classpath, and do this in local manner (just special options when deploy, or
>>> using some maven-plugins) not global .bat file rewritting.
>>>
>>> I think that the last options is the best one. Assume  the situation if
>>> someone has different application that are supposed to be configured with
>>> some properties files and these files  are located in different places. It's
>>> too unnatural to move this data into application server lib or repository ,
>>> since this is not suitable for user access and configuration.
>>>
>>> Could someone please clear out the rules of classpath resolution?
>>>
>>>
>>>
>>> As you can tell, I'm not in favor of allowing anyone to change the system
>>> classpath as a way to access application specific data.  There's some
>>> documentation on what I at least consider appropriate ways of locating your
>>> app's configuration info:
>>>
>>>
>>> http://cwiki.apache.org/GMOxDOC21/locating-your-application-specific-configuration-files.html
>>>
>>> If you have further questions pleas ask!
>>>
>>> thanks
>>> david jencks
>>>
>>>
>>> --
>>> Best regards,
>>> ~ Xasima ~
>>>
>>>
>>>
>>
>

Mime
View raw message