Search code examples
shared-librariesjythonapplication-serverwebsphere-7

Add shared libraries references to enterprise applications whith Jython in Websphere application server


I would like to programmatically add the shared libraries to my deployed applications in websphere application server (WAS).

I heard that it is possible using jython scripting.

How can I achieve this?

Can someone give some pratical example?


Solution

  • You can do this with the following script:

    # Map shared library 
    AdminApp.edit('ApplicationName', ['-MapSharedLibForMod', [['.*', '.*', 'SharedLibName']]])
    
    # Save configuration
    AdminConfig.save()
    
    # Synchronize nodes (if you don't have standalone server but network deployment)
    Sync1 = AdminControl.completeObjectName('type=NodeSync,node=*,*')
    AdminControl.invoke(Sync1, 'sync')
    

    I am using this method and it works.