You are viewing a plain text version of this content. The canonical link for it is here.
Posted to phoenix-dev@avalon.apache.org by Leif Mortenson <le...@tanukisoftware.com> on 2002/07/12 03:48:49 UTC

Sevak and the tools.jar file

The Sevak application requires that the tools.jar be present in the 
phoenix/lib distribution.
But we can not actually ship with it.   I was thinking of making it an 
optional jar for phoenix
so that it would be added to the dist if it was present.   The concern 
is that when we build
a binary release, we would have to be careful that this was not included.

Here is the patch I was thinking of committing.   Comments or a better 
way to do this?

RCS file: /home/cvs/jakarta-avalon-phoenix/build.xml,v
retrieving revision 1.138
diff -r1.138 build.xml
362a363,365
 >                
 >             <!-- Copy the tools.jar file if it exists.  Used by 
Sevak. -->
 >             <include name="tools.jar"/>

It seems like there could be other jars that might need to be added as 
well.  Is there any
reason why we should not copy all jars in the lib directory into 
Phoenix's dist?

Cheers,
Leif


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Sevak and the tools.jar file

Posted by Peter Donald <pe...@apache.org>.
At 03:15 PM 7/13/2002 +0900, you wrote:
>Peter,
>    It sounds like there are 3 classloader scopes that we have to set up.

The way I would like to do it eventually is partly described at

http://jakarta.apache.org/ant/myrmidon/classloader.html

(If you translate antlib to mean .sar file)


>1) Is the launcher.   This classloader should have access to 
>phoenix-loader.jar and
>wrapper.jar but nothing else.

This is what the diagram calls system classloader.

>2) The actual Phoenix Container.  This classloader will have access to the 
>container
>specific jars as well as a set of common jars.

The diagram breaks this into two classloaders. One is "common" that is 
shared between container and applications. The other is container that is 
private to the container.

>3) The applications.   These classloaders will have access to the set of 
>common jars,
>the contents of the ext directory and the lib and classes directories in 
>their SAR-INF
>directories.

yep, however the ext directory is only searched if they declare 
dependencies in the manifest of jars. In other cases it will not be used.

>If this is the case, then why not use a direcory structure like the following:
>lib/               (launcher jars)
>lib/phoenix-loader.jar
>lib/wrapper.jar
>lib/Wrapper.DLL or libwrapper.so
>lib/container (container jars)
>lib/common  (common jars)
>lib/ext          (extension jars)

Originally they were separated the way they are separated now because thats 
how other app servers do it. However if you want to change it then thats 
fine with me.

>I will admit that I am a little unclear as to which jars are needed where 
>as far
>as the #2 / #3 classloaders I have not really delved into the Phoenix code
>much past the launcher.   I could go in making changes like a bull in a china
>shop, but that would probably be unadvisable <:-)  For example, I have not
>figured out where in the existing code, the jars in ext are being loaded.

They are loaded for .sar files in

org.apache.avalon.phoenix.components.classloader.DefaultClassLoaderManager#getOptionalPackageFor()

however the container will never make use of them.

>  Sevak
>is unable to find tools.jar if I place it there.  Currently it has to be 
>in the lib
>directory.


Unfortunately tools.jar does not comply with "Optional Package" spec and 
thus will not be able to be loaded as an extension.

>|I moved all of the lib jars into the bin/lib directory.  But was unable 
>to start Phoenix
>with Sevak.  It seemed to require that logkit, framework, 
>excalibur-containerkit,
>ant excalibur-i18n be in the common lib directory.

containerkit aswell? Hmmm ... thats a bug - I will look at it soon.

Cheers,

Peter Donald
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"Faced with the choice between changing one's mind,
and proving that there is no need to do so - almost
everyone gets busy on the proof."
              - John Kenneth Galbraith
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Sevak and the tools.jar file

Posted by Leif Mortenson <le...@tanukisoftware.com>.
Peter,
    It sounds like there are 3 classloader scopes that we have to set up.

