cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dennis Riedel <dennis_rie...@web.de>
Subject Creating components - avalon component model
Date Mon, 01 Aug 2005 14:06:40 GMT
Hello
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.

Example:

MyComponentInterface component = null;

try {
   System.out.println("This line is executed");
   component = (MyComponentInterface) 
manager.lookup(MyComponentInterface.ROLE);
   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");
   manager.release(component);
}

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.

Dennis

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message