Sunday, April 29, 2012

Tomcat, WebApplication using a DataSource

copy ojdbc5.jar to $TOMCAT_HOME/lib directory

create your "cmdb" webapp folder under $TOMCAT_HOME/webapps/cmdb

create $TOMCAT_HOME/webapps/cmdb/META-INF/context.xml and put this in it:

<?xml version="1.0" encoding="UTF-8"?>


 <Resource name="jdbc/cmdb" auth="Container"
   type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver"
   username="cmdb" password="cmdb" maxActive="20" maxIdle="10"

in WEB-INF/web.xml put

<web-app xmlns=""
      <description>DB Connection</description>

in WEB-INF\lib put standard.jar and jstl.jar

and your test.jsp is

<%@ taglib uri="" prefix="sql" %>
<%@ taglib uri="" prefix="c" %>

<sql:query var="rs" dataSource="jdbc/cmdb">


<c:forEach var="row" items="${rs.rows}">


If you get errors like

"javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (IO Error: The Network Adapter could not establish the connection)""

and "tnsping" works, it's very possible that you need to ipconfig /renew or something like that...

On another instance of Tomcat, the same WebApp works only if I add

<Context path="/cmdb">
     <ResourceLink name="jdbc/cmdb" type="javax.sql.DataSource" global="jdbc/cmdb"/>

Saturday, April 28, 2012

Sending and receiving emails in WLST / Python

import smtplib
s = smtplib.SMTP('')
#SMTP.sendmail(from_addr, to_addrs, msg[, mail_options, rcpt_options])
s.sendmail('', '', 'ciao come stai?')

s.login('', 'mypw')

Traceback (innermost last):
File "", line 1, in ?
File "/opt/oracle/fmw11_1_1_5/wlserver_10.3/common/wlst/modules/jython-modules.jar/Lib/", line 540, in login
SMTPException: SMTP AUTH extension not supported by server.



WLST to delete JMS messages from queues, based on Selector

from javax.naming import Context, InitialContext
from weblogic.jndi import WLInitialContextFactory
from javax.jms import QueueSession, Queue, Session

msservers=["myhost1:8001", "myhost2:8001", "myhost3:8001", "myhost4:8001"]
jmsservers=["CommonJmsServer1", "CommonJmsServer2", "CommonJmsServer3", "CommonJmsServer4"]

jmsQueueJNDIs=["jms.jndi.dq.AQ", "jms.jndi.dq.BQ"];

for i in range(len(msservers)):
    msserver = msservers[i] 
    jmsserver = jmsservers[i]
    properties = Properties()
    properties[Context.PROVIDER_URL] = "t3://" + msserver
    properties[Context.INITIAL_CONTEXT_FACTORY] =
    print "connecting to " + msserver + "..."
    ctx = InitialContext(properties)
    print "successfully connected to ", msserver
    connectionFactory = ctx.lookup("weblogic/jms/XAConnectionFactory" )
    queueCon = connectionFactory.createQueueConnection();
    queueSession = queueCon.createQueueSession( false, Session.AUTO_ACKNOWLEDGE );
    for jmsqueue in jmsQueueJNDIs:
        theJNDI = jmsserver + "@" + jmsqueue
        queue = ctx.lookup(theJNDI)
        queueReceiver = queueSession.createReceiver(queue) # "ISTEST='true'"
        condition = True
        print "deleting messages from " + theJNDI
        while (condition):
            message = queueReceiver.receiveNoWait()
            if (message != None):
                print 'ack on message'
            condition = (message != None)

See also

Testing Physical Destinations belonging to Distributed Queues

I need to send a JMS message to a specific Queue part of a Distributed Queue.
If I send a message to a Distributed Queue, I have no control on which specific instance of the Queue, on which JMSServer, the message will go.

When you target a Distributed Queue "MyQ" to a cluster, this gets created in the JNDI tree of each Managed Server in the cluster:

The Distributed Queue:
Class: weblogic.jms.common.DistributedDestinationImpl
Binding Name: jms.jndi.dq.MyQ

The actual instance in the JMSServer running in the Managed Server:
Class: weblogic.jms.common.DestinationImpl
Binding Name = CommonJmsServer1@jms.jndi.dq.MyQ

So, you must bind to "CommonJmsServer1@jms.jndi.dq.MyQ" to send to only that JMSServer.

Example of WLST script to send to multiple physical destinations:

from javax.naming import Context, InitialContext
from weblogic.jndi import WLInitialContextFactory
from javax.jms import QueueSession, Queue, Session

msservers=["myhost1:8001", "myhost2:8001", "myhost3:8001", "myhost4:8001"]
jmsservers=["CommonJmsServer1", "CommonJmsServer2", "CommonJmsServer3", "CommonJmsServer4"]

jmsQueueJNDIs=["jms.jndi.dq.AQ", "jms.jndi.dq.BQ"];

for i in range(len(msservers)):
    msserver = msservers[i] 
    jmsserver = jmsservers[i]
    properties = Properties()
    properties[Context.PROVIDER_URL] = "t3://" + msserver
    properties[Context.INITIAL_CONTEXT_FACTORY] =
    print "connecting to " + msserver + "..."
    ctx = InitialContext(properties)
    print "successfully connected to ", msserver
    connectionFactory = ctx.lookup("weblogic/jms/XAConnectionFactory" )
    queueCon = connectionFactory.createQueueConnection();
    queueSession = queueCon.createQueueSession( false, Session.AUTO_ACKNOWLEDGE );
    for jmsqueue in jmsQueueJNDIs:
        theJNDI = jmsserver + "@" + jmsqueue
        queue = ctx.lookup(theJNDI)
        sender = queueSession.createSender( queue );
        msg = queueSession.createTextMessage( "I am a pig" );
        msg.setStringProperty("ISTEST", "true");
        print "sending message to " + theJNDI
        sender.send( msg );

See also:

Setting up HAFileAdapter with Oracle RAC DB

Create these DataSources:

the first is :

dsname=SOADataSource (local, non XA)

<?xml version='1.0' encoding='UTF-8'?>
<jdbc-data-source xmlns="" xmlns:sec="" xmlns:wls="" xmlns:xsi="" xsi:schemaLocation="">
    <test-table-name>SQL SELECT 1  FROM DUAL</test-table-name>

and the second is:

dsname=SOAXADataSource (global (XA))
dsjndi= jdbc/SOADataSource

<?xml version='1.0' encoding='UTF-8'?>
<jdbc-data-source xmlns="" xmlns:sec="" xmlns:wls="" xmlns:xsi="" xsi:schemaLocation="">
    <test-table-name>SQL SELECT 1  FROM DUAL</test-table-name>

now you can move to the eis/HAFileAdapter and configure it like this:

controlDir=/opt/oracle/domains/myydomain/shared/apps/fileadapter/controlDir (this is on a shared drive)


The mutex - allowing the HAFileAdapters to coordinate with each other and avoid picking up the same file - is based on 2 DB tables:

Name Null Type
------------------ -------- --------------

Name Null Type
------------------ -------- --------------

It's all, folks! Don't forget to test!

See also here for first approach

WebLogic TemporaryQueue0 JMS Destination

apparently this queue is for "weblogic internal use only", so do not bother to monitor it...

Xlib: PuTTY X11 proxy: wrong authorisation protocol attempted

I log into myserver as user “myuser”, then “sudo su – soa”; I have X11 forwarding enable on Putty, and XMing running on my laptop.
I run
and I get:

Xlib: connection to "localhost:10.0" refused by server
Xlib: PuTTY X11 proxy: wrong authorisation protocol attempted

googling for the message I find:

I try to
cat /etc/ssh/sshd_config
but I get
cat: /etc/ssh/sshd_config: Permission denied

I go back as myuser and I do
xauth list
myserver/unix:10 MIT-MAGIC-COOKIE-1 8ea792a81074c62518d53789faf9558d