1) Is the launcher.   This classloader should have access to 
phoenix-loader.jar and
wrapper.jar but nothing else.

2) The actual Phoenix Container.  This classloader will have access to 
the container
specific jars as well as a set of common jars.

3) The applications.   These classloaders will have access to the set of 
common jars,
the contents of the ext directory and the lib and classes directories in 
their SAR-INF
directories.

If this is the case, then why not use a direcory structure like the 
following:
lib/               (launcher jars)
lib/phoenix-loader.jar
lib/wrapper.jar
lib/Wrapper.DLL or libwrapper.so
lib/container (container jars)
lib/common  (common jars)
lib/ext          (extension jars)

This way the bin directory could be kept clean

I will admit that I am a little unclear as to which jars are needed 
where as far
as the #2 / #3 classloaders I have not really delved into the Phoenix code
much past the launcher.   I could go in making changes like a bull in a 
china
shop, but that would probably be unadvisable <:-)  For example, I have not
figured out where in the existing code, the jars in ext are being 
loaded.  Sevak
is unable to find tools.jar if I place it there.  Currently it has to be 
in the lib
directory.

This seems to have turned into a bigger project than I was originally 
planning
to take on right now <:-}

I moved all of the lib jars into the bin/lib directory.  But was unable 
to start Phoenix
with Sevak.  It seemed to require that logkit, framework, 
excalibur-containerkit,
ant excalibur-i18n be in the common lib directory.

Leif

> right. The ext dir is there for applications that contain jars that 
> declare "Optional Dependecies"/"Extensions". The extensions will 
> attempt to be loaded from the ext dir. SO if 
> myapp/SAR-INF/lib/cornerstone.jar had something like
>
> Extension-List: foo
> foo-Extension-Name: Foo API
> foo-Specification-Version: 1.1
> ... 

>
> Then phoenix would try and find the "foo" library in ext dir.
>
>   As the lib directory was not being included in the initial class 
> path to load the JVM, I assumed
>
>> that the Main class would be adding the files there and using them to 
>> load the rest of Phoenix.
>> But that does not appear to be happening right now.  Main finds the 
>> phoenix-engine.jar, but the
>> other jars are only available because of the -Djava.ext.dirs property.
>
>
> I just updated the code so that aall of the libraries contianed in 
> $PHOENIX_HOME/bin/lib are loaded into the Containers classloader (not 
> visible from .sar files). So thus we can create adirectory like
>
> jakarta-avalon-phoenix/lib/container
>
> and have all of its jars copied to dist/bin/lib.
>
> SO these are all the jars that are not shared with .sar files (CLI, 
> Baxter, logkit, excalibur-logger, jmx, containerkit....)
>
> How does that sound?
>
>>   I think that the needed fix is to create a method in Main which 
>> creates a classpath of all jar and
>> zip files in the lib and ext directories.  This classpath will then 
>> be used to load and launch the
>> CLIMain class.  Currently, the phoenix-engine.jar file is located in 
>> the bin directory and then
>> all other classes are found in the "JVM ext" directory.
>
>
> done.
>
>>   Doing this would also make it possible to move the 
>> phoenix-engine.jar file into the lib directory.
>> Is there any reason why the phoenix-loader.jar file is not over there 
>> as well?
>
>
>
> Mainly to isolate the apps from changes in the container. ie We have 
> had a few bug reports when we upgraded threading because 
> cornerstone.jar was relying on previous version of libraries being in 
> dist/lib .
>
> Having all the container jars in separate jar helps us avoid these 
> issues ... hopefully ;)
>
>
>
>> Also:
>> Any reason why the following is in the dist-lite task?
>
>
> no idea.
>
> Cheers,
>
> Peter Donald
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> "Faced with the choice between changing one's mind,
> and proving that there is no need to do so - almost
> everyone gets busy on the proof."
>              - John Kenneth Galbraith
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
> -- 
> To unsubscribe, e-mail:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>
>
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Sevak and the tools.jar file

