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 21:57:25 -0700

Jerome Dochez wrote:
> <snip>
>> com.sun.enterprise.v3.admin.cluster.NodeAgentConfigUpgrade$1.run(NodeAgentConfigUpgrade.java:131)
>>
>> at
>> com.sun.enterprise.v3.admin.cluster.NodeAgentConfigUpgrade$1.run(NodeAgentConfigUpgrade.java:92)
>>
>> at
>> org.jvnet.hk2.config.ConfigSupport$1.run(ConfigSupport.java:112)
>> at
>> org.jvnet.hk2.config.ConfigSupport._apply(ConfigSupport.java:171)
>> ... 22 more
>
> Ok let me look at this one, seems like a bug in config.
ok.
>> Aug 18, 2010 3:44:18 AM com.sun.enterprise.util.EarlyLogger add
>>>> Also how do I remove the node-agents element?
>>> I don't see a node-agents element on Server ? is it somewhere else ?
>> node-agents element is on Domain. there is a node-agents-ref
>> attribute on Server.
> so it's a collection of node-agent, you should just remove elements
> from the collection or remove all elements.
> something like :
> domain.getNodeAgents().removeAll();

I tried too that but get a compile time error.

INFO] Compiling 1 source file to
/Users/cmott/logging/v3/cluster/admin/target/classes
/Users/cmott/logging/v3/cluster/admin/src/main/java/com/sun/enterprise/v3/admin/cluster/NodeAgentConfigUpgrade.java:137:
cannot find symbol
symbol : method removeAll()
location: interface com.sun.enterprise.config.serverbeans.NodeAgents
                    domain.getNodeAgents().removeAll();
                                          ^
>
>>>
>>> the node-agents
>>>> Carla
>>>>
>>>> Jerome Dochez wrote:
>>>>> use the variable d as passed to the run() method rather than
>>>>> domain which is still the readonly view of the domain config object.
>>>>>
>>>>> On Aug 17, 2010, at 4:38 PM, 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
>>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> 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
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>