Change Weblogic Node Manager username and password

Did you lost or forgot the password of Weblogic Node Manager?
Do you want to change the username of Weblogic Node Manager?

I will describe you a way to change username and password of your Node Manager.

Change username

Edit WLS config.xml and edit the next line:
<node-manager-username>weblogic</node-manager-username>

Change weblogic with a new username.

Change password

Change password with a text editor:

  1. Go to directory: domain_directory/config/nodemanager
  2. Open the file: nm_password.properties
  3. Find an entry looking like hashed=zFiKcLvUQ1x9r11u8tjZlRvwBr1\= and remove it
  4. Fill the following properties with real values as simple text:
    1. password=
    2. username=

Change password via Admin Console:

Log in to Admin Console and go to: DomainName -> Security tab-> General subtab -> Advanced Options
Then change the property Credentials with the new password.

Additional steps

When you finish your changes remember to restart AdminServer and NodeManager.

Also, in order to verify your changes you can connect to your Node Manager using the new credentials:

$ cd /opt/fmw/oracle_common/common/bin
$ wlst.sh
wls:/offline> nmConnect(domainName='test_domain', username='NMUser', password='mpeeeeeee')
Connecting to Node Manager ...
Successfully Connected to Node Manager.
wls:/nm/test_domain> nmDisconnect()
Successfully disconnected from Node Manager.
wls:/offline> exit()

Regards,
Adrianos.

Democracy requires Free Software.

Posted in Administration, Weblogic | Tagged , | 3 Comments

Weblogic WLST – Create and configure JMS Resources

WLST is a scripting tool for Weblogic AS, made by BEA (and now Oracle). It gives you a scripting interface (Jython) to manage, create and monitor Weblogic domains and instances.

In this article I will give you (and explain) a WLST script that do the followings:

  1. Load properties from file
  2. Connect to Admin Server
  3. Delete existing JMS Resources (JMS server, Filestore, JMS module)
  4. Create a Filestore and a JMS Server
  5. Create a JMS Module
  6. Create 2 JMS Queues
    1. Configure JMS Queues
    2. Set Delivery Failure
    3. Enable Logging
    4. Set Overrides properties
  7. Create an XA JMS Connection Factory

### Section 1: Load properties from file ###

You need to create a properties file (like Ant properties file). This file must be like this:

username=weblogic
password=weblogic1
providerURL=t3://localhost:7001
fileStoreDirecory=/xxx/beahome10.3.2/user_projects/domains/simple_domain/myFileStore1

Then you need the following code to read and get the properties.

def loadProperties(fileName):
	properties = Properties()
	input = FileInputStream(fileName)
	properties.load(input)
	input.close()
	result= {}
	for entry in properties.entrySet(): result[entry.key] = entry.value
	return result

properties = loadProperties("local.properties")
username = properties['username']
password = properties['password']
url = properties['providerURL']

### Section 2: Connect to Admin Server ###

connect(username, password, url)
adminServerName = cmo.adminServerName

### Section 3: Delete existing JMS Resources ###

Delete existing JMS Module

cd("/JMSSystemResources")
deleteIgnoringExceptions(moduleName)

Delete existing JMS Server and its Filestore

cd("/JMSServers")
deleteIgnoringExceptions(jmsServerName)
cd("/FileStores")
deleteIgnoringExceptions(fileStoreName)

### Section 4: Create a Filestore and a JMS Server ###

You can find this code in function createJMSServer() of the script.

# Create Filestore
cd('/')
filestore = cmo.createFileStore(fileStoreName)
filestore.setDirectory(properties['fileStoreDirecory'])
filestore.targets = (adminServer,)

cd("/JMSServers")
# Create JMS server and assign the Filestore
jmsServer = create(jmsServerName, "JMSServer")
jmsServer.setPersistentStore(filestore)
jmsServer.targets = (adminServer,)

### Section 5: Create a JMS Module ###

The code creates a JMS Module and a Subdeployment for this dodule. You can find this code in function createJMSModule() inside the script.

cd('/JMSSystemResources')
jmsModule = create(moduleName, "JMSSystemResource")
jmsModule.targets = (adminServer,)

cd(jmsModule.name)
# Create and configure JMS Subdeployment for this JMS System Module
sd = create(subDeploymentName, "SubDeployment")
myJMSServer = getMBean('/JMSServers/' + jmsServerName)
sd.targets = (myJMSServer,)

### Section 6 & 7 ###

At these steps we create 2 JMS Queues (myRequestQueueEDQ, myRequestQueue).
The ‘myRequestQueueEDQ’ is used as Failed destination delivery queue for the ‘myRequestQueue’, which our application request queue. When redelivery limit of a JMS Message is exceeded (this is a Weblogic feature, but you can find it to other AS too), then you can configure messaging system to redirect this message to another queue (other actions are: Log and Reject). This is an extremely useful feature, and the ‘myRequestQueueEDQ’ is used to named as Dead Letter Queue.
In order to use this feature, we MUST set the ‘Redelivery Limit’ for this queue, because by default is to ‘-1’ (for ever).
Code also sets the ‘Redelivery Delay Override’ parameter, which is the delay that a failed message will be again available to consumers.
Also, code enables Logging of JMS Properties and set Delivery mode to ‘Persistent’ to always persist the messages.
You can find the related code at functions createDLQ() and createQueue().

### Section 8: Create an XA JMS Connection Factory ###

The code to do this is the following and you can find it inside the script in function createCF().

cd('/JMSSystemResources/'+moduleName+'/JMSResource/'+moduleName)
cf = create(cfname, "ConnectionFactory")
cf.JNDIName = cfjndiname
cf.subDeploymentName = subDeploymentName
# Set XA transactions enabled
cf.transactionParams.setXAConnectionFactoryEnabled(1)

### RUN ###

Before run the script you need the followings:

  1. Create the directory for the JMS Filestore.
  2. A running Weblogic instance.
  3. Set the local.properties values according to this Weblogic instance

The final step is to start WLST and execute/interpret the script. This can be done with a Bash shell like this:

cd WL_HOME/server/bin
source setWLSEnv.sh
cd ~/develop/wlst
java weblogic.WLST createConfigureJMSResources.py

### Useful data ###

  1. The WLST script: createConfigureJMSResources.py
  2. The properties file: local.properties
  3. Script has been tested with Weblogic 10.3.2 and 10.3.3
  4. OS was GNU/Linux Debian Lenny

This is the simplest use of WLST. WLST has many useful features that can save you much time. I will try to post more articles with other features of WLST.

Regards,
Adrianos.

Democracy requires Free Software.

NOTES:
# You are free do modify and distribute this script as you like.
# This script is for Weblogic WLST, which is a proprietary product of Oracle.
# Please use JBoss AS if it is possible, as it is as good as Weblogic and the source code is available.

Posted in Administration, Weblogic | Tagged , , | Leave a comment

Introduction of this blog

We are all free to comment, propose, criticise or argue with any clause/opinion of this blog. Be polite and reason your opinion.

The main topics of this blog are:

  1. Java
  2. Software integration
  3. The virtues of source

As you already know what Java and software integration are (or mean), I will define and what source means in this blog.
As source I mean:

  1. The source code of software programs.
  2. The source of any truth (for different issues there are different truths, but for one issue, there is only one truth).

Believe to yourself and be hungry for knowledge.

Adrianos Dadis.

Democracy requires Free Software.

Posted in Personal | Leave a comment