hi,all
This problem puzzle me ,and I had debuged the system ,but still not resolve this
problem ,help me!
my Role Manager conf is :
<role-list>
........................
<role name="test.avalon.framework.RoleASelector"
shorthand="RoleA"
default-class="org.apache.avalon.excalibur.component.ExcaliburComponentSelector">
<hint shorthand="default"
class="test.avalon.framework.DefaultRoleA"/>
<hint shorthand="example"
class="test.avalon.framework.ExampleRoleA"/>
</role>
<role name="test.avalon.framework.RoleB"
shorthand="RoleB"
default-class="test.avalon.framework.DefaultRoleB"/>
..........................
</role-list>
and System initialize as follow:
.............
initialized = true;
Logger logger = new Log4JLogger(Log4JUtil.getLogger("test"));
manager.enableLogging(logger);
manager.contextualize(new DefaultContext());
DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder(false);
String uri =
CPResourceLoader.getResource("roles.xml").toString();
Configuration roleConf = builder.build(uri);
DefaultRoleManager rm = new DefaultRoleManager();
rm.enableLogging(logger);
rm.configure(roleConf);
manager.setRoleManager(rm);
Configuration sysConf =
builder.build(CPResourceLoader.getResource("example.xml").toString());
manager.configure(sysConf);
manager.configure(new DefaultConfiguration("", ""));
manager.initialize();
....................
I user junit framework test the manager ,the code is
public void testSelectorForA() throws Exception{
Log.print("begin to test look up RoleA");
ComponentSelector select = (ComponentSelector)manager.lookup(RoleA.ROLE +
"Selector");
this.assertNotNull("message for not null assert!",select);
........................
}
The test work is failed, the error is :
701 [main] DEBUG test - looking up shorthand RoleA, returning
test.avalon.framework.RoleASelector
701 [main] DEBUG test - Adding component (test.avalon.framework.RoleASelector =
org.apache.avalon.excalibur.component.ExcaliburComponentSelector)
701 [main] DEBUG test - Attempting to get Handler for:
test.avalon.framework.RoleASelector
701 [main] DEBUG test - Handler type =
org.apache.avalon.excalibur.component.ThreadSafeComponentHandler
701 [main] DEBUG test - looking up shorthand RoleB, returning
test.avalon.framework.RoleB
721 [main] DEBUG test - Adding component (test.avalon.framework.RoleB =
test.avalon.framework.DefaultRoleB)
721 [main] DEBUG test - Attempting to get Handler for: test.avalon.framework.RoleB
721 [main] DEBUG test - Handler type =
org.apache.avalon.excalibur.component.DefaultComponentHandler
721 [main] DEBUG test - looking up shorthand RoleC, returning
test.avalon.framework.RoleC
721 [main] DEBUG test - Adding component (test.avalon.framework.RoleC =
test.avalon.framework.PoolableTestObject)
721 [main] DEBUG test - Attempting to get Handler for: test.avalon.framework.RoleC
721 [main] DEBUG test - Handler type =
org.apache.avalon.excalibur.component.PoolableComponentHandler
721 [main] DEBUG test - ComponentFactory creating new instance of
org.apache.avalon.excalibur.component.ExcaliburComponentSelector.
721 [main] ERROR test - Caught an exception trying to initialize the component
handler.
java.lang.NullPointerException
at
org.apache.avalon.excalibur.component.DefaultComponentFactory.newInstance(DefaultComponentFactory.java:180)
at
org.apache.avalon.excalibur.component.ThreadSafeComponentHandler.initialize(ThreadSafeComponentHandler.java:98)
at org.apache.avalon.excalibur.component.ExcaliburComponentManager.initialize
DefaultComponentFactory.java:180 is:
178 if( component instanceof LogKitManageable )
179 {
180 ( (LogKitManageable)component ).setLogKitManager(
m_logkit.getLogKitManager() );
181 }
class ExcaliburComponentSelector is also implements LogKitManageable interface.
I already used log4j.Does the EMC also need LogKit???
The NullPointerException looks like the log system raised,I use
excalibur-*-20020622.jar.
the avalon project Log system really confusing me!?
----------------
/|/|
| -''/"',___,,--''"`-,_
`6_ 6 ) `-, ( ),`-.__.`)
/_Y_./',, _ ) `._ `,``-..-'
_.'.`=' _ / / --'_.','
(il)' (li)'' ((!-'
* [EMAIL PROTECTED]
* 571-85022088-3019