WLST Libraries
I have a number of WLST scripts which all use a number of common functions I've written such as:
common.py:
import sys
import os
import shutil
import re
def offline_createManagedServer(Name, Port, ListenAddress):
cd('/')
create(Name, 'Server')
cd('Server/'+Name)
set('ListenPort', int(Port))
set('ListenAddress', ListenAddress)
This is called by createDomain.py
readTemplate('D:\\common\\bin\\osb1031' + '/wlserver_10.3/common/templates/domains/wls.jar')
common.offline_createManagedServer('ManagedServer1', '7001', 'localhost')
I have been attempting to use the instructions at:
http://download.oracle.com/docs/cd/E12840_01/wls/docs103/config_scripting/using_WLST.html#wp1093407
Using the above code I get 'NameError: cd' at the first line in offline_createManagedServer --> cd('/')
I then created the wl.py and import that and now get a different error:
Error: No domain or domain template has been read.
Error: set() cannot be applied at this point of path
I want to keep all the common functions in a library style script file so they can be shared.
Has anyone actually got this to work?
Edit:
I call the createDomain.py as follows:
set WL_HOME=D:\common\bin\osb1031\wlserver_10.3
call %WL_HOME%\server\bin\setWLSEnv.cmd
java weblogic.WLST createDomain.py
Edited by: user10074087 on Dec 13, 2009 10:20 PM
In case anyone finds this useful, I ended up using:
jpythonScriptsDir = os.environ.get("SCRIPTS_PYTHON")
execfile(jpythonScriptsDir + '/common/' + 'import.py')
I run this at the start of all scripts that need access to the common functions.
execfile loads the definitions in import.py into the namespace that has all of the WLST functions.
Similar Messages
-
Clean libraries not referencing in weblogic, WLST
Hi,
How can I do to clean all libraries that they are not referencing to any application in WLST?
Thanks!I solved in this way:
domainRuntime()
cd('ServerRuntimes')
servers = domainRuntimeService.getServerRuntimes()
for server in servers:
print('')
print '--------------------------------------------------'
print '--------------- ServerName -----------------------'
print '--------------------------------------------------'
print('')
print('')
print 'SERVER NAME: ' + server.getName()
print 'SERVER STATE: ' + server.getState()
print 'SERVER HEALTH STATE: ' + str(server.getHealthState())
print('')
libraries = server.getLibraryRuntimes()
for library in libraries :
libName = library.getLibraryName()
libIdentifier = library.getLibraryIdentifier()
if libName.startswith('com.edisa.libra.'):
referencingNames = library.getReferencingNames()
if referencingNames != 'null' and len(referencingNames) > 0:
print('libName ' + libName+' libIdentifier '+libIdentifier)
for ref in referencingNames:
print(' ---> Referenced in : '+ ref)
print('')
else:
print('libName ' + libName + ' is not referenced')
status = undeploy(libName)
print(status)
print('') -
Setting multiple targets for AppDeployments or Libraries in wlst off-line
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 etarray(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 newTargetsarray(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 moreFinally 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 + " " -
WLST Exception while Creating JMS Resources
Hi,
I am using Weblogic version 10 MP!, Below is the WLST online script, You willl see a lot of variables in the script, the value which i am calling from another file, This is beacuse everytime instead of modifying the script i will modify the template. There is a lot of p.MS1, p.MS2, the information is called from a different file.
Please provide some kind of suggestion to fix this issue.
Thanks in Advance..
********************************************************************************************SCRIPT********************************************************************************
from weblogic.descriptor import BeanAlreadyExistsException
from java.lang.reflect import UndeclaredThrowableException
from java.lang import System
import javax
from java.util import *
from javax.management import *
import javax.management.Attribute
from javax import management
from javax.management import MBeanException
from javax.management import RuntimeMBeanException
import javax.management.MBeanException
from java.lang import UnsupportedOperationException
import Domain_info as p
import Cluster_info as q
domName = p.Domain_Name
adminServerName = p.Admin_Name
adminServerListenPort = p.AdminPort
adminServerListenAddress = p.AdminListen
userName = p.username
passWord = p.password
domainDir = p.domainDir
URL = "t3://143.192.44.41:7301"
ManagedServer1 = q.MS1
ManagedServer2 = q.MS2
ManagedServer3 = q.MS3
ManagedServer4 = q.MS4
JMSServer1 = q.JMS1
JMSServer2 = q.JMS2
JMSServer3 = q.JMS3
JMSServer4 = q.JMS4
Queue1 = q.Q1
Queue2 = q.Q2
Queue3 = q.Q3
Queue4 = q.Q4
Queue5 = q.Q5
JMS_resource = q.JMS_resource
connect(userName, passWord, URL)
clustHM = HashMap()
edit()
startEdit()
cd('/')
print JMS_resource
print JmsSystemResource
#create(JMS_resource,'JMSSystemResource')
cd('JMSSystemResource/'+JMS_resource+'JmsResource/')
#cd('/')
#create(Queue1,'Queue')
#setJNDIName('jms/'+Queue1)
#setSubDeploymentName(JMSServer1,JMSServer2)
#cd('/')
#cd('JMSSystemResource/'+JMS_resource)
#create(JMSServer1,JMSServer2, 'SubDeployment')
save()
activate(block="true")
disconnect()
print 'End of script ...'
exit()
****************************************************END OF SCRIPT ***********************************************************************************************************
Exception:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
This Exception occurred at Sat Oct 18 18:13:50 GMT 2008.
javax.management.AttributeNotFoundException: com.bea:Name=Sample_1,Type=Domain:JMSSystemResource
at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:221)
at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:224)
at javax.management.remote.rmi.RMIConnectionImpl_1001_WLStub.getAttribute(Unknown Source)
at weblogic.management.remote.common.RMIConnectionWrapper$11.run(ClientProviderBase.java:531)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.security.Security.runAs(Security.java:61)
at weblogic.management.remote.common.RMIConnectionWrapper.getAttribute(ClientProviderBase.java:529)
at javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.getAttribute(RMIConnector.java:857)
at weblogic.management.scripting.BrowseHandler.regularPush(BrowseHandler.java:420)
at weblogic.management.scripting.BrowseHandler.splitPush(BrowseHandler.java:145)
at weblogic.management.scripting.BrowseHandler.cd(BrowseHandler.java:640)
at weblogic.management.scripting.WLScriptContext.cd(WLScriptContext.java:195)
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:585)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:160)
at org.python.core.PyMethod.__call__(PyMethod.java:96)
at org.python.core.PyObject.__call__(PyObject.java:270)
at org.python.core.PyObject.invoke(PyObject.java:2041)
at org.python.pycode._pyx19.cd$5(<iostream>:161)
at org.python.pycode._pyx19.call_function(<iostream>)
at org.python.core.PyTableCode.call(PyTableCode.java:208)
at org.python.core.PyTableCode.call(PyTableCode.java:267)
at org.python.core.PyFunction.__call__(PyFunction.java:172)
at org.python.pycode._pyx18.f$0(/opt/SCRIPTS/Domain_Creation/Create_JMS.py:52)
at org.python.pycode._pyx18.call_function(/opt/SCRIPTS/Domain_Creation/Create_JMS.py)
at org.python.core.PyTableCode.call(PyTableCode.java:208)
at org.python.core.PyCode.call(PyCode.java:14)
at org.python.core.Py.runCode(Py.java:1135)
at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:167)
at weblogic.management.scripting.WLST.main(WLST.java:106)
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:585)
at weblogic.WLST.main(WLST.java:29)
Caused by: javax.management.AttributeNotFoundException: com.bea:Name=Sample_1,Type=Domain:JMSSystemResource
at weblogic.management.jmx.modelmbean.WLSModelMBean.getPropertyDescriptorForAttribute(WLSModelMBean.java:1419)
at weblogic.management.mbeanservers.internal.SecurityInterceptor.getPropertyDescriptor(SecurityInterceptor.java:842)
at weblogic.management.mbeanservers.internal.SecurityInterceptor.checkGetSecurity(SecurityInterceptor.java:580)
at weblogic.management.mbeanservers.internal.SecurityInterceptor.getAttribute(SecurityInterceptor.java:297)
at weblogic.management.mbeanservers.internal.AuthenticatedSubjectInterceptor$5.run(AuthenticatedSubjectInterceptor.java:192)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.management.mbeanservers.internal.AuthenticatedSubjectInterceptor.getAttribute(AuthenticatedSubjectInterceptor.java:190)
at weblogic.management.jmx.mbeanserver.WLSMBeanServer.getAttribute(WLSMBeanServer.java:269)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1385)
at javax.management.remote.rmi.RMIConnectionImpl.access$100(RMIConnectionImpl.java:81)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1245)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1348)
at javax.management.remote.rmi.RMIConnectionImpl.getAttribute(RMIConnectionImpl.java:597)
at javax.management.remote.rmi.RMIConnectionImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:589)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:479)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:475)
at weblogic.rmi.internal.BasicServerRef.access$300(BasicServerRef.java:59)
at weblogic.rmi.internal.BasicServerRef$BasicExecuteRequest.run(BasicServerRef.java:1016)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:200)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:172)
Problem invoking WLST - Traceback (innermost last):
File "/opt/SCRIPTS/Domain_Creation/Create_JMS.py", line 52, in ?
File "<iostream>", line 170, in cd
WLSTException: 'Error cding to the MBean'Hi David,
Thanks for replying...
Here i am trying to create connection Factory
i made some small changes to script and run ls() command...
****************************************************SCRIPT******************************************************************************
from weblogic.descriptor import BeanAlreadyExistsException
from java.lang.reflect import UndeclaredThrowableException
from java.lang import System
import javax
from java.util import *
from javax.management import *
import javax.management.Attribute
from javax import management
from javax.management import MBeanException
from javax.management import RuntimeMBeanException
import javax.management.MBeanException
from java.lang import UnsupportedOperationException
import Domain_info as p
import Cluster_info as q
import sys
from java.lang import System
domName = p.Domain_Name
adminServerName = p.Admin_Name
adminServerListenPort = p.AdminPort
adminServerListenAddress = p.AdminListen
userName = p.username
passWord = p.password
domainDir = p.domainDir
URL = "t3://143.192.44.41:7301"
ManagedServer1 = q.MS1
ManagedServer2 = q.MS2
ManagedServer3 = q.MS3
ManagedServer4 = q.MS4
JMSServer1 = q.JMS1
JMSServer2 = q.JMS2
JMSServer3 = q.JMS3
JMSServer4 = q.JMS4
Queue1 = q.Q1
Queue2 = q.Q2
Queue3 = q.Q3
Queue4 = q.Q4
Queue5 = q.Q5
JMS_resource = q.JMS_resource
Connection_Factory1 = q.CF1
connect(userName, passWord, URL)
clustHM = HashMap()
edit()
startEdit()
# Creating a JMS Connection
ls()
create(Connection_Factory1,"JMSConnectionFactory")
ls()
cd("JMSConnectionFactory/"+Connection_Factory1)
print("Created the JMS Connection Factory ...."+Connection_Factory1)
cmo.setJNDIName(jms/Connection_Factory1)
#cd('/')
#create(Queue1,'Queue')
#setJNDIName('jms/'+Queue1)
#setSubDeploymentName(JMSServer1,JMSServer2)
#cd('/')
#cd('JMSSystemResource/'+JMS_resource)
#create(JMSServer1,JMSServer2, 'SubDeployment')
save()
activate(block="true")
disconnect()
print 'End of script ...'
exit()
****************************************************************END********************************************************************************
ls() OUTPUT
dr-- AppDeployments
dr-- BridgeDestinations
dr-- Clusters
dr-- CustomResources
dr-- DeploymentConfiguration
dr-- Deployments
dr-- EmbeddedLDAP
dr-- ErrorHandlings
dr-- FileStores
dr-- InternalAppDeployments
dr-- InternalLibraries
dr-- JDBCDataSourceFactories
dr-- JDBCStores
dr-- JDBCSystemResources
dr-- JMSBridgeDestinations
dr-- JMSInteropModules
dr-- JMSServers
dr-- JMSSystemResources
dr-- JMX
dr-- JTA
dr-- JoltConnectionPools
dr-- Libraries
dr-- Log
dr-- LogFilters
dr-- Machines
dr-- MailSessions
dr-- MessagingBridges
dr-- MigratableTargets
dr-- RemoteSAFContexts
dr-- SAFAgents
dr-- SNMPAgent
dr-- SNMPAgentDeployments
dr-- Security
dr-- SecurityConfiguration
dr-- SelfTuning
dr-- Servers
dr-- ShutdownClasses
dr-- SingletonServices
dr-- StartupClasses
dr-- SystemResources
dr-- Targets
dr-- VirtualHosts
dr-- WLDFSystemResources
dr-- WLECConnectionPools
dr-- WSReliableDeliveryPolicies
dr-- WTCServers
dr-- WebAppContainer
dr-- WebserviceSecurities
dr-- XMLEntityCaches
dr-- XMLRegistries
-rw- AdminServerName Sample_AdminServer
-rw- AdministrationMBeanAuditingEnabled false
-rw- AdministrationPort 9002
-rw- AdministrationPortEnabled false
-rw- AdministrationProtocol t3s
-rw- ArchiveConfigurationCount 0
-rw- ClusterConstraintsEnabled false
-rw- ConfigBackupEnabled false
-rw- ConfigurationAuditType none
-rw- ConfigurationVersion 10.0.1.0
-rw- ConsoleContextPath console
-rw- ConsoleEnabled true
-rw- ConsoleExtensionDirectory console-ext
-rw- DomainVersion 10.0.1.0
-r-- LastModificationTime 0
-rw- Name Sample_1
-rw- Notes null
-rw- Parent null
-rw- ProductionModeEnabled false
-r-- RootDirectory /opt/Dev/Sample_1
-r-- Type Domain
-r-x freezeCurrentValue Void : String(attributeName)
-r-x isSet Boolean : String(propertyName)
-r-x restoreDefaultValue Void : String(attributeName)
-r-x unSet Void : String(propertyName)
No stack trace available.
Problem invoking WLST - Traceback (innermost last):
File "/opt/SCRIPTS/Domain_Creation/Create_JMS.py", line 60, in ?
File "<iostream>", line 511, in create
WLSTException: 'Error occured while performing create : Cannot create MBean of type JMSConnectionFactory. You can only create MBeans children to the current cmo. \nTo view the children types that you can create, use listChildTypes().' -
How can I use custom WLST commands for Oracle SOA Suite in Weblogic
Hi There,
I'm trying to view and search the weblogic log files using WLST on a Solaris/Unix system.
I have come across this "custom WLST commands for Oracle SOA Suite" and thought of using the custom logging commands to get my task done.
However, my WLST shell is not recognizing the commands and giving me the NameError!
wls:/devDomain1/domainRuntime> listLogs()
Traceback (innermost last):
File "<console>", line 1, in ?
NameError: listLogs
I tried the commands listLogs, displayLogs, getLogLevel & setLogLevel but in vain!
I have followed the instructions as per the oracle recommendation of using Custom WLST commands (http://docs.oracle.com/cd/E29597_01/core.1111/e10105/getstart.htm#ASADM10692) as below
- Launched the WLST shell from Oracle Home.
cd ORACLE_HOME/common/bin
./wlst.sh
- Tried to run the listLogs command from domainRuntime()
I would like to know if I need to import any additional libraries to run the custom WLST commands for Oracle SOA Suite in my WLST shell?
I have only weblogic 10.3.1 server installed on my Solaris 10 machine on which I have deployed the OSB application software.
There is no SOA Suite installed.
Or is there any other way I can browse the Server Log file and get the list of log messages? Basically I would like to use this feature in my script to customize it according to my requirement of listing specific error logs which I can work it out if I know how to make these commands work.
Please advise if this is possible and how?
Cheers.
SatishI have tried on my OSB installation (no SOA Suite here), the command listLogs() works (I was in online mode, after a connect), and the classpath is:
CLASSPATH=/opt/oracle/fmw11_1_1_5/patch_wls1035/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/opt/oracle/fw11_1_1_5/patch_ocp360/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/usr/lib/jvm/java-1.6.0-sun-1.6.0.33.x6_64/lib/tools.jar:/opt/oracle/fmw11_1_1_5/wlserver_10.3/server/lib/weblogic_sp.jar:/opt/oracle/fmw11_1_1_5/wlserver_10./server/lib/weblogic.jar:/opt/oracle/fmw11_1_1_5/modules/features/weblogic.server.modules_10.3.5.0.jar:/opt/oracle/fmw111_1_5/wlserver_10.3/server/lib/webservices.jar:/opt/oracle/fmw11_1_1_5/modules/org.apache.ant_1.7.1/lib/ant-all.jar:/optoracle/fmw11_1_1_5/modules/net.sf.antcontrib_1.1.0.0_1-0b2/lib/ant-contrib.jar::/opt/oracle/fmw11_1_1_5/oracle_common/moules/oracle.jrf_11.1.1/jrf-wlstman.jar:/opt/oracle/fmw11_1_1_5/oracle_common/common/wlst/lib/adfscripting.jar:/opt/oracl/fmw11_1_1_5/oracle_common/common/wlst/lib/adf-share-mbeans-wlst.jar:/opt/oracle/fmw11_1_1_5/oracle_common/common/wlst/lb/mdswlst.jar:/opt/oracle/fmw11_1_1_5/oracle_common/common/wlst/resources/auditwlst.jar:/opt/oracle/fmw11_1_1_5/oracle_cmmon/common/wlst/resources/igfwlsthelp.jar:/opt/oracle/fmw11_1_1_5/oracle_common/common/wlst/resources/jps-wlst.jar:/optoracle/fmw11_1_1_5/oracle_common/common/wlst/resources/jrf-wlst.jar:/opt/oracle/fmw11_1_1_5/oracle_common/common/wlst/reources/oamap_help.jar:/opt/oracle/fmw11_1_1_5/oracle_common/common/wlst/resources/oamAuthnProvider.jar:/opt/oracle/fmw111_1_5/oracle_common/common/wlst/resources/ossoiap_help.jar:/opt/oracle/fmw11_1_1_5/oracle_common/common/wlst/resources/osoiap.jar:/opt/oracle/fmw11_1_1_5/oracle_common/common/wlst/resources/ovdwlsthelp.jar:/opt/oracle/fmw11_1_1_5/oracle_comon/common/wlst/resources/sslconfigwlst.jar:/opt/oracle/fmw11_1_1_5/oracle_common/common/wlst/resources/wsm-wlst.jar:/optoracle/fmw11_1_1_5/utils/config/10.3/config-launch.jar::/opt/oracle/fmw11_1_1_5/wlserver_10.3/common/derby/lib/derbynet.ar:/opt/oracle/fmw11_1_1_5/wlserver_10.3/common/derby/lib/derbyclient.jar:/opt/oracle/fmw11_1_1_5/wlserver_10.3/common/drby/lib/derbytools.jar::
The wlst.sh I have used is /opt/oracle/fmw11_1_1_5/osb/common/bin/wlst.sh
I hope this can help -
Shared Libraries Dummy Questions
Hello *,
I am painfully improving my understanding about shared libs. I read the technical docs how to reference them etc but I guess I am missing the concepts.
I built a web service with workshop 10.3 which of course runs fine from workshop, default settings, so the web service references 3 shared libs automagically.
Now I manually deployed this webservice app to a managed server instead of admin and it failed. I figured out I have to target the shared libs to the managed server which is of course understandable. But still, wouldn't it be helpfull to have shared libs targeted to all servers as default? (actually I am not sure if there is such a thing, target to all servers, all I know is target to a whole cluster).
Now I tried to deploy the same web service to another domain with admin console. This fails. Workshop deploys the shared libs but admin doesn't.
Now my main question is about the concept behind.
1. Is there a recommended way to get rid of the shared libs for a workshop project once it was configured to use shared libs?
Is the only way manually adding the shared lib under WEB-INF/lib?
2. Is there a deploy dependent shared libs? I mean if workshop can do it, couldn't wls admin do it the same way?
3. If I generate a build script, will it take care of deploying shared libs?
4. let's assume I want to replace the wls-commonslogging-bridge.war which contains the commons-logging.jar,
where is this jar located?
I understand share libs make sense for bigger projects, but I don't understand I have to deploy 3 of them first to
make a hello world web service run.
curious,
Barossa
Edited by: Barossa on Feb 18, 2009 9:17 PMFirst, for Workshop questions you may want to try that specific forum:
Workshop
Your question definitely has WebLogic components too. Let me give some of these a try.
>
1. Is there a recommended way to get rid of the shared libs for a workshop project once it was configured to use shared libs?
Is the only way manually adding the shared lib under WEB-INF/lib?That would be one way, another way would be APP-INF/lib of the EAR. The shared libraries are defined in weblogic.xml or weblogic-application xml. Typically a domain will be configured with the libraries to be deployed when it is created if you're just using the standard WebLogic shared libraries like the Workshop framework, etc. You can also make sure that your deployment mechanism, like WLST, checks to make sure the libraries are deployed.
>
2. Is there a deploy dependent shared libs? I mean if workshop can do it, couldn't wls admin do it the same way?It's my understand that this is a convenience mechanism that Workshop built specifically. You're shared libraries are defined in Workshop in the preferences so it knows where to get them from if they are missing, that's not necessarily true for deploying from the Admin Server.
3. If I generate a build script, will it take care of deploying shared libs?Definitely WLST can be used to do this.
4. let's assume I want to replace the wls-commonslogging-bridge.war which contains the commons-logging.jar,
where is this jar located?Can't remember offhand (not on my normal machine right now), but you should be able to check easily by searching your installation of WLS for the shared library name (the war in this case). Also, Workshop should have a reference to it somewhere in the preferences.
I understand share libs make sense for bigger projects, but I don't understand I have to deploy 3 of them first to
make a hello world web service run.As I mentioned earlier, if you made the domain a Workshop domain when you created it, those shared libraries should already have been deployed and it would be ready to go.
curious,
Barossa
Edited by: Barossa on Feb 18, 2009 9:17 PM -
WLST crashed on getting non-existing attribute in runtime()
After downloading the latest WLST package (April 14th, 2005) from the dev2dev site, I'm experiencing WLST crashs after attempting to get an attribute on a non-existing object instead of seeing a normal syntax error message.
Before updating my jython.jar and wlst.jar for dev2dev:
wls:/dizzyworld/runtime/ServerRuntime/dizzy1/ApplicationRuntimes/dizzy1_mbeanlis
ter/ComponentRuntimes/dizzy1_dizzy1_mbeanlister_mbeanlister> get('SessionsOpenTo
talCount')
Traceback (innermost last):
File "<input>", line 1, in ?
File "<iostream>", line 191, in get
WLSTException: 'Error occured while performing get : AttributeNotFound Exception
while doing a getAttribute for attribute SessionsOpenTotalCount. Use dumpStack(
) to view the error stack trace'
After:
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x8072644
Function=[Unknown.]
Library=D:\bea\jdk142_05\jre\bin\client\jvm.dll
NOTE: We are unable to locate the function name symbol for the error
just occurred. Please refer to release documentation for possible
reason and solutions.
Current Java thread:
at java.lang.Throwable.getStackTraceDepth(Native Method)
at java.lang.Throwable.getOurStackTrace(Throwable.java:588)
- locked <0x10462cf0> (a java.lang.Throwable)
at java.lang.Throwable.getStackTrace(Throwable.java:582)
at weblogic.utils.StackTraceUtils.getThrowableWithCause(StackTraceUtils.java:180)
at weblogic.rjvm.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:108)
at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:137)
at weblogic.management.internal.RemoteMBeanServerImpl_814_WLStub.getAttribute(Unknown Source)
at weblogic.management.scripting.BrowseHandler.handleRuntime(BrowseHandler.java:1596)
at weblogic.management.scripting.BrowseHandler.regularPush(BrowseHandler.java:981)
at weblogic.management.scripting.BrowseHandler.splitPush(BrowseHandler.java:139)
at weblogic.management.scripting.BrowseHandler.cd(BrowseHandler.java:1693)
at weblogic.management.scripting.BrowseHandler.cd(BrowseHandler.java:1683)
at weblogic.management.scripting.BrowseHandler.resetCD(BrowseHandler.java:1664)
at weblogic.management.scripting.BrowseHandler.splitPush(BrowseHandler.java:141)
at weblogic.management.scripting.BrowseHandler.cd(BrowseHandler.java:1693)
at weblogic.management.scripting.BrowseHandler.cd(BrowseHandler.java:1683)
at weblogic.management.scripting.BrowseHandler.resetCD(BrowseHandler.java:1664)
at weblogic.management.scripting.BrowseHandler.splitPush(BrowseHandler.java:141)
at weblogic.management.scripting.BrowseHandler.cd(BrowseHandler.java:1693)
at weblogic.management.scripting.BrowseHandler.cd(BrowseHandler.java:1683)
at weblogic.management.scripting.EditHandler.get(EditHandler.java:66)
at weblogic.management.scripting.EditHandler.get(EditHandler.java:57)
at weblogic.management.scripting.EditHandler.get(EditHandler.java:57)
at weblogic.management.scripting.EditHandler.get(EditHandler.java:57)
at weblogic.management.scripting.EditHandler.get(EditHandler.java:57)
Dynamic libraries:
0x00400000 - 0x0040B000 D:\bea\jdk142_05\bin\java.exe
0x77F80000 - 0x77FFD000 C:\WINNT\system32\ntdll.dll
0x7C2D0000 - 0x7C332000 C:\WINNT\system32\ADVAPI32.dll
0x7C570000 - 0x7C623000 C:\WINNT\system32\KERNEL32.DLL
0x77D30000 - 0x77DA1000 C:\WINNT\system32\RPCRT4.DLL
0x78000000 - 0x78045000 C:\WINNT\system32\MSVCRT.dll
0x08000000 - 0x08139000 D:\bea\jdk142_05\jre\bin\client\jvm.dll
0x77E10000 - 0x77E6F000 C:\WINNT\system32\USER32.dll
0x77F40000 - 0x77F7B000 C:\WINNT\system32\GDI32.dll
0x77570000 - 0x775A0000 C:\WINNT\system32\WINMM.dll
0x6BD00000 - 0x6BD0D000 C:\WINNT\system32\SYNCOR11.DLL
0x10000000 - 0x10007000 D:\bea\jdk142_05\jre\bin\hpi.dll
0x007C0000 - 0x007CE000 D:\bea\jdk142_05\jre\bin\verify.dll
0x007D0000 - 0x007E9000 D:\bea\jdk142_05\jre\bin\java.dll
0x007F0000 - 0x007FD000 D:\bea\jdk142_05\jre\bin\zip.dll
0x18BE0000 - 0x18BEF000 D:\bea\jdk142_05\jre\bin\net.dll
0x75030000 - 0x75044000 C:\WINNT\system32\WS2_32.dll
0x75020000 - 0x75028000 C:\WINNT\system32\WS2HELP.DLL
0x782C0000 - 0x782CC000 C:\WINNT\System32\rnr20.dll
0x77980000 - 0x779A4000 C:\WINNT\system32\DNSAPI.DLL
0x75050000 - 0x75058000 C:\WINNT\system32\WSOCK32.DLL
0x77340000 - 0x77353000 C:\WINNT\system32\iphlpapi.dll
0x77520000 - 0x77525000 C:\WINNT\system32\ICMP.DLL
0x77320000 - 0x77337000 C:\WINNT\system32\MPRAPI.DLL
0x75150000 - 0x7515F000 C:\WINNT\system32\SAMLIB.DLL
0x75170000 - 0x751BF000 C:\WINNT\system32\NETAPI32.DLL
0x7C340000 - 0x7C34F000 C:\WINNT\system32\Secur32.dll
0x77BF0000 - 0x77C01000 C:\WINNT\system32\NTDSAPI.dll
0x77950000 - 0x7797A000 C:\WINNT\system32\WLDAP32.DLL
0x751C0000 - 0x751C6000 C:\WINNT\system32\NETRAP.dll
0x77A50000 - 0x77B3F000 C:\WINNT\system32\OLE32.DLL
0x779B0000 - 0x77A4B000 C:\WINNT\system32\OLEAUT32.DLL
0x773B0000 - 0x773DF000 C:\WINNT\system32\ACTIVEDS.DLL
0x77380000 - 0x773A3000 C:\WINNT\system32\ADSLDPC.DLL
0x77830000 - 0x7783E000 C:\WINNT\system32\RTUTILS.DLL
0x77880000 - 0x7790E000 C:\WINNT\system32\SETUPAPI.DLL
0x7C0F0000 - 0x7C151000 C:\WINNT\system32\USERENV.DLL
0x774E0000 - 0x77513000 C:\WINNT\system32\RASAPI32.DLL
0x774C0000 - 0x774D1000 C:\WINNT\system32\RASMAN.DLL
0x77530000 - 0x77552000 C:\WINNT\system32\TAPI32.DLL
0x71710000 - 0x71794000 C:\WINNT\system32\COMCTL32.DLL
0x70A70000 - 0x70AD6000 C:\WINNT\system32\SHLWAPI.DLL
0x77360000 - 0x77379000 C:\WINNT\system32\DHCPCSVC.DLL
0x777E0000 - 0x777E8000 C:\WINNT\System32\winrnr.dll
0x777F0000 - 0x777F5000 C:\WINNT\system32\rasadhlp.dll
0x19070000 - 0x19075000 D:\bea\weblogic81\server\bin\stackdump.dll
0x74FD0000 - 0x74FEE000 C:\WINNT\system32\msafd.dll
0x75010000 - 0x75017000 C:\WINNT\System32\wshtcpip.dll
0x77920000 - 0x77943000 C:\WINNT\system32\imagehlp.dll
0x72A00000 - 0x72A2D000 C:\WINNT\system32\DBGHELP.dll
0x690A0000 - 0x690AB000 C:\WINNT\system32\PSAPI.DLL
Heap at VM Abort:
Heap
def new generation total 4544K, used 4428K [0x10010000, 0x104f0000, 0x104f0000)
eden space 4096K, 100% used [0x10010000, 0x10410000, 0x10410000)
from space 448K, 74% used [0x10410000, 0x10463190, 0x10480000)
to space 448K, 0% used [0x10480000, 0x10480000, 0x104f0000)
tenured generation total 60544K, used 60543K [0x104f0000, 0x14010000, 0x14010000)
the space 60544K, 99% used [0x104f0000, 0x1400ffc0, 0x14010000, 0x14010000)
compacting perm gen total 8960K, used 8801K [0x14010000, 0x148d0000, 0x18010000)
the space 8960K, 98% used [0x14010000, 0x148a8630, 0x148a8800, 0x148d0000)
Local Time = Tue Aug 09 11:22:51 2005
Elapsed Time = 133
# HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION
# Error ID : 4F530E43505002EF
# Please report this error at
# http://java.sun.com/cgi-bin/bugreport.cgi
# Java VM: Java HotSpot(TM) Client VM (1.4.2_05-b04 mixed mode)
Regards,
Zachary Slaybaugh
Sr. Application Administrator
Time Warner Cable, Inc.This has been fixed in the latest version of wlst. You can get it from
https://codesamples.projects.dev2dev.bea.com/servlets/Scarab/id/S13
Thanks,
-satya -
In this post we will use WLST to create a WebLogic domain (cluster, web server, resources, security and deployment). WLST is a scripting language, which can be used to create, monitor and manage domains. WLST is based on Jython and provides next to the default Jython functionality, functions which are WebLogic Server specific. WLST can be used in two ways: online and offline. The offline mode has no connection with the admin server, the online mode has. The offline mode can be used for creating domains. To configure the created domain we must connect to the admin server. WLST online is a Java Management Extensions (JMX) client, which communicates with the server's managed beans collections. A managed bean is a Java object that provides an interface for a particular resource. An overview of the available managed beans can be found here.
Before we start walking through the individual configuration steps, we define a few helpful parameters
beahome = '/home/oracle/bea';
linux = true;
adminusername = 'username';
adminpassword = 'password';
servername = 'AdminServer';
domainname = 'ScriptDomain';
pathseparator = '/';
if not linux:
pathseparator = '\\';
# set paths
domaintemplate = beahome + pathseparator + 'wlserver_10.3' + pathseparator + 'common' + pathseparator + 'templates' + pathseparator + 'domains' + pathseparator + 'wls.jar';
domainlocation = beahome + pathseparator + 'user_projects' + pathseparator + 'domains' + pathseparator + domainname;
nodemanagerhomelocation = beahome + pathseparator + 'wlserver_10.3' + pathseparator + 'common' + pathseparator + 'nodemanager';
jvmlocation = beahome + pathseparator + 'jrockit_160_05_R27.6.2-20';
jsfrilibrary = beahome + pathseparator + 'wlserver_10.3' + pathseparator + 'common' + pathseparator + 'deployable-libraries' + pathseparator + 'jsf-ri-1.1.1.war';
trinidadlibrary = beahome + pathseparator + 'wlserver_10.3' + pathseparator + 'common' + pathseparator + 'deployable-libraries' + pathseparator + 'trinidad.war';
coherencelibrary = beahome + pathseparator + 'wlserver_10.3' + pathseparator + 'coherence' + pathseparator + 'coherence-web-spi.war';
videotheekproxypath = beahome + pathseparator + 'deploy' + pathseparator + 'videotheekproxy' + pathseparator + 'VideotheekProxy.war';
videotheekproxyplanpath = beahome + pathseparator + 'deploy' + pathseparator + 'videotheekproxy' + pathseparator + 'Plan.xml';
videotheekpath = beahome + pathseparator + 'deploy' + pathseparator + 'videotheek' + pathseparator + 'Videotheek.ear';
videotheekplanpath = beahome + pathseparator + 'deploy' + pathseparator + 'videotheek' + pathseparator + 'Plan.xml';
Create a domain
By using a domain template, we can create a new domain. Some default templates are available in the directory: <middleware-home>/wlserver_10.3/common/templates/domains. In the example, we use the template wls.jar
createDomain(domaintemplate, domainlocation, adminusername, adminpassword);
WLST online
Before we are able to create resources, we must first connect to the admin server
print 'START NODE MANAGER';
startNodeManager(verbose='true', NodeManagerHome=nodemanagerhomelocation, ListenPort='5556', ListenAddress='localhost');
print 'CONNECT TO NODE MANAGER';
nmConnect(adminusername, adminpassword, 'localhost', '5556', domainname, domainlocation, 'ssl');
print 'START ADMIN SERVER';
nmStart(servername);
print 'CONNECT TO ADMIN SERVER';
connect(adminusername, adminpassword);
Edit mode
Changes are made in the WLST edit mode
print 'START EDIT MODE';
edit();
startEdit();
Create server environment
First, we create a machine
print 'CREATE MACHINE: VIDEOTHEEKMACHINE';
videotheekMachine = cmo.createUnixMachine('VideotheekMachine');
videotheekMachine.setPostBindUIDEnabled(true);
videotheekMachine.setPostBindUID('oracle');
videotheekMachine.setPostBindGIDEnabled(true);
videotheekMachine.setPostBindGID('oracle');
videotheekMachine.getNodeManager().setNMType('ssl');The variable cmo contains the current management object. (The methode ls() provides the functionality to print a tree containing all child objects of the current management object. By using cd('naamManagementBean') we can change the current management object.) Note that, in the example above a machine object of type MachineMBean is created. This management bean has related management beans such a NodeManager of type NodeManagerMBean. Using the method getNodeManager() we obtain an instance of this bean. By using accessors such as setNMType(), we can change the node manager type.
In a same manner, we create a cluster
print 'CREATE CLUSTER: VIDEOTHEEKCLUSTER';
videotheekCluster = cmo.createCluster('VideotheekCluster');
videotheekCluster.setClusterMessagingMode('unicast');
videotheekCluster.setWeblogicPluginEnabled(true);In the next step, we create a managed server and add this to the machine and cluster
print 'CREATE MANAGED SERVER: VIDEOTHEEKSERVER1';
videotheekServer1 = cmo.createServer('VideotheekServer1');
videotheekServer1.setListenPort(7002);
videotheekServer1.setAutoRestart(true);
videotheekServer1.setAutoKillIfFailed(true);
videotheekServer1.setRestartMax(2);
videotheekServer1.setRestartDelaySeconds(10);
videotheekServer1.getServerStart().setJavaHome(jvmlocation);
videotheekServer1.getServerStart().setJavaVendor('Oracle');
videotheekServer1.getServerStart().setArguments('-Xms128m -Xmx256m -Xns64m -Xgcprio:pausetime');
print 'ADD MANAGED SERVERS TO CLUSTER';
videotheekServer1.setCluster(videotheekCluster);
print 'ADD MANAGED SERVERS TO MACHINE';
videotheekServer1.setMachine(videotheekMachine);Creating the web server is identical, except that we do not add this server to the cluster
print 'CREATE MANAGED SERVER: VIDEOTHEEKWEBSERVER';
videotheekWebServer = cmo.createServer('VideotheekServer2');
videotheekWebServer.setListenPort(7004);
videotheekWebServer.setAutoRestart(true);
videotheekWebServer.setAutoKillIfFailed(true);
videotheekWebServer.setRestartMax(2);
videotheekWebServer.setRestartDelaySeconds(10);
videotheekWebServer.getServerStart().setJavaHome(jvmlocation);
videotheekWebServer.getServerStart().setJavaVendor('Oracle');
videotheekWebServer.getServerStart().setArguments('-Xms128m -Xmx128m -Xns32m -Xgcprio:throughput');
print 'ADD MANAGED SERVER TO MACHINE';
videotheekWebServer.setMachine(videotheekMachine);
Save and activate changes
Changes can be save and activated as follows
save();
activate(block='true');
Create a Java messaging environment
First, we create a file store to save messages
videotheekFileStore = cmo.createFileStore('VideotheekFileStore');
targets = videotheekFileStore.getTargets();
targets.append(videotheekServer1);
videotheekFileStore.setTargets(targets);The methode getTargets() returns a management bean of type TargetMBean. This management bean represents a targets list. All management beans that represent resources implement this TargetMBean. Targets can only be servers or clusters. The targets list is a Jython array and thus can be manipulated as such. The methode append() adds a target to the list, in this case: VideotheekServer1.
Next, we create a JMS Server and map this to the filestore
videotheekJMSServer = cmo.createJMSServer('VideotheekJMSServer');
videotheekJMSServer.setPersistentStore(videotheekFileStore);
videotheekJMSServer.setTargets(targets);Note that we target the JMS Server to the same target as the filestore. A JMS module can be created as follows
videotheekModule = cmo.createJMSSystemResource('VideotheekModule');
targets.remove(videotheekServer1);
targets.append(videotheekCluster);
videotheekModule.setTargets(targets);The JMS Module is targeted to the cluster (note that we first remove the managed server from the target list). Using a sub deployment all the resources in the JMS module are deployed to the JMS Server
videotheekModule.createSubDeployment('VideotheekSubDeployment');
videotheekSubDeployment = videotheekModule.lookupSubDeployment('VideotheekSubDeployment');
targets.remove(videotheekCluster);
targets.append(videotheekJMSServer);
videotheekSubDeployment.setTargets(targets);JMS Resources, such as Connection Factories and Queues can be created as follows
jmsResource = videotheekModule.getJMSResource();
jmsResource.createConnectionFactory('VideotheekConnectionFactory');
videotheekConnectionFactory = jmsResource.lookupConnectionFactory('VideotheekConnectionFactory');
videotheekConnectionFactory.setJNDIName('jms/ConnectionFactory');
videotheekConnectionFactory.setSubDeploymentName('VideotheekSubDeployment');
jmsResource.createQueue('VideotheekQueue');
videotheekQueue = jmsResource.lookupQueue('VideotheekQueue');
videotheekQueue.setJNDIName('jms/VideotheekQueue');
videotheekQueue.setSubDeploymentName('VideotheekSubDeployment');
videotheekQueue.getDeliveryParamsOverrides().setRedeliveryDelay(100);
videotheekQueue.getDeliveryFailureParams().setRedeliveryLimit(5);
videotheekQueue.getDeliveryFailureParams().setExpirationPolicy('Log');
videotheekQueue.getDeliveryFailureParams().setExpirationLoggingPolicy('%headers%);
videotheekQueue.getMessageLoggingParams().setMessageLoggingEnabled(true);
videotheekQueue.getMessageLoggingParams().setMessageLoggingFormat('%headers%');In the example above, the management bean JMSResource is resolved. The factory method createConnectionFactory() is used to create a connection factory. Note that this mehtod does not return an instance of connection factory. Using the method lookupConnectionFactory() we cobtain the desired instance. Next, we modify some connection factory parameters. The creation of a queue goes along the same lines.
Create a Connection Pool
First, we create a data source
videotheekDataSource = cmo.createJDBCSystemResource('VideotheekDataSource');
targets.remove(videotheekJMSServer);
targets.append(videotheekCluster);
videotheekDataSource.setTargets(targets);
jdbcResource = videotheekDataSource.getJDBCResource();
jdbcResource.setName('VideotheekDataSource');
names = ['jdbc/exampleDS'];
dataSourceParams = jdbcResource.getJDBCDataSourceParams();
dataSourceParams.setJNDINames(names);
dataSourceParams.setGlobalTransactionsProtocol('none');Next, we modify some driver parameters, linked to this data source
driverParams = jdbcResource.getJDBCDriverParams();
driverParams.setUrl('jdbc:oracle:thin:@hostname:1521:sid');
driverParams.setDriverName('oracle.jdbc.OracleDriver');
driverParams.setPassword('password');
driverProperties = driverParams.getProperties();
driverProperties.createProperty('user');
userProperty = driverProperties.lookupProperty('user');
userProperty.setValue('username');The property user is specific for the used driver. This property can be added by using the JDBCPropertiesBean. Finally, we modify some connection pool parameters
connectionPoolParams = jdbcResource.getJDBCConnectionPoolParams();
connectionPoolParams.setTestTableName('SQL SELECT 1 FROM DUAL');
connectionPoolParams.setConnectionCreationRetryFrequencySeconds(100);
Create Mail Session
The final resource we create is a mail session
videotheekMailSession = cmo.createMailSession('VideotheekMailSession');
videotheekMailSession.setTargets(targets);
videotheekMailSession.setJNDIName('mail/VideotheekMailSession');
import java.util.Properties;
properties = java.util.Properties();
properties.put('mail.smtp.password','password');
properties.put('mail.smtp.port','25');
properties.put('mail.transport.protocol','smtp');
properties.put('mail.smtp.host','mail.some-company.com');
properties.put('mail.smtp.user','username');
properties.put('mail.to','[email protected]');
properties.put('mail.from','[email protected]');
videotheekMailSession.setProperties(properties);To add properties, we use the module java.util.Properties. A properties variable is instantiated using java.util.Properties(). As a final step this properties variable is added to the management bean instance.
Security
Creating a security realm
securityConfiguration = cmo.getSecurityConfiguration();
securityConfiguration.createRealm('VideotheekRealm');
realm = securityConfiguration.lookupRealm('VideotheekRealm');
realm.createAuthenticationProvider('weblogic.security.providers.authentication.DefaultAuthenticator');
authenticator = realm.lookupAuthenticationProvider('DefaultAuthenticator');
authenticator.setControlFlag('optional');
realm.createAuthorizer('weblogic.security.providers.authorization.DefaultAuthorizer');
realm.createAdjudicator('weblogic.security.providers.authorization.DefaultAdjudicator');
realm.createRoleMapper('weblogic.security.providers.authorization.DefaultRoleMapper');
realm.createCredentialMapper('weblogic.security.providers.credentials.DefaultCredentialMapper');
realm.createCertPathProvider('weblogic.security.providers.pk.WebLogicCertPathProvider');By using WLST it is not possible to set the created certpath provider as the current builder. It is also not possible to set a created security realm as the default realm. To do this we must resort to the admin console.
Adding users and groups to the default realm
print 'START SERVER CONFIG';
serverConfig();
print 'ADD USERS AND GROUPS TO DEFAULT SECURITY REALM';
securityRealm = cmo.getSecurityConfiguration().getDefaultRealm();
authProvider = securityRealm.lookupAuthenticationProvider('DefaultAuthenticator');
authProvider.createUser('anemployee', 'welcome1', 'an employee of the videotheek');
authProvider.createUser('amanager', 'welcome1', 'a manager of the videotheek');
authProvider.createGroup('employees', 'employee group of the videotheek');
authProvider.createGroup('managers', 'manager group of the videotheek');
authProvider.addMemberToGroup('employees', 'anemployee');
authProvider.addMemberToGroup('managers', 'amanager');Changes concerning security must be performed in the serverConfig environment. Now we are able to obtain an instance of the default realm. Using this instance, the authentication provider can be looked up, to which users and groups are added. It is also possible to add groups or users to defined roles, for example,
sr = cmo.getSecurityConfiguration().getDefaultRealm();
rm = sr.lookupRoleMapper('XACMLRoleMapper');
expr = rm.getRoleExpression(None,'Admin');
rm.setRoleExpression(None,'Admin',expr+'|Usr(employee)');
rm.setRoleExpression(None,'Anonymous','Usr(employee)|Grp(everyone)');
rm.setRoleExpression(None,'Anonymous','Usr(employee)&Grp(everyone)');
Deployment
First, we start the managed servers
print 'START MANAGED SERVERS';
start('VideotheekWebServer','Server');
start('VideotheekCluster','Cluster');Next, we deploy the libraries and the applications
print 'DEPLOY LIBRARIES';
deploy('jsf-ri', path=jsfrilibrary, targets='VideotheekCluster', libraryModule='true');
deploy('trinidad', path=trinidadlibrary, targets='VideotheekCluster', libraryModule='true');
deploy('coherence-web-spi', path=coherencelibrary, targets='VideotheekCluster', libraryModule='true');
print 'START EDIT MODE';
edit();
startEdit();
print 'CHANGE DEPLOYMENT ORDER OF DEPLOYED LIBRARIES';
libraries = cmo.getLibraries();
for library in libraries:
library.setDeploymentOrder(1);
print 'SAVE AND ACTIVATE CHANGES';
save();
activate(block='true');The attribute libaryModule indicates, we are dealing with a library deployment. To deploy some applications we can use
print 'DEPLOY PROXY SERVLET TO MANAGED WEB SERVER';
deploy('VideotheekProxy', path=videotheekproxypath, targets='VideotheekWebServer', planPath=videotheekproxyplanpath, securityModel='Advanced');
print 'DEPLOY APPLICATION VIDEOTHEEK TO CLUSTER';
deploy('Videotheek', path=videotheekpath, targets='VideotheekCluster', planPath=videotheekplanpath, securityModel='Advanced');The attribuut planPath points to the location of the deployment plans, which were created before hand.
Running a WLST script
Open a command shell and set the WebLogic environment by running the command: source ./setWLSEnv.sh (or the short version: . ./setWLSEnv.sh). The script setWLSEnv.sh is located in the directory <middleware-home>/wlserver_10.3/server/bin. To run a WLST script we can something like: java weblogic.WLST bea/path_to_script/ScriptName.pyShameless plug.
And if you really want to feel good about ordering, please order Lightroom via the LightroomExtra.com home page and you will help me pay for all the bandwidth.
Sid
The LightroomExtra home page is right here. -
Hi All,
I am trying (unsuccessfully) to export metadata for webcenter portal application using WebLogic Scripting Tool.
Accordingly to documentation
http://docs.oracle.com/cd/E23943_01/webcenter.1111/e12405/wcadm_intro.htm#BHCEDCFG
To list WebCenter Portal WLST commands, type: help('webcenter') at the WLST command prompt.
If the message No help for webcenter found... displays, you are probably running the WLST script from the wrong directory, for example, you might be running wlst.sh or wlst.cmd from the oracle_common directory instead of WC_ORACLE_HOME/common/bin.
Also in examples
wlst:> importMetadata(application='wcps-services', server='WC_Utilities', fromLocation='<mar file>', remote='true'),
but when I run in looks
wls:> importMetadata(…………….
I try it in right directory, but still having error. I have JDeveloper 11.1.1.6 with Webcenter.1) If you are trying to export the MDS from JDeveloper you are doing an unnecessary step as the MDS in JDev is already file based and you only have to navigate to the MDS location.
You can find this in your Application properties by going to the Application menu and select Application Properties.
Open the Run node and select MDS. Copy the Default location and open it in your explorer. This should give you the MDS without needing to export it.
2) If you are trying to export MDS from a real WebCenter installation you have to go to the webcenter directory.
In my case this is:
C:\Oracle\middlewarePs6\Oracle_WC1\common\bin
So it looks like <fuisn home>/Oracle_WC1.common/bin
This will open the WLST command tool and will load the required libraries for WebCenter.
You can also read more about this in an article I recently wrote: http://www.ateam-oracle.com/exporting-metadata-for-a-specific-group-space-in-webcenter-spaces/ -
Does and how osb 11g support WLST scripts
Does 11g support WLST scripts to import and export OSB configuration?
Here are the old ones (as I see, dated 03.03.2009). For old 10.3 they worked perfectly.
http://www.oracle.com/technology/products/soa/service-bus/collateral/osbsamples.html
In new release names of few libraries changed (e.g. from com.bea.common.configfwk_1.2.1.0.jar to com.bea.common.configfwk_1.3.0.0.jar), so I simply changed the names in my scripts to use them for 11g. It didn't work. Old scripts (with old libs) don't work for 11g either.
So my question is does OSB still support this kind of deploying, and how can I do that?
Thanks in advance.@ frf
Is it working for you ? The scripts are running fine for me but the values are not geting changed.
This is my custom xml which is created
<?xml version="1.0" encoding="UTF-8"?>
<cus:Customizations xmlns:cus="http://www.bea.com/wli/config/customizations" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xt="http://www.bea.com/wli/config/xmltypes">
<cus:customization xsi:type="cus:FindAndReplaceCustomizationType">
<cus:description>Update to the correct server and port number</cus:description>
<cus:query>
<xt:refsToSearch xsi:type="xt:LocationRefType">
<xt:type>Project</xt:type>
<xt:path>Test OSB Project</xt:path>
</xt:refsToSearch>
<xt:includeOnlyModifiedResources>false</xt:includeOnlyModifiedResources>
<xt:searchString>http://localhost:7001/business/ValidateCoverage/ValidateCoverageService</xt:searchString>
<xt:isCompleteMatch>false</xt:isCompleteMatch>
</cus:query>
<cus:replacement>http://192.20.51.150:7001/business/ValidateCoverage/ValidateCoverageService</cus:replacement>
</cus:customization>
</cus:Customizations>
But import.py is simply not replacing the values in the WSDL -
Hi
I Would like to use rsh to send an alert.
Do somebody can advice me how to run rsh from a WLST script?
an Example:
heapSize = cmo.getHeapSizeCurrent()
if heapSize > THRESHOLD:
# do whatever is neccessary, send alerts, send email etc
How can I do it hier???
ThnaksFirst examine what facilities are available in raw Python (version 2.1, approximately). If you need additional ".py" libraries for this, get them from the Python distribution and make them available to your scripts.
Failing that, if you can write what you need to do in Java, then you can make that code available in a jar file, and import it to your Jython script, and call it from there. -
Upgrading WLS+ADF to 11.1.1.6: problem with ADF libraries
Hi,
I'm upgrading a standalone ADF environment (on RHEL5 64-bit) from 11.1.1.2.0 to 11.1.1.6.0. I followed note 1408663.1 "How to upgrade a WLS domain extended with ADF libraries" so first upgraded WLS to 10.3.6., then uninstalled Application Developer and finally installed the new ADF Runtime.
When I ran the upgradeJRF command in wlst for my existing domain, I got a listing of 11.1.1.2.0 targets and no mention of 11.1.1.6.0 (no error messages either, though). Starting the servers I'm still seeing deployments such as adf.oracle.domain(1.0,11.1.1.2.0) and adf.oracle.domain.webapp(1.0,11.1.1.2.0). Shouldn't these be 11.1.1.6.0 now? Also tried re-deploying my application, re-built with JDeveloper 11.1.1.6.0, but the library deployments are still on 11.1.1.2.0.
How can I upgrade the existing domain to 11.1.1.6.0?
Regards,
Joonashi Joonas
Joonas Linkola wrote:
...Starting the servers I'm still seeing deployments such as adf.oracle.domain(1.0,11.1.1.2.0) and adf.oracle.domain.webapp(1.0,11.1.1.2.0). Shouldn't these be 11.1.1.6.0 now? ...See also the related ADFEMG JIRA issue ADFEMG-112, "ER 12834041 : ADF RUNTIME LIBRARIES DON'T SHOW THE CORRECT VERSION NUMBERS IN WLS CONFIG.XML"
at http://java.net/jira/browse/ADFEMG-112
(or the forum message at Re: ADF Version to be used on a FormsReports 11gR2 install )
regards
Jan Vervecken -
Weblogic 10, WLST and Admin Console Classpath Exceptions
I've been deploying an application to Weblogic 10 (not 10.3 from Oracle, the last version under the BEA logo) for a few weeks now without a problem. We're going to upgrade to 10.3 from Oracle in our development environment and play around with that hopefully today but I can't imagine a dot-version being much different so I figured I'd post the issue anyway.
Recently, we've been having some issues with the WLST script we use to deploy/redeploy the application. It seems to have just started happening randomly which is odd because the script has not been modified since the get-go. What's happening is the application is compiled, staged and then the WLST script kicks off, log into the application server, looks to see if the app is already deployed, if it is, it redploys it with the latest code and then starts it up and then exits. Every now and again, the next time we go to deploy the application, the WLST fails saying that someone currently has a lock on the admin console. When we log in to the admin console, we see that the user the WLST script uses to log into the admin console currently has a lock on the console and we have the option to take the lock from this user.
When we click the button to take the lock, we get a HUGE exception in the lefthand panel where the Lock & Edit button typically is that says something along the lines of:
Error opening ...
The source of this error is javax.servlet.ServletException: javax.xml.transform.TransformerFactoryConfigurationError: Provider net.sf.saxon.TransformerFactoryImpl not found at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:324) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175) at weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:528) at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:454) at org.apache.beehive.netui.pageflow.scoping.internal.ScopedRequestDispatcher.include(ScopedRequestDispatcher.java:119) at com.bea.netuix.servlets.controls.content.JspContent.beginRender(JspContent.java:551) at ...
If I click on the 'Home' button along the upper righthand corner to go back to the home page of the admin console, the error goes away, the 'Activate Changes' button reappears, and then I click that and the Lock & Edit button reappears, then if I go back to my WLST script and run it, it runs successfully. If I log back into the admin console, everything appears normally. This happens intermittently and I'm not sure why it's happening some times and not others. If my WLST script is incorrect I would assume it would behave this way EVERY time.
I also don't get why the xml transformer factory SOMETIMES throws the exception and sometimes it doesn't. It also happens when I try to click on a JDBC data source. Same exact exception is thrown on the default configuration tab, if I click on any of the other tabs available after clicking on my JDBC data source, those all appear fine, just the initial default Configuration > General tab shows this huge exception. If I stop and restart the application server, these exceptions magically go away...the odd thing is this exception being thrown seems to be referencing libraries made available by my deployed application (the whole net.sf.saxon.TransformerFactoryImpl class is in a library we deploy with our application). These jar files containing these libraries should ONLY be available to the deployed application, I'm not putting these files on the classpath of the application server, so why the application server's admin console have any knowledge of these libraries? Could these be mucking with the overall functionality of the admin server's behavior?
Here is my WLST script I use the deploy the application. If you see something wrong with it, any feedback would be greatly appreciated. Any thoughts on the whole classpath of my application being used by the Weblogic Admin console would be helpful too.
WLST Script:
connect("merlin", "merlin595")
# check to see if the apb data source exists and if so, make sure it's targeting the AdminServer
try:
# Either deploy or redeploy application
try:
print 'Checking for the existence of the APB application.'
cd('/AppDeployments/apbEar')
print 'The APB application will be redeployed.'
progress=redeploy('apbEar')
print 'Status of redeployment: ' + progress.getState()
except WLSTException:
print 'The APB application has not yet been deployed to this server, so application will be deployed for the first time now.'
progress=deploy(appName='apbEar', path='/opt/weblogic/merlinpb/merlinpbEar/apbEar', targets='AdminServer')
print 'Status of initial deployment: ' + progress.getState()
# Start application
try:
print 'Starting APB application'
startApplication(appName='apbEar')
except WLSTException:
pass
disconnect()
print 'End of script, exiting WLST...'
exit()
except WLSTException:
print 'Could not deploy apb. Please log into the admin console and attempt the deployment manually.'
Oh, one final thing I've noticed when I use this script. The last thing the script says WHEN it actually runs successfully is:
<Nov 13, 2008 10:57:13 AM EST> <Warning> <JNDI> <BEA-050001> <WLContext.close() was called in a different thread than the one in which it was created.>
Why does it say that? What does that mean? Is my script mot structure correctly above?
Any help is greatly appreciated. Thanks again!
RobHey Mike,
The problem I was experiencing was that we had code that was applying an XSL stylesheet against XML we are getting from the database. In order for this stylesheet to work, we had to set code that does the following:
System.setProperty("javax.xml.transform.TransformerFactory", "net.sf.saxon.TransformerFactoryImpl");
Now the first time this code was called, and someone subsequently went to the Weblogic admin console, the screens would be completely unreachable...we were experiencing loads of compilation errors. So I did some digging and tried various other ways to set the TransformerFactory class that wouldn't affect the system as a whole. I found, by sheer luck, the fact that you can set this parameter in the weblogic-application.xml file located in the META-INF directory of your root EAR folder. The very first element in the XML of my weblogic-application.xml file is now:
<wls:xml>
<wls:parser-factory>
<wls:transformer-factory>net.sf.saxon.TransformerFactoryImpl</wls:transformer-factory>
</wls:parser-factory>
</wls:xml>
I now deploy the application with this and my reports are transformed properly and the admin console and command-line WLST scripts are all working uninterrupted as well without any adverse side-effects. Hope that helps. Just an aside, in preparation for the upgrade to WLS10, I restructured our application to a split development directory structure...this structure in combination with Workshop 10 really has made development and deployment much easier.
Best of luck. Cheers!
Rob -
[OSB11] issue migrating a WLST script from OSB1031
Hi all,
we are migrating a .py script (disable-enable-service.py) from OSB1031 to OSB11 (11.1.1.6) and we got an error at runtime.
The error:
Problem invoking WLST - Traceback (innermost last):
File "/products/software/servicebus/osb11/scripts/disable-enable-service.py", line 32, in ?
ImportError: cannot import name Ref
Extracts from the script:
import wlstModule
from com.bea.wli.config import Ref
from com.bea.wli.sb.management.configuration import ALSBConfigurationMBean
from com.bea.wli.sb.management.configuration import ProxyServiceConfigurationMBean
from com.bea.wli.sb.management.configuration import SessionManagementMBean
from com.bea.wli.sb.management.query import ProxyServiceQuery
from ConfigParser import ConfigParser
from util import createSessionName
from Failure import Failure
#=======================================================================================
# Main
#=======================================================================================
sessionMBean = None
sessionName = None
try:
checkParams()
CONFIG_PARSER = ConfigParser()
CONFIG_PARSER.read('admin.properties')
print
connectToWLS()
#Call to domainRuntime() needed for calling getSessionMBean()
domainRuntime()
sessionName = createSessionName('disable-enable-service')
sessionMBean = getSessionMBean(sessionName)
# Get the ALSBConfigurationMBean instance that operates on the session that has just been created.
alsbSession = findService(ALSBConfigurationMBean.NAME + "." + sessionName.toString(), ALSBConfigurationMBean.TYPE)
# Get the ProxyServiceConfigurationMBean specific to our session
mbean = findService(String("ProxyServiceConfiguration.").concat(sessionName),'com.bea.wli.sb.management.configuration.ProxyServiceConfigurationMBean')
edit()
startEdit()
#Cal to activate() needed otherwise raised unexpected error: java.lang.Exception
activate()
disableEnableService(alsbSession, mbean, sys.argv[1], sys.argv[2], sys.argv[3])
print
sessionMBean.activateSession(sessionName, sys.argv[1] + ": service " + sys.argv[2] + " , action " + sys.argv[3])
disconnect()
except:
raiseError()
We run the WLST including below jar files from OSB11 distribution:
CLASSPATH : /software/Middleware/bea1036/wlserver_10.3/server/lib/weblogic.jar:/software/Middleware/bea1036/Oracle_OSB11/lib/sb-kernel-api.jar:/software/Middleware/bea1036/Oracle_OSB11/lib/sb-kernel-impl.jar
We checked also sb-kernel-common.jar/sb-kernel-resources.jar/sb-kernel-wls.jar/sb-schemas.jar but we didn't find references to Ref class.
Do we need to add additional jars ?
Thanks and regards
ferpPlease refer -
Re: Error while running export.py in OSB 11g
the manifest.mf file of the alsb.jar contains the required libraries (including sb-kernel-impl.jar). It would be nice if you can put this jar instead of individual jars to reduce the impact of version and the packaging changes from version to version. I prefer to have this as best practice.
My two cents
ManojRegards,
Anuj -
Hi,
I am unable to start WLST and throwing "d:\Oracle\MIDDLE~1\WLSERV~1.3\server\native\win\x64\oci920_8 was unexpected at this time" error message
OS: Win 7 64-bit version
Java : Java 1.6 64-bit (jdk-6u33-windows-x64.exe)
WL Version : 10.3.6 generic version (wls1036_generic.jar)
While installing Weblogic, I have chosen the Sun JDK.
After successful installation, I changed the nodemanager properties such as startScriptEnabled and stopScriptEnabled as "true". And run the NodeManager and NodeManager started successfully on port 5556.
But while trying to start the Weblogic scripting Tool, it is throwing the error message as
"d:\Oracle\MIDDLE~1\WLSERV~1.3\server\native\win\x64\oci920_8 was unexpected at this time"
I have not created any domain and planning to create using WLST script.
Please help.
Thanks,
RaviHi all,
I am also facing the same issue.I am trying to update fusion midddleware shared libraries. For that i need to run
cd oracle_common\common\bin
wlst.cmd upgradeJRF('/DOMAIN_HOME')
While running wlst.cmd file i am getting message in command prompt
D:\OraHome\Middlleware\oracle_common\common\bin>wlst
The input line is too long.
:APPEND_CLASSPATH
was unexpected at this time.
D:\OraHome\Middlleware\oracle_common\common\bin>wlst
The input line is too long.
D:\OraHome\MIDDLL~1\ORACLE~1\common\bin\setWlstEnv.cmd was unexpected at this time.
Kindly guide me regarding this.
Thanks in advance.
Maybe you are looking for
-
I am using Window XP, Office 2007 Professional. When the upgrade occurred, I lost the functionallity of creating a pdf from Publisher. I go through the print, select Adobe PDF and then print. Sometimes it looks like it is creating a pdf and then o
-
While using cover flow....the artist and the album must be the same for it to show as one album, but i have albums where there are multiple artists or with .... ft. a person....is there ne way to consolidate these albums without changing the artists
-
Can I have my Adobe X Pro on more than one computer?
Can I have my Adobe X Pro on more than one computer?
-
Hiberate+JBoss Can Update, Select But Cannot Insert
Hi there, I got this error during insert operation using JBoss 4.2.2 with Hibernate 3: org.hibernate.PersistentObjectException: detached entity passed to persist: com.abc.uresdemo.bean.Result at org.hibernate.event.def.DefaultPersistEventListener
-
IMac Finder crawling, unusable even after troubleshooting. help!
Torturously slow Finder in my Intel iMac 2.16ghz OS 10.4.11. It can take it over a minute to load basic Finder windows. It can take five minutes to get from command- print to actually printing a photo from iPhoto, running the Spinning Beachball of De