Search code examples
pythonwebspherejythonwsadmincontextroot

Get context root of an installed application on WAS 7 via wsadmin


I need to create a script in Jython to migrate some applications from WAS 7 to WAS 8.5. I can't seem to find the context root for a certain application (i found the context root for all other applications in the application.xml file).

This application does not have the above mentioned file. Is there another default file in which this information can be found or is there a wsadmin command that can help me retrieve the context root?

Thanks in advance!


Solution

  • You can use for example the following command:

    wsadmin>AdminApp.view('Application Name', '-CtxRootForWebMod')
    

    e.g.:

    wsadmin>print AdminApp.view('Dynamic Cache Monitor', '-CtxRootForWebMod')
    CtxRootForWebMod: Specify the Context root of web module
    
    Configure values for context roots in web modules.
    
    Web module:  Dynamic Cache Monitor
    URI:  CacheMonitor.war,WEB-INF/web.xml
    Context Root:  /cachemonitor
    

    If application doesn't have application.xml then:

    • you can check WEB-INF/ibm-web-ext.xml file and see if there is element <context-root uri="myctx"/>
    • web module may have default name - which is filename without .war extension e.g. for MyWebMod.war context will be /MyWebMod