Websphere 8.5 context root change not applying to war file
Asked Answered
B

2

7

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?

Beatific answered 29/6, 2014 at 3:1 Comment(1)
Check if you have web.xml and if it is in correct version (you should either don't have web.xml or in version 2.5 or 3.0). If you have web.xml version 2.4 or earlier that file will be ignored as in previous version it was called ibm-web-ext.xmi.Harned
H
11

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>
Harned answered 29/6, 2014 at 12:26 Comment(2)
context root should start with '/'Twoply
@Twoply No, there is no requirement that it should start with / . Check the application.xml schema.Harned
E
1

"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.

Excessive answered 1/7, 2014 at 0:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.