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 Tue, 09 Aug 2005 17:38:44 GMT
No, no other error messages were noted prior to the exception being thrown.

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

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

Hi,

As far as I know, the service id of a service point should not contain
any '.' [dots].  Do you see any other errors from HiveMind before you
get to where you are now?

Johan

Do you see any other errors from hivemind

GUMMOW JR, DONALD R [AG/1000] wrote:
> Sure - here is the method that builds the registry...
> 
>  
> 
>     private Registry buildRegistry(String fileName)
> 
>     {
> 
>         String projectRoot = System.getProperty("PROJECT_ROOT", ".");
> 
>         String path = projectRoot +
> "/com/monsanto/tcc/domain/service/descriptor/" + fileName;
> 
>         verifyDomainDescriptor(path);
> 
>  
> 
>         ClassLoader classLoader = getClass().getClassLoader();
> 
>         ClassResolver resolver = new DefaultClassResolver(classLoader);
> 
>         RegistryBuilder builder = new RegistryBuilder();
> 
>  
> 
>         System.out.println("buildRegistry: classLoader="+classLoader);
> 
>         System.out.println("buildRegistry: classLoader.hashCode()=" +
> classLoader.hashCode());
> 
>  
> 
>         builder.addModuleDescriptorProvider(new
> XmlModuleDescriptorProvider(resolver));
> 
>         builder.addModuleDescriptorProvider(new
> XmlModuleDescriptorProvider(resolver,
> 
>                 new FileResource(path)));
> 
>  
> 
>         return builder.constructRegistry(Locale.getDefault());
> 
>     }
> 
>  
> 
> Console output: è
> 
> buildRegistry: classLoader=PluginClassLoader(Domain Repository Service)
> 
> buildRegistry: classLoader.hashCode()=17764792
> 
>  
> 
> ...and here is the method that attempts to access the service...
> 
>  
> 
>     public DomainRepository getRepository(Class repositoryClass)
> 
>     {
> 
>         ClassLoader classLoader = repositoryClass.getClassLoader();
> 
>         ClassLoader impl_Loader =
CropRepositoryImpl.class.getClassLoader();
> 
>
System.out.println("ClassLoader(interface):"+classLoader.toString()
> 
>             + " (#"+classLoader.hashCode()+")");
> 
>         System.out.println("ClassLoader(class):"+impl_Loader.toString()
> 
>             + " (#"+impl_Loader.hashCode()+")");
> 
>  
> 
>         return (DomainRepository) registry.getService(repositoryClass);
> 
>     }
> 
>  
> 
> Console output: è
> 
> ClassLoader(interface):PluginClassLoader(Domain Repository Service)
> (#17764792)
> 
> ClassLoader(class):PluginClassLoader(Domain Repository Service)
(#17764792)
> 
>  
> 
> The exception is thrown on retgistry.getService(repositoryClass)
> 
>  
> 
> Console output: è
> 
>  
> 
> [Severe] Uncaught exception during Plugin start: Apollo Core
> 
> org.apache.hivemind.ApplicationRuntimeException: Service
> com.monsanto.tcc.domain.crop.CropRepository does not implement the
> requested interface (com.monsanto.tcc.domain.crop.CropRepository).  The
> declared service interface type is
> com.monsanto.tcc.domain.crop.CropRepository.
> [./com/monsanto/tcc/domain/service/descriptor/domainServices.xml, line
> 53, column 101]
> 
>             at
>
org.apache.hivemind.impl.ServicePointImpl.getService(ServicePointImpl.java:2
26)
> 
>             at
>
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:66)
> 
>             at
>
com.monsanto.tcc.apollo.settings.CropSetting.getCropRepository(CropSetting.j
ava:53)
> 
>             at
> com.monsanto.tcc.apollo.settings.CropSetting.init(CropSetting.java:42)
> 
>             at
>
com.monsanto.tcc.apollo.settings.SettingsManager.register(SettingsManagerja
va:129)
> 
>             at
>
com.monsanto.tcc.apollo.settings.SettingsManager.registerSettings(SettingsMa
nager.java:58)
> 
>             at
>
com.monsanto.tcc.apollo.settings.SettingsManager.<init>(SettingsManager.java
:37)
> 
>             at
>
com.monsanto.tcc.apollo.workspace.WorkspaceManagerImpl.attachToWorkbench(Wor
kspaceManagerImpl.java:162)
> 
>             at
>
com.monsanto.tcc.apollo.workbench.internal.WorkbenchImpl.registerCollaborato
r(WorkbenchImpl.java:50)
> 
>             at
>
com.monsanto.tcc.apollo.ApolloCorePluginLifecycle.start(ApolloCorePluginLife
cycle.java:30)
> 
>             at
>
org.platonos.pluginengine.StartPluginQueue$PoolWorker.run(StartPluginQueue.j
ava:63)
> 
>             at java.lang.Thread.run(Thread.java:534)
> 
>  
> 
> ...and the descriptor for the registered service...
> 
>  
> 
> <module id="com.monsanto.tcc.domain" version="1.0.0">
> 
>  
> 
>     <service-point id="crop.CropFactory"
> interface="com.monsanto.tcc.domain.crop.CropFactory">
> 
>         <invoke-factory>
> 
>             <construct
> class="com.monsanto.tcc.domain.crop.impl.CropFactoryImpl"/>
> 
>         </invoke-factory>
> 
>         <interceptor service-id="hivemind.LoggingInterceptor"/>
> 
>     </service-point>
> 
>  
> 
>     <service-point id="crop.CropRepository"
> interface="com.monsanto.tcc.domain.crop.CropRepository">
> 
>         <invoke-factory>
> 
>             <construct
> class="com.monsanto.tcc.domain.crop.impl.CropRepositoryImpl"/>
> 
>         </invoke-factory>
> 
>         <interceptor service-id="hivemind.LoggingInterceptor"/>
> 
>     </service-point>
> 
>  
> 
> </module>
> 
>  
> 
>  
> 
> -----Original Message-----
> *From:* James Carman [mailto:james@carmanconsulting.com]
> *Sent:* Tuesday, August 09, 2005 9:07 AM
> *To:* hivemind-user@jakarta.apache.org
> *Subject:* RE: Classloaders and Registry
> 
>  
> 
> 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
>
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.//
> 
> /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?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFC+NIxHS6c76+IdrwRAvj7AKCXAAVDB+DRU/zKiDErGvOk2q9bPQCcCPQo
y8je/UGDgUmogDTj6MVfK6Q=
=gwv7
-----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