OSB Deployment scripts 11.1.1.7 using configtool
- 04
- April
- 2014
- By Nits
- Best Practices, Build, ESB, Oracle, OSB, SOA
- 1 Comment.
These instructions are only valid for OSB Release 11.1.1.7 onwards.
How to export desired projects using the configjar utility
The configjar tool is located in the OSB installation directory under
C:oracleMiddleware11117Oracle_OSB1toolsconfigjar
[Check the path relative to your install]
Run the setenv.cmd
And execute the
C:oracleMiddleware11117Oracle_OSB1toolsconfigjarconfigjar.bat -settingsfile C:OSB_DeploymentOSBPS6_MavenConfigToolnysolutions_export_projects.xml
Where the nysolutions_export_projects.xml file contains the names of the projects and the configuration files and the desired output filename.
The nysolutions_export_projects.xml I used for this post was
<source> <project dir= "C:UsersnitinaosbworkspaceContracts" /> <project dir= "C:UsersnitinaosbworkspaceNYSService1" /> <project dir= "C:UsersnitinaosbworkspaceNYSService2" /> <project dir= "C:UsersnitinaosbworkspaceNYSService3" /> <system dir= "C:Usersnitinaosbworkspacenys-conf" /> </source> <configjar jar= "C:OSB_DeploymentOSBPS6_MavenConfigToolexportNYSsbconfig.jar" > <projectLevel includeSystem= "true" /> </configjar> </configjarSettings> |
Complete list of options and commands are available in oracle documentation at http://docs.oracle.com/cd/E28280_01/dev.1111/e15866/app_export.htm#BABDJJIA
Export Settings File Schema Definition
Below is the schema definition for the export settings XML file. Some of the text below has been wrapped for readability.
<? xml version = "1.0" ?> elementFormDefault = "qualified" attributeFormDefault = "unqualified" < xs:element name = "configjarSettings" type = "tns:configjarSettings" /> < xs:complexType name = "configjarSettings" > < xs:sequence > < xs:element name = "source" type = "tns:source" /> < xs:element name = "configjar" type = "tns:configjar" maxOccurs = "unbounded" /> </ xs:sequence > </ xs:complexType > < xs:complexType name = "source" > < xs:sequence > < xs:choice minOccurs = "1" maxOccurs = "unbounded" > < xs:element name = "project" > < xs:complexType > < xs:attribute name = "dir" type = "xs:string" use = "required" /> </ xs:complexType > </ xs:element > < xs:element name = "system" > < xs:complexType > < xs:attribute name = "dir" type = "xs:string" use = "required" /> </ xs:complexType > </ xs:element > </ xs:choice > < xs:element name = "extensionMapping" minOccurs = "0" > < xs:complexType > < xs:sequence > < xs:element name = "mapping" minOccurs = "0" maxOccurs = "unbounded" > < xs:complexType > < xs:attribute name = "type" type = "xs:string" use = "required" /> < xs:attribute name = "extensions" type = "xs:string" use = "required" /> </ xs:complexType > </ xs:element > </ xs:sequence > </ xs:complexType > </ xs:element > < xs:element name = "fileset" type = "tns:contentSet" minOccurs = "0" /> </ xs:sequence > </ xs:complexType > < xs:complexType name = "configjar" > < xs:sequence > < xs:choice minOccurs = "1" maxOccurs = "1" > < xs:element name = "projectLevel" type = "tns:projectLevel" /> < xs:element name = "resourceLevel" type = "tns:resourceLevel" /> </ xs:choice > </ xs:sequence > < xs:attribute name = "jar" type = "xs:string" use = "required" /> < xs:attribute name = "overwrite" type = "xs:boolean" use = "optional" default = "true" /> </ xs:complexType > < xs:complexType name = "projectLevel" > < xs:sequence > < xs:element name = "project" type = "xs:string" minOccurs = "0" maxOccurs = "unbounded" /> </ xs:sequence > < xs:attribute name = "includeSystem" type = "xs:boolean" use = "optional" default = "false" /> </ xs:complexType > < xs:complexType name = "resourceLevel" > < xs:sequence > < xs:element name = "resources" type = "tns:contentSet" minOccurs = "0" /> </ xs:sequence > < xs:attribute name = "includeDependencies" type = "xs:boolean" use = "optional" default = "true" /> </ xs:complexType > < xs:complexType name = "contentSet" > < xs:sequence > < xs:element name = "include" type = "tns:contentSetPattern" minOccurs = "0" maxOccurs = "unbounded" /> < xs:element name = "exclude" type = "tns:contentSetPattern" minOccurs = "0" maxOccurs = "unbounded" /> </ xs:sequence > </ xs:complexType > < xs:complexType name = "contentSetPattern" > < xs:attribute name = "name" type = "xs:string" use = "required" /> </ xs:complexType > </ xs:schema > |
Sample configSettings.xml generated using eclipse
<? xml version = "1.0" encoding = "UTF-8" ?> < tns:configjarSettings xmlns:tns = "http://www.bea.com/alsb/tools/configjar/config" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation = "http://www.bea.com/alsb/tools/configjar/config config.xsd " > < tns:source > < tns:project dir = "" /> < tns:extensionMapping > < tns:mapping extensions = "" type = "" /> </ tns:extensionMapping > < tns:fileset > < tns:include name = "" /> < tns:exclude name = "" /> </ tns:fileset > </ tns:source > < tns:configjar jar = "" overwrite = "true" > < tns:projectLevel includeSystem = "false" > < tns:project >tns:project</ tns:project > </ tns:projectLevel > </ tns:configjar > </ tns:configjarSettings > |
Step 2
Create a ALSBCustomizationFile.xml which contains all the config settings.
Step 3
Run the deployment scripts to deploy the NYSsbconfig.jar file generated above…
Update the wlst with environment specific values deployToServer.py
java weblogic.WLST deployToServer.py
Where the deployToServer.py file is
from java.util import HashMap from java.util import HashSet from java.util import ArrayList from java.io import FileInputStream from com.bea.wli.sb.util import Refs from com.bea.wli.config.customization import Customization from com.bea.wli.sb.management.importexport import ALSBImportOperation import sys #======================================================================================= # Entry function to deploy project configuration and resources # into a ALSB domain #======================================================================================= def importToALSBDomain(): try : SessionMBean = None print 'Attempting to import :' , importJar, "on ALSB Admin Server listening on :" , adminUrl theBytes = readBinaryFile(importJar) print 'Read file' , importJar sessionName = createSessionName() print 'Created session' , sessionName SessionMBean = getSessionManagementMBean(sessionName) print 'SessionMBean started session' ALSBConfigurationMBean = findService(String( "ALSBConfiguration." ).concat(sessionName), "com.bea.wli.sb.management.configuration.ALSBConfigurationMBean" ) print "ALSBConfiguration MBean found" , ALSBConfigurationMBean ALSBConfigurationMBean.uploadJarFile(theBytes) print 'Jar Uploaded' if project == "None" : print 'No project specified, additive deployment performed' alsbJarInfo = ALSBConfigurationMBean.getImportJarInfo() alsbImportPlan = alsbJarInfo.getDefaultImportPlan() alsbImportPlan.setPassphrase(passphrase) alsbImportPlan.setPreserveExistingEnvValues( true ) importResult = ALSBConfigurationMBean.importUploaded(alsbImportPlan) SessionMBean.activateSession(sessionName, "Complete import without customization using wlst" ) else : print 'ALSB project' , project, 'will get overlaid' alsbJarInfo = ALSBConfigurationMBean.getImportJarInfo() alsbImportPlan = alsbJarInfo.getDefaultImportPlan() alsbImportPlan.setPassphrase(passphrase) operationMap=HashMap() operationMap = alsbImportPlan.getOperations() print print 'Default importPlan' printOpMap(operationMap) set = operationMap.entrySet() alsbImportPlan.setPreserveExistingEnvValues( true ) # boolean abort = false #list of created ref createdRef = ArrayList() for entry in set: ref = entry.getKey() op = entry.getValue() #set different logic based on the resource type type = ref.getTypeId if type == Refs.SERVICE_ACCOUNT_TYPE or type == Refs.SERVICE_PROVIDER_TYPE: if op.getOperation() == ALSBImportOperation.Operation.Create: print 'Unable to import a service account or a service provider on a target system' , ref abort = true # elif op.getOperation() == ALSBImportOperation.Operation.Create: else : #keep the list of created resources print 'ref: ' ,ref createdRef.add(ref) if abort == true : print 'This jar must be imported manually to resolve the service account and service provider dependencies' SessionMBean.discardSession(sessionName) raise print print 'Modified importPlan' printOpMap(operationMap) importResult = ALSBConfigurationMBean.importUploaded(alsbImportPlan) printDiagMap(importResult.getImportDiagnostics()) if importResult.getFailed().isEmpty() == false : print 'One or more resources could not be imported properly' raise #customize if a customization file is specified #affects only the created resources if customFile != "None" : print 'Loading customization File' , customFile print 'Customization applied to the created resources only' , createdRef iStream = FileInputStream(customFile) customizationList = Customization.fromXML(iStream) filteredCustomizationList = ArrayList() setRef = HashSet(createdRef) # apply a filter to all the customizations to narrow the target to the created resources for customization in customizationList: print customization newcustomization = customization.clone(setRef) filteredCustomizationList.add(newcustomization) ALSBConfigurationMBean.customize(filteredCustomizationList) SessionMBean.activateSession(sessionName, "Complete import with customization using wlst" ) print "Deployment of : " + importJar + " successful" except: print "Unexpected error:" , sys.exc_info()[ 0 ] if SessionMBean != None: SessionMBean.discardSession(sessionName) raise #======================================================================================= # Utility function to print the list of operations #======================================================================================= def printOpMap(map): set = map.entrySet() for entry in set: op = entry.getValue() print op.getOperation(), ref = entry.getKey() print ref print #======================================================================================= # Utility function to print the diagnostics #======================================================================================= def printDiagMap(map): set = map.entrySet() for entry in set: diag = entry.getValue().toString() print diag print #======================================================================================= # Utility function to read a binary file #======================================================================================= def readBinaryFile(fileName): file = open(fileName, 'rb' ) bytes = file.read() return bytes #======================================================================================= # Utility function to create an arbitrary session name #======================================================================================= def createSessionName(): sessionName = String( "SessionScript" +Long(System.currentTimeMillis()).toString()) return sessionName #======================================================================================= # Utility function to load a session MBeans #======================================================================================= def getSessionManagementMBean(sessionName): SessionMBean = findService( "SessionManagement" , "com.bea.wli.sb.management.configuration.SessionManagementMBean" ) SessionMBean.createSession(sessionName) return SessionMBean # IMPORT script init try : # import the service bus configuration adminUser = "weblogic" adminPassword= "weblogic1" adminUrl = "t3://soabpm-vm:7001" importJar = "export/NYSsbconfig.jar" customFile = "ALSBCustomizationFile.xml" passphrase = "osb" project = "NYSService1" connect(adminUser,adminPassword,adminUrl) domainRuntime() importToALSBDomain() except: print "Unexpected error: " , sys.exc_info()[ 0 ] dumpStack() raise |
That’s it all done…you can then check on the sbconsole that the changes have all been deployed.
Related
One Response so far.
Recent Posts
- 12.1.0.2 RAC Installation – Step by Step installation on VMware
- OSB FTP Poller continuously throwing exception – while no file pending on FTP Location
- Using JMS Transport with OSB
- Installing Spring Tool Suite and configuring Spring for a development PC
- Rest Enabling SOA using OSB in Oracle 12c
Recent Comments
- Nits on Installing Oracle SOA Suite 12c
- Rajesh Krishna on Installing Oracle SOA Suite 12c
- Nits on Installing Oracle SOA Suite 12c
- Rohinii on Installing Oracle SOA Suite 12c
- Mahitha on Oracle Service Bus (OSB) Development Best Practices.
Archives
- December 2015
- May 2015
- November 2014
- September 2014
- August 2014
- July 2014
- April 2014
- March 2014
- February 2014
- January 2014
- December 2013
- November 2013
- October 2013
- September 2013
- July 2013
- June 2013
- May 2013
- March 2013
- February 2013
- November 2012
- October 2012
- September 2012
- May 2012
- March 2012
- February 2012
- December 2011
- November 2011
- October 2011
- September 2011
- August 2011
- June 2011
- May 2011
- January 2011
- December 2010
- November 2010
- October 2010
- September 2010
- July 2010
- June 2010
- March 2010
- February 2010
- December 2009
- September 2009
- August 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- November 2008
- October 2008
- August 2008
- June 2008
- May 2008
Categories
- AIA
- AXIS2
- Best Practices
- BPEL
- BPM
- Budget
- Build
- Design Patterns
- ESB
- Hermes
- Hibernate
- Home Owners
- Java
- JMS
- JSR 168
- Maven
- Mediator
- Messaging
- Nitin
- OER
- OESB
- Oracle
- OSB
- OWSM
- Portlets
- SDLC
- Sequencing
- Singleton
- SOA
- SOAP
- Spring
- Struts
- UK
- Uncategorized
- Web Services
- WLST
Meta
To find out more, including how to control cookies, see here: Cookie Policy
Recent Posts
- 12.1.0.2 RAC Installation – Step by Step installation on VMware
- OSB FTP Poller continuously throwing exception – while no file pending on FTP Location
- Using JMS Transport with OSB
- Installing Spring Tool Suite and configuring Spring for a development PC
- Rest Enabling SOA using OSB in Oracle 12c
Recent Comments
- Nits on Installing Oracle SOA Suite 12c
- Rajesh Krishna on Installing Oracle SOA Suite 12c
- Nits on Installing Oracle SOA Suite 12c
- Rohinii on Installing Oracle SOA Suite 12c
- Mahitha on Oracle Service Bus (OSB) Development Best Practices.
Archives
- December 2015
- May 2015
- November 2014
- September 2014
- August 2014
- July 2014
- April 2014
- March 2014
- February 2014
- January 2014
- December 2013
- November 2013
- October 2013
- September 2013
- July 2013
- June 2013
- May 2013
- March 2013
- February 2013
- November 2012
- October 2012
- September 2012
- May 2012
- March 2012
- February 2012
- December 2011
- November 2011
- October 2011
- September 2011
- August 2011
- June 2011
- May 2011
- January 2011
- December 2010
- November 2010
- October 2010
- September 2010
- July 2010
- June 2010
- March 2010
- February 2010
- December 2009
- September 2009
- August 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- November 2008
- October 2008
- August 2008
- June 2008
- May 2008
Categories
- AIA
- AXIS2
- Best Practices
- BPEL
- BPM
- Budget
- Build
- Design Patterns
- ESB
- Hermes
- Hibernate
- Home Owners
- Java
- JMS
- JSR 168
- Maven
- Mediator
- Messaging
- Nitin
- OER
- OESB
- Oracle
- OSB
- OWSM
- Portlets
- SDLC
- Sequencing
- Singleton
- SOA
- SOAP
- Spring
- Struts
- UK
- Uncategorized
- Web Services
- WLST
[…] UPDATE: For 11.1.1.7 deployment scripts …. see my new post http://nitinaggarwal.wordpress.com/2014/04/04/osb-deployment-scripts-11-1-1-7-using-configtool/ […]