Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Websphere 8.5 context root change not applying to war file

I need a little help changing the context root of my war in my Websphere 8.5 appserver. I have a war file called test.war When I deploy it to websphere the context root is /test However I want to change this to be /example

When I looked online I read I need to include WEB-INF/ibm-web-ext.xml within test.war so I added that and enter the following:

<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_0.xsd"
    version="1.0">
  <context-root uri="/example"/>
</web-ext>

When I deploy again the context-root is still /test That file has had no effect. Is there something I am missing?

like image 401
user36737 Avatar asked Jun 29 '14 03:06

user36737


2 Answers

The easiest way after installation, is to open web admin console and change the context-root via:

Applications > Application Types > WebSphere enterprise applications > application_name > Context root for web modules.

You could do it also via wsadmin script.

You can provide context name, during application installation via admin console or you can change file name before installation as default context, when you install war is taken from the file name.

The last option would be to create EAR and define application.xml with web module like this:

<web>
  <web-uri>test.war</web-uri>
  <context-root>example</context-root>
</web>
like image 52
Gas Avatar answered Sep 22 '22 08:09

Gas


"When I deploy again"

Did you perform an update, or an uninstall & reinstall?

When you update an application, WebSphere doesn't necessarily update the existing application's bindings (you need to explicitly ask WebSphere to discard binding information during an update). You have to select "Use new bindings" during installation in order to force WebSphere to pick up the bindings changes.

When you uninstall an application, all bindings information is lost, so when you re-install the same application, the bindings information included within the WAR file is used.

like image 31
Isaac Avatar answered Sep 20 '22 08:09

Isaac