You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Ulrich Mayring <ul...@denic.de> on 2001/09/10 10:19:41 UTC

How does Avalon load libraries???

Hello,

we have severe problems here with classloading, which we cannot
reproduce at will. Sometimes jars in the general Avalon lib directory
are not found by a block. Sometimes jars in a block's lib directory are
found by other blocks (even by blocks in another .sar application),
sometimes not even by their own block. Sometimes Avalon loads blocks and
sars in alphabetical order, sometimes not. Something is seriously weird
here and to put my finger on it I'd like to know how and when Avalon
loads libraries in a multi-block, multi-sar environment like this:

~avalon/lib

~avalon/apps/foo.sar
~avalon/apps/foo/blocks/block1/lib
~avalon/apps/foo/blocks/block2/lib

~avalon/apps/bar.sar
~avalon/apps/bar/blocks/block3/lib
~avalon/apps/bar/blocks/block4/lib

~avalon/apps/baz.sar
~avalon/apps/baz/blocks/block5/lib

Now, suppose block3 and block5 need the same jar - where do I put it?
What is the general strategy of Avalon loading jars?

Thank you very much for any pointers,

Ulrich

-- 
Ulrich Mayring
DENIC eG, Systementwicklung

---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: How does Avalon load libraries???

Posted by Peter Donald <do...@apache.org>.
On Mon, 10 Sep 2001 19:29, Peter Donald wrote:
> Extension-List: required1
> required1-Extension-Name: excalibur.required1
> required1-Specification-Version: 1.0
> required1-Implementation-Version: 1.0.2
> required1-Implementation-Vendor-Id: org.apache.jakarta
> required1-Implementation-URL:
> http://jakarta.apache.org/avalon/excalibur/required1.jar

Of course that could also be as simple as

Extension-List: required1
required1-Extension-Name: excalibur.required1

-- 
Cheers,

Pete

---------------------------------------------
 We shall not cease from exploration, and the 
  end of all our exploring will be to arrive 
 where we started and know the place for the 
        first time -- T.S. Eliot
---------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: How does Avalon load libraries???

Posted by Peter Donald <do...@apache.org>.
On Mon, 10 Sep 2001 18:19, Ulrich Mayring wrote:
> Hello,
>
> we have severe problems here with classloading, which we cannot
> reproduce at will. Sometimes jars in the general Avalon lib directory
> are not found by a block. Sometimes jars in a block's lib directory are
> found by other blocks (even by blocks in another .sar application),
> sometimes not even by their own block. Sometimes Avalon loads blocks and
> sars in alphabetical order, sometimes not. Something is seriously weird
> here and to put my finger on it I'd like to know how and when Avalon
> loads libraries in a multi-block, multi-sar environment like this:
>
> ~avalon/lib
>
> ~avalon/apps/foo.sar
> ~avalon/apps/foo/blocks/block1/lib
> ~avalon/apps/foo/blocks/block2/lib
>
> ~avalon/apps/bar.sar
> ~avalon/apps/bar/blocks/block3/lib
> ~avalon/apps/bar/blocks/block4/lib
>
> ~avalon/apps/baz.sar
> ~avalon/apps/baz/blocks/block5/lib
>
> Now, suppose block3 and block5 need the same jar - where do I put it?
> What is the general strategy of Avalon loading jars?

The way it is *supposed* to work is the following. 

