Hello,

I am new to this list, this is my first posting and first of all, I want to
say 'thank's' to the avalon developer community. It think its a very nice
pice of software and I enjoyed it very much to learn about it.

And now my question: I have tried to use the
org.apache.avalon.framework.component.DataSourceComponent in a little
Application build on fortress. I did some mistakes in the Configuration
Files (roles) - it was not valid XML. At Application startup i got the
following Error:

     [java] org.apache.avalon.fortress.InitializationException: Cannot set
up Container. Startup lifecycle failure
     [java]     at
org.apache.avalon.fortress.impl.DefaultContainerManager.createContainer(Defa
ultContainerManager.java:230)
     [java]     at
org.apache.avalon.fortress.impl.DefaultContainerManager.initializeContainer(
DefaultContainerManager.java:167)
     [java]     at
org.apache.avalon.fortress.impl.DefaultContainerManager.initialize(DefaultCo
ntainerManager.java:160)
     [java]     at
org.apache.avalon.framework.container.ContainerUtil.initialize(ContainerUtil
.java:282)
     [java]     at
net.kintrup.learning.avalon.simple.Main.main(Main.java:31)

The general Startup lifecycle failure message did *not* lead me to the real
error - an incorrect Configuration in the roles file. I took a look at the
source code (the DefaultContainerManager in this case) and found out, that
avalon uses a kind of nested Exceptions. Is this true? If yes, how do I get
the "real root cause" of the Error message? I tried something like
(Main.java - nearly the same as in the example)
try {

String res = "resource://my/ressources";

final FortressConfig config = new FortressConfig();

config.setContainerConfiguration( res + "/SimpleContainer.xconf");

config.setRoleManagerConfiguration( res + "/SimpleContainer.roles");

config.setLoggerManagerConfiguration( res + "/SimpleContainer.xlog" );

ContainerManager cm = new DefaultContainerManager( config.getContext() );

ContainerUtil.initialize( cm );


DefaultContainer container = (DefaultContainer)cm.getContainer();

SimpleComponent simple =
(SimpleComponent)container.getServiceManager().lookup(
SimpleComponent.ROLE );

System.out.println( "SimpleComponent says: " + simple.getName() );

container.getServiceManager().release( simple );

ContainerUtil.dispose( cm );

} catch( Exception e) {

e.printStackTrace();

while( e.getCause() != null ) {

if( e instanceof Exception ) {

e = (Exception)e.getCause();

}

e.printStackTrace();

}

}

This did not work. Do I overlook something in Error Handling?

Thank you very much for your help,
Jens



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to