then I “sudo su – soa” again and I do
xauth add myserver/unix:10 MIT-MAGIC-COOKIE-1 8ea792a81074c62518d53789faf9558d
xauth: creating new authority file /home/soa/.Xauthority

I run again

and it works! Thank you Jason!!!

Useful links:

For info on .Xauthority

Sample EntityManager usage in Java and Python WLST

In Eclipse, create a JDBC Connection
show view Data Source Explorer
new Connection Profile (enter parameters for your schema)

New JPA project
JPA Tools, Generate Entities from Tables

you should have a persistence.xml which contains

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="" xmlns:xsi="" xsi:schemaLocation="">
 <persistence-unit name="ToplinkTest" transaction-type="RESOURCE_LOCAL">
   <property name="javax.persistence.jdbc.url" value="jdbc:oracle:thin:@localhost:1521:xe"/>
   <property name="javax.persistence.jdbc.user" value="DEV_SOAINFRA"/>
   <property name="javax.persistence.jdbc.password" value="DEV_SOAINFRA"/>
   <property name="javax.persistence.jdbc.driver" value="oracle.jdbc.OracleDriver"/>

You can now code the client:

package com.osb.reporting.client;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.Query;

import com.osb.reporting.WliQsReportAttribute;

public class ReportingClient {
 public static void main(String[] args) throws ClassNotFoundException {
  EntityManagerFactory emf = Persistence.createEntityManagerFactory("ToplinkTest");
  EntityManager em = emf.createEntityManager();
  WliQsReportAttribute result = em.find(WliQsReportAttribute.class, "uuid:0e6fb58fc7c49289:5378b92d:134416bc5f5:-7fbe");
  Query fa = em.createQuery("select a from WliQsReportAttribute a");
  List res = fa.getResultList();
  for (Object el : res) {
   System.out.println( ((WliQsReportAttribute)el).getMsgLabels());

you will need to add the JDBC driver to the classpath, like

In WLST, just add to the classpath the location from which you can access classes and META-INF (where persistence.xml is located).... like the build\classes directory.

package com.osb.reporting.client;

from javax.persistence import *
emf = Persistence.createEntityManagerFactory("CMBDModeling")
em = emf.createEntityManager()
q = em.createQuery("select envs from Nesoa2Env envs")
res = q.getResultList()
for i in res:
   print i.envname

so the message is: you can easily use JPA in WLST and get rid of all that horrible pain of reading property files, by accessing directly a DB

Friday, April 27, 2012

Bill of rights of technical human resources


A meeting must have objectives. All relevant information should be circulated in advance to all participants of the meeting.
In every meeting there should be a minute taker, minutes should be circulated after the meeting. The meeting is not over
until all attendees have expressed their opinions, and all the objectives have been reached. Otherwise, pending points should be rescheduled for another meeting.

A meeting should not be called to read an email to all attendees. Email should be sent in advance, then eventually ask people what they think.

All management stuff should be discussed in management meeting ,to which technical resources do not need to attend.

Meetings are meant for people to exchange information and reach agreement,
they should not be the monopoly of a single people who takes all the bandwidth and prevents communication amongst other attendees.
As a rule of thumb, in a meeting with 10 people, no more than 30% of the time should be allocated to a single attendee.
If a single person talks for more than 3 minutes in a row in a meeting, this is a communication antipattern.

Long lasting verbal communication should be avoided, and if really needed backed up by schemas, writing etc. Not all people have the same receptivity
to verbal communication, and visual communication is to be preferred over pure verbal conceptualization.

These emails should be concise, and with precise topics. Complex stuff should not be treated in emails, they have invented voice conversations for that.


It’s the management responsibility to identify tasks – which should be as much as possible atomic –prioritize them, and assign them to the technical resources.
Technical people can help in this process, but “task management” is strictly the management responsibility.
It’s the duty of the technical resource to provide regular (once a day, your mileage might vary) progress report to management.
Management has always the right to review priorities and reassign tasks, but bearing in mind that in general this should be avoided.
Excessive task switching is a known factor of burnout and poor work quality.

WLST to send a JMS message

Here the Java version.

from javax.naming import Context, InitialContext
from weblogic.jndi import WLInitialContextFactory
from javax.jms import QueueSession, Queue, Session

properties = Properties()
properties[Context.PROVIDER_URL] = "t3://localhost:7001"
properties[Context.INITIAL_CONTEXT_FACTORY] =
ctx = InitialContext(properties)

connectionFactory = ctx.lookup("weblogic/jms/XAConnectionFactory" )
queueCon = connectionFactory.createQueueConnection();
queueSession = queueCon.createQueueSession( false, Session.AUTO_ACKNOWLEDGE );
queue = ctx.lookup( "jms/testme")
sender = queueSession.createSender( queue );

msg = queueSession.createTextMessage( "I am a pig" );

sender.send( msg );

If you want to resubmit to a JMS queue all the files in a folder, use this:

from javax.naming import Context, InitialContext
from weblogic.jndi import WLInitialContextFactory
from javax.jms import QueueSession, Queue, Session
import os


properties = Properties()
properties[Context.PROVIDER_URL] = PROVIDER_URL
properties[Context.INITIAL_CONTEXT_FACTORY] =
properties[Context.SECURITY_PRINCIPAL] = "weblogic"
properties[Context.SECURITY_CREDENTIALS] = "mypassword"
ctx = InitialContext(properties)

connectionFactory = ctx.lookup(cfjndi)
queueCon = connectionFactory.createQueueConnection();
queueSession = queueCon.createQueueSession( false, Session.AUTO_ACKNOWLEDGE );
queue = ctx.lookup(queuejndi)
sender = queueSession.createSender( queue );

for file in os.listdir(filespath):
    current_file = os.path.join(filespath, file)
    data = open(current_file, "rb")
    msg = queueSession.createTextMessage(;
    print "processing ", current_file
    sender.send( msg );
    print "done processing ", current_file

Error untargetting and targetting again a JMSServer

We had an interesting case where WebLogic was keeping in JNDI tree a reference to a JMS Connection Factory (CF) even after untargetting the JMSServer on which the CF was deployed.
When I retarget the CF, I get this error:

An error occurred during activation of changes, please see the log for details.
Message icon - Error Error preparing connection factory GM_CommonOsbJMSModule!CommonOsbCF
Message icon - Error The proposed JNDI name "" for connection factory "GM_CommonOsbJMSModule!CommonOsbCF" is already bound by another object of type "weblogic.jms.frontend.FEConnectionFactoryImpl_1035_WLStub"

The only solution was a server restart.

Minimalistic file load generator and HAFileAdapter tester

I need to copy over and over the same file (with different file names) to a shared SAMBA folder, to test HAFileAdater in a cluster.

Minimalistic approach, a shell script:

for i in {1..10}
    cp myfile.xml target/myfile${i}.xml

but when it comes to sleeping, sleep in shell takes only a parameter in SECONDS (no milliseconds). Pathetic.

Why some people use Shell script to do anything more than really basic stuff, I will never understand. Probably they started their career 20 years ago with Shell scripting and they never weaned off.

So I do the same in Python:
import shutil
import time
i = 1
while i < 100:
    shutil.copyfile('myfile.xml', 'target/myfile' + str(i) + '.xml'
    i = i + 1
Here is a JCA file poller.... just change FileAdapter into HAFileAdapter in the JCA file, and the source folder, and add a Report action to trace the file name ($inbound/ctx:transport/ctx:request/tp:headers/jca:jca.file.FileName ) here is $inbound :

        New Text Document.txt


wls:/offline> from dbexts import dbexts
wls:/offline> d = dbexts()
Traceback (innermost last):
File "", line 1, in ?
File "C:\bea1035\WLSERV~1.3\common\wlst\modules\jython-modules.jar\Lib/", line 188, in __init__
File "C:\bea1035\WLSERV~1.3\common\wlst\modules\jython-modules.jar\Lib/javaos$py.class", line 256, in __getitem__
File "C:\bea1035\WLSERV~1.3\common\wlst\modules\jython-modules.jar\Lib/UserDict$py.class", line 14, in __getitem__
File "C:\bea1035\WLSERV~1.3\common\wlst\modules\jython-modules.jar\Lib/javaos$py.class", line 256, in __getitem__
File "C:\bea1035\WLSERV~1.3\common\wlst\modules\jython-modules.jar\Lib/UserDict$py.class", line 14, in __getitem__
KeyError: HOME

we need a dbexts.ini
Here it says:
"dbexts will default to looking for a file named 'dbexts.ini' in the same directory as but can optionally be passed a filename to the cfg attribute."

I find out many "", one looking promising is:

I try putting a dbexts.ini in

my dbexts.ini is:



and still get the same "KeyError: HOME" error.

Looking in the code I find:

fn = os.path.join(os.path.split(__file__)[0], "dbexts.ini")
if not os.path.exists(fn):
fn = os.path.join(os.environ['HOME'], ".dbexts")

So I need to declare a HOME System property:
set HOME=C:\bea1035\wlserver_10.3\common\wlst\modules\jython-modules\Lib\

This time around I get:

File "", line 1, in ?
File "C:\bea1035\WLSERV~1.3\common\wlst\modules\jython-modules.jar\Lib/", line 189, in __init__
File "C:\bea1035\WLSERV~1.3\common\wlst\modules\jython-modules.jar\Lib/", line 661, in __init__
File "C:\bea1035\WLSERV~1.3\common\wlst\modules\jython-modules.jar\Lib/", line 664, in parse
IOError: No such file or directory: C:\bea1035\wlserver_10.3\common\wlst\modules\jython-modules\Lib\.dbexts

then I realize the file should be called ".dbexts" rather than dbexts.ini

and this time around IT WORKS!

The mystery is how to pass the dbexts.ini file location in the cfg parameter... really confusing and poorly documented...

Thursday, April 26, 2012

WLST and Oracle DB, zxJDBC, Jython...

the zxJDBC doc:
and also here

it seems that WLS 10.3.5 incorporates this library (enter zxJDBC in Everything Search)

java weblogic.WLST

from com.ziclix.python.sql import zxJDBC
params = {}
params['serverName'] = 'localhost'
params['databaseName'] = 'xe'
params['user'] = 'DEV_SOAINFRA'
params['password'] = 'DEV_SOAINFRA'
params['port'] = 1521
db = apply(zxJDBC.connectx, ("oracle.jdbc.xa.client.OracleXADataSource",), params)

this fails with "Error: no such method [setPort] using arg type [class java.lang.Integer], value [1521]"

then I try

jdbc_url = "jdbc:oracle:thin:@pierrepc:1521:XE"
username = "DEV_SOAINFRA"
password = "DEV_SOAINFRA"
driver = "oracle.jdbc.xa.client.OracleXADataSource"

conn = zxJDBC.connect(jdbc_url, username, password, driver)

cursor = conn.cursor(1)
cursor.execute("select count(*) from WLI_QS_REPORT_ATTRIBUTE")
print cursor.rowcount
print cursor.rowcount

it seems to work!

cursor.execute("select MSG_LABELS from WLI_QS_REPORT_ATTRIBUTE")
for a in cursor.description:
print a

('MSG_LABELS', 12, 2048, None, None, None, 1)

try also

print cursor.fetchall()
print cursor.fetchmany()

cursor.execute("select MSG_GUID from WLI_QS_REPORT_ATTRIBUTE order by MSG_GUID")
res = cursor.fetchall()
print res

for a in res:
   print a

for a in res:
   print a[0]

To access a specific column without guessing its position:

cursor.execute("select * from SOMETABLE where ID = '29'")

columnNames = []
for item in cursor.description:
for a in cursor.fetchall():
 ID = a[columnNames.index('ID')]
 DSNAME = a[columnNames.index('DSNAME')]
 print 'ID=' + ID
 print 'DSNAME=' + DSNAME

where ID and DSNAME are column names

Wednesday, April 25, 2012

Hyperic, exploring (and exporting) autodiscovered resources with HQApi

List details of a platform (machine)

cd C:\pierre\workspace\Hyperic\lib\hqapi1-client-5.0.0\bin
hqapi resource list -platform

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <Resource id="11328" name="" description="Red Hat Enterprise Linux 5"
location="" instanceId="10003" typeId="1">
        <ResourcePrototype resourceTypeId="1" instanceId="10001" id="10001" name="Linux"/>
        <Agent id="10003" address="" port="2144" version="4.6.5" unidirectional="false"/>

        <Ip address="" mac="34:8E:99:27:FD:80" netmask=""/>
        <Ip address="" mac="00:00:00:00:00:00" netmask=""/>
        <ResourceInfo key="fqdn" value=""/>

List all details of a all Linux platforms (machine)

hqapi resource list -prototype Linux

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <Resource id="10882" name="" description="Red Hat Enterprise Linux 5"
location="" instanceId="10001" typeId="1">
        <ResourcePrototype resourceTypeId="1" instanceId="10001" id="10001" name="Linux"/>
        <Agent id="10001" address="" port="2144" version="4.5.3" unidirectional="false"/>

        <Ip address="" mac="99:8E:99:27:FD:98" netmask=""/>
        <Ip address="" mac="99:8E:99:27:FD:98" netmask=""/>
        <Ip address="" mac="00:00:00:00:00:00" netmask=""/>
        <ResourceInfo key="fqdn" value=""/>

    <Resource id="10883" name="" description="Red Hat Enterprise Linux 5"
location="" instanceId="10002" typeId="1">
        <ResourcePrototype resourceTypeId="1" instanceId="10001" id="10001" name="Linux"/>
        <Agent id="10001" address="" port="2144" version="4.5.3" unidirectional="false"/>

        <Ip address="" mac="99:8E:99:27:FD:98" netmask=""/>
        <Ip address="" mac="99:8E:99:27:FD:98" netmask=""/>
        <Ip address="" mac="00:00:00:00:00:00" netmask=""/>
        <ResourceInfo key="fqdn" value=""/>

Something really fantastic is when you do:

hqapi resource list -prototype Linux --children > myresources.xml

this will dump the ENTIRE database of resources!

And the real great thing is that you can
resource sync --file myresources.xml

to import into a HQ Server the resources exported by "resource list"

Platform MBean Server Used

In the logs I find:

The JMX MBean PlatformMBeanServerUsed attribute is true, but the Platform MBeanServer was created without the hooks for the WLS security infrastructure. The Platform MBeanServer will NOT be used and Platform MBeans will NOT be available via the WLS Runtime or Domain Runtime MBeanServers. This can occur if you have defined Platform MBeanServer system properties or JVM options ( or JRockit -XManagement).
To allow the Platform MBeanServer to be used, you must either remove the system properties/JVM options or start WLS with the following system property:
If you want to eliminate this log error and do not need Platform MBeans to be available via WLS, then set the PlatformMBeanUsed attribute in the JMXMBean to false.

In the WL Console, Domain, Configuration, General, we have:

Platform MBean Server Enabled

Specifies whether each server instance initializes the JDK's platform MBean server. Enabling it, along with isPlatformMBeanServerUsed, causes WebLogic Server to use the platform MBean server as its Runtime MBean Server

and also
Platform MBean Server Used

Specifies whether WebLogic Server will use the platform MBean server for its Runtime MBean Server. Previously, WebLogic Server used the platform MBean server by default if it was enabled. This attribute provides a separation between enabling the platform MBean server and using it for WebLogic Server MBeans

So.... in order to USE actually the Platform MBean Server, you not only must set to true both flags (Enabled and Used), but also pass the property.... hard work!

More doc here:

"If it is essential that JMX clients be able to monitor your custom MBeans, WebLogic Server MBeans, and the JVM’s platform MBeans through a single MBean server, you can configure the runtime MBean server to be the JVM platform MBean server"

Tuesday, April 24, 2012

How choosing the wrong RAR adapter can screw you big time

In a rush to redeploy a malfunctioning DbAdapter.rar, a colleague has incorrectly chosen the one in the "was" directory


To avoid this problem in future, I just want to remove the was folder from any WebLogic installation. Honestly naming two completely different adapters with the same name is only a call for trouble.

Public Key Authentication With PuTTY

I run PuTTYgen

provide passphrase
generate key

save public key ssh-rsa in a file ssh-rsa.txt
save private key to myuserpprd.ppk

I log to remote server as myuser

mkdir .ssh
cd .ssh
vi authorized_keys


run putty
edit the "Private key file for authentication" to provide myuserpprd.ppk

the first login I get

"Authenticating with public key "rsa-key-20120424"
Passphrase for key "rsa-key-20120424":"

Monday, April 23, 2012

WLST list all JDBC resources (datasources) in WebLogic

allJDBCResources = cmo.getJDBCSystemResources()
for jdbcResource in allJDBCResources:
   dsname = jdbcResource.getName()
   print dsname, jdbcResource.getJDBCResource().getJDBCDataSourceParams().getJNDINames()[0], jdbcResource.getJDBCResource().getJDBCDriverParams().getUrl() 

DbAdapter.rar: weblogic.application.ModuleException: weblogic.connector.exception.RAException: Jndi Name is null or empty.

I have tried everything:
- deleted the deployment and redeployed again
- restarted the Managed Server
- visually checked the plan.xml

I am persuaded that the problem stems from Connection Factories referring to non -existing Datasources... and that the error message should actually be "unable to locate object bla in JNDI tree"..... and surely the error message is really poorly fomulated and gives you no clue of what went wrong.

WebLogic HTTP access.log not being written

(aka How To Change the Buffer Size for the WebLogic Server Http Access Log [ID 1113583.1] )

HTTP access logs are buffered for performance reasons.
By default logs are buffered until reaching 8kb when they are flushed to the file.
You can configure this buffer - if set to zero then logs will be written immediately.

The HTTPAccessLog could sometimes not be viewed from the console.
The LogFileMBean now includes a buffer-size-kb parameter. This parameter has a default value of 8 KB; when set to zero or less, it will not buffer the log messages.
For example, to set the buffer size for access.log in config.xml:

<web-server-log> See also LogFileFlushSecs, which is deprecated and no longer available: so your only chance it to change the BufferSize

cd /Servers/osbdv2ms1/WebServer/osbdv2ms1/WebServerLog/osbdv2ms1

Sunday, April 22, 2012

Hyperic HQApi and the Groovy Console

HQApi documentation here

"HQApi allows you to circumvent the Hyperic user interface and directly access Hyperic Server functionality. " ... great, I love it!

Let's get our hands dirty....

On HQ Console, Click on Administration, Groovy Console...

print 'ciao'
return 'pippo'

and click "execute"... great, in the "result" tab I see "pippo".... where is "ciao" though? I can't find the stdout of "Server for Hyperic HQ" Windows service.

Scripts are stored in a temporary file C:\pierre\hypericserver\server-4.6.5-EE\hq-engine\hq-server\temp\gcon3792879954783360219.tmp

I click on "HQ Web Services Api" and download the hqapi1-client-5.0.0.tar.gz

The most common useful classes to run the examples in Hyperic site are in

<classpathentry kind="lib" path="C:/pierre/workspace/Hyperic/lib/hqapi1-client-5.0.0/hqapi1-5.0.0.jar"/>
<classpathentry kind="lib" path="C:/pierre/workspace/Hyperic/lib/hqapi1-client-5.0.0/hqapi1-tools-5.0.0.jar"/>
<classpathentry kind="lib" path="C:/pierre/hypericserver/server-4.6.5-EE/hq-engine/hq-server/webapps/ROOT/WEB-INF/lib/hq-rendit-4.6.5.jar"/>
<classpathentry kind="lib" path="C:/pierre/hypericserver/server-4.6.5-EE/hq-engine/hq-server/webapps/ROOT/WEB-INF/lib/hq-server-4.6.5.jar"/>
<classpathentry kind="lib" path="C:/pierre/hypericserver/server-4.6.5-EE/hq-engine/hq-server/webapps/ROOT/WEB-INF/lib/httpclient-4.1.1.jar"/>
<classpathentry kind="lib" path="C:/pierre/hypericserver/server-4.6.5-EE/hq-engine/hq-server/webapps/ROOT/WEB-INF/lib/httpcore-4.1.jar"/>
<classpathentry kind="lib" path="C:/pierre/hypericagent/agent-4.6.5-EE/bundles/agent-4.6.5/pdk/lib/httpmime-4.1.1.jar"/>
<classpathentry kind="lib" path="C:/pierre/hypericserver/server-4.6.5-EE/hq-engine/hq-server/webapps/ROOT/WEB-INF/lib/activemq-all-5.3.0.jar"/>
<classpathentry kind="lib" path="C:/pierre/workspace/Hyperic/lib/hqapi1-client-4.3.0/lib/spring-core-3.0.1.RELEASE.jar"/>
<classpathentry kind="lib" path="C:/pierre/hypericserver/server-4.6.5-EE/lib/commons-codec-1.1.jar"/>

Some Groovy Console samples are here:

First steps with HQApi command line interface

here instructions on how to create the file.

I do this (my user is pvernet):
cd C:\Users\pvernet\
mkdir ".hq"

I create a file containing this:


and when I do
cd C:\pierre\workspace\Hyperic\lib\hqapi1-client-5.0.0\bin
hqapi agent list

I get a fantastic

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Agent id="10003" address="" port="2144" version="4.6.5" unidirectional="false"/>

Awesome! This is like the HQApi Hello World!

ImportError: no module named hyperic

I have added all the good classes to CLASSPATH (using full paths),
I run weblogic.WLST and I do

import org.hyperic.hq.hqapi1.HQApi

this gives me ImportError: no module named hyperic

Here it reminds you that there is a

C:\Oracle\Middleware\wlserver_10.3\common\wlst directory

but this is a place only for Python modules...

Well the reality is that, if you set the classpath right (make sure you use full path names), you should not need to make any extra step to use a Java class...

WebLogic CMDB

Definition of a CMDB here

I am starting to model a WebLogic environments management DB here.

It will be a long exercise, but the fountation of a sound management tool for WebLogic administration.

SVG file available here for ER model.

Thursday, April 19, 2012

Deployment descriptors of a OSB MDB

Inside the /opt/oracle/domains/osbdv2do/sbgen/_ALSB_1329599716508.ear you will find:


<?xml version='1.0' encoding='UTF-8'?>
<jav:application xmlns:jav="">
  <jav:display-name>ProxyService GM_ReqPackMat/ProxyServices/ReqPackMat_ReqPackMatQ_to_WMOS_PS</jav:display-name>


<?xml version='1.0' encoding='UTF-8'?>
<web:weblogic-application xmlns:web="">

The plan.xml in /opt/oracle/domains/osbdv2do/osb/config/plan/Plan-_ALSB_1335183510889.ear.xml is:

<?xml version='1.0' encoding='UTF-8'?>
<deployment-plan xmlns="" xmlns:xsi="" xsi:schemaLocation="">
    <module-descriptor external="false">
    <module-descriptor external="false">
    <module-descriptor external="true">
    <module-descriptor external="false">
    <module-descriptor external="false">

And in the ejb.jar you can find:


<?xml version='1.0' encoding='UTF-8'?>
<jav:ejb-jar xmlns:jav="">
  <jav:display-name>BEA ALSB JMS Inbound Endpoint</jav:display-name>
      <jav:display-name>BEA ALSB JMS Inbound Endpoint (Request)</jav:display-name>



Hyperic will discover this MDB as "Weblogic 10.3 Message Driven EJB"

Weblogic osbdv1do osbdv1ms1 _ALSB_1335183510889 RequestEJB-6533237974024524838-be3fafc.135ee630c77.-7f0a_GM_ReqPackMatJMSModule!AcmeCommonJmsServer1@ReqPackMatQ Message Driven EJB

but also as a "Weblogic 10.3 Application"
Weblogic osbdv2do osbdv2ms1 _ALSB_1335183510889 Application

WLST browsing deployed Applications : OSB EJBs

connect('weblogic', 'weblogic1', 't3://')
cd AppDeployments

dr-- ALDSP Transport Provider
dr-- ALSB Cluster Singleton Marker Application
dr-- ALSB Coherence Cache Provider
dr-- ALSB Domain Singleton Marker Application
dr-- ALSB Framework Starter Application
dr-- ALSB Logging
dr-- ALSB Publish
dr-- ALSB Resource
dr-- ALSB Routing
dr-- ALSB Subscription Listener
dr-- ALSB Test Framework
dr-- ALSB Transform
dr-- ALSB UDDI Manager
dr-- AqAdapter
dr-- BPEL 10g Transport Provider
dr-- DMS Application#
dr-- DatalinksPocs-Project1-context-root
dr-- DbAdapter
dr-- EJB Transport Provider
dr-- Email Transport Provider
dr-- FLOW Transport Provider
dr-- FMW Welcome Page Application#
dr-- File Transport Provider
dr-- FileAdapter
dr-- Ftp Transport Provider
dr-- FtpAdapter
dr-- JCA Transport Provider
dr-- JEJB Transport Provider
dr-- JMS Reporting Provider
dr-- JmsAdapter
dr-- MQ Transport Provider
dr-- MQSeriesAdapter
dr-- Message Reporting Purger
dr-- OracleAppsAdapter
dr-- OracleBamAdapter
dr-- SB Transport Provider
dr-- SFTP Transport Provider
dr-- SOA-DIRECT Transport Provider
dr-- ServiceBus_Console
dr-- SocketAdapter
dr-- Tuxedo Transport Provider
dr-- WS Transport Async Applcation
dr-- WS Transport Provider
dr-- XBus Kernel
dr-- _ALSB_1329599716508
dr-- _ALSB_1329599717744
dr-- _ALSB_1329599717858
dr-- _ALSB_1329599717944
dr-- _ALSB_1329754384502
dr-- _ALSB_1329824947023
dr-- _ALSB_1329888150254
dr-- _ALSB_1330332828977
dr-- _ALSB_1330332829084
dr-- _ALSB_1330333576280
dr-- _ALSB_1330333576386
dr-- _ALSB_1330463663134
dr-- _ALSB_1331647120095
dr-- _ALSB_1331708084330
dr-- _ALSB_1332091161130
dr-- _ALSB_1333024471355
dr-- _ALSB_1333969392746
dr-- _ALSB_1334249766371
dr-- _ALSB_1334333217358
dr-- _ALSB_1334608617083
dr-- _ALSB_1334670601508
dr-- wsil-wls

cd _ALSB_1329599716508

dr-- SubDeployments
dr-- Targets

-r-- AbsoluteInstallDir null
-r-- AbsolutePlanDir /opt/oracle/domains/osbdv2do/osb/config/plan
-r-- AbsolutePlanPath /opt/oracle/domains/osbdv2do/osb/config/plan/Pla
-r-- AbsoluteSourcePath /opt/oracle/domains/osbdv2do/sbgen/_ALSB_1329599
-r-- ApplicationIdentifier _ALSB_1329599716508
-r-- ApplicationName _ALSB_1329599716508
-r-- CompatibilityName null
-r-- DeploymentOrder 100
-r-- DeploymentPlan [B@185b08b
-r-- DeploymentPlanExternalDescriptors null
-r-- DeploymentPrincipalName null
-r-- InstallDir null
-r-- ModuleType ear
-r-- Name _ALSB_1329599716508
-r-- Notes null
-r-- PlanDir osb/config/plan
-r-- PlanPath Plan-_ALSB_1329599716508.ear.xml
-r-- SecurityDDModel DDOnly
-r-- SourcePath sbgen/_ALSB_1329599716508.ear
-r-- StagingMode stage
-r-- Type AppDeployment
-r-- ValidateDDSecurityData false
-r-- VersionIdentifier null

-r-x freezeCurrentValue Void : String(attributeName)
-r-x isSet Boolean : String(propertyName)
-r-x unSet Void : String(propertyName)

see also

Hyperic, installing Server on a Linux machine

requires root access if you want to use the internal PostGREs Database:

this script:

must be run as root.

If you are not root, you can try to fool him by doing

touch /tmp/_hq-was-tuned

and hope your system will be fool enough to believe you... do at your own risk!!!

cd /opt/hyperic/server/server-4.6.5-EE/bin/
./ start
cd ../logs/
less bootstrap.log

I find this :o( :

2012-04-22 11:50:20,511 ERROR [main] [] Task "dbupgrade" finished with error.
/opt/hyperic/server/server-4.6.5-EE/data/db-upgrade.xml:43: DBUpgrader: sql error: org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

In fact I do

cd /opt/hyperic/installer/bin

and I find

./ line 7: cd: hqdb: No such file or directory
./ line 16: /opt/hyperic/installer/bin/pg_ctl: No such file or directory


Otherwise you must configure the Server to use an external db, such as Oracle

Wednesday, April 18, 2012

Hyperic, how to change HQ Server IP for an Agent

I have been torturing myself for ages about this simple question...

just run setup

but at the end of the process I get

"Error updating agent: Unable to invoke 'updateAgent': Permission denied"

When I do this, it works:

Would you like to re-setup the auth tokens [default=no]: yes

Would you like to re-setup the auth tokens [default=no]: yes
- Received temporary auth token from agent
- Registering agent with HQ
- HQ gave us the following agent token
- Informing agent of new HQ server
- Validating
- Successfully setup agent

Tuesday, April 17, 2012

wrapper | The Hyperic HQ Agent service is not installed

First of all, Run As Administrator.

hq-agent.bat install
wrapper | Hyperic HQ Agent service installed.

hq-agent.bat start

wrapper | Starting the Hyperic HQ Agent service...
wrapper | Waiting to start...
wrapper | Hyperic HQ Agent started.
- No token file found, waiting for Agent to initialize
[ Running agent setup ]
Should Agent communications to HQ be unidirectional [default=no]:

What is the HQ server IP address:
Should Agent communications to HQ always be secure [default=yes]:
What is the HQ server SSL port [default=7443]:
- Testing secure connection ... Success
What is your HQ login [default=hqadmin]:
What is your HQ password:

What IP should HQ use to contact the agent [default=]:
What port should HQ use to contact the agent [default=2144]:
- Received temporary auth token from agent
- Registering agent with HQ
The server to agent communication channel is using a self-signed certificate and could not be verifi
Are you sure you want to continue connecting? [default=no]: yes
- HQ gave us the following agent token
- Informing agent of new HQ server
- Validating
- Successfully setup agent

It works like a breeze, and the HQ server immediately discovers:

Microsoft Windows 2008
Weblogic Admin 1...main AdminServer
PostgreSQL 8.2
Tomcat 6.0
Oracle 10g
Agent 4.6.5

China rising steady and fast in the Software Industry

I have noticed a steady trend in the last few months: on the blog I am getting more and more hits from China

Of course, they do everything, why not Software?

So, I am quietly waiting for the day a good WebLogic administrator from China will bill remotely 100 USD a day, and get ready to go fishing.... actually no, I am vegetarian... to go picking berries in the woods.

Extended Logging Format Fields (ELFF) in WebLogic

By default WebLogic logs this fields in the access.log:
date time cs-method cs-uri sc-status

Here is the MBean WebServerLogMBean.ELFFields

and here the entire documentation on the supported field identifiers.


The IP address of the client.


The IP address of the server.

Don't forget that in case of need you can define a Java class to provide extra ELF fields.

Sunday, April 15, 2012

Eclipse not responding

Having spent most of my current project watching an hourglass hovering on Eclipse,
I have at last decided to do something about that.

Eclipse executable is in: C:\Oracle\Middleware\oepe_11gR1PS4\eclipse.exe


In the same directory, the eclipse.ini contains:


I run Task Manager, and View Columns PID, so that I know the PID of this JVM

I install VisualVM to connect to the Eclipse JVM (anyway the Eclipse process is properly named in VisualVM, no need to use Task Manager to view the PID)

I click on the Threads tab and I am ready to monitor the next "Not Responding" event...I also click on "Sampler", it hangs for a while to determine if Eclipse supports CPU and Memory profiling.... it does!

So I monitor the CPU while Eclipse seems to be hanging, and I notice that the is eating my CPU alive...

Oh, but why JRockit? Because it's the vm option in eclipse.ini.

What if I switch to Sun JVM?
I try with C:/Oracle/Middleware/jdk160_24/bin/javaw.exe

It seems to be more responsive now...

Will keep an eye on it.... next time I will do a
netstat -ano
(see here)
to find out on Windows which sockets are open by a PID

I have tried using:
Window/Preferences/Java/Editor/Content Assist/ Uncheck Auto Activation

Saturday, April 14, 2012

JMS Server bases on a JDBCStore on RAC

First create a GridLink DataSource, but BEWARE, it should not be based on a XA driver, nor have LLR or Emulate 2PC:

You cannot specify a JDBC data source that is configured to support global (XA) transactions. Therefore, the specified JDBC data source must use a non-XA JDBC driver. In addition, you cannot enable Logging Last Resource or Emulate Two-Phase Commit in the data source. This limitation does not remove the XA capabilities of layered subsystems that use JDBC stores. For example, WebLogic JMS is fully XA-capable regardless of whether it uses a file store or any JDBC store.

This is all the WLST needed:

To run the tests:
#Variable declaration


#Connect with WLST to Admin

cd /opt/oracle/domains/osbdv2do
. ./bin/
java weblogic.WLST
connect(username, password, serverurl)
#create DataSource (non-RAC, no XA, no LLR)



cd('/JDBCSystemResources/' + datasource + '/JDBCResource/' + datasource)
cd('/JDBCSystemResources/' + datasource + '/JDBCResource/' + datasource + '/JDBCDataSourceParams/' + datasource)
set('JNDINames',jarray.array([String(datasource_jndi)], String))
cd('/JDBCSystemResources/' + datasource + '/JDBCResource/' + datasource + '/JDBCDriverParams/' + datasource)

cd('/JDBCSystemResources/' + datasource + '/JDBCResource/' + datasource + '/JDBCConnectionPoolParams/' + datasource)
cmo.setTestTableName('SQL SELECT 1 FROM DUAL')
cd('/JDBCSystemResources/' + datasource + '/JDBCResource/' + datasource + '/JDBCDriverParams/' + datasource + '/Properties/' + datasource + '')

cd('/JDBCSystemResources/' + datasource + '/JDBCResource/' + datasource + '/JDBCDriverParams/' + datasource + '/Properties/' + datasource + '/Properties/user')
cd('/JDBCSystemResources/' + datasource + '/JDBCResource/' + datasource + '/JDBCDataSourceParams/' + datasource)
cd('/SystemResources/' + datasource)
set('Targets',jarray.array([ObjectName('com.bea:Name=' + clustername + ',Type=Cluster')], ObjectName))

#create File Store

filestore_target='osbdv2ms1 (migratable)'


cd('/FileStores/' + filestore_name)
set('Targets',jarray.array([ObjectName('com.bea:Name=' + filestore_target + ',Type=MigratableTarget')], ObjectName))

#create JDBC Store

jdbcstore_target='osbdv2ms1 (migratable)'


cd('/JDBCStores/'+ jdbcstore_name)
cmo.setDataSource(getMBean('/SystemResources/' + jdbcstore_datasource))
set('Targets',jarray.array([ObjectName('com.bea:Name=' + jdbcstore_target + ',Type=MigratableTarget')], ObjectName))

#create JMS Server

set('Targets',jarray.array([ObjectName('com.bea:Name=osbdv2ms1,Type=Server')], ObjectName))
#create JMS Module

set('Targets',jarray.array([ObjectName('com.bea:Name=osbdv2cl,Type=Cluster')], ObjectName))
#create JMS SubDeployment


set('Targets',jarray.array([ObjectName('com.bea:Name=ACMECommonJmsServer1,Type=JMSServer')], ObjectName))
#create JMS Distributed Queue

#assign SubDeployment



WebLogic and NFS, the odd couple...

It's a sort of metropolitan legend that NFS is "not fully supported" with WebLogic (I guess "not fully supported" means "it works unless you do something naughty").

Here is the Official Oracle Reference:

In fact I had heard in the past that SAN is recommended over NFS.

Some salient excerpts from the above document:

“Oracle strongly recommends verifying the behavior of a server restart after abrupt machine failures when the JMS messages and transaction logs are stored on an NFS mounted directory.”

“The NFS storage device does not become aware of machine failure in a timely manner and the locks are not released by the storage device. As a result, after abrupt machine failure, followed by a restart, any subsequent attempt by WebLogic Server to acquire locks on the previously locked files may fail.”

ONE workaround they suggest is to “disable file locking” on the FileStores of any kind (diagnostics, default, custom file stores, JMS logs...)

Centos drbd nfs

We are using a dual machine mounting Centos and the drbd NFS package (it's free!) to ensure a shared NFS storage with a mirror, sinchronized in case 1 disk crashes.

On any server mounting this device, if I do "mount" I see:

/dev/mapper/rootvg-rootlv on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/mapper/rootvg-optlv on /opt type ext3 (rw)
/dev/mapper/rootvg-homelv on /home type ext3 (rw)
/dev/mapper/rootvg-tmplv on /tmp type ext3 (rw)
/dev/mapper/rootvg-varlv on /var type ext3 (rw)
/dev/cciss/c0d0p1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
// on /data/bo/bu type cifs (rw,mand,noexec,nosuid,nodev)
/dev/mapper/rootvg-hypericlv on /home/hyperic type ext3 (rw)
peppettone-vip2:/drbd/main/shared/ on /opt/oracle/domains/osbdomain/shared type nfs (rw,user=root,noexec,nosuid,nodev,user,addr=

As you can see, the last entry peppettone is of type nfs (the cifs is the Samba share).

This is a quite interesting article on how a Highly Available NFS share is setup (it's 5 pages long...).

Notice that the NFS share is represented by a Virtual IP address (the, actually shielding the 2 (or more?) instances of physical servers.

More in DRDB here.
More on NFS here.

Friday, April 13, 2012

Linux disk performance benchmark

Suppose you have local and shared disks mounted on your box. You want to find out their relative performance, to assess for instance the performance loss in case you locate your WebLogic files (logs, filestores...) on one or the other.

$ df -kP

Filesystem 1024-blocks Used Available Capacity Mounted on
/dev/mapper/rootvg-rootlv 8125880 1953072 5753380 26% /
/dev/mapper/rootvg-optlv 30472188 24894656 4005004 87% /opt
/dev/mapper/rootvg-homelv 2031440 1939192 0 100% /home
/dev/mapper/rootvg-tmplv 3047184 161068 2728832 6% /tmp
/dev/mapper/rootvg-varlv 9141624 687588 7982244 8% /var
/dev/cciss/c0d0p1 497829 31487 440640 7% /boot
tmpfs 12342596 0 12342596 0% /dev/shm

$ /sbin/hdparm /dev/mapper/rootvg-optlv

/dev/mapper/rootvg-optlv: Permission denied

(hdparm has to be run with root privileges!)

Linux 2.6.18-308.1.1.el5 (myhostname)         04/13/2012

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           2.03    0.01    0.20    0.01    0.00   97.76

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
cciss/c0d0       10.14         8.85       305.48   16119821  556372354
cciss/c0d0p1      0.00         0.00         0.00       2351        156
cciss/c0d0p2     10.14         8.85       305.48   16117198  556372198
dm-0              4.94         0.63        38.96    1148082   70960475
dm-1             13.75         6.45       108.96   11742082  198439411
dm-2              5.78         1.29        45.76    2341482   83332872
dm-3              2.51         0.01        20.04      12186   36492920
dm-4             11.49         0.48        91.77     871650  167146504
dm-5              0.00         0.00         0.00       1072          0

You can also use Bonnie++ but I don't want to install any module.

REGEX and string manipulation with SQL

REGEXP_SUBSTR : search a string for a regular expression pattern

REGEXP_REPLACE the function returns source_char with every occurrence of the regular expression pattern replaced with replace_string

REPLACE REPLACE returns char with every occurrence of search_string replaced with replacement_string

Querying the OSB Reporting Provider table

We are using the OSB JMS Reporting Provider to track messages.
We must build custom reports to track the activity within a range of time.

The only problem is that the key-value pairs are stored as SEMICOLON (;) separated lists key1=value1;key2=value2....

Nothing is easier that writing SQL queries supported by PL/SQL functions.

Here how to create the function and types needed:

if you run
select tokenize('key1=value1;key2=value2', ';') from dual;

you get the list

Since my PL/SQL skills are very basic, I will follow a pure SQL Functions approach:

WITH csv_data AS (SELECT '&your_csv_string' AS CSV ,'[^ |;]+' REGEX FROM DUAL)

SELECT regexp_replace(TRIM(REGEXP_SUBSTR(A.CSV, A.REGEX, 1, LEVEL)),'[^[:print:]]', '') STR FROM csv_data a CONNECT BY LEVEL <= REGEXP_COUNT(A.CSV, A.REGEX) ORDER BY 1 Honestly I prefer a "poor man's" approach, that I will explain in another post.


describe wli_qs_report_data
Name       Null     Type         
---------- -------- ------------ 
DATA_TYPE           NUMBER(38)   
ENCODING            VARCHAR2(24) 
DATA_VALUE          BLOB         

describe wli_qs_report_attribute
Name                  Null     Type           
--------------------- -------- -------------- 
MSG_GUID              NOT NULL VARCHAR2(64)   
DB_TIMESTAMP          NOT NULL DATE           
HOST_NAME             NOT NULL VARCHAR2(50)   
STATE                 NOT NULL VARCHAR2(8)    
NODE                           VARCHAR2(128)  
PIPELINE_NAME                  VARCHAR2(128)  
STAGE_NAME                     VARCHAR2(128)  
INBOUND_OPERATION              VARCHAR2(64)   
MSG_LABELS                     VARCHAR2(2048) 
ERROR_CODE                     VARCHAR2(64)   
ERROR_REASON                   VARCHAR2(1024) 
ERROR_DETAILS                  VARCHAR2(2048) 


if WLI_QS_REPORT_DATA.DATA_TYPE == 1 then DATA_VALUE contains String

MSG_GUID is unique, and it joins the 2 tables (there is a PK_WLI_QS_REPORT_ATTRIBUTE and IX_WLI_QS_REPORT_DATA index on the tables, UNIQUE on MSG_GUID).

If one of your labels is "InterfaceID=BLA", then this:

select REGEXP_SUBSTR(MSG_LABELS, 'InterfaceID=[^;]+') from wli_qs_report_attribute where MSG_GUID = 'uuid:7f9b72b69446518a:6207823d:13595beb079:-7e59';

will return InterfaceID=BLA, and

select REPLACE(REGEXP_SUBSTR(MSG_LABELS, 'InterfaceID=[^;]+'), 'InterfaceID=', '') from wli_qs_report_attribute where MSG_GUID = 'uuid:7f9b72b69446518a:6207823d:13595beb079:-7e59';

will return BLA

So, putting it all together:

select * from wli_qs_report_attribute where REPLACE(REGEXP_SUBSTR(MSG_LABELS, 'InterfaceID=[^;]+'), 'InterfaceID=', '') = 'BLA';

will return all the records of a given InterfaceID

(of course
select * from wli_qs_report_attribute where MSG_LABELS like '%InterfaceID=BLA%';
would do the same)

In our Reporting we have defined several labels:

If I want to find all events of a given interface and of a given EventType within a given time range:

select * from wli_qs_report_attribute where REPLACE(REGEXP_SUBSTR(MSG_LABELS, 'InterfaceID=[^;]+'), 'InterfaceID=', '') = 'BLA' and MSG_LABELS like '%EventType=FileConsumed%' and REPLACE(REGEXP_SUBSTR(MSG_LABELS, 'EventOccuredOn=[^;]+'), 'EventOccuredOn=', '') >= '2012-02-28T22:14' and REPLACE(REGEXP_SUBSTR(MSG_LABELS, 'EventOccuredOn=[^;]+'), 'EventOccuredOn=', '') <= '2012-02-28T23:14'; and if I need to provide the value of each label as a different column: select REPLACE(REGEXP_SUBSTR(MSG_LABELS, 'InterfaceID=[^;]+'), 'InterfaceID=', '') as InterfaceID, REPLACE(REGEXP_SUBSTR(MSG_LABELS, 'EventType=[^;]+'), 'EventType=', '') as EventType, REPLACE(REGEXP_SUBSTR(MSG_LABELS, 'BusinessID=[^;]+'), 'BusinessID=', '') as BusinessID, REPLACE(REGEXP_SUBSTR(MSG_LABELS, 'EventOccuredOn=[^;]+'), 'EventOccuredOn=', '') as EventOccuredOn, REPLACE(REGEXP_SUBSTR(MSG_LABELS, 'TechnicalMessageID=[^;]+'), 'TechnicalMessageID=', '') as TechnicalMessageID from wli_qs_report_attribute where REPLACE(REGEXP_SUBSTR(MSG_LABELS, 'InterfaceID=[^;]+'), 'InterfaceID=', '') = 'BLA' and MSG_LABELS like '%EventType=FileConsumed%' and REPLACE(REGEXP_SUBSTR(MSG_LABELS, 'EventOccuredOn=[^;]+'), 'EventOccuredOn=', '') >= '2012-02-28T22:14' and REPLACE(REGEXP_SUBSTR(MSG_LABELS, 'EventOccuredOn=[^;]+'), 'EventOccuredOn=', '') <= '2012-02-28T23:14'; creating a function will help you clean up the code:

create or replace FUNCTION findLabelValue
(labels IN VARCHAR2, labelname IN VARCHAR2 ) return VARCHAR2
return REPLACE(REGEXP_SUBSTR(labels, labelname || '=[^;]+'), labelname || '=', '');

With this, a sample query joining to events to determine the first and last even of a message processing is:

findlabelvalue(A.MSG_LABELS, 'InterfaceID') as InterfaceID,
findlabelvalue(A.MSG_LABELS, 'BusinessID') as BusinessID,
findlabelvalue(A.MSG_LABELS, 'EventType') as EventType1,
findlabelvalue(A.MSG_LABELS, 'EventOccuredOn') as Event1OccuredOn,
findlabelvalue(A.MSG_LABELS, 'EventType') as EventType2,
findlabelvalue(A.MSG_LABELS, 'EventOccuredOn') as Event2OccuredOn,
findlabelvalue(A.MSG_LABELS, 'TechnicalMessageID') as TechnicalMessageID

from wli_qs_report_attribute A, wli_qs_report_attribute B
where findlabelvalue(A.MSG_LABELS, 'InterfaceID') = 'Pippo'
and A.MSG_LABELS like '%EventType=FileConsumed%'
and findlabelvalue(A.MSG_LABELS, 'EventOccuredOn') >= '2012-02-28T22:14'
and findlabelvalue(A.MSG_LABELS, 'EventOccuredOn') <= '2012-05-28T23:14'
and findlabelvalue(A.MSG_LABELS, 'TechnicalMessageID') = findlabelvalue(B.MSG_LABELS, 'TechnicalMessageID')
and B.MSG_LABELS like '%EventType=FTPFilePut%'

Selling software entails much more than manufacturing a good product

A software producer tells me:

Software business is a _big_ business. It is big in that you need loooots of money to get they notice you.

Most funny is that you don't even need to have a very good product.

What you do need is:

1). A well-designed web site

2). Money to buzz about yourself on every corner. This includes not only various banners, but most important: having various computer magazines to write articles about you (that's all for payment); publish a couple of books about your product (but do not forget to hire a tech-writer for this, as well as to pay the publisher); participate in various exhibition (also pay for your place there); and the last: issue a press-release about every new "nail" in your software (but do not forget to subscribe to "media-kits" everywhere you want to press-release yourself)

3). At last, hire a lot of "account-managers" to push your software to the local businesses.

When you calculate how much it will cost, you'll get a figure of a several millions euros. That's it.
The development of the software itself will be the least part of your expenses.

Why all that system is needed to get people use that very software in the end, I don't really understand myself, particularly when everybody can reach every website in Internet and download/try any software out

Our customers do include some very top companies (or rather some people working there), like: (omissis) .... But all of them purchased mostly a single license (or set of licenses) and that was all.
If I was told from the very start that this would happen, I wouldn't belief...

Also, making all those things, I listed, would take some number of people. You wouldn't be able to do it alone.
And once you've got some tens of people, you obviously need a few more ordinary professionals, like a secretary,
a bookkeeper (or "CFO", as they say).
Possibly, also a human-resource manager and a lawyer -- but those would be required for a bit bigger business.

If your company is very small yet (e.g. 2-4 guys), the whole item N2 (that is, buzzing about yourself on every corner), could be done by a special "public relation" company. There are quite a lot of them, and they will arrange everything (all those sub-items). But you have to pay them, of course!

Well, whatever you do, a few thousands euros (or dollars) would be never enough. This is just called a "seed capital".
If you want to go any further, a true investor (with those millions) must be found somewhere!

That's theory, of course. But, lots of this is written in various books, even academic ones.
It is a big science, in fact, how to create and run company.

For instance, here you can read who those "account manages" are:
I knew a few of them. Quite modest people with not so large salaries.
But if you have an army of them, you will be making millions! :)

But some other people, I guess, may think something different about all this...

For instance, how the "open source" model works still remains a mystery to me.
A typical open source project is posed as a team of geeks.
But on the other hand (from my experience), to make really complex things you need very coordinated and dedicated people.
That means, it is a full-time job. You've got to feed them (and not only feed, by the way)!
And the promotion is also needed, less of course, but anyway.

So.... if you dream of being the next Bill Gates, now you know it's not only about writing good code... am I saying that Microsoft produces good products? I must be ill...

Tuesday, April 10, 2012

Getting started with Hyperic - demo

I am really impressed by what you can do - like running "top" on a remote box within your Hyperic console....

This one is also very good:

Installing Hyperic Server on Windows and Agent on Linux to monitor WebLogic


VMware vFabric Hyperic 4.6.5 Server and Agent - Linux (64 bit)
03/15/12 | 4.6.5 | 396M | Binary (.tar.gz)

It gives me a hyperic-hqee-installer-4.6.5-x86-64-linux.tar.gz
I unzip it into a hyperic-hqee-installer-4.6.5-x86-64-linux.tar
Which untarred gives a hyperic-hqee-installer-4.6.5 folder

which contains

86,371,609 hyperic-hqee-agent-4.6.5-x86-64-linux.tar.gz
DIR installer
49,455 open_source_licenses-SpringSource_tc_Server.txt
796,537 open_source_licenses.txt
241,153,046 server-4.6.5.tar.gz
108 setup.bat

Here the installation instructions.

I also download the Windows version.
Apparently no need for DB (using internal PostgreSQL DB)
Run setup.bat. Create a C:\pierre\hypericserver directory first.
Provide SMTP server.

Admin user: hqadmin

At the end I get:

Installation Complete:
Server successfully installed to: C:\pierre\hypericserver/server-4.6.5-EE

You should now install the HQ server as a Windows Service using this command:

C:\pierre\hypericserver\server-4.6.5-EE\bin\hq-server.bat install

You can then use the Service Control Manager (Control Panel->Services) to
start the HQ server. Note that the first time the HQ server starts up it may
take several minutes to initialize. Subsequent startups will be much faster.

Once the HQ server reports that it has successfully started, you can log in
to your HQ server at:
username: hqadmin
password: pippo0

To change your password, log in to the HQ server, click the "Administration"
link, choose "List Users", then click on the "hqadmin" user.

Setup completed.
A copy of the output shown above has been saved to:

Press the Enter key to exit setup.

I run a Command Prompt as Administrator, and execute

C:\pierre\hypericserver\server-4.6.5-EE\bin\hq-server.bat install

I get the message

wrapper | Hyperic HQ Server service installed.

I run services.msc and I can see a "Hyperic HQ Server" service: I start it.
The executable is C:\pierre\hypericserver\server-4.6.5-EE\wrapper\sbin\wrapper-windows-x86-32.exe -s C:\pierre\hypericserver\server-4.6.5-EE\conf\wrapper.conf set.SERVER_INSTALL_HOME=C:\pierre\hypericserver\server-4.6.5-EE\bin\.. set.JAVA_HOME=C:\pierre\hypericserver\server-4.6.5-EE\bin\..\jre

I access in Firefox the url
It takes a long time. But it works. I get this lovely screen:

Now let's install the agent on Linux:

Now I install the agent on Linux.
Copy all the Linux stuff to /opt/hyperic/.
chmod 755 *.sh
chmod 755 /opt/hyperic/installer/bin/*
mkdir /opt/hyperic/agent

choose 2 (agent)

when asked
HQ agent installation path [default '/home/hyperic']: say:

It will tell you:

Loading install configuration...
Install configuration loaded.
Preparing to install...
Validating agent install configuration...
Installing the agent...
Looking for previous installation
Unpacking /opt/hyperic/hyperic-hqee-agent-4.6.5-x86-64-linux.tar.gz to: /opt/hyperic/agent/agent-4.6.5-EE...
Setting permissions on /opt/hyperic/agent/agent-4.6.5-EE...
Setting permissions on agent binaries...
Fixing line endings on text files...
Installation Complete:
Agent successfully installed to: /opt/hyperic/agent
You can now start your HQ agent by running this command:

/opt/hyperic/agent/agent-4.6.5-EE/bin/ start

Setup completed.
A copy of the output shown above has been saved to:

Deleting temporary JRE

I run
/opt/hyperic/agent/agent-4.6.5-EE/bin/ start

Starting HQ Agent...
- No token file found, waiting for Agent to initialize
[ Running agent setup ]
Should Agent communications to HQ be unidirectional [default=no]:
What is the HQ server IP address:
Should Agent communications to HQ always be secure [default=yes]:
What is the HQ server SSL port [default=7443]:
- Testing secure connection ... Success
What is your HQ login [default=hqadmin]:
What is your HQ password:
What IP should HQ use to contact the agent [default=]:
What port should HQ use to contact the agent [default=2144]:
- Received temporary auth token from agent
- Registering agent with HQ
The server to agent communication channel is using a self-signed certificate and could not be verified
Are you sure you want to continue connecting? [default=no]: yes
- HQ gave us the following agent token
- Informing agent of new HQ server
- Validating
- Successfully setup agent

At this point, I go to the Hyperic console Home Page and in the Auto-Discovery tab I find the 2 WebLogic domains and the Apache Tomcat running on the Linux box.... pretty cool!

On the Linux box I see 2 processes:


/opt/hyperic/agent/agent-4.6.5-EE/jre/bin/java etc etc

To stop the agent:
/opt/hyperic//agent/agent-4.6.5-EE/bundles/agent-4.6.5/bin/ stop