dev@glassfish.java.net

Re: upgrading v2 config elements to v3 elements

From: Carla Mott <carla.mott_at_oracle.com>
Date: Tue, 17 Aug 2010 17:07:39 -0700

I was using domains instead of d....

Thanks Jerome.


Carla Mott wrote:
> Hi,
>
> I'm trying to write up the code to upgrade v2 (node-agents) to v3
> (nodes). In my case, I need to create elements (nodes and node) based
> on information that is in the node-agents and node-agent elements in
> v2. I then need to remove the node-agents references from the
> config. I tried to create a nodes elements but get the stace trace
> below.
>
>
> What does this error mean? How do I get a locked parent config
> object? The parent object for both nodes and node-agents is domain.
> When I try to create the child 'nodes' I get this error.
> My code looks like:
>
> ConfigSupport.apply(new SingleConfigCode<Domain>() {
> public Object run(Domain d) throws
> PropertyVetoException, TransactionFailure {
>
> Nodes nodes=domain.createChild(Nodes.class);
> for( NodeAgent na: agList){
> String host=null;
> Node node = nodes.createChild(Node.class);
> node.setName(na.getName());
> node.setType("CONFIG");
> node.setInstallDir("${com.sun.aas.installRoot}");
> List<Property> agentProp =na.getProperty();
> //get the properties and see if host name is specified
> for ( Property p : agentProp) {
> String name = p.getName();
> if (name.equals("client-hostname"))
> node.setNodeHost(p.getValue()); //create
> the node with a host name
> //else get the host name of the machine running on and use that
> }
> nodes.getNode().add(node);
> }
> domain.setNodes(nodes);
>
> List<Server> serverList=servers.getServer();
> if (serverList.size() <= 0)
> return null;
>
> for (Server s: serverList){
> s.setNode(s.getNodeAgentRef());
> s.setNodeAgentRef(null);
> }
> //remove the node-agent element
>
> return null;
> }
> }, domain);
> } catch (Exception e) {
> Logger.getAnonymousLogger().log(Level.SEVERE,
> "Failure while upgrading node-agent from V2 to V3", e);
> throw new RuntimeException(e);
> }
>
>
> Thanks,
> Carla
>
> Aug 17, 2010 10:18:55 PM
> com.sun.enterprise.v3.admin.cluster.NodeAgentConfigUpgrade postConstruct
> SEVERE: Failure while upgrading node-agent from V2 to V3
> org.jvnet.hk2.config.TransactionFailure: Must use a locked parent
> config object for instantiating new config object
> at
> org.jvnet.hk2.config.ConfigBeanProxy$Duck.createChild(ConfigBeanProxy.java:126)
>
> 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 org.jvnet.hk2.config.Dom.invokeDuckMethod(Dom.java:941)
> at org.jvnet.hk2.config.Dom.invoke(Dom.java:894)
> at
> org.glassfish.config.support.TranslatedConfigView.invoke(TranslatedConfigView.java:84)
>
> at $Proxy19.createChild(Unknown Source)
> at
> com.sun.enterprise.v3.admin.cluster.NodeAgentConfigUpgrade$1.run(NodeAgentConfigUpgrade.java:90)
>
> at
> com.sun.enterprise.v3.admin.cluster.NodeAgentConfigUpgrade$1.run(NodeAgentConfigUpgrade.java:87)
>
> at org.jvnet.hk2.config.ConfigSupport$1.run(ConfigSupport.java:112)
> at
> org.jvnet.hk2.config.ConfigSupport._apply(ConfigSupport.java:171)
> at org.jvnet.hk2.config.ConfigSupport.apply(ConfigSupport.java:130)
> at org.jvnet.hk2.config.ConfigSupport.apply(ConfigSupport.java:109)
> at
> com.sun.enterprise.v3.admin.cluster.NodeAgentConfigUpgrade.postConstruct(NodeAgentConfigUpgrade.java:87)
>
> 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.AbstractWombImpl.get(AbstractWombImpl.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:145)
> at org.glassfish.config.support.DomainXml.run(DomainXml.java:111)
> 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:86)
>
> at
> com.sun.enterprise.glassfish.bootstrap.GlassFishMain$Launcher.launch(GlassFishMain.java:113)
>
> 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:98)
>
> at
> com.sun.enterprise.glassfish.bootstrap.ASMain.main(ASMain.java:61)
> Caused by: java.lang.ClassCastException
> at java.lang.Class.cast(Class.java:2990)
> at
> org.jvnet.hk2.config.ConfigBeanProxy$Duck.createChild(ConfigBeanProxy.java:123)
>
> ... 34 more
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>