You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hivemind.apache.org by Vinicius Carvalho <ja...@gmail.com> on 2005/08/08 22:36:55 UTC

Re: Newbie question

Hello there! Yeah, unless your class has a constructor you must tell
it what setters to use, at least the same problem was happening to me
and I solved (Actually, Hugo Palma gave me the hint :D )

 <service-point id="localPortals"
    interface="RLocalPortals"/>
 <implementation service-id="localPortals">
      <invoke-factory>
        <construct class="impl.RLocalPortalsImpl">
             <set-object property="session" value="service:sessionFactory"/>
        </construct>
      </invoke-factory>
 </implementation>

Cheers


On 8/8/05, Ron Piterman <rp...@gmx.net> wrote:
> Hi,
> I use the hibernate example from howards article in TSS, but I am not
> sure I understand HiveMind correctly:
> 
> When I define a service for Interface X, and in the implementation class
> of some other service, I add a setter: setBla(X x), hivemind should set
> an X instance to the Service implementation automatically?
> 
> Or do I have to explicitly add <set-service... to each factory ?
> 
> 
> In a repository implementation , the hibernate session is not being set.
> 
> Nothing on the logs (DEBUG level) - how do I get to the source of the
> problem?
> 
> 
> Here are some files...
> Thanx, Ron
> 
> 
> ...
> <service-point id="sessionFactory"
>    interface="org.apache.hivemind.ServiceImplementationFactory"
>    parameters-occurs="none"/>
> 
> <service-point id="session" interface="org.hibernate.Session"/>
> ...
> 
> <service-point id="localPortals"
>    interface="RLocalPortals"/>
> <implementation service-id="localPortals">
>      <invoke-factory>
>        <construct class="impl.RLocalPortalsImpl"/>
>      </invoke-factory>
> </implementation>
> 
> ---
> 
> public class RLocalPortalsImpl extends AbstractRepositoryImpl implements
> RLocalPortals {
> 
>    public List getRegistrationCountries() {
>      Query q =
>        session.getNamedQuery("registration-countries");  // *NullPExcep*
>      return q.list();
>    }
>    public void setSession(Session session) {
>      this.session = session;
>    }
> }
> 
> ---
> 
> On the session.getNamedQuery(...) I get a null pointer exception,
> meaning the session is null :-(
> 
> Wo what did I do wrong?
> 
> 
> 
> ---------------------------------------------------------------------
> 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: Newbie question

Posted by Ron Piterman <rp...@gmx.net>.
Sorry for that - its just that howard's name was on the article...

now it seems autowiring does not function (in my case). Where do I look?
How come that DEBUG logging in hivemind yealds that little ?

ציטוט James Carman:
> Yes, provided everything is configured correctly, your dependency should be
> "autowired" in.  I'm working on an HSQLDB-based version of my (by the way I
> wrote that article not Howard...of course he helped me proofread).  Anyway,
> I'm going to make available via my subversion repository momentarily (as
> soon as I can figure out how to configure SVN-Apache to only show certain
> project) and I'll send out an email showing you how to access it.  I'm not
> sure if I can make it available on the Apache site given that it uses
> third-party libraries.  I'm not a licensing expert, so I don't want to break
> any rules.
> 
> 
> 
> -----Original Message-----
> From: Achim Hügen [mailto:achim.huegen@gmx.de] 
> Sent: Monday, August 08, 2005 5:11 PM
> To: hivemind-user@jakarta.apache.org
> Subject: Re: Newbie question
> 
> No, actually Vinicius is right.
> In this case autowiring of properties should happen.
> If both of you have suffered from this problem, could you please
> make a small test case and open an issue? 
> (http://issues.apache.org/jira/secure/BrowseProject.jspa?id=10500).
> 
> Thanks
> Achim
> 
> 
> Am Mon, 8 Aug 2005 17:36:55 -0300 schrieb Vinicius Carvalho 
> <ja...@gmail.com>:
> 
> 
>>Hello there! Yeah, unless your class has a constructor you must tell
>>it what setters to use, at least the same problem was happening to me
>>and I solved (Actually, Hugo Palma gave me the hint :D )
>>
>> <service-point id="localPortals"
>>    interface="RLocalPortals"/>
>> <implementation service-id="localPortals">
>>      <invoke-factory>
>>        <construct class="impl.RLocalPortalsImpl">
>>             <set-object property="session" 
>>value="service:sessionFactory"/>
>>        </construct>
>>      </invoke-factory>
>> </implementation>
>>
>>Cheers
>>
>>
>>On 8/8/05, Ron Piterman <rp...@gmx.net> wrote:
>>
>>>Hi,
>>>I use the hibernate example from howards article in TSS, but I am not
>>>sure I understand HiveMind correctly:
>>>
>>>When I define a service for Interface X, and in the implementation class
>>>of some other service, I add a setter: setBla(X x), hivemind should set
>>>an X instance to the Service implementation automatically?
>>>
>>>Or do I have to explicitly add <set-service... to each factory ?
>>>
>>>
>>>In a repository implementation , the hibernate session is not being set.
>>>
>>>Nothing on the logs (DEBUG level) - how do I get to the source of the
>>>problem?
>>>
>>>
>>>Here are some files...
>>>Thanx, Ron
>>>
>>>
>>>...
>>><service-point id="sessionFactory"
>>>   interface="org.apache.hivemind.ServiceImplementationFactory"
>>>   parameters-occurs="none"/>
>>>
>>><service-point id="session" interface="org.hibernate.Session"/>
>>>...
>>>
>>><service-point id="localPortals"
>>>   interface="RLocalPortals"/>
>>><implementation service-id="localPortals">
>>>     <invoke-factory>
>>>       <construct class="impl.RLocalPortalsImpl"/>
>>>     </invoke-factory>
>>></implementation>
>>>
>>>---
>>>
>>>public class RLocalPortalsImpl extends AbstractRepositoryImpl implements
>>>RLocalPortals {
>>>
>>>   public List getRegistrationCountries() {
>>>     Query q =
>>>       session.getNamedQuery("registration-countries");  // *NullPExcep*
>>>     return q.list();
>>>   }
>>>   public void setSession(Session session) {
>>>     this.session = session;
>>>   }
>>>}
>>>
>>>---
>>>
>>>On the session.getNamedQuery(...) I get a null pointer exception,
>>>meaning the session is null :-(
>>>
>>>Wo what did I do wrong?
>>>
>>>
>>>
>>>---------------------------------------------------------------------
>>>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
>>
> 
> 
> 
> 
> ---------------------------------------------------------------------
> 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: Newbie question

Posted by James Carman <ja...@carmanconsulting.com>.
The hivemind article example code is available via SVN at...

http://www.carmanconsulting.com/svn/public/hivemind-article

For those of you who use IDEA, the project files are checked into SVN, so it
should be quite easy to get up and running.  Let me know if you have any
trouble downloading/using it (I'm trying to become a Subversion expert, but
I'm not there yet).

-----Original Message-----
From: James Carman [mailto:james@carmanconsulting.com] 
Sent: Monday, August 08, 2005 5:32 PM
To: hivemind-user@jakarta.apache.org
Subject: RE: Newbie question

Yes, provided everything is configured correctly, your dependency should be
"autowired" in.  I'm working on an HSQLDB-based version of my (by the way I
wrote that article not Howard...of course he helped me proofread).  Anyway,
I'm going to make available via my subversion repository momentarily (as
soon as I can figure out how to configure SVN-Apache to only show certain
project) and I'll send out an email showing you how to access it.  I'm not
sure if I can make it available on the Apache site given that it uses
third-party libraries.  I'm not a licensing expert, so I don't want to break
any rules.



-----Original Message-----
From: Achim Hügen [mailto:achim.huegen@gmx.de] 
Sent: Monday, August 08, 2005 5:11 PM
To: hivemind-user@jakarta.apache.org
Subject: Re: Newbie question

No, actually Vinicius is right.
In this case autowiring of properties should happen.
If both of you have suffered from this problem, could you please
make a small test case and open an issue? 
(http://issues.apache.org/jira/secure/BrowseProject.jspa?id=10500).

Thanks
Achim


Am Mon, 8 Aug 2005 17:36:55 -0300 schrieb Vinicius Carvalho 
<ja...@gmail.com>:

> Hello there! Yeah, unless your class has a constructor you must tell
> it what setters to use, at least the same problem was happening to me
> and I solved (Actually, Hugo Palma gave me the hint :D )
>
>  <service-point id="localPortals"
>     interface="RLocalPortals"/>
>  <implementation service-id="localPortals">
>       <invoke-factory>
>         <construct class="impl.RLocalPortalsImpl">
>              <set-object property="session" 
> value="service:sessionFactory"/>
>         </construct>
>       </invoke-factory>
>  </implementation>
>
> Cheers
>
>
> On 8/8/05, Ron Piterman <rp...@gmx.net> wrote:
>> Hi,
>> I use the hibernate example from howards article in TSS, but I am not
>> sure I understand HiveMind correctly:
>>
>> When I define a service for Interface X, and in the implementation class
>> of some other service, I add a setter: setBla(X x), hivemind should set
>> an X instance to the Service implementation automatically?
>>
>> Or do I have to explicitly add <set-service... to each factory ?
>>
>>
>> In a repository implementation , the hibernate session is not being set.
>>
>> Nothing on the logs (DEBUG level) - how do I get to the source of the
>> problem?
>>
>>
>> Here are some files...
>> Thanx, Ron
>>
>>
>> ...
>> <service-point id="sessionFactory"
>>    interface="org.apache.hivemind.ServiceImplementationFactory"
>>    parameters-occurs="none"/>
>>
>> <service-point id="session" interface="org.hibernate.Session"/>
>> ...
>>
>> <service-point id="localPortals"
>>    interface="RLocalPortals"/>
>> <implementation service-id="localPortals">
>>      <invoke-factory>
>>        <construct class="impl.RLocalPortalsImpl"/>
>>      </invoke-factory>
>> </implementation>
>>
>> ---
>>
>> public class RLocalPortalsImpl extends AbstractRepositoryImpl implements
>> RLocalPortals {
>>
>>    public List getRegistrationCountries() {
>>      Query q =
>>        session.getNamedQuery("registration-countries");  // *NullPExcep*
>>      return q.list();
>>    }
>>    public void setSession(Session session) {
>>      this.session = session;
>>    }
>> }
>>
>> ---
>>
>> On the session.getNamedQuery(...) I get a null pointer exception,
>> meaning the session is null :-(
>>
>> Wo what did I do wrong?
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>



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




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


RE: Newbie question

Posted by James Carman <ja...@carmanconsulting.com>.
Yes, provided everything is configured correctly, your dependency should be
"autowired" in.  I'm working on an HSQLDB-based version of my (by the way I
wrote that article not Howard...of course he helped me proofread).  Anyway,
I'm going to make available via my subversion repository momentarily (as
soon as I can figure out how to configure SVN-Apache to only show certain
project) and I'll send out an email showing you how to access it.  I'm not
sure if I can make it available on the Apache site given that it uses
third-party libraries.  I'm not a licensing expert, so I don't want to break
any rules.



-----Original Message-----
From: Achim Hügen [mailto:achim.huegen@gmx.de] 
Sent: Monday, August 08, 2005 5:11 PM
To: hivemind-user@jakarta.apache.org
Subject: Re: Newbie question

No, actually Vinicius is right.
In this case autowiring of properties should happen.
If both of you have suffered from this problem, could you please
make a small test case and open an issue? 
(http://issues.apache.org/jira/secure/BrowseProject.jspa?id=10500).

Thanks
Achim


Am Mon, 8 Aug 2005 17:36:55 -0300 schrieb Vinicius Carvalho 
<ja...@gmail.com>:

> Hello there! Yeah, unless your class has a constructor you must tell
> it what setters to use, at least the same problem was happening to me
> and I solved (Actually, Hugo Palma gave me the hint :D )
>
>  <service-point id="localPortals"
>     interface="RLocalPortals"/>
>  <implementation service-id="localPortals">
>       <invoke-factory>
>         <construct class="impl.RLocalPortalsImpl">
>              <set-object property="session" 
> value="service:sessionFactory"/>
>         </construct>
>       </invoke-factory>
>  </implementation>
>
> Cheers
>
>
> On 8/8/05, Ron Piterman <rp...@gmx.net> wrote:
>> Hi,
>> I use the hibernate example from howards article in TSS, but I am not
>> sure I understand HiveMind correctly:
>>
>> When I define a service for Interface X, and in the implementation class
>> of some other service, I add a setter: setBla(X x), hivemind should set
>> an X instance to the Service implementation automatically?
>>
>> Or do I have to explicitly add <set-service... to each factory ?
>>
>>
>> In a repository implementation , the hibernate session is not being set.
>>
>> Nothing on the logs (DEBUG level) - how do I get to the source of the
>> problem?
>>
>>
>> Here are some files...
>> Thanx, Ron
>>
>>
>> ...
>> <service-point id="sessionFactory"
>>    interface="org.apache.hivemind.ServiceImplementationFactory"
>>    parameters-occurs="none"/>
>>
>> <service-point id="session" interface="org.hibernate.Session"/>
>> ...
>>
>> <service-point id="localPortals"
>>    interface="RLocalPortals"/>
>> <implementation service-id="localPortals">
>>      <invoke-factory>
>>        <construct class="impl.RLocalPortalsImpl"/>
>>      </invoke-factory>
>> </implementation>
>>
>> ---
>>
>> public class RLocalPortalsImpl extends AbstractRepositoryImpl implements
>> RLocalPortals {
>>
>>    public List getRegistrationCountries() {
>>      Query q =
>>        session.getNamedQuery("registration-countries");  // *NullPExcep*
>>      return q.list();
>>    }
>>    public void setSession(Session session) {
>>      this.session = session;
>>    }
>> }
>>
>> ---
>>
>> On the session.getNamedQuery(...) I get a null pointer exception,
>> meaning the session is null :-(
>>
>> Wo what did I do wrong?
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>



---------------------------------------------------------------------
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: Newbie question

Posted by Achim Hügen <ac...@gmx.de>.
No, actually Vinicius is right.
In this case autowiring of properties should happen.
If both of you have suffered from this problem, could you please
make a small test case and open an issue? 
(http://issues.apache.org/jira/secure/BrowseProject.jspa?id=10500).

Thanks
Achim


Am Mon, 8 Aug 2005 17:36:55 -0300 schrieb Vinicius Carvalho 
<ja...@gmail.com>:

> Hello there! Yeah, unless your class has a constructor you must tell
> it what setters to use, at least the same problem was happening to me
> and I solved (Actually, Hugo Palma gave me the hint :D )
>
>  <service-point id="localPortals"
>     interface="RLocalPortals"/>
>  <implementation service-id="localPortals">
>       <invoke-factory>
>         <construct class="impl.RLocalPortalsImpl">
>              <set-object property="session" 
> value="service:sessionFactory"/>
>         </construct>
>       </invoke-factory>
>  </implementation>
>
> Cheers
>
>
> On 8/8/05, Ron Piterman <rp...@gmx.net> wrote:
>> Hi,
>> I use the hibernate example from howards article in TSS, but I am not
>> sure I understand HiveMind correctly:
>>
>> When I define a service for Interface X, and in the implementation class
>> of some other service, I add a setter: setBla(X x), hivemind should set
>> an X instance to the Service implementation automatically?
>>
>> Or do I have to explicitly add <set-service... to each factory ?
>>
>>
>> In a repository implementation , the hibernate session is not being set.
>>
>> Nothing on the logs (DEBUG level) - how do I get to the source of the
>> problem?
>>
>>
>> Here are some files...
>> Thanx, Ron
>>
>>
>> ...
>> <service-point id="sessionFactory"
>>    interface="org.apache.hivemind.ServiceImplementationFactory"
>>    parameters-occurs="none"/>
>>
>> <service-point id="session" interface="org.hibernate.Session"/>
>> ...
>>
>> <service-point id="localPortals"
>>    interface="RLocalPortals"/>
>> <implementation service-id="localPortals">
>>      <invoke-factory>
>>        <construct class="impl.RLocalPortalsImpl"/>
>>      </invoke-factory>
>> </implementation>
>>
>> ---
>>
>> public class RLocalPortalsImpl extends AbstractRepositoryImpl implements
>> RLocalPortals {
>>
>>    public List getRegistrationCountries() {
>>      Query q =
>>        session.getNamedQuery("registration-countries");  // *NullPExcep*
>>      return q.list();
>>    }
>>    public void setSession(Session session) {
>>      this.session = session;
>>    }
>> }
>>
>> ---
>>
>> On the session.getNamedQuery(...) I get a null pointer exception,
>> meaning the session is null :-(
>>
>> Wo what did I do wrong?
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>



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