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(

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...

1 comment:

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.