Weblogic - Static Web Site Deployment
About
Java - Web Application (Web Module) - War in Weblogic
How to deploy a static website in Weblogic.
Steps
Create a Web Archive
- create a WEB-INF directory at your web site root
- add a web.xml in this directory
<?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
<?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
- Zip all the files in a WAR (Web Archive)
cd $WEB_SITE_ROOT
jar cvf path\to\myWarFile.war .
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
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