You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Ryan Shaw <ry...@silveregg.co.jp> on 2002/02/12 09:42:13 UTC

Applying Avalon in a (Jo!) Servlet Environment REDUX

Hello,

I would like to revive the discussion of Avalon-Servlet relations.

[Apologies for the crosspost.]

Previous discussion:
http://marc.theaimsgroup.com/?t=100811389300002&r=1&w=2

There seem to be two competing styles for using Avalon in a Servlet
environment (or using Servlets in an Avalon environment).

Style 1: Use the init() method of an initialization Servlet to create 
a ComponentManager (or ContainerManager, once the system package is 
stable) and place it in the ServletContext for your webapp. Use the
destroy() method of the initialization Servlet to dispose the 
ComponentManager/ContainerManager.

Style 2: Run your components inside of Phoenix and make them available
as a service which can be accessed via a socket connection using your
protocol of choice. Your servlets talk to your Phoenix service(s) via
socket connections.

We (Leif and I) have thus far used Style 1, since it is far simpler 
to get started. But now we are running into problems, because there
are no guarantees of the order in which the servlets will be destroyed,
so it is possible that the initialization Servlet (and thus the 
ComponentManager/ContainerManager) will be destroyed before the 
others.

In the Servlet 2.3 spec this kind of thing can be handled using
ServletContextListeners which listen for webapp startup and shutdown
events. So you would just implement a SCL which does the same thing
as the initialization Servlet mentioned above.

But this is not an option for Servlet 2.2 containers, like Jo!,
our servlet container of choice. We really don't want to go back
to the painful horror of Tomcat just to get this.

I'm still not too stoked about Style 2, though, since it seems like a 
lot of work and I am lazy.

Fortunately, Jo! can be run as a Phoenix block, which perhaps opens up
other possibilities. However, I know very little about how Phoenix
actually works at this point, so I'm not sure if what I have in mind 
is workable.

Basically, I want to create a Server Application with just two blocks,
MyBlock and Jo. MyBlock depends on Jo. MyBlock sets up a ComponentManager
or ContainerManager and stores it in a JNDI tree, then calls the deployWar
method of the Jo block. At Phoenix shutdown MyBlock calls undeployWar
and then disposes the ComponentManager/ContainerManager.

Does this make sense? Thoughts? Better ideas?

Thanks for reading,

Ryan








--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Applying Avalon in a (Jo!) Servlet Environment REDUX

Posted by Paul Hammant <Pa...@yahoo.com>.
Peter Donald wrote:

>On Tue, 12 Feb 2002 20:20, Paul Hammant wrote:
>
>>I think it makes sense.  We have some small issues with Jo and it's
>>parent classloaders for servlet (all jars in SAR-INF/libs are visible to
>>servlets), but you should be able to get your app working by careful
>>avoiding of duplicate jars in the war file.
>>
>
>Try to bug me lots this weekend so I remember to do the classloader stuff to 
>fix this ;)
>

** Bug bug bug ***

Proposal ->

  Two more hours are added to each day for Apache committers who have 
been active for more than three years.

+1 from me.

- Paul



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Applying Avalon in a (Jo!) Servlet Environment REDUX

Posted by Paul Hammant <Pa...@yahoo.com>.
Peter

>Try to bug me lots this weekend so I remember to do the classloader stuff to 
>fix this ;)
>
I will write an Ant Task just for you

<bug who="peter@apache.org" when="Saturday" freq="every hours">
  <echo>Peter do the classloader stuff</echo>
</bug>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Applying Avalon in a (Jo!) Servlet Environment REDUX

Posted by Peter Donald <pe...@apache.org>.
On Tue, 12 Feb 2002 20:20, Paul Hammant wrote:
> I think it makes sense.  We have some small issues with Jo and it's
> parent classloaders for servlet (all jars in SAR-INF/libs are visible to
> servlets), but you should be able to get your app working by careful
> avoiding of duplicate jars in the war file.

Try to bug me lots this weekend so I remember to do the classloader stuff to 
fix this ;)

