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!"; } }
Fortress *does* attempt to proxy components. What we have here should
be better rendered:
public interface HelloWorld
{
String ROLE = HelloWorld.class.getName();
String getHelloWorld();
}
public class DefaultHelloWorld
extends AbstractLogEnabled implements HelloWorld
{
public String getHelloWorld()
{
return "Hello World!";
}
}
This allows Fortress (and Merlin) to do what it needs to do behind the
scenes. What you were writing before was a JavaBean, not a component.
The general rule of thumb is that all Components have a separate
interface from the implementation. CORBA components are no exception
because the interface is defined--just in a neutral IDL.
> =========== 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 ==========
ClassCastException?
It seems odd that would happen rather than a general error in
initialization.
>
>
> 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?
The FortressConfig is what is used to assign those locations.
I personally set the Context root to be the Servlet's context root,
and the work directory to be where the Servlet's work directory.
In a servlet environment, you don't want a Console logger. You want
to send log events to the Servlet's log() command. That is done via
the LoggerManager.
Realistically speaking though, you want to reduce as many calls to the
Servlet's log() command as possible--and just send them to a file. That
would give you the ability to go back and determine what (if anything)
went wrong.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
- [Newbie] Fortess - Hello World webapp "Schaible, J�rg"
- Re: [Newbie] Fortess - Hello World webapp Robert McIntosh
- RE: [Newbie] Fortess - Hello World web... Berin Loritsch
- RE: [Newbie] Fortess - Hello World webapp "Schaible, J�rg"
- RE: [Newbie] Fortess - Hello World webapp "Schaible, J�rg"
- RE: [Newbie] Fortess - Hello World webapp "Schaible, J�rg"
- Re: [Newbie] Fortess - Hello World web... Berin Loritsch
- RE: [Newbie] Fortess - Hello World webapp "Schaible, J�rg"
- Re: [Newbie] Fortess - Hello World web... Berin Loritsch
- Re: [Newbie] Fortess - Hello World... Berin Loritsch
- RE: [Newbie] Fortess - Hello World webapp "Schaible, J�rg"
- RE: [Newbie] Fortess - Hello World webapp "Schaible, J�rg"