Posted by Peter Donald <pe...@apache.org>.
At 02:55 PM 7/12/2002 +0900, you wrote:
>Peter,
>    I got most of this done, but am trying to figure out how Phoenix 
> should be finding the ext
>jars.   The ext directory already existed, but jars placed there would not 
>be found.

right. The ext dir is there for applications that contain jars that declare 
"Optional Dependecies"/"Extensions". The extensions will attempt to be 
loaded from the ext dir. SO if myapp/SAR-INF/lib/cornerstone.jar had 
something like

Extension-List: foo
foo-Extension-Name: Foo API
foo-Specification-Version: 1.1
...

Then phoenix would try and find the "foo" library in ext dir.

   As the lib directory was not being included in the initial class path to 
load the JVM, I assumed
>that the Main class would be adding the files there and using them to load 
>the rest of Phoenix.
>But that does not appear to be happening right now.  Main finds the 
>phoenix-engine.jar, but the
>other jars are only available because of the -Djava.ext.dirs property.

I just updated the code so that aall of the libraries contianed in 
$PHOENIX_HOME/bin/lib are loaded into the Containers classloader (not 
visible from .sar files). So thus we can create adirectory like

jakarta-avalon-phoenix/lib/container

and have all of its jars copied to dist/bin/lib.

SO these are all the jars that are not shared with .sar files (CLI, Baxter, 
logkit, excalibur-logger, jmx, containerkit....)

How does that sound?

>   I think that the needed fix is to create a method in Main which creates 
> a classpath of all jar and
>zip files in the lib and ext directories.  This classpath will then be 
>used to load and launch the
>CLIMain class.  Currently, the phoenix-engine.jar file is located in the 
>bin directory and then
>all other classes are found in the "JVM ext" directory.

done.

>   Doing this would also make it possible to move the phoenix-engine.jar 
> file into the lib directory.
>Is there any reason why the phoenix-loader.jar file is not over there as well?


Mainly to isolate the apps from changes in the container. ie We have had a 
few bug reports when we upgraded threading because cornerstone.jar was 
relying on previous version of libraries being in dist/lib .

Having all the container jars in separate jar helps us avoid these issues 
... hopefully ;)



>Also:
>Any reason why the following is in the dist-lite task?

no idea.

Cheers,

Peter Donald
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"Faced with the choice between changing one's mind,
and proving that there is no need to do so - almost
everyone gets busy on the proof."
              - John Kenneth Galbraith
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Sevak and the tools.jar file

Posted by Leif Mortenson <le...@tanukisoftware.com>.
Peter,
    I got most of this done, but am trying to figure out how Phoenix 
should be finding the ext
jars.   The ext directory already existed, but jars placed there would 
not be found.  The lib dir
is not even on the class path.  The jars there are found because of the 
-Djava.ext.dirs=../lib
parameter being passed to the JVM.  I understand why this is necessary 
to tell the JVM to
look there for its XML jars rather than in the JVM's ext dir.
    As the lib directory was not being included in the initial class 
path to load the JVM, I assumed
that the Main class would be adding the files there and using them to 
load the rest of Phoenix.
But that does not appear to be happening right now.  Main finds the 
phoenix-engine.jar, but the
other jars are only available because of the -Djava.ext.dirs property.

    How should I proceed here?  Adding the jars in the ext directory to 
the classpath, of course
fixes the problem.  But that seems counter to design.  It is also 
possible to change the java.ext.dirs
property to include the ../ext directory.

    I think that the needed fix is to create a method in Main which 
creates a classpath of all jar and
zip files in the lib and ext directories.  This classpath will then be 
used to load and launch the
CLIMain class.  Currently, the phoenix-engine.jar file is located in the 
bin directory and then
all other classes are found in the "JVM ext" directory.

    Doing this would also make it possible to move the 
