You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hivemind.apache.org by Aleksej <al...@ivs.lt> on 2005/07/29 12:16:53 UTC

Using hivemind in servlets and pointing modules locations in general

Hi!
I have such problem:
In web-application I use HiveMindFilter as showen in hivemind documentation.
there is xxx.services and xxx.servives.impl packages, where first 
contains interfaces
and second implementations. In web.inf i have such entry:
----------
<filter>
   <filter-name>HiveMindFilter</filter-name>
   <filter-class>org.apache.hivemind.servlet.HiveMindFilter</filter-class>
</filter>
<servlet>
   <servlet-name>App</servlet-name>
   <servlet-class>org.apache.tapestry.ApplicationServlet</servlet-class>
</servlet>
<filter-mapping>
   <filter-name>HiveMindFilter</filter-name>
   <servlet-name>App</servlet-name>
</filter-mapping>   
----------
in WEB-INF there is hivemodule.xml file which looks like that:
----------
<?xml version="1.0"?>
<module id="xxx.services" version="1.0.0" package="xxx.services">
    <service-point id="Counter" interface="Counter">
        <create-instance class="impl.CounterImpl" />
    </service-point>
</module>
----------
there is xxx.services.Couner.java and xxx.services.impl.CounterImpl.java 
files
and my code looks like:
----------
Registry registry= RegistryBuilder.constructDefaultRegistry();
Counter test= (Counter) registry.getService( "Counter", Counter.class );
----------

but I got such exceptions:
org.apache.hivemind.impl.RegistryInfrastructureImpl.getServicePoint(RegistryInfrastructureImpl.java:177) 
org.apache.hivemind.impl.RegistryInfrastructureImpl.getService(RegistryInfrastructureImpl.java:203) 

org.apache.hivemind.impl.RegistryImpl.getService(RegistryImpl.java:68)

I think I miss something but really can't understand what.
Documentaion claims that filter will inicialize registry using 
WEB-INF/hivemodule.xml
but I am not sure about it. Maybe module description is incorrect? I am 
stuck...

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org


RE: confuze with service model

Posted by James Carman <ja...@carmanconsulting.com>.
No, the beta should be fine for this.  Can you show us the code you use to
ask the registry for the Counter service and then subsequently call methods
on it?  Show us the code you use to do it multiple times?



-----Original Message-----
From: Aleksej [mailto:aleksej@ivs.lt] 
Sent: Monday, August 01, 2005 2:12 AM
To: hivemind-user@jakarta.apache.org
Subject: Re: confuze with service model

James Carman wrote:

>What version of HM are you using?
>
>-----Original Message-----
>From: Aleksej [mailto:aleksej@ivs.lt] 
>Sent: Friday, July 29, 2005 8:46 AM
>To: hivemind-user@jakarta.apache.org
>Subject: confuze with service model
>
>Having such simple service description as:
>-----
>    <service-point id="Counter" interface="mediena.services.Counter">
>        <create-instance class="impl.CounterImpl" model="singleton"/>
>    </service-point>
>-----
>
>where Counter interface looks like this:
>-----
>    int getCounter();
>    void increaseCounter( int value );
>-----
>
>and CounterImpl keeps counter value and logs each method I found that 
>every time
>I ask registry for Counter service and call any method, registry creates 
>new instance of
>Service. I call them from the same thread and even from the same 
>method... By default service
>is sigleton, but even not defining model at all behaviour is still the
same.
>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
>
>
>
>  
>
I am using 1.1beta2. Do I need to use 1.0? How stable beta2 is?

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org


Re: confuze with service model

Posted by Aleksej <al...@ivs.lt>.
James Carman wrote:

