You could grap a copy of the source file reference below and include it in with your other sources. Its a class that handles exception reporting and will list out of the cuasal exception messages followed by a stack track of the root exception.
http://cvs.apache.org/viewcvs.cgi/avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/util/ExceptionHelper.java
Here is a usage example:
try
{
// whatever
}
catch( Throwable e )
{
String problem = ExceptionHelper.packException( "Woops", e, true );
System.out.println( problem );
}Cheers, Steve.
Jens Kintrup wrote:
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]
--
Stephen J. McConnell mailto:[EMAIL PROTECTED] http://www.osm.net
Sent via James running under Merlin as an NT service. http://avalon.apache.org/sandbox/merlin
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
