hivemind-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "GUMMOW JR, DONALD R [AG/1000]" <donald.r.gummow...@monsanto.com>
Subject RE: Classloaders and Registry
Date Thu, 11 Aug 2005 14:32:07 GMT
Johan -- I am able to access my registered services without exception using
the default registry, as you suggested, but am still getting the error when
the service classes have a different class loader.

Regards,
...Don 

-----Original Message-----
From: Johan Lindquist [mailto:johan@kawoo.co.uk] 
Sent: Thursday, August 11, 2005 2:55 AM
To: hivemind-user@jakarta.apache.org
Subject: Re: Classloaders and Registry

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

Hi Don,

Sorry about perhaps being a little unclear - if you try to run your code
outside of your normal environment, but still using hivemind.

So something like:

... some class ...

public static void main(String[] args)
{

  Registry registry = RegistryBuilder.constructDefaultRegistry();
  ServiceClass sc = (ServiceClass)registry.getService(<servicename>);

}
...

Running this, with all your jars on the classpath should allow you to
make sure your code runs in a single classloader environment.  If it
works, it eliminates the problem being a configuration issue, allowing
us to head down the class loader problem path with confidence.

Johan


GUMMOW JR, DONALD R [AG/1000] wrote:
> I'm not sure I understand your request. Please clarify, as I'd love to do
> any experiment that would help illuminate this issue.
> 
> Regards,
> ...Don 
> 
> -----Original Message-----
> From: Johan Lindquist [mailto:johan@kawoo.co.uk] 
> Sent: Wednesday, August 10, 2005 1:51 AM
> To: hivemind-user@jakarta.apache.org
> Subject: Re: Classloaders and Registry
> 
> Ok, could you then try to instantiate the registry using one class
> loader and the default initialization method of the registry?  Would be
> good to confirm that this problem doesn't occur in a "normal" class
> loading environment as well I think.
> 
> Johan
> 
> GUMMOW JR, DONALD R [AG/1000] wrote:
> 
>>>Yes, this is correct. The test cases are just initiated via JUnit and the
>>>IDE
>>>
>>>-----Original Message-----
>>>From: Johan Lindquist [mailto:johan@kawoo.co.uk] 
>>>Sent: Tuesday, August 09, 2005 10:58 AM
>>>To: hivemind-user@jakarta.apache.org
>>>Subject: Re: Classloaders and Registry
>>>
>>>But you are not using hivemind to instantiate the test cases if I
>>>understand this correctly?
>>>
>>>Johan
>>>
>>>GUMMOW JR, DONALD R [AG/1000] wrote:
>>>
>>>
>>>>>Yes, the DomainRepositoryServiceImpl class is instantiated in both the
UT
>>>>>and the production code...
>>>>>
>>>>>public class DomainRepositoryService_UT extends TestCase
>>>>>{
>>>>>   private DomainRepositoryService repositoryService;
>>>>>
>>>>>   protected void setUp()
>>>>>   {
>>>>>       repositoryService = new DomainRepositoryServiceImpl();
>>>>>
>>>>>   }
>>>>>
>>>>>   public void testGetRepository()
>>>>>   {
>>>>>       repository =
>>>
>>>repositoryService.getRepository(CropRepository.class);
>>>
>>>
>>>>>       assertTrue(repository instanceof CropRepository);
>>>>>   }
>>>>>}
>>>>>
>>>>>Here is the same debug output as in prior note but generated within the
>>>>>UT...
>>>>>
>>>>>buildRegistry: classLoader=sun.misc.Launcher$AppClassLoader@53ba3d
>>>>>buildRegistry: classLoader.hashCode()=5487165
>>>>>
>>>>>...and...
>>>>>
>>>>>ClassLoader(interface):sun.misc.Launcher$AppClassLoader@53ba3d
(#5487165)
>>>>>ClassLoader(class):sun.misc.Launcher$AppClassLoader@53ba3d (#5487165)
>>>>>
>>>>>
>>>>>...Don
>>>>>
>>>>>-----Original Message-----
>>>>>From: Johan Lindquist [mailto:johan@kawoo.co.uk] 
>>>>>Sent: Tuesday, August 09, 2005 9:41 AM
>>>>>To: hivemind-user@jakarta.apache.org
>>>>>Subject: Re: Classloaders and Registry
>>>>>
>>>>>Out of interest, does your unit tests use hivemind as well?
>>>>>
>>>>>Johan
>>>>>
>>>>>James Carman wrote:
>>>>>
>>>>>
>>>>>
>>>>>>>How are you getting these two different classloaders?  Can you
try
>>>>>>>printing out the classloaders at each point (registry creation
and
when
>>>>>>>you ask for the service) so that we can verify that you are actually
>>>>>>>using the exact same one (print out there ?identity hashcode?)?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>---------------------------------------------------------------------
--
> 
> -
> 
>>>>>>>*From:* GUMMOW JR, DONALD R [AG/1000]
>>>>>>>[mailto:donald.r.gummow.jr@monsanto.com]
>>>>>>>*Sent:* Tuesday, August 09, 2005 9:58 AM
>>>>>>>*To:* hivemind-user@jakarta.apache.org
>>>>>>>*Subject:* RE: Classloaders and Registry
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>-->
>>>>>>>
>>>>>>>James, thanks for the response. I've tried this, making sure that
the
>>>>>>>classloader I pass into DefaultClassResolver is the same as the
loader
>>>>>>>reported for the interface that I later pass into
registry.getService(
> 
> )
> 
>>>>>>>- but am still getting the app run-time exception:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>org.apache.hivemind.ApplicationRuntimeException: Service
>>>>>>>com.monsanto.tcc.domain.Item does not implement the requested
interface
>>>>>>>(com.monsanto.tcc.domain.Item).  The declared service interface
type
is
>>>>>>>com.monsanto.tcc.domain.Item.
>>>>>>>[./com/monsanto/tcc/domain/service/descriptor/domainServices.xml,
line
>>>>>>>53, column 101]
>>>>>>>
>>>>>>>          at
>>>>>>>
>>>>>
>>>>>
>
org.apache.hivemind.impl.ServicePointImpl.getService(ServicePointImpl.java:2
> 
>>>>>26)
>>>>>
>>>>>
>>>>>
>>>>>>>          at
>>>>>>>
>>>>>
>>>>>CISSP
>>>
>
org.apache.hivemind.impl.RegistryInfrastructureImpl.getService(RegistryInfra
> 
>>>>>structureImpl.java:242)
>>>>>
>>>>>
>>>>>
>>>>>>>          at
>>>>>>>org.apache.hivemind.impl.RegistryImpl.getService(RegistryImpl.java:73
)
>>>>>>>
>>>>>>>          at
>>>>>>>
>>>>>
>>>>>
>
com.monsanto.tcc.domain.service.impl.DomainRepositoryServiceImpl.getReposito
> 
>>>>>ry(DomainRepositoryServiceImpl.java:62)
>>>>>
>>>>>
>>>>>
>>>>>>>...
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>I don't see any place else in the API where you can inject a
>>>>>>>ClassLoader, but the "does not implement the requested interface"
> 
> really
> 
>>>>>>>does seem to be loader related, since it all works just fine in
the
UT.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>Any good ideas on how to proceed from here?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>Thanks,
>>>>>>>
>>>>>>>...Don
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>-----Original Message-----
>>>>>>>*From:* James Carman [mailto:james@carmanconsulting.com]
>>>>>>>*Sent:* Tuesday, August 09, 2005 6:48 AM
>>>>>>>*To:* hivemind-user@jakarta.apache.org
>>>>>>>*Subject:* RE: Classloaders and Registry
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>You need to build your registry differently...
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>RegistryBuilder builder = new RegistryBuilder();
>>>>>>>
>>>>>>>builder.addModuleDescriptorProvider( new XmlModuleDescriptorProvider(
>>>>>>>new DefaultClassResolver( MY_CLASSLOADER ) ) );
>>>>>>>
>>>>>>>Registry reg = builder.constructRegistry( Locale.getDefaultLocale()
);
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>That code's off the top of my head, so the method names may be
changed.
> 
> 
>>>>>>>Also, this is HiveMind 1.1 code.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>---------------------------------------------------------------------
--
> 
> -
> 
>>>>>>>*From:* GUMMOW JR, DONALD R [AG/1000]
>>>>>>>[mailto:donald.r.gummow.jr@monsanto.com]
>>>>>>>*Sent:* Tuesday, August 09, 2005 7:42 AM
>>>>>>>*To:* hivemind-user@jakarta.apache.org
>>>>>>>*Subject:* Classloaders and Registry
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>Hello - I've got a situation where the service interface and
>>>>>>>implementation classes use a different class loader than the default
>>>>>>>loader for the registry, and I'm getting an
ApplicationRuntimeException
>>>>>>>when I call to registry.getService( ) telling me that the service
does
>>>>>>>not implement the requested interface. (The code works perfectly
in
my
>>>>>>>unit test, where both are using the same classloader.)
>>>>>>>
>>>>>>>Does anyone have any tips on how this situation should be approached
>>>>>>>within HiveMind?
>>>>>>>
>>>>>>>Regards,
>>>>>>>
>>>>>>>...Don
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>//This e-mail message may contain privileged and/or confidential
>>>>>>>information, and is intended to be received only by persons entitled
to
>>>>>>>receive such information. If you have received this e-mail in
error,
>>>>>>>please notify the sender immediately. Please delete it and all
>>>>>>>attachments from any servers, hard drives or any other media.
Other
use
>>>>>>>of this e-mail by you is strictly prohibited.//
>>>>>>>
>>>>>>>//All e-mails and attachments sent and received are subject to
>>>>>>>monitoring, reading and archival by Monsanto. The recipient of
this
>>>>>>>e-mail is solely responsible for checking for the presence of
"Viruses"
>>>>>>>or other "Malware". Monsanto accepts no liability for any damage
caused
>>>>>>>by any such code transmitted by or accompanying this e-mail or
any
>>>>>>>attachment.//
>>>>>>>
>>>>>>>//This e-mail message may contain privileged and/or confidential
>>>>>>>information, and is intended to be received only by persons entitled
to
>>>>>>>receive such information. If you have received this e-mail in
error,
>>>>>>>please notify the sender immediately. Please delete it and all
>>>>>>>attachments from any servers, hard drives or any other media.
Other
use
>>>>>>>of this e-mail by you is strictly prohibited.//
>>>>>>>
>>>>>>>//All e-mails and attachments sent and received are subject to
>>>>>>>monitoring, reading and archival by Monsanto. The recipient of
this
>>>>>>>e-mail is solely responsible for checking for the presence of
"Viruses"
>>>>>>>or other "Malware". Monsanto accepts no liability for any damage
caused
>>>>>>>by any such code transmitted by or accompanying this e-mail or
any
>>>>>>>attachment.//
>>>>>>>
>>>>>
>>>>>
>>>>>--
>>>>>you too?
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
>>>
>>>
>>>-
>>>
> 
>
----------------------------------------------------------------------------
> 
>>>-----------------------------
>>>This e-mail message may contain privileged and/or confidential
>>>information, and is intended to be received only by persons entitled to
>>>receive such information. If you have received this e-mail in error,
>>>please notify the sender immediately. Please delete it and all
>>>attachments from any servers, hard drives or any other media. Other use
>>>of this e-mail by you is strictly prohibited.
>>>
>>>
>>>All e-mails and attachments sent and received are subject to monitoring,
>>>reading and archival by Monsanto. The recipient of this e-mail is solely
>>>responsible for checking for the presence of "Viruses" or other
>>>"Malware". Monsanto accepts no liability for any damage caused by any
>>>such code transmitted by or accompanying this e-mail or any attachment.
>>>-
>>>
> 
>
----------------------------------------------------------------------------
> 
>>>-----------------------------
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
>>>
>>>
>>>
>>>--
>>>you too?
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
> 
> 
> -
>
----------------------------------------------------------------------------
> -----------------------------
> This e-mail message may contain privileged and/or confidential
> information, and is intended to be received only by persons entitled to
> receive such information. If you have received this e-mail in error,
> please notify the sender immediately. Please delete it and all
> attachments from any servers, hard drives or any other media. Other use
> of this e-mail by you is strictly prohibited.
> 
> 
> All e-mails and attachments sent and received are subject to monitoring,
> reading and archival by Monsanto. The recipient of this e-mail is solely
> responsible for checking for the presence of "Viruses" or other
> "Malware". Monsanto accepts no liability for any damage caused by any
> such code transmitted by or accompanying this e-mail or any attachment.
> -
>
----------------------------------------------------------------------------
> -----------------------------
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
> 
> 
> 
> --
> you too?

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


-
----------------------------------------------------------------------------
-----------------------------
This e-mail message may contain privileged and/or confidential
information, and is intended to be received only by persons entitled to
receive such information. If you have received this e-mail in error,
please notify the sender immediately. Please delete it and all
attachments from any servers, hard drives or any other media. Other use
of this e-mail by you is strictly prohibited.


All e-mails and attachments sent and received are subject to monitoring,
reading and archival by Monsanto. The recipient of this e-mail is solely
responsible for checking for the presence of "Viruses" or other
"Malware". Monsanto accepts no liability for any damage caused by any
such code transmitted by or accompanying this e-mail or any attachment.
-
----------------------------------------------------------------------------
-----------------------------


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



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

iD8DBQFC+wRPHS6c76+IdrwRAu6fAKD2BeCkDxKnPNI5vNRHHv9saQ4TsgCgnljH
hl0+yT/7eN4l3+X1IDWjJCg=
=8xIT
-----END PGP SIGNATURE-----

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


---------------------------------------------------------------------------------------------------------
This e-mail message may contain privileged and/or confidential information, and is intended
to be received only by persons entitled to receive such information. If you have received
this e-mail in error, please notify the sender immediately. Please delete it and all attachments
from any servers, hard drives or any other media. Other use of this e-mail by you is strictly
prohibited.


All e-mails and attachments sent and received are subject to monitoring, reading and archival
by Monsanto. The recipient of this e-mail is solely responsible for checking for the presence
of "Viruses" or other "Malware". Monsanto accepts no liability for any damage caused by any
such code transmitted by or accompanying this e-mail or any attachment.
---------------------------------------------------------------------------------------------------------


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


Mime
View raw message