Thursday, August 25, 2011

Finding and deleting old log files

Occassionally you need to clean up some disk space. The quickest and easiest thing to do is often to look for log files that have been rolled by some other process.

For Example:
find . -name *.log.5 -exec /bin/rm '{}' \;
Of course, you need to understand the naming convention of your logs.  Here's a quick example of finding and removing files with a date appended to the original log name.  This command will remove all the log files for the first 9 days of August 2011.

find . -name *.log.2011-08-0* -exec /bin/rm '{}' \;

Thursday, July 21, 2011

Jython Snippet - Max Heap or All appServers on Node XYZ

#get max heap size for all JVMs on a given node. Must connect to dmgr for this to work
serverList = AdminServerManagement.listServers("",myNode)
for server in serverList:
   print serverName + " " + maxHeap

Thursday, June 16, 2011

Complete Idiot's Guide To Jython for Noob Dummies

It's been a long time since I have jython'ed.  Here's a tip...

you can't concatenate an integer and a string.  Make sense, but it's a pain for someone that's used to doing a lot of perl/shell type scripting.

if you try something like this:

print "counter is " +cntr
you're going to get an error similar to:
TypeError: __add__ nor __radd__ defined for these operands

So how do you do this?  It's almost too easy:
print "counter is " +cntr.toString()

Thursday, September 16, 2010

Enabling trace on Datasources in WAS 7

In the Admin Console, you can add 2 Custom Properties to a datasource to enable trace level logging.

Go to your datasource, and click on the "Custom Properties" link to the right of the middle frame and add the following:

traceLevel (value is 7)
traceFile (value is fully qualified file name for the data to be written to)

Once I set these up, I usually cycle the nodeagent on one of our servers, and then do a test connection when it's back. This proves to me the setting is correct and something will be written to the log.  once I know this is ok, I can cycle the appServers I am concerned about for the settings to take hold.

Friday, March 12, 2010

How can I tell if a perl module is installed?

find `perl -e '{print join $/, grep {/[^.]/} @INC}'` -name '*pm' 2>/dev/null |grep -i <>

where <> is the name of the module you are looking for

find `perl -e '{print join $/, grep {/[^.]/} @INC}'` -name '*pm' 2>/dev/null

Tuesday, March 9, 2010

Updating PHP variables without access to PHP.ini

has the following information:

although you will probably not achieve the desired result, due to restrictions that your ISP has set in place, to change the maximum execution time limit of your PHP scripts, add:

php_value max_execution_time 60

This will set the time limit to 60 seconds.

In general, to set values in an .htaccess file, use the following format:


where the string php-value is a literal.

Wednesday, April 22, 2009

IIS Integrated Authentication Gets Wrong User

Here's an interesting scenario we just went through and I thought I would share in case anyone else is searching for a fix to a similar issue... I recently wrote a set of web pages and cgi scripts for deploying OSB10gR3, WLI 9.2.2 and ALDSP3.0.1 assets from a web page. The idea is that developers can install assets to development themselves (without giving full admin access to the consoles) and not have to wait on the Middleware team to do installs for them. Part of the code checks the user that is hitting the page and validates they are authorized to run the install scripts in the environment they are trying to install to... The web pages are running in IIS Version 6.0 and I have Authenticated Integration enabled. The scripts worked great, except for 1 person, who was somehow hitting the page with a different userid than the one they were logged into Windows with... Turns out... We logged into his Windows XP machine and opened "User Accounts" in the Control Panel for his PC. Under the "Advanced" tab, there was an account set up for connecting to the specific server my pages are running on with the account name we saw when he tried hitting my web pages. We removed this entry, and tried hitting the page again (no reboot required) and the page recognized him as the corrct user. Simple fix, but it took a little while for us to find it.

Monday, April 20, 2009

Monday, March 30, 2009

Obtain a list of JPDs?

I'm expanding my search for help with a WLST script that will terminate all the aborted processes in WLI 9.2.2 I have an open case with Oracle, but we haven't come up with my "ideal" solution. What I have right now is a Java program that I can pass a JPD to, and it will terminate all the aborted processes for that JPD. This works ok, but I would like to find a way for the program to find all the JPDs in the environment and then parse through them. Ideally, all of this would be done in WLST, but I can live with Java if it gets the job done. Anyone out there have thoughts on how to do this? Unfortunately, I am a middleware guy and not a Java programmer, so I can't do much with this on my own. The code I have right now is included below:

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import java.util.Date;
import java.text.SimpleDateFormat;
import java.util.*;
import com.bea.wli.bpm.runtime.ProcessStatus;

