Monday, October 18, 2010

How to make application deployed in weblogic as default web application?


 The default Web Application is presented to clients who do not specify a URI (or specify "/" as the URI). To deploy a Web Application as a default Web Application, set the value of the context-root element to "/" in its deployment descriptor.


OPTION-1)

You can specify the context-root element in the weblogic.xml deployment descriptor for Web Applications that are packaged as a .war archive or exploded .war directory. 

If you package the Web Application as part of an Enterprise Application (.ear archive or exploded .ear), specify the context-root in application.xml. Note that the application.xml context-root takes precedent over the weblogic.xml value.




Example:
<?xml version=’1.0′ encoding=’UTF-8′?>
<weblogic-web-app xmlns=”http://www.bea.com/ns/weblogic/90″ xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”>
<context-root>/</context-root> </weblogic-web-app>

To test this:
Enter the URL in the browser after successfully configured as explianed above:
http://{server_name}:{port_no}/
Note: No need to mention the application name after /.




OPTION-2)
If you don’t want to change your “weblogic.xml” then Please login to admin console—
Servers—>YourManagedServerName(Click)—>Protocol (Tab)—>Http (Sub Tab)—>Default WebApp Context Root:

NOTE:- In the above Field Please specify your WebApplications Context Root Preceding by forward slash (Example: /MyContextRoot)…so that after Server restart that Application will become your Servers Default WebApp….

For better results .. Please add the “welcome-page” inside your “web.xml” like following:

<?xml version=”1.0″ encoding=”UTF-8″?>
<web-app xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns=”http://java.sun.com/xml/ns/javaee” xmlns:web=”http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd” xsi:schemaLocation=”http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd” id=”WebApp_ID” version=”2.5″>
<display-name>SpringOne</display-name>
<welcome-file-list>
<welcome-file>
YourWelcomePage.jsp</welcome-file>
</welcome-file-list>
</web-app>
.

No comments:

Post a Comment