cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
laurentdubois
Level 3

LegacyRegistryService ClassCastException ??

Hello,

I'm getting the following ClassCastException when removing a software Object using the legacyRegistryservice (see code below). any ideas of what I'm doing wrong?

java.lang.ClassCastException: com.installshield.product.LegacyGenericSoftwareObject
at com.installshield.product.service.legacyregistry.LegacyPureJavaRegistryServiceImpl.removeSoftwareObject(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.installshield.wizard.service.LocalImplementorProxy.invoke(Unknown Source)
at com.installshield.wizard.service.AbstractService.invokeImpl(Unknown Source)
at com.installshield.product.service.legacyregistry.LegacyGenericRegistryService.removeSoftwareObject(Unknown Source)
at xxxxxxxxxxx.actions.RemoveLegacyObject.install(RemoveLegacyObject.java:31)
at com.installshield.product.service.product.PureJavaProductServiceImpl.installProductAction(Unknown Source)
at com.installshield.product.service.product.PureJavaProductServiceImpl$InstallProduct.getResultForProductAction(Unknown Source)
at com.installshield.product.service.product.InstallableObjectVisitor.visitComponent(Unknown Source)
at com.installshield.product.service.product.InstallableObjectVisitor.visitInstallableComponents(Unknown Source)
at com.installshield.product.service.product.InstallableObjectVisitor.visitProductBeans(Unknown Source)
at com.installshield.product.service.product.PureJavaProductServiceImpl$InstallProduct.install(Unknown Source)
at com.installshield.product.service.product.PureJavaProductServiceImpl$Installer.execute(Unknown Source)
at com.installshield.wizard.service.AsynchronousOperation.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)


and the code:

LegacyRegistryService regService = (LegacyRegistryService) getService(LegacyRegistryService.NAME);
LegacySoftwareObject softObj = regService.getNewestSoftwareObject(mUID);
if (softObj != null)
{
SoftwareObjectKey myKey = softObj.getKey();
regService.removeSoftwareObject(myKey);
}
Labels (1)
0 Kudos
(2) Replies
laurentdubois
Level 3

I've been able to go pass the ClassCastException now by recompiling my project with an updated engine.jar

But, even after calling removeSoftwareObject, the registry has not been updated and i'm still able to retrieve the softwareObject from the registry.
I also tried to call finalizeRegistry(), but this didn't change anything.

Please let me know if anybody has been able to use the LegacyRegistryService to cleanup the registry of a product installed with ISMP 5 and updated with a new version installed with ISMP 11.5

Thanks.
0 Kudos
Barry_Lawson
Level 3

I could be wrong on this, but along with the finalizeRegistry() call there is also an initializeRegistry() call. Is it possible that your finalize call is making the change in the registry (on disk), but the value is not being changed in memory. You may need to "reload" the registry into memory (using iniitialize) to "see" the change. Just a guess.
0 Kudos