The following are included once per JVM
<base>/lib/*.zip 
<base>/lib/*.jar 

The following are included once per application
<base>/apps/<myapp>/lib/*.jar 
<base>/apps/<myapp>/lib/*.zip
<base>/apps/<myapp>/blocks/*.bar

At this current stage there is no directory that is "shared" between apps but 
are loaded multiple times. For instance there is no way to have the same 
archives loaded into different classloaders at this point. People have 
requested this so you could have something like

<base>/share/*.jar

that would be loaded once per app. However at this stage my thinking is we 
should follow the servlet/ejb specs and they require such dependencies to be 
specified in the .jars using the jdk1.3 "Optional Package" mechanism. You 
place something like

Extension-List: required1
required1-Extension-Name: excalibur.required1
required1-Specification-Version: 1.0
required1-Implementation-Version: 1.0.2
required1-Implementation-Vendor-Id: org.apache.jakarta
required1-Implementation-URL: 
http://jakarta.apache.org/avalon/excalibur/required1.jar

In any jar that depends on this shared library. I am about halfway through 
implementing the infrastructure for it at the moment but I wont have the 
chance to finish it in near future.

-- 
Cheers,

Pete

*-----------------------------------------------------*
| Never argue with an idiot, they'll drag you down to |
| their level, and beat you with experience           |
*-----------------------------------------------------*

---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: How does Avalon load libraries???

Posted by Paul Hammant <Pa...@yahoo.com>.
Peter,

Forget this, the cornerstone demos were not building prperly.  I'll 
re-raise if it occurs again

>does 
>
><base>/apps/soap-helloworld/lib/GLUE-STD.jar
>
>exist? Plus any files it depends. (Does it require specific xml parsers or 
>whatever???).
>
- Paul


---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: How does Avalon load libraries???

Posted by Peter Donald <do...@apache.org>.
does 

<base>/apps/soap-helloworld/lib/GLUE-STD.jar

exist? Plus any files it depends. (Does it require specific xml parsers or 
whatever???).


On Tue, 11 Sep 2001 18:40, Paul Hammant wrote:
> OK more info on this bug....
>
>  From console :
>
> There was an uncaught exception:
> ---------------------------------------------------------
> java.lang.NoClassDefFoundError: electric/registry/RegistryException
>         at java.lang.Class.newInstance0(Native Method)
>         at java.lang.Class.newInstance(Class.java:237)
>         at
> org.apache.avalon.phoenix.components.phases.StartupPhase.createBlock(Unknow
>n Source)
>         at
> org.apache.avalon.phoenix.components.phases.StartupPhase.visitBlock(Unknown
> Source)
>         at
> org.apache.avalon.phoenix.components.phases.BlockDAG.visitBlock(Unknown
> Source)
>         at
> org.apache.avalon.phoenix.components.phases.BlockDAG.visitDependencies(Unkn
>own Source)
>         at
> org.apache.avalon.phoenix.components.phases.BlockDAG.visitBlock(Unknown
> Source)
>         at
> org.apache.avalon.phoenix.components.phases.BlockDAG.walkGraph(Unknown
> Source)
>         at
> org.apache.avalon.phoenix.components.application.DefaultServerApplication.r
>unPhase(Unknown Source)
>         at
> org.apache.avalon.phoenix.components.application.DefaultServerApplication.s
>tart(Unknown Source)
>         at
> org.apache.avalon.phoenix.components.kernel.AbstractKernel.startEntry(Unkno
>wn Source)
>         at
> org.apache.avalon.phoenix.components.kernel.AbstractKernel.postAdd(Unknown
> Source)
>         at
> org.apache.avalon.excalibur.container.AbstractContainer.add(AbstractContain
>er.java:39) at
> org.apache.avalon.phoenix.components.deployer.DefaultSarDeployer.addEntry(U
>nknown Source)
>         at
> org.apache.avalon.phoenix.components.deployer.DefaultSarDeployer.deploy(Unk
>nown Source)
>         at
> org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.deployFile(Un
>known Source)
>         at
> org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.deployFiles(U
>nknown Source)
>         at
> org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.deployDefault
>Applications(Unknown Source)
>         at
> org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.execute(Unkno
>wn Source)
>         at org.apache.avalon.phoenix.frontends.CLIMain.execute(Unknown
> Source)
>         at org.apache.avalon.phoenix.frontends.CLIMain.main(Unknown Source)
>         at java.lang.reflect.Method.invoke(Native Method)
>         at org.apache.avalon.phoenix.launcher.Main.main(Unknown Source)
> ---------------------------------------------------------
>
> Phoenix log attached.  Nothing at all or of interest in the various logs
> in the unSARed apps' log dirs.
>
> Steps to reproduce :
>
> 1) Deploy jesktop and ftpserver
> 2) Shutdown phoenix.
> 3) Deploy the soap-helloworld.sar,
> 4) Start phoenix -> exception.
>
> Steps to recover :  Restart phoenix.
>
> -PH

-- 
Cheers,

Pete

*------------------------------------------------*
| Trying is the first step to failure.           |
|   So never try, Lisa  - Homer Jay Simpson      |
*------------------------------------------------*

---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: How does Avalon load libraries???

Posted by Paul Hammant <Pa...@yahoo.com>.
Oops, the log file had changed before I hit send.  Damn attachments in 
Mozilla.  This is some other thing I guess.

>
>java.lang.Exception: Unable to locate resource (org/apache/avalon/cornerstone/blocks/packet/DefaultPacketManager.xinfo) to create block info for packet-manager.
>	at org.apache.avalon.phoenix.components.application.DefaultServerApplication.getBlockInfo(Unknown Source)
>	at org.apache.avalon.phoenix.components.application.DefaultServerApplication.loadBlockInfos(Unknown Source)
>	at org.apache.avalon.phoenix.components.application.DefaultServerApplication.start(Unknown Source)
>	at org.apache.avalon.phoenix.components.kernel.AbstractKernel.startEntry(Unknown Source)
>	at org.apache.avalon.phoenix.components.kernel.AbstractKernel.postAdd(Unknown Source)
>	at org.apache.avalon.excalibur.container.AbstractContainer.add(AbstractContainer.java:39)
>	at org.apache.avalon.phoenix.components.deployer.DefaultSarDeployer.addEntry(Unknown Source)
>Tue Sep 11 05:39:49 BST 2001 [INFO   ] <<Phoenix>> (): Installing Sar file 
>
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: How does Avalon load libraries???

Posted by Paul Hammant <Pa...@yahoo.com>.
OK more info on this bug....

 From console :

There was an uncaught exception:
---------------------------------------------------------
java.lang.NoClassDefFoundError: electric/registry/RegistryException
        at java.lang.Class.newInstance0(Native Method)
        at java.lang.Class.newInstance(Class.java:237)
        at 
org.apache.avalon.phoenix.components.phases.StartupPhase.createBlock(Unknown 
Source)
        at 
org.apache.avalon.phoenix.components.phases.StartupPhase.visitBlock(Unknown 
Source)
        at 
org.apache.avalon.phoenix.components.phases.BlockDAG.visitBlock(Unknown 
Source)
        at 
org.apache.avalon.phoenix.components.phases.BlockDAG.visitDependencies(Unknown 
Source)
        at 
org.apache.avalon.phoenix.components.phases.BlockDAG.visitBlock(Unknown 
Source)
        at 
org.apache.avalon.phoenix.components.phases.BlockDAG.walkGraph(Unknown 
Source)
        at 
org.apache.avalon.phoenix.components.application.DefaultServerApplication.runPhase(Unknown 
Source)
        at 
org.apache.avalon.phoenix.components.application.DefaultServerApplication.start(Unknown 
Source)
        at 
org.apache.avalon.phoenix.components.kernel.AbstractKernel.startEntry(Unknown 
Source)
        at 
org.apache.avalon.phoenix.components.kernel.AbstractKernel.postAdd(Unknown 
Source)
        at 
org.apache.avalon.excalibur.container.AbstractContainer.add(AbstractContainer.java:39)
        at 
org.apache.avalon.phoenix.components.deployer.DefaultSarDeployer.addEntry(Unknown 
Source)
        at 
org.apache.avalon.phoenix.components.deployer.DefaultSarDeployer.deploy(Unknown 
Source)
        at 
org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.deployFile(Unknown 
Source)
        at 
org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.deployFiles(Unknown 
Source)
        at 
org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.deployDefaultApplications(Unknown 
Source)
        at 
org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.execute(Unknown 
Source)
        at org.apache.avalon.phoenix.frontends.CLIMain.execute(Unknown 
Source)
        at org.apache.avalon.phoenix.frontends.CLIMain.main(Unknown Source)
        at java.lang.reflect.Method.invoke(Native Method)
        at org.apache.avalon.phoenix.launcher.Main.main(Unknown Source)
---------------------------------------------------------

Phoenix log attached.  Nothing at all or of interest in the various logs 
in the unSARed apps' log dirs.

Steps to reproduce :

1) Deploy jesktop and ftpserver
2) Shutdown phoenix.  
3) Deploy the soap-helloworld.sar,
4) Start phoenix -> exception.

Steps to recover :  Restart phoenix.

-PH

Re: How does Avalon load libraries???

Posted by Paul Hammant <Pa...@yahoo.com>.
Ulrich,

>>Anyways if you can point out an example error (or preferably a junit test
>>case) I will fix it.
>>
>
>Heh... :)
>
>We currently have five sar applications running under Avalon including
>James. The applications work with JMS message queues and JDBC databases
>- this is a bit hard to put into a simple test case. Perhaps we can hire
>someone to come to Frankfurt/Germany for one or two days? :)
>
I'll go (unemployed and based in London), but then I am not the sharpest 
knife in the Avalon draw ;-)

Regards,

- Paul H


---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: How does Avalon load libraries???

Posted by Ulrich Mayring <ul...@denic.de>.
Peter Donald wrote:
> 
> Anyways if you can point out an example error (or preferably a junit test
> case) I will fix it.

Heh... :)

We currently have five sar applications running under Avalon including
James. The applications work with JMS message queues and JDBC databases
- this is a bit hard to put into a simple test case. Perhaps we can hire
someone to come to Frankfurt/Germany for one or two days? :)

cheers,

Ulrich

-- 
Ulrich Mayring
DENIC eG, Systementwicklung

---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: How does Avalon load libraries???

Posted by Peter Donald <do...@apache.org>.
On Mon, 10 Sep 2001 19:37, Paul Hammant wrote:
> Ulrich,
>
> >we have severe problems here with classloading, which we cannot
> >reproduce at will. Sometimes jars in the general Avalon lib directory
> >are not found by a block. Sometimes jars in a block's lib directory are
> >found by other blocks (even by blocks in another .sar application),
> >sometimes not even by their own block. Sometimes Avalon loads blocks and
> >sars in alphabetical order, sometimes not. Something is seriously weird
> >here and to put my finger on it I'd like to know how and when Avalon
> >loads libraries in a multi-block, multi-sar environment like this:
>
> I've been getting that too.  Sometimes works, sometimes does not.

Could you give specific examples so I can track down the culprit. The 
application should not rely on any ordering semantics of loading the 
.bars/.jars/.zips inside .sars as it is OS specific. However these classes 
will always be loaded after <base>/lib/*.jar.

Anyways if you can point out an example error (or preferably a junit test 
case) I will fix it.

-- 
Cheers,

Pete

----------------------------------------
Why does everyone always overgeneralize?
----------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: How does Avalon load libraries???

Posted by Paul Hammant <Pa...@yahoo.com>.
Ulrich,

>>Each .sar is completely seperate.  Jars in it's lib/ dir will be shared
>>by all it's blocks.
>>
>
>What is a lib dir of a sar? We only have lib dirs inside blocks. In the
>main directory of a sar we only have subdirectories "blocks", "conf" and
>"logs" - do I need to create a "lib" directory there?
>
Create you own lib/ dir.  See Cornerstone's Jesktop.sar and 
avalon-soapdemo-0.7.sar

Both depend on "third party" jars.

IMHO duplicating things into lib/ of sar is better than using a globally 
visible phoenix level lib.  Despite the potential for different versions.
Maybe you introducting a need for a pooled jar concept.  It's been 
touched on before and technically shot down.

- Paul H


---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: How does Avalon load libraries???

Posted by Ulrich Mayring <ul...@denic.de>.
Paul Hammant wrote:
> 
> >~avalon/lib
> >
> >~avalon/apps/foo.sar
> >~avalon/apps/foo/blocks/block1/lib
> >~avalon/apps/foo/blocks/block2/lib
> >
> >~avalon/apps/bar.sar
> >~avalon/apps/bar/blocks/block3/lib
> >~avalon/apps/bar/blocks/block4/lib
> >
> >~avalon/apps/baz.sar
> >~avalon/apps/baz/blocks/block5/lib
> >
> >Now, suppose block3 and block5 need the same jar - where do I put it?
> >What is the general strategy of Avalon loading jars?
> >
> Each .sar is completely seperate.  Jars in it's lib/ dir will be shared
> by all it's blocks.

What is a lib dir of a sar? We only have lib dirs inside blocks. In the
main directory of a sar we only have subdirectories "blocks", "conf" and
"logs" - do I need to create a "lib" directory there?

cheers,

Ulrich

-- 
Ulrich Mayring
DENIC eG, Systementwicklung

---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: How does Avalon load libraries???

Posted by Paul Hammant <Pa...@yahoo.com>.
Ulrich,

>we have severe problems here with classloading, which we cannot
>reproduce at will. Sometimes jars in the general Avalon lib directory
>are not found by a block. Sometimes jars in a block's lib directory are
>found by other blocks (even by blocks in another .sar application),
>sometimes not even by their own block. Sometimes Avalon loads blocks and
>sars in alphabetical order, sometimes not. Something is seriously weird
>here and to put my finger on it I'd like to know how and when Avalon
>loads libraries in a multi-block, multi-sar environment like this:
>
I've been getting that too.  Sometimes works, sometimes does not.

>~avalon/lib
>
>~avalon/apps/foo.sar
>~avalon/apps/foo/blocks/block1/lib
>~avalon/apps/foo/blocks/block2/lib
>
>~avalon/apps/bar.sar
>~avalon/apps/bar/blocks/block3/lib
>~avalon/apps/bar/blocks/block4/lib
>
>~avalon/apps/baz.sar
>~avalon/apps/baz/blocks/block5/lib
>
>Now, suppose block3 and block5 need the same jar - where do I put it?
>What is the general strategy of Avalon loading jars?
>
Each .sar is completely seperate.  Jars in it's lib/ dir will be shared 
by all it's blocks.  

In your scenario, bar.sar and baz.sar would need to contain the libs, 
but they'll be in different classloaders and share no static aspects.

>Thank you very much for any pointers,
>
Hope that helped.

-PH


---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: How does Avalon load libraries???

Posted by Ulrich Mayring <ul...@denic.de>.
Eung-ju Park wrote:
> 
> Hi. Each application( sar ) is absolute seperated.
> each application has it's own ClassLoader.
> therefore block1 in app1 does not access block2 in app2.

Then why does it not work if I put all my jars in phoenix/lib? I like
that approach best, because I don't have multiple jars with potentially
different versions around.

Ulrich

-- 
Ulrich Mayring
DENIC eG, Systementwicklung

---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: How does Avalon load libraries???

Posted by Eung-ju Park <co...@isoft.co.kr>.
----- Original Message -----
From: "Ulrich Mayring" <ul...@denic.de>
To: <av...@jakarta.apache.org>
Sent: Monday, September 10, 2001 5:19 PM
Subject: How does Avalon load libraries???


> Hello,
>
> we have severe problems here with classloading, which we cannot
> reproduce at will. Sometimes jars in the general Avalon lib directory
> are not found by a block. Sometimes jars in a block's lib directory are
> found by other blocks (even by blocks in another .sar application),
> sometimes not even by their own block. Sometimes Avalon loads blocks and
> sars in alphabetical order, sometimes not. Something is seriously weird
> here and to put my finger on it I'd like to know how and when Avalon
> loads libraries in a multi-block, multi-sar environment like this:
>
> ~avalon/lib
>
> ~avalon/apps/foo.sar
> ~avalon/apps/foo/blocks/block1/lib
> ~avalon/apps/foo/blocks/block2/lib
>
> ~avalon/apps/bar.sar
> ~avalon/apps/bar/blocks/block3/lib
> ~avalon/apps/bar/blocks/block4/lib
>
> ~avalon/apps/baz.sar
> ~avalon/apps/baz/blocks/block5/lib
>
> Now, suppose block3 and block5 need the same jar - where do I put it?
> What is the general strategy of Avalon loading jars?


put to phoenix/lib jars which commonly used by applications.
put to ${app1}.sar/lib jars which commonly used by blocks in same
application.

do not put jars to bar. bar contain only blocks and classes.

Hi. Each application( sar ) is absolute seperated.
each application has it's own ClassLoader.
therefore block1 in app1 does not access block2 in app2.

>
> Thank you very much for any pointers,
>
> Ulrich
>
> --
> Ulrich Mayring
> DENIC eG, Systementwicklung
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: avalon-dev-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org