Setting DataSources in Weblogic 10 with WLST (setEncrypt)

# This script creates DataSources in Weblogic configuration using Defined Dictionary of DS and already stored encrypted password
# What is interesting here that setEncrypted wlst command is not documented on Oracle pages
# DS Dictionary with DataSource:JNDIName Entries, coma separated
# We assume that we have already one DS created from the console an Password has been stored in
#   setEncrypted(‘Password’, ‘Password_1301559772904′, ‘/opt/wls/weblogic/10.3/user_projects/cbd2Domain/WLSTScript-Recording-logConfig’, ‘/opt/wls/weblogic/10.3/user_projects/cbd2Domain/WLSTScript-Recording-logSecret’)
#
# start this script with execfile(‘/path/to/this/script.py’)
#
startEdit()
# Dictionary definition
DS={‘DSN1′:’JNDI1′,’DS2′:’JNDI2′,’DS3′:’JNDI3′}

for DSName, JNDI in DS.items():

print „DSName = ” + DSName
print „JNDI = ” + JNDI

cd(‘/’)
cmo.createJDBCSystemResource(DSName)

cd(‘/JDBCSystemResources/’+DSName+’/JDBCResource/’+DSName)
cmo.setName(DSName)

cd(‘/JDBCSystemResources/’+DSName+’/JDBCResource/’+DSName+’/JDBCDataSourceParams/’+DSName)
set(‘JNDINames’,jarray.array([String(JNDI)], String))

cd(‘/JDBCSystemResources/’+DSName+’/JDBCResource/’+DSName+’/JDBCDriverParams/’+DSName)
cmo.setUrl(‘jdbc:oracle:thin:@fdcicgcbdad01u.eur.nsroot.net:1541:UELCCBD2′)
cmo.setDriverName(‘oracle.jdbc.OracleDriver’)
setEncrypted(‘Password’, ‘Password_1301559772904′, ‘/opt/wls/weblogic/10.3/user_projects/cbd2Domain/WLSTScript-Recording-logConfig’, ‘/opt/wls/weblogic/10.3/user_projects/cbd2Domain/WLSTScript-Recording-logSecret’)

cd(‘/JDBCSystemResources/’+DSName+’/JDBCResource/’+DSName+’/JDBCConnectionPoolParams/’+DSName)
cmo.setTestTableName(‘SQL SELECT 1 FROM DUAL\r\n\r\n\r\n’)
cmo.setTestConnectionsOnReserve(true)

cd(‘/JDBCSystemResources/’+DSName+’/JDBCResource/’+DSName+’/JDBCDriverParams/’+DSName+’/Properties/’+DSName)
cmo.createProperty(‘user’)

cd(‘/JDBCSystemResources/’+DSName+’/JDBCResource/’+DSName+’/JDBCDriverParams/’+DSName+’/Properties/’+DSName+’/Properties/user’)
cmo.setValue(‘uelccbd’)

cd(‘/JDBCSystemResources/’+DSName+’/JDBCResource/’+DSName+’/JDBCDataSourceParams/’+DSName)
cmo.setGlobalTransactionsProtocol(‘OnePhaseCommit’)

cd(‘/SystemResources/’+DSName)
set(‘Targets’,jarray.array([], ObjectName))

set(‘Targets’,jarray.array([ObjectName('com.bea:Name=cbd2Cluster,Type=Cluster')], ObjectName))

save()
activate()

Eclipse and remote file editing

Remote System Explorer – first hit in google and that it!

It allows:

* remote files editing via SSH/FTP..

* terminal on remote server

 

Help->Install New Software

Add Site:

Work with: http://download.eclipse.org/tm/updates/3.2

Select
+ Remote System Explorer End-User Runtime
Select from TM and RSE Uncategorized
+RSE SSH Services

Window->Open Perspective->Remote System Explorer

In ‘Remote System’ Tab – ‘Define a connection to remote system’ (icon a side to tab name)

or from Main menu:

New->Other->Remote System Explorer->Connection

Plugin SITE:

http://www.eclipse.org/tm/tutorial/index.php

customizing Sun One Web Server 6.1 logs

Adding request header to access log

in magnus.conf add/change line

Init fn=flex-init access=”$accesslog” format.access=”%Ses->client.ip% – %Req->vars.auth-user% [%SYSDATE%] \”%Req->reqpb.clf-request%\” %Req->srvhdrs.clf-status% %Req->srvhdrs.content-length% %Req->headers.originatingip% %Req->headers.host%” 