public class TerminateProcess {

public static void main(String[] args){

    //Parameters to be configured
    //String JPDURI = "/IDXWEB/processes/Process.jpd";
    //String Provider_URL = "t3://localhost:7001";
    //String Security_Principal = "weblogic";
    //String Security_Credentials = "weblogic";

   if (args.length != 5) {
  String adminURL = args[0];
  System.out.println("Admin URL is$$$ "+adminURL);
  String jpdURI = args[1];
  System.out.println("jpdURI is$$$ "+jpdURI);
  String adminUserName = args[2];
  String adminPassword = args[3];
  int exitCount = Integer.parseInt(args[4]);
  boolean blnExitOnCount = false;//Flag to run the terminate process in batch. If true, it will
                                               //only the number of instances in the exitCount parameter.
                                               //If false, it will terminate all the instances of that JPD.

 try {
    String CONTEXT_FACTORY = "weblogic.jndi.WLInitialContextFactory";
    Properties p = new Properties();
    p.put(Context.PROVIDER_URL, adminURL );

    Context ctx = new InitialContext(p);

    MBeanHome home = (MBeanHome)ctx.lookup(MBeanHome.ADMIN_JNDI_NAME);

    Set s = home.getMBeansByType("ProcessRuntime");
    Iterator it = s.iterator();

    while (it.hasNext())
            ProcessRuntimeMBean bean = (ProcessRuntimeMBean);

            //Query for JPD
            ProcessInstanceQuery query = new ProcessInstanceQuery();
   ProcessInstanceQueryResult info = bean.getProcessInstances(query);
            String[] instances = info.getInstanceIds();
            System.out.println("Instance Ids " + instances.toString());
            System.out.println("Instance Count " + instances.length);

            for(int i=0;i= exitCount-1))
    } catch (Exception ex) {



Monday, March 9, 2009

Ctrl-S in vi hangs my edit session

Sometimes I'm a bit stubborn and continue to work around an issue even though I know there must be a better way. Here's a great example: Working in vi, every now and again, I find myself hitting Ctrl-S when I want to save (Ctrl-S is a windows shortcut for Save for those that don't know...) And when you do that vi gets very unhappy. in fact, it seems to stop responding to all commands, and the only way I was ever able to "fix" my mistake was to close my connection to the server, and log back in. Then I would need to delete the .swp file vi creates when you are in an edit session, and then I could go back in and make all those changes over again (because, of course, I couldn't really save it...) I've been doing this sporadically, as needed, for the better part of 3 years. Today I got fed up and a quick google search (less than a minute) turned up a solution. Ctrl-Q will apparently put vi back in its place and accepting cryptic orders from me again.

Thursday, February 26, 2009

Virus shutting off access to outside world

A while back I ran into an issue when one of my PCs was infected with some kind of virus that stopped my access to go out to various virus protection websites, Google, etc. It turns out there is a file in Windows similar the one I am familiar with in UNIX called hosts. Here's a quick tip to help regaina ccess to the outside world if you run into a similar issue... C:\windows\system32\drivers\etc\hosts Make sure the only line in this file is " Localhost" If you've been infected by a spyware/Virus/Trojan/Adware... etc... it may have change this file so when you type in or some other address it could redirect you over a specified ip, instead of looking up the address "normally."

Wednesday, February 25, 2009

My "virtual friend" Unnikrishnan Pillai, who I've worked with when calling Oracle Support in the past recently posted an example WLST script for creating JDBC datasources, which ended with "MultiDataSources coming soon..." (See Unni's Blog Post: ) I tried to add a comment to his blog with my own example WLST script for creating MultiDatasources, but received an error, so I figured I would post it here, and Unni... you can feel free to take this as a starting point and clean it up, or ignore it completely. But, I thought I would share in case there is anyone out there wondering how to do this. Feel free to post comments and/or ask questions if you need help with this script. The script creates a multiu datasource, pointing to 2 instances of an Oracle 10G RAC database...


set('JNDINames',jarray.array([String('DS1')], String))
set('TestTableName','SQL SELECT 1 FROM DUAL')
cd('/JDBCSystemResources/DS1/JDBCResource/DS1/JDBCDriverParams/DS1/Properties/DS1/Properties/user') set('Value','myUser')
set('Targets',jarray.array([ObjectName('com.bea:Name=AdminServer,Type=Server')], ObjectName))

set('JNDINames',jarray.array([String('DS2')], String))
set('TestTableName','SQL SELECT 1 FROM DUAL')
set('Targets',jarray.array([ObjectName('com.bea:Name=AdminServer,Type=Server')], ObjectName))

set('JNDINames',jarray.array([String('MultiDS')], String))
set('Targets',jarray.array([ObjectName('com.bea:Name=AdminServer,Type=Server')], ObjectName))


Thursday, January 29, 2009

java.lang.NoSuchMethodError: getWLSTOptions

Ok, this is an odd one, and my friends at Oracle are working on it, but we have no resolution yet. We have an AquaLogic Service Bus domain that consists of an Admin Server on HostA and a Managed Server on HostB. To start and stop the Admin Server, we use the provided shell scripts (RH Linux 4.0 ES) (, This has all been working fine for months.... Then, all of a sudden, when we try to stop the Admin weblogic server running the script and receive the following output: Stopping Weblogic Server... Problem invoking WLST - java.lang.NoSuchMethodError: getWLSTOptions Done What happened? I'm not sure yet, but if anyone has any thoughts, I'm all EARs ;)

Thursday, January 22, 2009

WLST script without a plain text password

One of the things that has annoyed me about WLST is the seemingly missing method of being able to invoke a WLST script without having a plain text userid and password either in the script or in a properties file. I came across a great post on the Oracle Blogs today by Bola Kothandaraman that describes how you can have a WLST script without having a plan text username and password to your admin Server. It's similar to the file, but there are some nuances of this method that are described pretty well in this post (at least I think they are... see my current script issue below): UPDATE: I originally had posted that I was having issues with this method, but I found my problem, and it was a super dumb mistake on my part which I fixed and tested this morning. The method described above is working like a charm and I'm happy to understand how to use WLST without a plain text username and password now.

Wednesday, January 7, 2009

Deleting All Tables in a MySQL database

I recently came into a scenario where I wanted to delete all the tables in my MySQL 5.x database, but didn't want to have to drop and recreate the database (because I didn't have access to do this and was too impatient to wait for the help...) and I didn't want to have to manually enter in 50+ tables each time I needed to clean up. I finally figured out a decent solution... I grep the output from the mysqldump command, looking for only the lines that begin with the word DROP (i.e. Drop table such-and-such) and pipe those lines back into mysql. The result is something like the following, where you fill in the username, password and database with your own information... mysqldump -u [USERNAME] --password=[PASSWORD] [DATABASE] grep ^DROP mysql -u [USERNAME] --password=[PASSWORD] [DATABASE]

Wednesday, December 24, 2008

Easier WLST syntax

An easy way to simplify WLST script syntax while working in interactive mode is to use the easeSyntax() command after you log in. Using the Example from Satya Ghattu's blog ( ) cd(“/Servers/testServer”) ls() After executing easeSyntax() to navigate around you will use. cd /Servers/testServer ls piece of cake. Thanks for the tidbit, Satya. This will be a great timesaver for me as I am working on developing new WLST scripts. - Brian

Tuesday, December 23, 2008

Checking for Expired SSL certificates: keytool -list -keystore -alias <AliasIfYouKnowIt> -v

Tuesday, December 2, 2008

Creating Perl Modules

I've always been gun shy about creating perl modules for my code because I've never found a great tutorial that breaks it all down. Today it all changes as I cvame across this posting that does a pretty good job at breaking down how it all works. At least in a simple case...

Getting the most recent row for each id

I was working on configTracker today (a pet project to watch server configurations for changes and do alerting, reporting, etc...) and ran into a scenario where I needed to find the most recent row in a table for a given id. The table has a column called aud_ts of type timestamp. and a column call host_id of type integer. After several iterations (my SQL skills are waining after not developing for 5 or so years....) I came up with: select host_id, max(aud_ts) from myTable group by host_id; Then, I can join this table against all the others in the system on host_id and aud_ts and know I'm getting the most recent info for this server.

Tuesday, November 25, 2008

Checking Hobbit Alerts

We use Hobbit to monitor many of our UNIX based systems. You can check your hobbit configuration by executing a command similar to the following:

./bin/bbcmd - -env=etc/hobbitserver.cfg hobbitd_alert - -test

Sunday, October 12, 2008

Searching for all the files containing a string

Recursively search all files from the current directory down, ignoring case: grep -ir search_string .
Recursively search all files from the current directory down, ignoring case, and only get the file listing: grep -irl search_string .

Ramblings of an Admining Newbie

I'm using this blog more or less as a place to put some notes to myself about things as I learn them. I'm working as a Middleware administrator, which I've been doing for a few years in WebSphere land, but now I have moved over to WebLogic land, and am also responsible for the SOA products Oracle (formerly BEA) has to offer... Aqualogic Service Bus (ALSB), WebLogic Integration (WLI), and Aqualogic Data Services Platform (ALDSP). So, this blog will be a hodgepodge of ramblings, helpful notes, and rants. The views expressed on this blog are in NO WAY the view of my employer, who I won't even share here so you don't get the wrong idea.... :)