Thursday, September 1, 2016

Create a war file from html and deploy or host in weblogic

Create a folder let's say C:\Oracle\Middleware\user_projects\domains\base_domain\robin
then create a text file, write something in it and save as r.html, save as type - all files.

Create another text file, add below contents in it and save as weblogic.xml, save as type - all files.
(ensure <local-path> matches your respective path)


<?xml version="1.0"?>

<!DOCTYPE weblogic-web-app SYSTEM "http://www.bea.com/servers/wls810/dtd/weblogic-web-jar.dtd" PUBLIC "-//BEA Systems, Inc.//DTD Web Application 8.1//EN">

-<weblogic-web-app>


-<container-descriptor>

<index-directory-enabled>true</index-directory-enabled>

</container-descriptor>


-<virtual-directory-mapping>

<local-path>C:\Oracle\Middleware\user_projects\domains\base_domain\robin</local-path>

<url-pattern>*</url-pattern>

</virtual-directory-mapping>

<context-root>/html</context-root>

</weblogic-web-app>



now open cmd and traverse to C:\Oracle\Middleware\user_projects\domains\base_domain\bin
run setdomainenv to set the classpath, you will find yourself under base_domain now, then cd robin.

C:\Oracle\Middleware\user_projects\domains\base_domain\robin>jar cvf r.war *
added manifest
adding: New Text Document.txt(in = 538) (out= 298)(deflated 44%)
adding: r.html(in = 5) (out= 7)(deflated -40%)
adding: weblogic.xml(in = 538) (out= 298)(deflated 44%)

check the contents as
C:\Oracle\Middleware\user_projects\domains\base_domain\robin>jar tvf r.war
     0 Thu Sep 01 15:29:16 IST 2016 META-INF/
    68 Thu Sep 01 15:29:16 IST 2016 META-INF/MANIFEST.MF
   538 Thu Sep 01 15:28:00 IST 2016 New Text Document.txt
     5 Thu Sep 01 14:45:58 IST 2016 r.html
   538 Thu Sep 01 15:28:20 IST 2016 weblogic.xml


Deploy this war file on JVM running on port 7001 and access as below

http://localhost:7001/r/r.html

No comments: