Oracle Weblogic Server Archive

How to configure SSL on Nodemanager for 12c

In Weblogic Server 12.1.2, the java version of Node Manager controls all WLS instances belonging to the same domain.This allows the feasibility to have different nodemanager configurations for different domains.

You can follow the steps below to use one nodemanager per domain running over SSL ( custom identity & custom trust)

1)  Start nodemanager from the following location ( just to create a default nodemanager.properties file).

D:\Oracle\Middleware\wlserver_12.1\server\bin\startNodeManager.cmd

Stop the nodemanager.

2) Copy the nodemanager folder from the this location to your domain folder.

D:\Oracle\Middleware\wlserver_12.1\common\nodemanager

3) Copy startNodeManager.cmd present at the below location to your domain home folder

D:\Oracle\Middleware\wlserver_12.1\server\bin\startNodeManager.cmd

4) Open the script and update the NodeManager home location in the script

set NODEMGR_HOME=D:/Oracle/Middleware/user_projects/domains/base_domain/nodemanager

5) Create Identity Store for the Node Manager in the nodemanger folder.

keytool -genkey -alias mykey -keyalg RSA -keysize 1024 -dname "CN=www.welogic-wonders.com, OU=Customer Support, O=BEA Systems Inc, L=Denver, ST=Colorado, C=US" -keypass mykeypass -keystore identity.jks -storepass mystorepass

keytool -selfcert -v -alias mykey -keypass mykeypass -keystore identity.jks -storepass mystorepass -storetype jks

You can create it anywhere but then you will have to give the complete path in nodemanager.properties file.

6) Add the following in nodemanager.properties file

KeyStores=CustomIdentityAndCustomTrust
CustomIdentityAlias=mykey
CustomIdentityKeyStoreFileName=identity.jks
CustomIdentityKeyStorePassPhrase=password
CustomIdentityKeyStoreType=JKS
CustomIdentityPrivateKeyPassPhrase=password

7) Start your Node Manager from the domain folder at any available port you want.

D:\Oracle\Middleware\user_projects\domains\base_domain>startNodeManager.cmd localhost 6666

D:\Oracle\Middleware\user_projects\domains\base_domain>set CLASSPATH=.;D:\Oracle
\Middleware\patch_wls1211\profiles\default\sys_manifest_classpath\weblogic_patch
.jar;D:\Oracle\Middleware\jrockit_160_29_D1.2.0-10\lib\tools.jar;D:\Oracle\Middl
eware\wlserver_12.1\server\lib\weblogic_sp.jar;D:\Oracle\Middleware\wlserver_12.
1\server\lib\weblogic.jar;D:\Oracle\Middleware\modules\features\weblogic.server.
modules_12.1.1.0.jar;D:\Oracle\Middleware\wlserver_12.1\server\lib\webservices.j
ar;D:\Oracle\Middleware\modules\org.apache.ant_1.7.1/lib/ant-all.jar;D:\Oracle\M
iddleware\modules\net.sf.antcontrib_1.1.0.0_1-0b2/lib/ant-contrib.jar;

D:\Oracle\Middleware\user_projects\domains\base_domain>if not "" == "" set CLASS
PATH=;.;D:\Oracle\Middleware\patch_wls1211\profiles\default\sys_manifest_classpa
th\weblogic_patch.jar;D:\Oracle\Middleware\jrockit_160_29_D1.2.0-10\lib\tools.ja
r;D:\Oracle\Middleware\wlserver_12.1\server\lib\weblogic_sp.jar;D:\Oracle\Middle
ware\wlserver_12.1\server\lib\weblogic.jar;D:\Oracle\Middleware\modules\features
\weblogic.server.modules_12.1.1.0.jar;D:\Oracle\Middleware\wlserver_12.1\server\
lib\webservices.jar;D:\Oracle\Middleware\modules\org.apache.ant_1.7.1/lib/ant-al
l.jar;D:\Oracle\Middleware\modules\net.sf.antcontrib_1.1.0.0_1-0b2/lib/ant-contr
ib.jar;

D:\Oracle\Middleware\user_projects\domains\base_domain>if not "" == "" set CLASS
PATH=.;D:\Oracle\Middleware\patch_wls1211\profiles\default\sys_manifest_classpat
h\weblogic_patch.jar;D:\Oracle\Middleware\jrockit_160_29_D1.2.0-10\lib\tools.jar
;D:\Oracle\Middleware\wlserver_12.1\server\lib\weblogic_sp.jar;D:\Oracle\Middlew
are\wlserver_12.1\server\lib\weblogic.jar;D:\Oracle\Middleware\modules\features\
weblogic.server.modules_12.1.1.0.jar;D:\Oracle\Middleware\wlserver_12.1\server\l
ib\webservices.jar;D:\Oracle\Middleware\modules\org.apache.ant_1.7.1/lib/ant-all
.jar;D:\Oracle\Middleware\modules\net.sf.antcontrib_1.1.0.0_1-0b2/lib/ant-contri
b.jar;;

D:\Oracle\Middleware\user_projects\domains\base_domain>cd D:\Oracle\Middleware\u
ser_projects\domains\base_domain\nodemanager