-- 
Cheers,

Pete

------------------------------
Kitsch never goes out of style
------------------------------

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Applying Avalon in a (Jo!) Servlet Environment REDUX

Posted by Ryan Shaw <ry...@silveregg.co.jp>.
Paul wrote:

||| >||| Good lateral thinking to publish the CM.  I guess it would work, but 
||| >||| publishing to JNDI is not so trivial.  It is one of a few small things I 
||| >||| am stuck on with AltRMI. 
||| >
||| >Yeah, I don't really know much about JNDI. What kinds of problems are you
||| >running into?
|||
||| My problem is that I am example orientated.  I can;t understand 
||| something unless I see some examples.  There are supposed to be some 
||| JNDI publications in Tomcat and I might copy from there.

have you looked at the examples in the JNDI tutorial?

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Applying Avalon in a (Jo!) Servlet Environment REDUX

Posted by Paul Hammant <Pa...@yahoo.com>.
Ryan,

>||| Good lateral thinking to publish the CM.  I guess it would work, but 
>||| publishing to JNDI is not so trivial.  It is one of a few small things I 
>||| am stuck on with AltRMI. 
>
>Yeah, I don't really know much about JNDI. What kinds of problems are you
>running into?
>
My problem is that I am example orientated.  I can;t understand 
something unless I see some examples.  There are supposed to be some 
JNDI publications in Tomcat and I might copy from there.

- Paul H


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Applying Avalon in a (Jo!) Servlet Environment REDUX

Posted by Ryan Shaw <ry...@silveregg.co.jp>.
Paul wrote:

||| Ryan,
||| 
||| ><snip/>
||| >Basically, I want to create a Server Application with just two blocks,
||| >MyBlock and Jo. MyBlock depends on Jo. MyBlock sets up a ComponentManager
||| >or ContainerManager and stores it in a JNDI tree, then calls the deployWar
||| >method of the Jo block. At Phoenix shutdown MyBlock calls undeployWar
||| >and then disposes the ComponentManager/ContainerManager.
||| >
||| This is interesting and should work as you want.  You are talking of the 
||| CM in the JNDI tree because you hope you can achieve it (communication) 
||| without a socket connecton?

Yep.

||| Good lateral thinking to publish the CM.  I guess it would work, but 
||| publishing to JNDI is not so trivial.  It is one of a few small things I 
||| am stuck on with AltRMI. 

Yeah, I don't really know much about JNDI. What kinds of problems are you
running into?

||| >Does this make sense? Thoughts? Better ideas?
||| >
||| I think it makes sense.  We have some small issues with Jo and it's 
||| parent classloaders for servlet (all jars in SAR-INF/libs are visible to 
||| servlets), but you should be able to get your app working by careful 
||| avoiding of duplicate jars in the war file.

Okay, I'll keep that in mind. Thanks for the feedback!

Ryan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Applying Avalon in a (Jo!) Servlet Environment REDUX

Posted by Paul Hammant <Pa...@yahoo.com>.
Ryan,

><snip/>
>Basically, I want to create a Server Application with just two blocks,
>MyBlock and Jo. MyBlock depends on Jo. MyBlock sets up a ComponentManager
>or ContainerManager and stores it in a JNDI tree, then calls the deployWar
>method of the Jo block. At Phoenix shutdown MyBlock calls undeployWar
>and then disposes the ComponentManager/ContainerManager.
>
This is interesting and should work as you want.  You are talking of the 
CM in the JNDI tree because you hope you can achieve it (communication) 
without a socket connecton?
Good lateral thinking to publish the CM.  I guess it would work, but 
publishing to JNDI is not so trivial.  It is one of a few small things I 
am stuck on with AltRMI.  

>Does this make sense? Thoughts? Better ideas?
>
I think it makes sense.  We have some small issues with Jo and it's 
parent classloaders for servlet (all jars in SAR-INF/libs are visible to 
servlets), but you should be able to get your app working by careful 
avoiding of duplicate jars in the war file.

- Paul


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>