Sunday, 1 February 2015

Weblogic - Deployment of Java EE based web application

Hello Everyone,

In this post, I am going to explain about my learning related to deployment of Java EE based web application in Oracle Weblogic server.

There are so many tutorials out there, but when I was trying to deploy - I was having tough time in finding the basic tutorial. Hence, in this tutorial - I am going to explain the process of web app deployment in weblogic using straight forward, simplistic approach.

First download Oracle Weblogic eval version from here and perform the installation.

After the installation, check whether the installation is proper by launching 'Weblogic Configuration Wizard' from here: All Programs -> Oracle -> OracleHome -> Weblogic Server 12c -> Tools
-> Configuration Wizard

If the above operation launches Configuration Wizard, then your installation is successful. If it throws any error related to JVM, then there is an issue between Weblogic installation and your Java installation.

Unfortunately, my installed Java had an issue and I had to resolve it :-( Resolving Java issue is a separate activity, I will write another blog on this separately.

Assuming all your installation issues are resolved and your Weblogic installation is successful, you need to create a domain for your weblogic server in order to carry on the application deployment.

To create a domain, use 'Domain Template Builder' wizard available under '..Weblogic Server 12c -> Tools' menu, Its a simple and straighforward process.

Now web application can be deployed in 3 ways as mentioned here:

We will use the approach of deployment using 'Weblogic Deployer' utility.

Navigate to the location that you have specified in your domain creation. There you would find no of directories created along with your domain. Perform below steps in order to create your web app to be deployed in weblogic:

1. Create new folder for your web app under your domain directory.
2. Under the web app directory, create folders named 'WEB-INF'.
3. Under 'WEB-INF', create the folders 'lib' and 'classes'.
4. Place all your java library reference files under 'lib' folder.
5. Place all your compiled class files of the web app under 'classes' folder.
6. Place your 'web.xml' file under 'WEB-INF' folder.
7. If your web app contains any static files such as jsp, html or xhtml - place them under web app directory.

Now you have placed your web app files in the directory structure that Weblogic would understand.

Next we will be initiating the deployment of web app in Weblogic as below:

1. Under your domain directory, there will be a file 'startWebLogic.cmd'. Double click on it.
This step would start the server.
2. Next step is to initiate the deployment by invoking 'weblogic.Deployer' file present under 'weblogic.jar'.
3. In command prompt, navigate to the directory of your domain and execute the below command:

java -cp .;C:\Oracle\Middleware\Oracle_Home\wlserver\server\lib\weblogic.jar weblogic.Deployer -username weblogic -password welcome1 -adminurl t3://localhost:7001 -name <Your web app name> -source <Your web app folder name> -deploy -debug

As shown above, you are adding weblogic.jar into your java classpath and initiating the deployment.

If everything else is fine, your application would have been successfully deployed and you would be able to access it from below url:

http://localhost:7001/<Your web app folder name>

For the application containing JSF/JSP, it requires some additional steps. I will cover them separately. Please let me know if there is any clarifications.


No comments:

Post a Comment