D:\Oracle\Middleware\user_projects\domains\base_domain\nodemanager>if not "6666"
== "" if not "localhost" == "" goto runNMWithListenAddressAndPort

D:\Oracle\Middleware\user_projects\domains\base_domain\nodemanager>"D:\Oracle\Mi
ddleware\jrockit_160_29_D1.2.0-10\bin\java.exe" -jrockit -Xms128m -Xmx256m -Dbea
.home=D:\Oracle\Middleware -Xverify:none -Djava.endorsed.dirs=D:\Oracle\Middlew
are\jrockit_160_29_D1.2.0-10/jre/lib/endorsed;D:\Oracle\Middleware\wlserver_12.1
/endorsed "-Djava.security.policy=D:\Oracle\Middleware\wlserver_12.1\server\lib\
weblogic.policy" "-Dweblogic.nodemanager.javaHome=D:\Oracle\Middleware\jrockit_1
60_29_D1.2.0-10" -DListenAddress="localhost" -DListenPort="6666" weblogic.NodeMa
nager -v

Apr 23, 2015 8:30:50 PM weblogic.nodemanager.server.NMServerConfig initDomainsMa
p
INFO: Loading domains file: D:\Oracle\Middleware\wlserver_12.1\common\nodemanage
r\nodemanager.domains

Apr 23, 2015 8:30:50 PM weblogic.nodemanager.server.SSLConfig loadKeyStoreConfig

INFO: Loading identity key store: FileName=D:\Oracle\Middleware\user_projects\do
mains\base_domain\nodemanager\identity.jks, Type=JKS, PassPhraseUsed=true

Apr 23, 2015 8:30:50 PM weblogic.nodemanager.server.NMServer 
INFO: Loaded node manager configuration properties from 'D:\Oracle\Middleware\us
er_projects\domains\base_domain\nodemanager\nodemanager.properties'
Node manager v10.3

Configuration settings:

NodeManagerHome=D:\Oracle\Middleware\wlserver_12.1\common\nodemanager
ListenAddress=localhost
ListenPort=6666
ListenBacklog=50
SecureListener=true
AuthenticationEnabled=true
NativeVersionEnabled=true
CrashRecoveryEnabled=false
JavaHome=D:\Oracle\Middleware\jrockit_160_29_D1.2.0-10\jre
StartScriptEnabled=true
StopScriptEnabled=false
StartScriptName=startWebLogic.cmd
StopScriptName=
LogFile=D:\Oracle\Middleware\wlserver_12.1\common\nodemanager\nodemanager.log
LogLevel=INFO
LogLimit=0
LogCount=1
LogAppend=true
LogToStderr=true
LogFormatter=weblogic.nodemanager.server.LogFormatter
DomainsFile=D:\Oracle\Middleware\wlserver_12.1\common\nodemanager\nodemanager.do
mains
DomainsFileEnabled=true
StateCheckInterval=500
UseMACBroadcast=false
DomainRegistrationEnabled=false
DomainsDirRemoteSharingEnabled=false

Domain name mappings:


wl_server -> D:\Oracle\Middleware\wlserver_12.1\samples\domains\wl_server
base_domain -> D:\Oracle\Middleware\user_projects\domains\base_domain
medrec -> D:\Oracle\Middleware\wlserver_12.1\samples\domains\medrec

Apr 23, 2015 8:30:51 PM weblogic.nodemanager.server.SSLListener run
INFO: Secure socket listener started on port 6666, host localhost/127.0.0.1

How to store http sessions in database for WebLogic Cluster

In this example we are going use Postgres database for session replication. It can be downloaded from here

Once installed, you need to execute the following query to create the table to store session

 

create table wl_servlet_sessions ( wl_id TEXT NOT NULL, wl_context_path TEXT NOT NULL, wl_is_new CHAR(1),
 wl_create_time NUMERIC(20),     wl_is_valid CHAR(1), wl_session_values BYTEA, wl_access_time NUMERIC(20), 
wl_max_inactive_interval INTEGER, PRIMARY KEY (wl_id, wl_context_path) );

Once the database setup is complete, we need to create a postgres datasource on Weblogic Server.
You can follow the steps here if needed.Then you need to update the deployment descriptor (weblogic.xml) of your application as follows.

 

<session-descriptor>
   <persistent-store-type>jdbc</persistent-store-type>
   <persistent-store-pool>postgresds</persistent-store-pool>
   <persistent-store-table>WL_SERVLET_SESSIONS</persistent-store-table>
</session-descriptor>

 

Now you can log in to your application, store objects in session.

If you want to have a look at the session details in the database, you can use the pgAdmin tool.

replication-session

 

Please feel free to get in touch with us if you have any queries.

 

Cheers!

Wonders Team

Simple Checklist for WebLogic to JBoss Migration

Compare the supported J2EE specs ( EJB, JMS, Webservices) of the Weblogic Version you are going to migrate from to the JBoss Server version. You will get the details from their official website.

Find out the architecture of the Weblogic Application Server ( How many servers? Clusters? Machines?) either from the config.xml or Admin Console.

Find the dependencies of the applications ( where are third part libraries?)