>What version of HM are you using?
>
>-----Original Message-----
>From: Aleksej [mailto:aleksej@ivs.lt] 
>Sent: Friday, July 29, 2005 8:46 AM
>To: hivemind-user@jakarta.apache.org
>Subject: confuze with service model
>
>Having such simple service description as:
>-----
>    <service-point id="Counter" interface="mediena.services.Counter">
>        <create-instance class="impl.CounterImpl" model="singleton"/>
>    </service-point>
>-----
>
>where Counter interface looks like this:
>-----
>    int getCounter();
>    void increaseCounter( int value );
>-----
>
>and CounterImpl keeps counter value and logs each method I found that 
>every time
>I ask registry for Counter service and call any method, registry creates 
>new instance of
>Service. I call them from the same thread and even from the same 
>method... By default service
>is sigleton, but even not defining model at all behaviour is still the same.
>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
>
>
>
>  
>
I am using 1.1beta2. Do I need to use 1.0? How stable beta2 is?

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org


RE: confuze with service model

Posted by James Carman <ja...@carmanconsulting.com>.
What version of HM are you using?

-----Original Message-----
From: Aleksej [mailto:aleksej@ivs.lt] 
Sent: Friday, July 29, 2005 8:46 AM
To: hivemind-user@jakarta.apache.org
Subject: confuze with service model

Having such simple service description as:
-----
    <service-point id="Counter" interface="mediena.services.Counter">
        <create-instance class="impl.CounterImpl" model="singleton"/>
    </service-point>
-----

where Counter interface looks like this:
-----
    int getCounter();
    void increaseCounter( int value );
-----

and CounterImpl keeps counter value and logs each method I found that 
every time
I ask registry for Counter service and call any method, registry creates 
new instance of
Service. I call them from the same thread and even from the same 
method... By default service
is sigleton, but even not defining model at all behaviour is still the same.





---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org


confuze with service model

Posted by Aleksej <al...@ivs.lt>.
Having such simple service description as:
-----
    <service-point id="Counter" interface="mediena.services.Counter">
        <create-instance class="impl.CounterImpl" model="singleton"/>
    </service-point>
-----

where Counter interface looks like this:
-----
    int getCounter();
    void increaseCounter( int value );
-----

and CounterImpl keeps counter value and logs each method I found that 
every time
I ask registry for Counter service and call any method, registry creates 
new instance of
Service. I call them from the same thread and even from the same 
method... By default service
is sigleton, but even not defining model at all behaviour is still the same.





---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org


RE: Using hivemind in servlets and pointing modules locations in general

Posted by James Carman <ja...@carmanconsulting.com>.
It can be placed in either location, using the HiveMindFilter.

-----Original Message-----
From: Aleksej [mailto:aleksej@ivs.lt] 
Sent: Friday, July 29, 2005 8:35 AM
To: hivemind-user@jakarta.apache.org
Subject: Re: Using hivemind in servlets and pointing modules locations in
general

