You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hivemind.apache.org by Jason Vinson <vi...@charter.net> on 2005/01/26 17:51:14 UTC

Unable to find a Constructor?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

First of all, i'm very new to and very impressed with HiveMind.  The
documentaion is clear and consise for the most part, so i've had some
good success with strict JavaBean properties style wiring with hive
modules.  Now I am seeing some weird behavior when i add a no-args
constructor.  I have something like the following:

[com.myapp.Service]
interface Service {
~  public void doStuff();
}

[com.myapp.access.AccessService]
class AccessService implements Service {

~  private Map myMap();

~  public void doStuff() { /*do something*/ }

~  public AccessService () {
~    myMap = new HashMap();
~  }
}

And in my hivemodule:

<module id="ioc" version="1.0.0">
~  <service-point id="AccessService" interface="com.myapp.Service">
~    <create-instance class="com.myapp.access.AccessService"/>
~  </service-point>
</module>

So when i do the following in my unit test:
~  registry.getService("ioc.AccessService", Service.class);

I see something like this:

org.apache.hivemind.ApplicationRuntimeException: Unable to construct
service ioc.AccessService: Unable to find a constructor for class
com.myapp.access.AccessService.

Any idea what i may be doing wrong?  If there's a default constructor,
do i need to invoke-factory instead of create-instance?

Any input would be appreciated,
Jason
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFB98qCAQ71cZOfvEQRAkizAJ4lECDGpklgb39BCIZDYmBP5TQvhACeOg8/
M76zfTIcv2kfHWz8fWUDmbU=
=3TMd
-----END PGP SIGNATURE-----


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


Re: Unable to find a Constructor?

Posted by Jason Vinson <vi...@charter.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Man do i feel like an idiot... it was package level.

We're doing a little Spring/HiveMind comparison, and Spring could
create those instances with package level visibility.

Thanks!
Jason


Achim Huegen wrote:

| Is your class defined public or like in the pasted code only with
| package level access? This could cause such a problem
|
| Achim
|
| Jason Vinson wrote:
|

| First of all, i'm very new to and very impressed with HiveMind.
| The documentaion is clear and consise for the most part, so i've
| had some good success with strict JavaBean properties style wiring
| with hive modules.  Now I am seeing some weird behavior when i add
| a no-args constructor.  I have something like the following:
|
| [com.myapp.Service] interface Service { ~  public void doStuff(); }
|
|
| [com.myapp.access.AccessService] class AccessService implements
| Service {
|
| ~  private Map myMap();
|
| ~  public void doStuff() { /*do something*/ }
|
| ~  public AccessService () { ~    myMap = new HashMap(); ~  } }
|
| And in my hivemodule:
|
| <module id="ioc" version="1.0.0"> ~  <service-point
| id="AccessService" interface="com.myapp.Service"> ~
| <create-instance class="com.myapp.access.AccessService"/> ~
| </service-point> </module>
|
| So when i do the following in my unit test: ~
| registry.getService("ioc.AccessService", Service.class);
|
| I see something like this:
|
| org.apache.hivemind.ApplicationRuntimeException: Unable to
| construct service ioc.AccessService: Unable to find a constructor
| for class com.myapp.access.AccessService.
|
| Any idea what i may be doing wrong?  If there's a default
| constructor, do i need to invoke-factory instead of
| create-instance?
|
| Any input would be appreciated, Jason

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



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFB99ICAQ71cZOfvEQRAvx+AJ9kpCCPoZYreQcIiKb11yC9PFfNRQCeND9K
9ioXENU4pXvlCYq+/yrWEEg=
=ti7K
-----END PGP SIGNATURE-----


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


Re: Unable to find a Constructor?

Posted by Achim Huegen <ah...@gmx-topmail.de>.
Is your class defined public or like in the pasted code only with 
package level access?
This could cause such a problem

Achim

Jason Vinson wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> First of all, i'm very new to and very impressed with HiveMind.  The
> documentaion is clear and consise for the most part, so i've had some
> good success with strict JavaBean properties style wiring with hive
> modules.  Now I am seeing some weird behavior when i add a no-args
> constructor.  I have something like the following:
> 
> [com.myapp.Service]
> interface Service {
> ~  public void doStuff();
> }
> 
> [com.myapp.access.AccessService]
> class AccessService implements Service {
> 
> ~  private Map myMap();
> 
> ~  public void doStuff() { /*do something*/ }
> 
> ~  public AccessService () {
> ~    myMap = new HashMap();
> ~  }
> }
> 
> And in my hivemodule:
> 
> <module id="ioc" version="1.0.0">
> ~  <service-point id="AccessService" interface="com.myapp.Service">
> ~    <create-instance class="com.myapp.access.AccessService"/>
> ~  </service-point>
> </module>
> 
> So when i do the following in my unit test:
> ~  registry.getService("ioc.AccessService", Service.class);
> 
> I see something like this:
> 
> org.apache.hivemind.ApplicationRuntimeException: Unable to construct
> service ioc.AccessService: Unable to find a constructor for class
> com.myapp.access.AccessService.
> 
> Any idea what i may be doing wrong?  If there's a default constructor,
> do i need to invoke-factory instead of create-instance?
> 
> Any input would be appreciated,
> Jason
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.4 (GNU/Linux)
> Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
> 
> iD8DBQFB98qCAQ71cZOfvEQRAkizAJ4lECDGpklgb39BCIZDYmBP5TQvhACeOg8/
> M76zfTIcv2kfHWz8fWUDmbU=
> =3TMd
> -----END PGP SIGNATURE-----
> 
> 
> ---------------------------------------------------------------------
> 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