phoenix-engine.jar file into the lib directory.
Is there any reason why the phoenix-loader.jar file is not over there as 
well?

Also:
Any reason why the following is in the dist-lite task?  If there is a 
reason, it should have a comment.
        <copy todir="${bin.dist.lib}/">
            <fileset dir="${build.lib}">
                <include name="phoenix-client.jar"/>
                <include name="phoenix-client.jar"/>
                <include name="phoenix-client.jar"/>
            </fileset>
        </copy>

I'll await your comments before going any farther.

Cheers,
Leif



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Sevak and the tools.jar file

Posted by Peter Donald <pe...@apache.org>.
At 12:59 PM 7/12/2002 +0900, you wrote:
I like that better.  So lib/ would be for the build, lib/common/ would be 
for the dist/lib directory
>and lib/ext/ would go into dist/ext/ ?

yep

>Looking at what is there now, I would move the files like this?
>
>lib/common/avalon-framework*.jar
>lib/common/excalibur*.jar
>lib/common/logkit-1.1a.jar
>lib/common/phoenix-client.jar
>lib/common/xalan-2.3.1.jar
>lib/common/xerces-2.0.1.jar
>lib/common/xml-apis.jar
>lib/ext/tools.jar  (not checked in)
>
>Looking at all of this.  It looks like all of the files in lib are current 
>copied into the dist directory.

Quite possibly. Though I think there is a bunch of other files I usually 
have in there (JMX ones come to mind). But all of those could be moved.

>The xdoclet jars are already in a sub directory: lib/xdoclet/
>
>Should they be moved into lib/ in the new structure?

XDoclet jars are fairly volatile and I would like to kepe them separate and 
isolated - at least until there are some stable releases from them. After 
that we can move them back into lib/


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Sevak and the tools.jar file

Posted by Leif Mortenson <le...@tanukisoftware.com>.

Peter Donald wrote:

>
> At 10:48 AM 7/12/2002 +0900, you wrote:
>
>> It seems like there could be other jars that might need to be added 
>> as well.  Is there any
>> reason why we should not copy all jars in the lib directory into 
>> Phoenix's dist?
>
>
> Thats a good idea. The only problem is that some of them are not 
> needed and should not go into dist/lib (ie xdoclet jars spring to 
> mind). Maybe another idea would be to create the following directories
>
> lib/common
> lib/ext
>
> And then copy all of lib/common into dist/lib and all of lib/ext into 
> dist/ext.
>
> Thoughts? 

I like that better.  So lib/ would be for the build, lib/common/ would 
be for the dist/lib directory
and lib/ext/ would go into dist/ext/ ?

Looking at what is there now, I would move the files like this?

lib/common/avalon-framework*.jar
lib/common/excalibur*.jar
lib/common/logkit-1.1a.jar
lib/common/phoenix-client.jar
lib/common/xalan-2.3.1.jar
lib/common/xerces-2.0.1.jar
lib/common/xml-apis.jar
lib/ext/tools.jar  (not checked in)

Looking at all of this.  It looks like all of the files in lib are 
current copied into the dist directory.
The xdoclet jars are already in a sub directory: lib/xdoclet/

Should they be moved into lib/ in the new structure?

Cheers,
Leif



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Sevak and the tools.jar file

Posted by Peter Donald <pe...@apache.org>.
At 10:48 AM 7/12/2002 +0900, you wrote:
>It seems like there could be other jars that might need to be added as 
>well.  Is there any
>reason why we should not copy all jars in the lib directory into Phoenix's 
>dist?

Thats a good idea. The only problem is that some of them are not needed and 
should not go into dist/lib (ie xdoclet jars spring to mind). Maybe another 
idea would be to create the following directories

lib/common
lib/ext

And then copy all of lib/common into dist/lib and all of lib/ext into dist/ext.

Thoughts?


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>