We have third party web based enterprise application, which is deployed on weblogic server and can be accessible using
http://hostname:port/myApp
But, due to some reason, we wanted to change context-root for this application, so that it must be ONLY accessible using
http://hostname:port/newApp
So, to achieve this, we tried changing application.xml
<?xml version = '1.0' encoding = 'utf-8'?>
<application xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd" version="1.4">
<display-name>myApp</display-name>
<module>
<web>
<web-uri>myApp.war</web-uri>
<context-root>newApp</context-root> // changed from myApp to newApp
</web>
</module>
</application>
But, while deploying this application on weblogic server, we are getting following error.
weblogic.management.DeploymentException: The application myApp contains a SubDeploymentMBean with a name myApp however there is no module in the application with that URI or context-root.
On the other hand, if we keep both context-root as shown below application.xml file, then it gets deployed successfully and also able to access application using both context-root.
<?xml version = '1.0' encoding = 'utf-8'?>
<application xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd" version="1.4">
<display-name>myApp</display-name>
<module>
<web>
<web-uri>myApp.war</web-uri>
<context-root>newApp</context-root> // changed from myApp to newApp
</web>
</module>
<module>
<web>
<web-uri>myApp.war</web-uri>
<context-root>myApp</context-root>
</web>
</module>
</application>
Can anyone help me to resolve this issue ? Let me know, if additional information required.
==Edited==
I have added weblogic.xml file, but not sure, what I suppose to change in this file as pointed by #Hououin Kyouma in his/her answer.
<?xml version = '1.0' encoding = 'US-ASCII'?>
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app">
<session-descriptor>
<cookie-path>/myApp</cookie-path>
</session-descriptor>
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
</weblogic-web-app>
You cannot define a context root with a differently named war file in the application.xml
<module>
<web>
<web-uri>myApp.war</web-uri>
<context-root>newApp</context-root> // changed from myApp to newApp
</web>
</module>
You must change above to
<module>
<web>
<web-uri>newApp.war</web-uri> // changed from myApp to newApp
<context-root>newApp</context-root>
</web>
</module>
You need to create the war with the new name. You will still need to change the weblogic.xml in the new war file, but as long as this question goes, above is what you need to do.
Have you tried setting the context root in the weblogic.xml?
https://docs.oracle.com/cd/E13222_01/wls/docs90/webapp/weblogic_xml.html#1073750
EDIT
Trying adding it like mentioned in this
https://community.oracle.com/thread/747158
<?xml version = '1.0' encoding = 'US-ASCII'?>
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app">
<context-root>/newApp</context-root>
<session-descriptor>
<cookie-path>/newApp</cookie-path>
</session-descriptor>
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
Related
I created a simple version API with rest-easy and wildfly, everything should works but the application path has the name of my project:
My version API return the version number from my pom.xml: The URI should be http://localhost:8080/version
but to acces it this is http://localhost:8080/projectName/version.
To acces to the open api file : The URI should be http://localhost:8080/openapi
but this is http://localhost:8080/projectName/openapi
I tried to extend Application to set the #ApplicationPath("/") but it's not working, it just allowed me to add element on the application path
example: http://localhost:8080/projectName/test/....
How can I set the application path to the root (/) and remove the projectName ?
JaxRSActivator class:
#ApplicationPath("/")
public class JaxRSActivator extends Application {
public JaxRSActivator()
{
super();
}
}
VersionFacade class:
#Path("/version")
#Tags
public interface VersionFacade {
#GET
#Produces(TEXT_PLAIN)
#Operation(summary = "Application version",
responses = {
#ApiResponse(responseCode = "200",
description = "Version number",
content = #Content(mediaType = TEXT_PLAIN, schema = #Schema(implementation = String.class)))})
String getVersion();
}
web.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_9" version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee"
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_3_0.xsd">
<!-- public API -->
<security-constraint>
<web-resource-collection>
<web-resource-name>public</web-resource-name>
<url-pattern>/openapi.json</url-pattern>
<url-pattern>/version</url-pattern>
</web-resource-collection>
</security-constraint>
<context-param>
<param-name>resteasy.role.based.security</param-name>
<param-value>true</param-value>
</context-param>
</web-app>
openapi-configuration.yaml file
openapi: 3.0.0
prettyPrint: true
cacheTTL: 0
openAPI:
info:
version: '0.0.1'
title: API config file
Jboss wildfly use the Web module name (projectName.war) as default context root. To set it you need to:
Add the WEB-INF/jboss-web.xml file in your Web module:
(if you don't package your app in an EAR file)
<jboss-web xmlns="http://www.jboss.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.jboss.com/xml/ns/javaee
http://www.jboss.org/j2ee/schema/jboss-web_5_1.xsd">
<!-- Set context root to / -->
<context-root>/</context-root>
</jboss-web>
Or add the META-INF/application.xml file in your EAR:
(if you package your app in an EAR file)
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/application_8.xsd" version="8">
<display-name>projectName-ear</display-name>
<module>
<web>
<!--My Web module -->
<web-uri>projectName-ws.war</web-uri>
<!-- Set context root to / -->
<context-root>/</context-root>
</web>
</module>
<module>
<!-- other EJB module -->
<ejb>projectName-core.jar</ejb>
</module>
</application>
If you use Eclipse, careful it sometimes don't publish your application.xml so you need to put it manually in your Wildfly standalone/deployments folder.
I'm trying to put my application on the root context to wildfly.
I put this files jboss-web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web xmlns="http://www.jboss.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.jboss.com/xml/ns/javaee
http://www.jboss.org/j2ee/schema/jboss-web_5_1.xsd">
<context-root>/</context-root>
</jboss-web>
and the empty file bean.xml at WEB-INF/
The welcome-content is still working at localhost:8080
If you put localhost:8080/index.xhtml my application appears.
I tried renaming the direcctory welcome-content but no works.
SOLVED: REFRESH CACHE OF THE BROWSER
I have this scenario in a EAR application which have the following structure:
Project
data
ear
entity
META-INF
persistence.xml
business
web
At the entity folder there is all the entity classes and a persistence.xml with the hibernate.hbm2ddl.auto property setted to create. When I deploy the jar about entity the database is generated but when I deploy the ear he isn't. Please somebody can let me know why this is happening and some way to solve it?
In your EAR project you must have a META-INF/application.xml file, that includes the entity jar file:
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:application="http://java.sun.com/xml/ns/javaee/application_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd" id="Application_ID" version="6">
<display-name>MY_ear</display-name>
<module>
<ejb>ENTITY.jar</ejb><!--change the name accordingly-->
</module>
</application>
I have written an Webservice using jax-ws (with Eclipse IDE) and have bundled it in War, in turn bundled within an Ear. I'm able to deploy that fine and testing of the web services also works fine. But when I login to my Weblogic Admin console and expand the Ear deployment, I don't see anything under 'Web services', it displays None to display.
Could any one please let me know what is that am missing here?
this is the application.xml
<?xml version="1.0" encoding="UTF-8"?>
<application id="Application_ID" version="1.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">
<display-name>EAR1</display-name>
<module id="WebModule_1376158300960">
<web>
<web-uri>TestWEB.war</web-uri>
<context-root>TestWEB</context-root>
</web>
</module>
</application>
I have a simple JSP/Servlets application. The app is already deployed to the server and is running at say URL http://www.servername:7001/myapp1/jsp/login.jsp. I have made some substantial changes to the code and I redeployed it as myapp2 in the server. However if I try to access it at this URL,,say http://www.servername:7001/myapp2/jsp/login.jsp, this gives me a "resource not found error". Is the URL mapped to the application somewhere? What do I need to do to access the newly deployed project. I do not want to remove the old project till I am sure the new one works properly
You probably need to specify a context root. There are a couple of places this might appear.
1) Inside your EAR file in META-INF/application.xml, e.g.:
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:application="http://java.sun.com/xml/ns/javaee/application_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd"
id="Application_ID" version="5">
<display-name>myapp2</display-name>
<module>
<web>
<web-uri>myapp2.war</web-uri>
<context-root>/myapp2</context-root>
</web>
</module>
</application>
2) In the WAR file, in WEB-INF/weblogic.xml, e.g.:
<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app xmlns:wls="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">
<wls:weblogic-version>10.3.2</wls:weblogic-version>
<wls:context-root>myapp2</wls:context-root>
</wls:weblogic-web-app>