The root of the Weblogic application context is the name of the military file instead of the name specified in weblogic.xml

I have an application that I deployed using Maven before Weblogic 10.3.6 . I set the context root in weblogic.xml as

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

The problem I am facing is that the name of the war file is used as the root of the context instead of the name I specified in weblogic.xml

How to change the context root instead of the name that takes the name of the war file as the 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> 
+6
source share
2 answers

I assume this is due to your Maven settings / properties. (The same could happen with jDeveloper, if you don't have a set of properties, it will override your root context).

Have you seen this answer? Launch the correct root context with Netbeans (and Maven)

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

+4
source

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

fix it here and the eclipse will respect him

Edit: Looks like they fixed it correctly in 2015

if you use 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

+1
source

Source: https://habr.com/ru/post/945300/


All Articles