This discussion is archived
1 Reply Latest reply: Mar 22, 2013 6:19 AM by PetervanNesatTheFutureGroup RSS

Setting multiple targets for AppDeployments or Libraries in wlst off-line

PetervanNesatTheFutureGroup Newbie
Currently Being Moderated
I am currently struggling to add targets/change to Apps and libraries in wlst offline mode. Setting one target is succesfull, but every way i can think of setting multiple targets does fail.

If someone has a good hint.....

What i tried (with errors and outcomes) ;
readDomain('/u01/app/oracle/user_projects/domains/bip_domain')
cd('/AppDeployment/wsm-pm')
et=get('Target')
print et
array(weblogic.management.configuration.TargetMBean,[Proxy for bi_cluster: Name=bi_cluster, Type=Cluster, Proxy for AdminServer: Name=AdminServer, Type=Server])
set('Target',et)
Error: set() failed. Do dumpStack() to see details.
dumpStack()
com.oracle.cie.domain.script.jython.WLSTException: java.lang.IllegalArgumentException: Param type [Lweblogic.management.configuration.TargetMBean; not supported
...
Caused by: java.lang.IllegalArgumentException: Param type [Lweblogic.management.configuration.TargetMBean; not supported
        at com.oracle.cie.domain.script.jython.WLScriptContext.set(WLScriptContext.java:1296)
s
cmo.setTargets(et)>cd('/Clusters/bi_cluster')>tcl=cmo>cd('/AppDeployment/wsm-pm')>newTargets=array([,Class.forName('weblogic.management.configuration.TargetMBean'))
newTargets.append(tcl)
print newTargets array(weblogic.management.configuration.TargetMBean,[Proxy for bi_cluster: Name=bi_cluster, Type=Cluster])
set('Target',newTargets)
Error: set() failed. Do dumpStack() to see details.
dumpStack()
com.oracle.cie.domain.script.jython.WLSTException: java.lang.IllegalArgumentException: Param type [Lweblogic.management.configuration.TargetMBean; not supported
...
Caused by: java.lang.IllegalArgumentException: Param type [Lweblogic.management.configuration.TargetMBean; not supported
set('Target','bi_cluster')>print get('Target')array(weblogic.management.configuration.TargetMBean,[Proxy for bi_cluster: Name=bi_cluster, Type=Cluster)
set('Target','bi_cluster,AdminServer')
print get('Target') Error: getTargets() failed. Do dumpStack() to see details.
dumpStack()
com.oracle.cie.domain.script.jython.WLSTException: com.oracle.cie.domain.script.ScriptException: com.oracle.cie.domain.script.ScriptException: No JMSServer object with name AdminServer
...
set('Target','AdminServer')
print get('Target')
array(weblogic.management.configuration.TargetMBean,[Proxy for AdminServer: Name=AdminServer, Type=Server])
bTargets=array([],Class.forName('javax.management.ObjectName'))
cd('/AppDeployment/wsm-pm')
set('Target',bTargets)
Error: set() failed. Do dumpStack() to see details.
dumpStack()
com.oracle.cie.domain.script.jython.WLSTException: java.lang.IllegalArgumentException: Param type [Ljavax.management.ObjectName; not supported
....
> cmo.
cmo.setTargets(newTargets)
ls()
...
-rw- StagingMode nostage
-rw- Target bi_cluster
-rw- ValidateDdSecurityData false
...
print get('Target')
array(weblogic.management.configuration.TargetMBean,[Proxy for bi_cluster: Name=bi_cluster, Type=Cluster])
cd('/Servers/AdminServer')
tsvr=cmo
cd('/AppDeployment/wsm-pm')
newTargets.append(tsvr)
print newTargets
array(weblogic.management.configuration.TargetMBean,[Proxy for bi_cluster: Name=bi_cluster, Type=Cluster, Proxy for AdminServer: Name=AdminServer, Type=Server])
cmo.setTargets(newTargets)
Error: setTargets() failed. Do dumpStack() to see details.
dumpStack()
com.oracle.cie.domain.script.jython.WLSTException: java.lang.NullPointerException
at com.oracle.cie.domain.script.jython.CommandExceptionHandler.handleException(CommandExceptionHandler.java:51)
at com.oracle.cie.domain.script.jython.WLScriptContext.handleException(WLScriptContext.java:1538)
at com.oracle.cie.domain.script.jython.ScriptInvocationHandler.invoke(ScriptInvocationHandler.java:143)
at $Proxy1.setTargets(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
...
at java.lang.reflect.Method.invoke(Method.java:597)
at weblogic.WLST.main(WLST.java:29)
Caused by: java.lang.NullPointerException
at com.oracle.cie.domain.script.jython.ScriptInvocationHandler.set(ScriptInvocationHandler.java:175)
at com.oracle.cie.domain.script.jython.ScriptInvocationHandler.invoke(ScriptInvocationHandler.java:103)
... 25 more
  • 1. Re: Setting multiple targets for AppDeployments or Libraries in wlst off-line
    PetervanNesatTheFutureGroup Newbie
    Currently Being Moderated
    Finally solved it myself. For the interest of others.

    With 2 calls of moveTargets, the target bi_cluster is replaced with BIP_Cluster_1 for all Library and AppDeployments.
    moveTargets('bi_cluster','BIP_Cluster_1','Library')
    moveTargets('bi_cluster','BIP_Cluster_1','AppDeployment')
    #=======================================================================================
    # moveTargets - target configBeans from oldDestination to newDestination
    #=======================================================================================
    
    def moveTargets(oldDest, newDest, cfgBean) :
      print 'Moving configBean ' + cfgBean + ' from ' + oldDest + ' to ' + newDest
    
      cd('/' + cfgBean)
      bag=ls(returnMap='true')
    
      for bean in bag:
         cd('/' + cfgBean + '/' + bean )
         workBean = cmo
         print "cfgBean " + workBean.getName() + " "
         # if oldDest is in Target of cfgBean
         if str(get('Target')).count(': Name=' + oldDest + ",")!=0:
           # unassign oldDest
           unassign(cfgBean,bean,"Target",oldDest)
           print " +- unassigned " + oldDest + " "
           # if newDest is not in Target of cfgBean
           if str(get('Target')).count(': Name=' + newDest + ",")==0:
             # assign newDest
             assign(cfgBean,bean,"Target",newDest)
             print " +- assigned " + newDest + " "

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points