Sunday, August 12, 2012

WLST set Targets : Array has at least one null element

Very often I struggle with the setTarget method:

this statement:
set('Targets', jarray.array(jmsServerArray, ObjectName))

often results in:

java.lang.IllegalArgumentException: Array has at least one null element
at weblogic.descriptor.internal.AbstractDescriptorBeanHelper._cleanAndValidateArray(AbstractDescriptorBeanHelper.java:730)
at weblogic.management.configuration.TargetInfoMBeanImpl.setTargets(TargetInfoMBeanImpl.java:240)


Now, the problem more often than not is NOT that some elements in jmsServerArray are null.... the problem lies in that they are the ObjectName of something that DOES NOT EXIST in the Domain/Server config.
So rather than trying to find out if an element is NULL, find out if it's a VALID RESOURCE.

Frustrating.... indeed...

3 comments:

diogoko said...

If you're doing something like

set('Targets', jarray.array([ObjectName('com.bea:Name=AdminServer,Type=Server')], ObjectName))

there must NOT be a space between the object name and the "Type=..." part.

Anonymous said...

God bless you, diogoko. This was driving me crazy. Thank you.

SOA_Lead said...

Hi Diogoko,

How to add more targets like AdminServer,osb_cluster,soa_cluster, kindly assist.

Thanks
Rajah Samuel