cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dennis Riedel <>
Subject Creating components - avalon component model
Date Mon, 01 Aug 2005 14:06:40 GMT
I want to write my own components and access them from other components 
or classes within my application.
I followed the instructions how to create a component and accessed it 
through FlowScript using cocoon.getComponent().

That worked. But when I try to get the component through the 
ServiceManager in a class that implements Serviceable it doesn`t work. 
It seems to hang when it comes to the line where 
manager.lookup(MyComponentInterface.ROLE); tries to get the instance.

After that no code is executed, only the finally statement where I try 
to release the component. But there it throws a NullPointerException.


MyComponentInterface component = null;

try {
   System.out.println("This line is executed");
   component = (MyComponentInterface) 
   System.out.println("This line is not executed");
}catch(ServiceException e) {
   System.out.println("Nothing gets executed here.");
}finally {
   System.out.println("Finally is executed but throws 
NullPointerException when running next line");

Ok. NullPointer is normal because it was declared null at first.

But why does lookup work with FlowScripts getComponent() but not when 
using classes and the ServiceManager?

Thanks for any ideas or help.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message