<?xml version="1.0"?>
<role-list>
<role
name="Runner"
shorthand="runner"
default-class="DefaultRunner"/> </role-list>
This is my system.xconf file
<my-system> <runner/> </my-system>
And this is my main class file
public class TestFortress{
public static void main( String[] args )
throws Exception
{final FortressConfig config = new FortressConfig();
config.setContextDirectory("");
config.setWorkDirectory("");
config.setContainerConfiguration("system.xconf" );
config.setRoleManagerConfiguration("report.roles");
//config.setLoggerManagerConfiguration("logkit.xconf");ContainerManager cm = new
DefaultContainerManager(config.getContext());
ContainerUtil.initialize( cm );
DefaultContainer container = (DefaultContainer) cm.getContainer();
ServiceManager manager = container.getServiceManager();
Runner service = (Runner) manager.lookup(Runner.ROLE);
System.out.println(service.getName());
container.getServiceManager().release(service); org.apache.avalon.framework.container.ContainerUtil.dispose( cm ); } }
This is Runner.java
public interface Runner {
public static final String ROLE="Runner";
public String getName();
}This is DefaultRunner.java
public class DefaultRunner implements Runner { public String getName() { return ROLE; } }
Below is the jar files I used
avalon-framework-4.1.5.jar commons-collections-2.1.jar crimson.jar excalibur-fortress-complete-1.0.jar excalibur-lifecycle-1.0.jar excalibur-util-concurrent-1.3.1.jar logkit-1.2.jar xalan.jar xerces.jar
when I ran the main class,there was an exception:
org.apache.avalon.framework.service.ServiceException: Unable to provide implementation for Runner (Key='Runner')
at org.apache.avalon.framework.service.DefaultServiceManager.lookup(DefaultServiceManager.java:117)
at org.apache.avalon.fortress.util.ContextManager$EAServiceManager.lookup(ContextManager.java:1042)
at org.apache.avalon.fortress.impl.lookup.FortressServiceManager.lookup(FortressServiceManager.java:106)
at TestFortress.main(TestFortress.java:33)
and when I debug the code and ran to breakpoint at Runner service = (Runner) manager.lookup(Runner.ROLE); it kept throwing out this exception
java.lang.AbstractMethodError: org/apache/excalibur/event/impl/AbstractQueue.enqueue
at org.apache.excalibur.event.command.AbstractThreadManager$PipelineRunner.run(AbstractThreadManager.java:310)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:727)
at java.lang.Thread.run(Thread.java:484)
so what happened to the code? anything is wrong with my code?
Thanks Mike
_________________________________________________________________
免费下载 MSN Explorer: http://explorer.msn.com/lccn/
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