Find the resources needed by the Application ( Datasources / Queues & Topics / Resource Adapters)

Change the Proxy ( Webserver configurations)

Deployment descriptor changes

Does the application rely of Application Server security? If so you will have to create corresponding users in JBoss.

Migrate the Custom MBeans / Startup classes / Application Listeners.

Change the JNDI lookup code in the application.

Refer this link that explains in details.

Auto Deployment and Hot Deployment

Auto Deployment:  

Features provided by the Application Servers in which applications can be automatically deployed / undeployed on to the server. The App Server provides a mechanism where they scan certain folders for the applications for ex. autoDeploy folder in weblogic, deploy folder in tomcat / Jboss etc.

Hot deployment:

The process of adding new components (such as WAR files, EJB Jar files, enterprise Java beans, servlets, and JSP files) to a running server without having to stop the application server process and start it again.  

Hot deployment is mainly used to update the individual modules or jsps/servlets/classes in a module without redeploying the complete app.

Auto Deployments of Web Applications in WebLogic Server:

This is the simplest form of deployment. When enabled the Admin Server periodically scans the autoDeploy folder and deploy all the applications present in there.

Note: This feature is disabled in the production mode.

Production mode of the application server can be changed using the handle –Dweblogic.ProductionModeEnabled=true in the server startup file.

Need of Auto Deployment:

This is a very quick way of deploying the application which can be using during development and unit testing phase to reduce the deployment time.

How to auto Deploy:

1. Start the WebLogic Server domain in development mode.

2. Place the application’s exploded directory structure or archive file in this autodeploy directory.

It is present under $DOMAIN_HOME folder structure.

Hot Deployment (Redeployment Strategies) in Weblogic server:

This can be achieved by using different Redeployment Strategies.

Production Redeployment:  

Production redeployment strategy involves deploying a new version of an updated application alongside an older version of the same application. WebLogic Server automatically manages client connections so that only new client requests are directed to the new version. Clients already connected to the application during the redeployment continue to use the older version of the application until they complete their work, at which point WebLogic Server automatically retires the older application.

In-Place Redeployment:

In-place redeployment immediately replaces a running application’s deployment files with updated deployment files. In contrast to production redeployment, in-place redeployment of an application or stand-alone J2EE module does not guarantee uninterrupted service to the application’s clients. This is because WebLogic Server immediately removes the running classloader for the application and replaces it with a new classloader that loads the updated application class files.

Partial Redeployment of Static Files:

WebLogic Server enables you to redeploy selected files in a running application, rather than the entire application at once. This feature is generally used to update static files in a running Web application, such as graphics, static HTML pages, and JSPs. Partial redeployment is available only for applications that are deployed using an exploded archive directory.

Partial Redeployment of J2EE Modules :

Partial redeployment also enables you to redeploy a single module or subset of modules in a deployed Enterprise Application. Again, partial deployment is supported only for applications that are deployed using an exploded archive directory.

Further reading.

http://docs.oracle.com/cd/E11035_01/wls100/deployment/redeploy.html

Happy Reading.

Wonders Team 🙂

Weblogic Server Administration for Beginners.

This article is for System Admins who are new to Weblogic Administration.

The following are the day to day task of a Weblogic Server Administrators.

1. Setting up infrastructure ( Managed Servers, Cluster, Nodemanager)
2. Deploying Applications
3. Creating resources( JMS, JDBC, Security)
4. Monitoring
5. Performance Tuning
6. Troubleshooting

Setting up infrastructure ( Managed Servers, Cluster, Nodemanager)

This includes installing Weblogic Server , creating domains, domain templates.
You need to figure out the needs of the application/applications that the domain is going to host.
Do you need a distibuted setup with Weblogic Server running on multiple machines?
Do you need a cluster, is session replication necessary for your application or load balancing is enough?
Do you want to control ( start/stop) the managed server from the console or you’ll prefer scripts to do it for you?
What environment you are going to create, DEV, UAT, SIT, Production?

You will need answers to these questions before going ahead with setting up the infrastructure.

Deploying Applications

You will have to select the mode of deployment ( stage, nostage, external stage) of the application.
This is largely determined by the size of the application. Also before deploying the applications you will have to know the dependency of the applications. Does your application need a datasource configuration? Do you have MDB’s in your application?What Queues/Topics the application needs? Read the Create Configurations section.

Create resources

Your application might need datasources/ jms queues and topics. You need to configure them. Also check if your application is using J2EE security , does it rely on Application Server container authentication. If yes, you’ll have to create users and groups. In some cases you will have to configure external security providers.

Monitoring

In production usually third party tools ( that rely on SNMP) are available to do the monitoring. You can also use JMX and WLST to write your own monitoring tools.

Performance Tuning

This is a very important area. You need to know the number of concurrent users who will be accessing the application, what wil be the transaction per second. You need to tune the heap and work manager accordingly to cater to the load. There is a calculation that goes behind it and I will try to cover in a separate article.

Troubleshooting

Admins are expected to resolve issues starting from the initial phase of setting up the infrastructure till the application goes live. A lot of Weblogic related issues are covered in the troubleshooting section of wonders.