dev@glassfish.java.net

Re: PropertyVetoException during upgrade

From: Jerome Dochez <jerome.dochez_at_oracle.com>
Date: Wed, 25 Aug 2010 14:08:04 -0700

On Aug 25, 2010, at 1:26 PM, Joseph Fialli wrote:

> Jerome,
>
> Here is the code fragment in question.
>
> private class GroupManagementServiceConfigCode implements SingleConfigCode<Config> {
> public Object run(Config config) throws PropertyVetoException, TransactionFailure {
> GroupManagementService gms = config.getGroupManagementService();
> Transaction t = Transaction.getTransaction(config);
> t.enroll(gms);

u must use the return value from the enroll method

GroupManagementService writeableGms = t.enroll(gms);
writeableGms.setGroupDiscoveryTimeoutInMills(...

> String value = gms.getPingProtocolTimeoutInMillis();
> if (value != null) {
> gms.setGroupDiscoveryTimeoutInMillis(value);
> }
>
> FailureDetection fd = gms.getFailureDetection();
> t.enroll(fd);
same as above.

> value = gms.getFdProtocolTimeoutInMillis();
> if (value != null){
> fd.setHeartbeatFrequencyInMillis(value);
> }
> I am using the locked view passed into the run method BUT I am modifying a child of the locked view.
> (I don't think there is a way to get all the GroupManagementService objects to pass directly to the run view.)
> I did everything that I knew how to do to make that child part of the current transaction
> (by enrolling the gms object in config's transaction).
>
> The code above worked last week and now stopped working.
right, it should have never worked. I fixed the issue that allowed this incorrect usage to get un-noticed.

>
> -Joe
>
> On 8/25/10 3:55 PM, jerome.dochez_at_oracle.com wrote:
>>
>> I really tried to make *that* message clear :( You are using a read only view to call the set method instead of using the locked view which is passed to the run() call called from the ConfigSupport. I fixed a bug in hk2 which is probably why it started failing, you were doing the wrong thing all along.
>>
>> Jerome
>>
>> On Aug 25, 2010, at 12:45, Bobby Bissett <bobby.bissett_at_oracle.com> wrote:
>>
>>> Hi all,
>>>
>>> Can someone tell me what's causing the exception below and/or what I need to do to fix it? Note, this all worked last week and the upgrade code hasn't changed (unless Bill snuck some magic into the copyright header, heh heh).
>>>
>>> Bonus note: you can create the failure without needing a v2 domain to upgrade. Just run "asadmin start-domain --upgrade" on your 3.1 server and you'll see it. Normally you can "upgrade" a 3.1 domain to 3.1 and everything succeeds (it just doesn't do any real work).
>>>
>>> Here's the code:
>>>
>>> http://tinyurl.com/25ckope -- see the top of "private class GroupManagementServiceConfigCode" for the bits that hk2 is complaining about.
>>>
>>> Here's the stack trace:
>>>
>>> SEVERE: Failure while upgrading cluster data from V2 to V3
>>> org.jvnet.hk2.config.TransactionFailure: Instance of com.sun.enterprise.config.serverbeans.GroupManagementService named 'null' is not locked for writing when invoking method setGroupDiscoveryTimeoutInMillis you must use transaction semantics to access it.
>>> at org.jvnet.hk2.config.ConfigSupport._apply(ConfigSupport.java:203)
>>> at org.jvnet.hk2.config.ConfigSupport.apply(ConfigSupport.java:133)
>>> at org.jvnet.hk2.config.ConfigSupport.apply(ConfigSupport.java:112)
>>> at org.glassfish.gms.GMSConfigUpgrade.upgradeGroupManagementServiceElements(GMSConfigUpgrade.java:100)
>>> at org.glassfish.gms.GMSConfigUpgrade.postConstruct(GMSConfigUpgrade.java:79)
>>> at com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:109)
>>> at com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java:92)
>>> at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:68)
>>> at com.sun.hk2.component.EventPublishingInhabitant.get(EventPublishingInhabitant.java:136)
>>> at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:61)
>>> at org.glassfish.config.support.DomainXml.upgrade(DomainXml.java:152)
>>> at org.glassfish.config.support.DomainXml.run(DomainXml.java:118)
>>> at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.populateConfig(AbstractModulesRegistryImpl.java:167)
>>> at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.createHabitat(AbstractModulesRegistryImpl.java:149)
>>> at com.sun.enterprise.module.bootstrap.Main.createHabitat(Main.java:430)
>>> at org.jvnet.hk2.osgiadapter.HK2Main.createHabitat(HK2Main.java:92)
>>> at com.sun.enterprise.glassfish.bootstrap.GlassFishActivator$1.newGlassFish(GlassFishActivator.java:89)
>>> at com.sun.enterprise.glassfish.bootstrap.GlassFishMain$Launcher.launch(GlassFishMain.java:116)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>> at com.sun.enterprise.glassfish.bootstrap.GlassFishMain.main(GlassFishMain.java:101)
>>> at com.sun.enterprise.glassfish.bootstrap.ASMain.main(ASMain.java:65)
>>> Caused by: java.beans.PropertyVetoException: Instance of com.sun.enterprise.config.serverbeans.GroupManagementService named 'null' is not locked for writing when invoking method setGroupDiscoveryTimeoutInMillis you must use transaction semantics to access it.
>>> at org.jvnet.hk2.config.Dom.invoke(Dom.java:906)
>>> at org.glassfish.config.support.TranslatedConfigView.invoke(TranslatedConfigView.java:119)
>>> at $Proxy33.setGroupDiscoveryTimeoutInMillis(Unknown Source)
>>> at org.glassfish.gms.GMSConfigUpgrade$GroupManagementServiceConfigCode.run(GMSConfigUpgrade.java:145)
>>> at org.glassfish.gms.GMSConfigUpgrade$GroupManagementServiceConfigCode.run(GMSConfigUpgrade.java:138)
>>> at org.jvnet.hk2.config.ConfigSupport$1.run(ConfigSupport.java:115)
>>> at org.jvnet.hk2.config.ConfigSupport._apply(ConfigSupport.java:174)
>>> ... 23 more
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>