The problem was in incorrect documentation.
As described here http://jakarta.apache.org/hivemind/filter.html 
hivemodule.xml
must be placed in WEB-INF catalog, but later I found that it is required in
WEB-INF/classes/META-INF. I must say, that it is not very easy to find 
something
in project documentation :(



---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org


Re: Using hivemind in servlets and pointing modules locations in general

Posted by Aleksej <al...@ivs.lt>.
The problem was in incorrect documentation.
As described here http://jakarta.apache.org/hivemind/filter.html 
hivemodule.xml
must be placed in WEB-INF catalog, but later I found that it is required in
WEB-INF/classes/META-INF. I must say, that it is not very easy to find 
something
in project documentation :(



---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org


Re: Using hivemind in servlets and pointing modules locations in general

Posted by Achim Huegen <ac...@gmx.de>.
The full service name is xxx.services.Counter since
you defined id="xxx.services" .
Try : registry.getService( "xxx.services.Counter", Counter.class );

Achim


Aleksej wrote:
> Hi!
> I have such problem:
> In web-application I use HiveMindFilter as showen in hivemind 
> documentation.
> there is xxx.services and xxx.servives.impl packages, where first 
> contains interfaces
> and second implementations. In web.inf i have such entry:
> ----------
> <filter>
>   <filter-name>HiveMindFilter</filter-name>
>   <filter-class>org.apache.hivemind.servlet.HiveMindFilter</filter-class>
> </filter>
> <servlet>
>   <servlet-name>App</servlet-name>
>   <servlet-class>org.apache.tapestry.ApplicationServlet</servlet-class>
> </servlet>
> <filter-mapping>
>   <filter-name>HiveMindFilter</filter-name>
>   <servlet-name>App</servlet-name>
> </filter-mapping>   ----------
> in WEB-INF there is hivemodule.xml file which looks like that:
> ----------
> <?xml version="1.0"?>
> <module id="xxx.services" version="1.0.0" package="xxx.services">
>    <service-point id="Counter" interface="Counter">
>        <create-instance class="impl.CounterImpl" />
>    </service-point>
> </module>
> ----------
> there is xxx.services.Couner.java and xxx.services.impl.CounterImpl.java 
> files
> and my code looks like:
> ----------
> Registry registry= RegistryBuilder.constructDefaultRegistry();
> Counter test= (Counter) registry.getService( "Counter", Counter.class );
> ----------
> 
> but I got such exceptions:
> org.apache.hivemind.impl.RegistryInfrastructureImpl.getServicePoint(RegistryInfrastructureImpl.java:177) 
> org.apache.hivemind.impl.RegistryInfrastructureImpl.getService(RegistryInfrastructureImpl.java:203) 
> 
> org.apache.hivemind.impl.RegistryImpl.getService(RegistryImpl.java:68)
> 
> I think I miss something but really can't understand what.
> Documentaion claims that filter will inicialize registry using 
> WEB-INF/hivemodule.xml
> but I am not sure about it. Maybe module description is incorrect? I am 
> stuck...
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org


Re: Using hivemind in servlets and pointing modules locations in general

Posted by Aleksej <al...@ivs.lt>.
Aleksej wrote:

> Hi!
> I have such problem:
> In web-application I use HiveMindFilter as showen in hivemind 
> documentation.
> there is xxx.services and xxx.servives.impl packages, where first 
> contains interfaces
> and second implementations. In web.inf i have such entry:
> ----------
> <filter>
>   <filter-name>HiveMindFilter</filter-name>
>   <filter-class>org.apache.hivemind.servlet.HiveMindFilter</filter-class>
> </filter>
> <servlet>
>   <servlet-name>App</servlet-name>
>   <servlet-class>org.apache.tapestry.ApplicationServlet</servlet-class>
> </servlet>
> <filter-mapping>
>   <filter-name>HiveMindFilter</filter-name>
>   <servlet-name>App</servlet-name>
> </filter-mapping>   ----------
> in WEB-INF there is hivemodule.xml file which looks like that:
> ----------
> <?xml version="1.0"?>
> <module id="xxx.services" version="1.0.0" package="xxx.services">
>    <service-point id="Counter" interface="Counter">
>        <create-instance class="impl.CounterImpl" />
>    </service-point>
> </module>
> ----------
> there is xxx.services.Couner.java and 
> xxx.services.impl.CounterImpl.java files
> and my code looks like:
> ----------
> Registry registry= RegistryBuilder.constructDefaultRegistry();
> Counter test= (Counter) registry.getService( "Counter", Counter.class );
> ----------
>
> but I got such exceptions:
> org.apache.hivemind.impl.RegistryInfrastructureImpl.getServicePoint(RegistryInfrastructureImpl.java:177) 
> org.apache.hivemind.impl.RegistryInfrastructureImpl.getService(RegistryInfrastructureImpl.java:203) 
>
> org.apache.hivemind.impl.RegistryImpl.getService(RegistryImpl.java:68)
>
> I think I miss something but really can't understand what.
> Documentaion claims that filter will inicialize registry using 
> WEB-INF/hivemodule.xml
> but I am not sure about it. Maybe module description is incorrect? I 
> am stuck...
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
>
>
>
Oh, by the way, excepiton message is:
Service point Counter does not exist :)

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org