2
votes

I have a web application which is installed on Websphere with WAR file. I am trying to automatically deploy the webapplication on websphere through a python script. The script is as follows:

###cat deplApps.py
import time

#the 3 arguments are jvm name, ent app name, and path to war file
print "Args are:" , sys.argv
SERVERMBEAN = AdminServerManagement.queryMBeans("AppSrvNode01", sys.argv[0] , "Server")
if SERVERMBEAN == [] :
        print "Server is in stopped state"
else :
        AdminServerManagement.stopSingleServer("AppSrvNode01", sys.argv[0] )

print "sleeping for 10 seconds"
time.sleep(10)
AdminApplication.updateApplicationUsingDefaultMerge( sys.argv[1],  sys.argv[2] )
AdminConfig.save()

time.sleep(10)
Sync1 = AdminControl.completeObjectName('type=NodeSync,process=nodeagent,node=AppSrvNode01,*')
AdminControl.invoke(Sync1, 'sync')
print "sleeping for 120 seconds before starting the server"
time.sleep(120)
AdminServerManagement.startSingleServer("AppSrvNode01", sys.argv[0] )

When I run the script to deploy the war file on Websphere I get the following error:

Exception: <type 'com.ibm.ws.scripting.ScriptingException'> com.ibm.ws.scripting.ScriptingException: WASX7109E: Insufficient data for install task "MapWebModToVH

ADMA0010E: Validation error in task Selecting virtual hosts for Web modules. A virtual host is not specified for web module Work Queues with URI agriworxAPP.war,WEB-INF/web.xml." WASX7017E: Exception received while running file "/apps/deploy/deplApps.py"; exception information: com.ibm.ws.scripting.ScriptingException: WASX7109E: Insufficient data for install task "MapWebModToVH

When I searched for the error it said I have to provide the ibm-web-bnd.xml ibm-web-ext.xml in the WAR file, So I provided the fillowing ibm-web-bnd.xml and ibm-web-ext.xml files inthe WAR file;

ibm-web-bnd.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-bnd 
    xmlns="http://websphere.ibm.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-web-bnd_1_0.xsd"
    version="1.0">


    <virtual-host name="default_host" 
    <resource-ref>
   <description>Work Queues</description>
   <res-ref-name>jdbc/WorkQueuestDS</res-ref-name>
   <res-type>javax.sql.DataSource</res-type>
   <res-auth>Container</res-auth>
</resource-ref>/>
</web-bnd>

ibm-web-ext.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-ext
   xmlns="http://websphere.ibm.com/xml/ns/javaee"
   xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-web-ext_1_0.xsd"
      version="1.0">

   <default-error-page uri="error.jsp"/>
   <jsp-attribute name="useThreadTagPool" value="true" />
   <jsp-attribute name="verbose" value="false" />
   <jsp-attribute name="deprecation" value="false" />
   <jsp-attribute name="reloadEnabled" value="true" />
   <jsp-attribute name="reloadInterval" value="5" />
   <jsp-attribute name="keepgenerated"  value="true" />
   <jsp-attribute name="trackDependencies" value="true" />
   <reload-interval value="9"/>
   <auto-encode-requests value="true"/>
   <auto-encode-responses value="false"/>
   <enable-directory-browsing value="false"/>
   <enable-file-serving value="false"/>
   <pre-compile-jsps value="false"/>
   <enable-reloading value="true"/>
   <enable-serving-servlets-by-class-name value="true"/>
</web-ext>

Now I am getting the following errorL

Exception: <type 'com.ibm.ws.scripting.ScriptingException'> com.ibm.ws.scripting.ScriptingException: WASX7109E: Insufficient data for install task "MapWebModToVH

ADMA0010E: Validation error in task Selecting virtual hosts for Web modules. A virtual host is not specified for web module Work Queues with URI agriworxAPP.war,WEB-INF/web.xml."

2

2 Answers

1
votes

In my case, I was having this error because my app required some bindings to be made. As I wanted to install the app with all the default configurations I just needed to add the parameter -usedefaultbindings.

AdminApp.install("/work/shared/myApp.ear", "-appname myApp -node DefaultNode01 -server server1 -nouseMetaDataFromBinary -usedefaultbindings")
0
votes

This error has nothing to do with .bnd or .ext files. The command AdminApplication.updateApplicationUsingDefaultMerge as it name stats is used to update existing app, not to install new one. If you want to install you need to use AdminApplication.installXXX commands. Check https://www.ibm.com/support/knowledgecenter/SSEQTP_8.5.5/com.ibm.websphere.base.doc/ae/rxml_7libapp.html So you need to utilize AdminApplication.checkIfAppExists command and based on that either install or update app.

VH is virtual host on your WAS, typically default_host. Sometimes it is used to customize installation see this https://www.ibm.com/support/knowledgecenter/SSEQTP_8.5.5/com.ibm.websphere.base.doc/ae/rxml_taskoptions.html#rxml_taskoptions__cmd61 but I dont know how the AdminApplication is actually utilizing it.