How to list all apps on WAS and their linked node cell and server name? - websphere

The context is that I have a script that automates the update or deployment of applications on WAS 6.1 servers from a DMGR. This script use a setting file that contains the application name, the server cell, node and name. I don't want to make manually a file for every application. I searched IBM for a way to get all these informations and can't find how.
http://pic.dhe.ibm.com/infocenter/wasinfo/v8r0/index.jsp?topic=%2Fcom.ibm.websphere.base.doc%2Finfo%2Faes%2Fae%2Ftxml_listapp.html
I know how to list apps on a server but I need to link all those infos together.
$AdminApp list (any options would give me info I need?)

Use the scriptLibrary included in WAS version 8:
AdminApplication.listApplications()
Returns: List of the available application names in the respective cell.

Related

Unable to build extended domain with WLS, Forms, Reports: expected directories not created

I am in the middle of building a 4-node application layer using WLS, Oracle Forms and Oracle Reports. I have built an ADMIN node and successfully built the RCU and have run config.sh.
I fully defined the entire domain (all 4 nodes) while running config.sh. I have copied and moved the domain definition to the 2nd node using pack & unpack.
When I attempt to install and build on the 2nd node (ADMIN does not run here), and run Forms and/or Reports for the first time, many directories are automatically created.
But some I expect to be created are missing.
For example:
$DOMAIN_HOME/config/fmwconfig/components/FORMS/instances/forms2/server/
did not get created.
What step did I miss here that results in some of the necessary directories not being created?
This is because the FORMS SystemComponents are not installed in the new instance locations under <domain_name>/config/fmwconfig/components/FORMS/<instance> and the FORMS components are not carried across by the pack command.
Re-running the config wizard will allow you to install the components on the new instances.
Alternatively, the instance definitions can be added on the Admin Server with WLST in offline mode only:
readDomain('<$DOMAIN_HOME>')
print('Create FORMS SystemComponent '+'forms2')
cd('/')
create('forms2', 'SystemComponent')
cd('/SystemComponent/'+'forms2')
cmo.setComponentType('FORMS')
set('Machine', machineName)
updateDomain()
closeDomain()
The above only works if the Managed Server shares the domain's filesystem with the Admin Server.
Also see:
https://github.com/galiacheng/oracle-forms-reports-weblogic-on-azure#create-managed-servers-and-forms-component

Configuring settings for last paricipant support wsadmin/websphere

Recently i've came to an issue to configure Last Participant Support on deployed application. I've found some old post about that:
https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014090728
On server itself i found how to do it. But with jython or wsadmin commands im not able to find how to do it on application itself.
But it does not help for me. Any ideas?
There is no command assistance available for the action of changing last participant support from the admin console which typically implies there is no scripting command associated the action. And there doesn't appear to be an wsadmin AdminApp command to modify the property. Looking at config repo changes made as a result of the admin console action, the IBM Programming Model Extensions (PME) deployment descriptor file "ibm-application-ext-pme.xmi" for an application is created/modified by the action.
If possible, the best long-term solution would be to use a tool like RAD to generate that extensions file when packaging the application because if you need to redeploy the app, your config changes wouldn't get overridden. If you can't mod the app, you can script the addition of an PME descriptor file in each of the desired apps with the knowledge that redeploying the app will overwrite your changes. The changes can be made by doing something along the lines of:
1) create a text file named ibm-application-ext-pme.xmi with contents similar to this:
<pmeext:PMEApplicationExtension xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:pmeext="http://www.ibm.com/websphere/appserver/schemas/5.0/pmeext.xmi" xmi:id="PMEApplicationExtension_1559836881290">
<lastParticipantSupportExtension xmi:id="LastParticipantSupportExtension_1559836881292" acceptHeuristicHazard="false"/>
</pmeext:PMEApplicationExtension>
2) in wsadmin or your jython script do the following (note in this example the xmi file you created is in the current directory, if not, include the full path to it in the createDocument command) :
deployUri = "cells/<your_cell_name>/applications/<your_app_name>.ear/deployments/<your_app_name>/META-INF/ibm-application-ext-pme.xmi"
AdminConfig.createDocument(deployUri, "ibm-application-ext-pme.xmi")
AdminConfig.save()
3) restart the server

How to list all Websphere installed applications for a given Middleware server using jython

I have a Websphere 8.5.5.12 installation with multiple applications running on it. For a given Middleware Server, I'd like to be able to list all applications associated with it using Jython.
I have gone as far as writing this code:
wsadmin>print AdminApp.list("WebSphere:cell=myCell,node=myNode")
However this is retrieving applications for a different Dynamic Cluster
If I add a specific server, it errors out
wsadmin>print AdminApp.list("WebSphere:cell=myCell,server=myServer")
ADMA0184E: myServer is not a valid target.
Your query should look like:
wsadmin>AdminApp.list("WebSphere:cell=myCell,node=myNode,server=server1")
It appears you're missing the node identifier in your query. And if wsadmin still returns "myServer is not a valid target", then the server name is wrong, try looking at your app server profile directory structure to double check it.

Is it possible to copy/export WebSphere Application Server Cell configuration from one environment to another environment?

Remember this is not Standalone Environment.
In one physical server I have set up a Cell with one Deployment Manager, one Node, one application server and configured them. Now I need to create 12 more similar cell with same configuration in different physical servers. So is it possible to copy/export configuration from one environment to another ?
Creating the Cell is not a problem for me, I want to skip the step of configuring again and again.
Start by looking at this IBM KnowledgeCenter topic on properties-based configuration and administration. It has a number of links to other topics with additional information. The property file based configuration allows you to extract a text file of properties from an existing WebSphere Application Server configuration, perform some processing on the text file (like changing hostnames, ports, etc) using your favorite tools and then apply that configuration to another cell, node, or server.

How to install applications to a WebSphere 7.0 cluster using wsadmin?

I want to deploy to all four processes on a Websphere cluster with two nodes. Is there a way of doing this with one Jython command or do I have to call 'AdminControl.invoke' on each one?
Easiest way to install an application using wsadmin is with AdminApp and not AdminControl.
I suggest you download wsadminlib.py (Got the link from here)
it has a lot of functions, one of them is installApplication which works also with cluster.
Edit:
Lately I found out about AdminApplication which is a script library included in WAS 7 (/opt/IBM/WebSphere/AppServer/scriptLibraries/application/V70)
The docuemntation is not great in the info center but its a .py file you can look inside to see what it does.
It is imported automatically to wsadmin and you can use it without any imports or other configuration.
Worth a check.
#aviram-segal is right, wsadminlib is really helpful for this.
I use the following syntax:
arg = ["-reloadEnabled", "-reloadInterval '0'", "-cell "+self.cellName, "-node "+self.nodeName, "-server '"+ self.serverName+"'", "-appname "+ name, '-MapWebModToVH',[['.*', '.*', self.virtualHost]]]
AdminApp.install(path, arg)
Where path is the location of your EAR/WAR file.
You can find documentation here

Resources