Custom header pattern is

  %Req->headers.<HEADERNAME>%

IMPORTANT

add <HEADERNAME> lowercase letters.

Customer Care Department – connected minds employment

* Employees of CCD minds connected together into one big  CCD (ARtificial?)Inteligence
* On input customers
* On output once CCD mind
* After working hours, no employees, mind is disintegrated
* During hours – mind is integrated

This is example how to iterate over CSV file in python

This simple  example does not use csv module.
IT could be used for example to set DB connections

<code>
import sys

CSVFile=’/var/tmp/your_file.csv’

def processRow(row):
    args=row.split(‘,’)
    (DatabaseName,DatabaseUserName,HostName,DatasourceName,Port,MaxConn)=args[4:10]

    print row
    print ” DBName = ” + DatabaseName +\
„\n DatabaseUserName = ” + DatabaseUserName +\
„\n Hostname = ” + HostName +\
„\n DSName = ” +  DatasourceName +\
„\n Port = ” + Port +\
„\n MaxConn = ” +  MaxConn

    # PUT YOUR CODE HERE
   
    # END OF CODE

# END OF PROCEDURE

print ‘Reading ‘+CSVFile
f=open(CSVFile,’r')
print f
firstrow=f.readline()
row=firstrow

print „First Row is [" + firstrow + "]„

#
# MAIN LOOP
#
while 1:
    row=f.readline()
    if row==”":
        break
    processRow(row)
f.close
</code>

Setting CustomProperty for HTTP channels in Websphere using wsadmin and jython

This is not smart enough yet.

HTTP_4 and HTTP_2  channels are harcoded

Need to be run from Deployment <anager bin folder

================================

PropertyName=’CookiesConfigureNoCache’

PropertyValue=’false’

PropertyDesc=’Requsted by App Team to fix IE6 bug’

serverlist=AdminTask.listServers(‘[-serverType APPLICATION_SERVER ]‘)

for server in serverlist.split():

        services=ac.list(‘TransportChannelService’,server)

        channels=ac.list(‘HTTPInboundChannel’,services)

        for http in channels.split(‘\n’):

                hname=ac.showAttribute(http, ‘name’)

                if  hname==’HTTP_2′ or hname==’HTTP_4′:

                        print http

                        print ‘[[validationExpression ""] [name "'+PropertyName+'"] [description "'+PropertyDesc+'"] [value "'+PropertyValue+'"] [required "false"]]’

                        ac.create(‘Property’,http,’[[validationExpression ""] [name "'+PropertyName+'"] [description "'+PropertyDesc+'"] [value "'+PropertyValue+'"] [required "false"]]’)

ac.save()

============================================

Checking JDBC Oracle Driver Version

/**
 * It requires to ojdbc6.jar be on classpath
 */

public class CheckJDBCVersion {

    /**
     * @param args
     */
    public static void main(String[] args) {
        System.out.println(„JDBCVersion: ” + oracle.jdbc.OracleDriver.getJDBCVersion());
        System.out.println(„JDBCDriverVersion: ” + oracle.jdbc.OracleDriver.getDriverVersion());
    }

}

start in weblogic object definition in Sun One Webserver

If in weblogic object of sun one you have ppath=’*’ definition you can easily access weblogic backend connecting directly sun one instance.

weblogic.Admin class is enough all administration mbeans are exposed to frontend.
What you only need is Weblogic user which allow authentication.

Anyway this is security breach as most of attacks on company infrastructure is being done by unhappy former employees.

SunOne WebServer (iplanet) 61sp9 umask error

If you specify in magnus.conf ‘Umask 027′ directive that error log will be create with no permissions.
So it will be unacessible and next start of instance will fail.

Solution.

Remove Umask directive from magnus.conf and set umask for unix user.

Enabling the Administration Console via wlst (weblogic)

WLST method of enabling Administration Console.

connect("username","password")
edit()
startEdit()
cmo.setConsoleEnabled(true)
save()
activate()
The following attribute(s) have been changed on MBeans which require server re-start.

MBean Changed : com.bea:Name=mydomain,Type=Domain Attributes changed : 
ConsoleEnabled
Activation completed

disconnect()
exit()

« Starsze wpisy

Follow

Otrzymuj każdy nowy wpis na swoją skrzynkę e-mail.