May be I do something wrong.
I wrote in the server.xml in
<GlobalNamingResources>
   <Resource name="bean/HivemindRegistry" auth="Container"
             type="org.apache.hivemind.Registry"
      description="Global Hivemind registry"
          factory="com.intersolved.hawk.web.HiveMindFactory"
          />
</GlobalNamingResources>

In the log file I see that my factory is invoked. I can see my registry via jconcole (because tomcat registries it in the JMX)
But in the filter of the web application I can not get it
               Context initCtx = new InitialContext();
Context javaCtx = (Context) initCtx.lookup("java:comp/env"); registry = (Registry) javaCtx.lookup("bean/HivemindRegistry");
I get NameNotFound exception.

By the way how can I stop this registry (constructed in such way) when tomcat will be shutdown.

Best Regards,
        Dmitry



Schulte Marcus wrote:

I think, the canonical way to do this in Tomcat, is defining a global
Resource in Tomcat with a custom ResourceFactory which sets up your Registry
using
RegistryBuilder. In server.xml that would look like
<Resource name="HivemindRegistry" auth="Container"
             type="org.apache.hivemind.Registry"
      description="the HivemindRegistry"
          factory="some.package.MyRegistryFactory" />

Note, that afaik Webapps cannot access global JNDI-Ressources directly.
You'll have to map it into the local namespace (java:comp/env) via
resource-env-ref / ResourceLink in your web.xml / context.xml.
hth,
Marcus


-----Original Message-----
From: Dmitry Kozakov [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 28, 2005 9:29 AM
To: [email protected]
Subject: Re: Hivemind+Tomcat


I tried to put registry to the JNDI int the LifecycleListener

Context initCtx = new InitialContext();
initCtx.bind(HIVEMIND_REGISTRY_KEY,registry);

but I can not access to it at any web aaplication.

Code generate unboun exception
Context initCtx = new InitialContext();
initCtx.lookup(HIVEMIND_REGISTRY_KEY);

Best Regards,
        Dmitry



Heiko Braun wrote:

Hi Dmitry,

the registry itself is threadsafe. you only need to take care when constructing it. that means you can either run it as a singleton or add it to a jndi context.
these are probably the simpliest solutions, i think.

btw. does someone know about any performance issues
when running a single registry in a heavily mutlithreaded
environment?
hth, heiko

Dmitry Kozakov schrieb:

Hi
Hivemind has filter which can be set for web application
and can be used for working with registry.
But I want to setup Registry for all application which
will be started
under Tomcat. It is possible to write LifecycleListener for Tomcat
and init/shutdown Registry there. But how to access that registry
in the web applications. I did not find any solutions.
May be somebody
confront with this problem?

Best Regards,
   Dmitry






---------------------------------------------------------------------
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]


---------------------------------------------------------------------
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