Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Weblogic application context root is war file name instead of name specified in weblogic.xml

I have an application which I have deployed using Maven to Weblogic 10.3.6. I have specified context root in weblogic.xml as

<context-root>/myapps</context-root>

The problem I am having is it is taking the war file name as context root instead of the name I have specified in weblogic.xml

How can I change the context root instead of the name taking war file name as context root?

Weblogic.xml

<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
 http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd 
 http://xmlns.oracle.com/weblogic/weblogic-web-app 
 http://xmlns.oracle.com/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd">
 <context-root>/myapps</context-root>
<container-descriptor>
        <prefer-application-packages>
            <package-name>antlr.*</package-name>
            <package-name>org.hibernate.*</package-name>
            <package-name>javax.persistence.*</package-name>
        </prefer-application-packages>
    </container-descriptor>
    </weblogic-web-app>
like image 892
Jacob Avatar asked May 17 '13 20:05

Jacob


People also ask

What is context root in WebLogic xml?

Weblogic application context root is war file name instead of name specified in weblogic. xml. Bookmark this question. Show activity on this post.

Where is the WebLogic XML file?

If you are using WebLogic as your application server, there are certain values in the weblogic. xml file, located in the /WEB-INF directory of the TeamConnect .


2 Answers

I assume this is happening because of your Maven setup/properties. (The same can happen with jDeveloper, if you don't have a property set it will override your context root).

Have you seen this answer? Run with Netbeans (and Maven) the right context root

And the corresponding Maven link: http://maven.apache.org/plugins/maven-ear-plugin/examples/customizing-context-root.html

like image 153
Display Name is missing Avatar answered Oct 09 '22 13:10

Display Name is missing


If you are using eclipse/oepe - the context root is in .settings/org.eclipse.wst.common.component file and wtp overrides your files

correct it here and eclipse would respect it

Edit: Looks like they fixed this the right way in 2015

if you are using maven, put this in the pom file

<properties>
  <m2eclipse.wtp.contextRoot>my_context_root !</m2eclipse.wtp.contextRoot>
</properties>

See https://bugs.eclipse.org/bugs/show_bug.cgi?id=461068

like image 44
Kalpesh Soni Avatar answered Oct 09 '22 15:10

Kalpesh Soni