What you should probably do is create a HelloWorld interface and then have an impl that extends AbstractLogEnabled. For one, your cast will then work, as long as you cast to your interface, and it will allow you to have (potentially) different implementations of that same interface available within Fortress.

Just my .02 :-)

- Robert

Schaible, J�rg wrote:

Hello Fortress users,

currently I am trying to setup at least one little service in a webapp that has just a getHelloWorld method. I looked at the sample code for the servlets and adopted anything to my situation. Anything seems to run fine, unless I want to access my service. The returned object is a proxy and the cast fails therefore obviously - although I was following the implementation scheme with the translation component in the examples. Any hints?


The component:
=========== snip ==========
public class HelloWorld extends AbstractLogEnabled
{
public static String ROLE = HelloWorld.class.getName();
public String getHelloWorld( )
{
return "Hello World!";
}
}
=========== snap ==========


The initialisation in the ServletContainer, that tries to retrieve the component rising the CastException:
=========== snip ==========
public void initialize( ) throws Exception
{
super.initialize( );
m_HelloWorld = (HelloWorld) m_serviceManager.lookup( HelloWorld.ROLE );
}
=========== snap ==========


The role:
=========== snip ==========
<role name="demo.service.HelloWorld">
<component shorthand="hello"
class="demo.service.HelloWorld"
handler="org.apache.avalon.fortress.impl.handler.ThreadSafeComponentHandler"/>
</role>
=========== snap ==========



Another question arises with the logging.

Although I used the same xlog for my ServletContainer as in the example and I initialize also the context and home directories (what is the exact definition here for Fortress ?) to the same path, but the only log information I get is on the console (before the LogManager of the app is enabled) and the log file itself is not craeted at all. How can I switch the Factory in the xlog to a Console logger?

Regards,
J�rg

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to