Saturday, 14 November 2015

Why WebLogic server goes in Admin state?

Oracle WebLogic Server Administration Console 12cQuite a while, when you restart a Managed Server in WebLogic Console, the server state instead of changing from <STARTING> to <RUNNING> goes to <ADMIN> state. So, what happens is you will face a downtime and it will affect the whole deployment process. The Managed server is not able to handle operational requests in ADMIN mode.

What is the reason behind WebLogic Managed server in ADMIN state?

There are various reasons for a Managed Server to change state to ADMIN. But it usually happens when the Managed Server is unable to activate some modules that are deployed on this particular server.

The most probable reason for a WebLogic Server in ADMIN state is because the Database is down and WebLogic tries to create a connection pool to this data source. 

How to change it to <RUNNING>?

Well, you need to know the exact reason first. You will have to diagnose the server logs and find out why the server is not able to change its state to running. Now, if you are facing the issue because the data source is down, you will have to UP your database and restart it. 

In case you want to keep the database down, you can just simply "resume" the Managed Server and it will be in RUNNING state.
Resume a WebLogic Server from Admin mode

There is another way where you won't need to manually resume the server whenever it's in Admin mode. You can set the InitialCapacity of the DataSource to 0 (ZERO). WebLogic will not try to create any JDBC connection object at the start up and you won't face the connection issue, ultimately avoiding the server to going to ADMIN state. 

This is what the server log looks like (for me when one of the server was in Admin state)

Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [applicationContext-abc-persistence.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Unable to resolve 'omx.jndi.jdbc.abcdef'. Resolved 'abcd.jndi.jdbc'; remaining name 'abcd'
        at org.springframework.beans.factory.access.SingletonBeanFactoryLocator.useBeanFactory(
        at org.springframework.web.context.ContextLoader.loadParentContext(
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(
        at weblogic.servlet.internal.EventsManager$

You can clearly figure out from the codes that the error is due to datasource not defined. So follow the above methods of resuming when you are sure you don't need a datasource connection or either by InitialCapacity of the DataSource to 0. 

Friday, 13 November 2015

Setting up Administrative console in WebLogic

Now, since you have set up WebLogic Server in your Windows System, lets set up the first project that comes with WebLogic and see how the Administrative console look like. 

WebLogic gives two example project "medrec" and "medrec-spring" on which you can try hands-on. 

Open Command Prompt (Start > Search "cmd"). Navigate to C:\Oracle\Middleware\Oracle_Home\user_projects\domains\medrec\bin
Type startWeblogic.cmd and press enter. You will server start up logs. It will look like something

Do not worry about the technicality of it as for now. Once the server state changes to <RUNNING>, as you can see in the last line, the medrec website will open that is present on your local system. Like for me, it was

To Open WebLogic console of this project, replace /medrec with /console and the administrative console will open. 

Administration Console WebLogic 12c

Type in the username and password to login to your Administration Console for WebLogic. 

Administration Console WebLogic 12c

Once you have successfully Login, click on the Servers to see the server list. 

Administration Console WebLogic 12c

You can check out the Deployment from clicking the "deployments" on the left side under "Domain Structure".
Deployments in WebLogic 12c

Get familiar with other options in the Administrative console. You can perform various operations like shutting down the server, creating managed servers and deploying some of the modules on them, monitoring and managing servers etc. We will learn about them in details in coming days. 

How to set up Weblogic Server in Windows

I tried setting up WebLogic Server in my Windows System (Windows 7, to be precise) and I was able to set it up without much difficulty. So, in this article I'm going to show you how you can set up WebLogic in Windows yourself and learn the basics, configure it, master it. 

Pre-requisite - Before you can set up and use Weblogic, you need to have Java Runtime Environment set up and paths defined. 

Downloading WebLogic for Windows

Download a fresh copy of WebLogic from Oracle's website: WebLogic Server Download Page

At present, WebLogic Server 12.2.1 is the latest one to download.

Once you download it, follow the below steps and you will be able to set up WebLogic in Windows.

Step 1: Open Command Prompt. (Start > Search > cmd). Navigate to the folder where the downloaded jar file is present. Like here in the snapshot, I have kept the jar file at C:\weblogic.

Type in the following command:

java -jar fmw_12.

The launcher will extract the jar file. 

Set Up Weblogic in Windows

Step 2: Once the extraction is done, you will have to follow the installation screen. Click Next.

Installation Window

Step 3: Select the preferred Installation Location. I have selected C:\Oracle\Middleware\Oracle_Home.

Installation Window

Step 4: Select the Installation Type as Complete with Examples. This will give you demo projects to play with. You can read about the other installations type of Google, since here I am only dedicated to set up WeLogic in Windows. Click Next.

Installation Window

Step 5: The Installation Windows will check for the prerequisite needed for WebLogic Server installation. and set up. Once it verifies that everything is up to the mark, Click Next. If the check says something is missing, fix it first. 

Installation Window

Step 6: The Installation Windows will then show the Installation Summary that will include different information as you can see in the below screenshots.

Installation Window

Step 7: The Installation Progress will show on the screen. Give some time and installation will complete. Click on Finish once the installation is over.

Installation Window

Installation Window

Step 8: Once the installation is complete, a quick start guide will open up.

Quick Start Guide

Fill in the details, username and password that you will use to login to WebLogic administrative console. Keep other things as it is, for now. You can choose different SSL Listen Port but that's a un-necessary part as of now. 

Configuration Wizard

The configuration process will begin. Click on Next > Finish. 


Installation Completed for WebLogic

You have now successfully completed the set up of WebLogic Server in Windows. Your WebLogic Server homepage will look something like this, follow the below screenshot. 

Administrative Console

We will cover other topics like setting up the demo projects, working with the servers in other articles. For now, you have successfully completed setting up WebLogic Server in Windows 7.