antautomationwebspherewsadmininstallation-package

Unable to pass context root to .war application in websphere using wsadmin


I need a little help in updating the context root for my war in my Websphere 8.5 appserver. I have a war file called DefaultApplication.war and during manual deployment through websphere console, iam able to set the context-root. Now i ahve requirment of automating the current flow and i choosed to write ant script to install the war file. Below is the code

<target name="installEAR" depends="uninstallEAR">
<fail unless="wasHome.dir">The property "wasHome.dir" must be specified.
</fail>
<fail unless="appName">The property "appName" must be specified.</fail>
<fail unless="deployEar">The property "deployEar" must be specified.</fail>
    <echo message="Deployable EAR File found at: ${deployEar}" />
    <wsInstallApp ear="${deployEar}"
                  options="-appname ${appName} -cell ${was.cell} -node ${was.node} -usedefaultbindings"
                  wasHome="${wasHome.dir}"
                  conntype="${connType}"
                  port="${port}"
                  host="${hostName}"
                  user="${userId}"
                  password="${password}"
                  failonerror="true" />
</target>

As mentioned in above code, iam setting -usedefaultbindings to use and i have ibm-web-ext.xml file in WEB-INF folder of war file.

Context of ibm-web-ext.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-ext
 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-ext_1_1.xsd"  
version="1.1">

<context-root uri="test"/>
</web-ext>

After deployment my apllication is getting started but unable to access it through /test context path. please help me on this.

Thanks in advance.


Solution

  • You must specify Servlet 3.0 or 3.1 in your web.xml, or ibm-web-ext.xml will not be interpreted. For 2.4, a similar file called ibm-web-ext.xmi is interpreted instead.