Hi Everyone,
Today i came across the requirement where i need to publish some of the static HTML pages to weblogic and request through HTTP Server.
Following blog will guide you through the steps to configure the Oracle HTTP Server 11g and WebLogic Server 10.3.1+ to serve static HTML pages and a simple demo JSP. This is not a normal task, but may be used for troubleshooting while working on more complex issues involving a Java application.
following are the specifications and Test Environment where i have implemented the same.
MS Windows Server 2003 SP2
WebLogic Server version 10.3.2
Oracle HTTP Server 11g version 11.1.1.2.0 based on Apache Server 2.2
Hostname : ajinkya-vichare
WebLogic Server Admin Port: 7001
HTTP Server port : 7777
This section will tell you how to configure your WebLogic Server to serve a static HTML page:
Step 1. Install and configure WebLogic Server on your system. You do not need to create a custom managed server. You may choose one in a later step, but for this example, we will use the AdminServer.
Step 2. Install and configure Oracle HTTP Server 11g. It is not required to associate this instance with the WebLogic domain.
Step 3. Create a directory of your choice, this is what we will call the "document root".
C:\oracle\static_root
Step 4. Copy the following static file to this directory:
HelloWorld.html
<html>
<body>
<h1> Hello World!!!</h1>
<h3> This is my static HTML page</h3>
</body>
</html>
Step 5. In the document root directory created in step 3 create the directory WEB-INF:
C:\oracle\static_root\WEB-INF
Step 6. In the WEB-INF directory create a file called web.xml with the following content:
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
<web-app>
</web-app>
Step 7. Login to the WebLogic Console to deploy the application:
i.e: http://ajinkya-vichare:7001/console
Step 8. Click on Deployments.
Step 9. Click Install and set the path to the directory created in step 3.
Step 10. Leave default "Install this deployment as an application" and click Next.
Step 11. Select a Managed Server to deploy to and click Next. If there aren't any custom managed servers on this domain, the AdminServer will be selected automatically. Otherwise, a list of available managed servers will be presented and you can select to one where you want to use as a target.
Step 12. Accept the defaults and click Finish.
Step 13. Deployment completes successfully, now click the Activate Changes.
Step 14. You should now see the application started in the deployments screen.
Step 15. You can now access your static content on the WebLogic Server port via the following URL:
http://ajinkya-vichare:7001/static_root/HelloWorld.html
Hello World!!!
This is my static HTML page
Now, you can configure the Oracle HTTP Server to serve this page from the WebLogic Server.
Step 16. Edit the mod_wl_ohs.conf file and add the Location directive for /static_root:
C:\Oracle\Middleware\Oracle_WT1\instances\instance1\config\OHS\ohs1\mod_wl_ohs.conf
LoadModule weblogic_module "${ORACLE_HOME}/ohs/modules/mod_wl_ohs.so"
<IfModule mod_weblogic.c>
WebLogicHost ajinkya-vichare
WebLogicPort 7001
<Location /static_root>
SetHandler weblogic-handler
</Location>
</IfModule>
Step 17. Save the mod_wl_ohs.conf file and re-start the Oracle HTTP Server.
Step 18. You can now access your page using the Oracle HTTP Server port via the following example address:
http://ajinkya-vichare:7777/static_root/HelloWorld.html
Hello World!!!
This is my static HTML page
It works for me..!!! again thanks to OTN. i have follow metalink ID : 1192439.1.
Enjoy working with Middleware.
Regards,
Ajinkya Vichare
ajinkya-vichare.blogspot.com
Hi,
ReplyDeleteThanks for this. Though, I have now a question:
If the html file is updated periodically, is there any way to "Auto-deploy" the html-file?
Br
Patric
Very good article...simple & informative...
ReplyDeleteHi
ReplyDeleteIn one of our Siebel implementations, the SunOne Web server is used with the Siebel App Server. Along with these, we have 2 web applications for Reporting (BI Publisher) & Rules Engine (OPA) hosted in Weblogic Server. The Sibel App Server communicates with these applications and users DO NOT directly interact with these applications.
We are debating over, should we use a 'Oracle HTTP Server' as web server for Weblogic App Server, or would 'Weblogic App Server' themselves be sufficient ?
Since there are no users who directly hit these 2 web applications in Weblogic (BI Publisher & OPA), and also there are not much of static content to be delivered, does it really makes sense to have a OHS web server ? How do you think it would benefit by having it ?
I am unable to deploy the app as per the steps mentioned above.
ReplyDeleteIt is not allowing me to select any file to deploy.
kindly help . its very urgent. I am using Oracle weblogic 10.3.
If for my application I am having context path "/" and I want deliver static components through OHS, what are configuration changes needed to be done in mod_wl_ohs.conf ?? Could you plz advise on this ??
ReplyDeleteThis I want implement in OHS 12c and weblogic 12c.
Regards,
Ganesh