Weblogic - Static Web Site Deployment

> (Weblogic|Fusion Middelware|FMW)

1 - About

Java - Web Application (Web Module) - War in Weblogic

How to deploy a static website in Weblogic.

2 - Steps

2.1 - Create a Web Archive

  • create a WEB-INF directory at your web site root
  • add a web.xml in this directory
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app>
 
    <display-name>My Web Site Name</display-name>
 
    <description>
       A static web site
    </description>
 
    <welcome-file-list>
       <welcome-file>index.html</welcome-file>
    </welcome-file-list>
 
</web-app>
  • add also the weblogic.xml file that defines the context-root
weblogic.xml
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app">
	<context-root>WebSiteName</context-root>
</weblogic-web-app>
  • Verify the structure of your website on the file system. It must be something like that:
WEB_SITE_ROOT
  - page1.html
  - page2.html
  - script.js
  - ...........
  - WEB-INF
      - web.xml
      - weblogic.xml
cd $WEB_SITE_ROOT
jar cvf path\to\myWarFile.war .
Advertising

2.2 - Deploy the Web Site into Weblogic

To deploy web application into weblogic, you use the weblogic.Deployer (See doc )

  • Undeploy if it was already deployed
java ^ 
  -cp "C:\fmw\wlserver\server\lib\weblogic.jar" ^
  weblogic.Deployer ^
  -undeploy ^
  -name myWebSite ^
  -username weblogic ^
  -password welcome1 ^
  -adminurl t3://localhost:9500
  • Deploy it (same as undeploy but you give the war file and change the action)
java ^ 
  -cp "C:\fmw\wlserver\server\lib\weblogic.jar" ^
  weblogic.Deployer ^
  -deploy ^
  -name myWebSite ^
  -username weblogic ^
  -password welcome1 ^
  -adminurl t3://localhost:9500
  -source path\to\myWebSite.war
REM You can also specified the target server with the targets options
REM   -targets bi_server1

2.3 - Verification

The application can be seen in the weblogic console. Console > Deployment

If you open a browser and go to the following URL, you should see your website as you defined the index in the web.xml file

http://localhost:portOfTarget/context-root

Example: http://localhost:9500/myWebSite

weblogic/web_application.txt · Last modified: 2018/09/20 14:01 by gerardnico