Saturday, December 31, 2011

Happy new ear

and a prosperous 2012

Impress your friends with this great Dr Spock costume! Available on ebay!

Thursday, December 29, 2011

Coherence cluster interference

####<Dec 28, 2011 12:32:51 PM CET> <Warning> <Coherence> <acme102> <osbdv1ms1> <Logger@1780819408> <<anonymous>> <> <0000JI4RpfkE8Tk5ozx0iY1Eyjr6000002> <1325071971843> <BEA-000000> <Oracle Coherence (member=n/a): Received a discovery message that indicates the presence of an existing cluster that does not respond to join requests; this is usually caused by a network layer failure:
Message "SeniorMemberHeartbeat"
FromMember=Member(Id=1, Timestamp=2011-11-24 15:56:30.477, Address=, MachineId=14269, Location=process:26431, Role=OSB-node)
[000]=Broadcast{PacketType=0x0DDF00D2, ToId=0, FromId=1, Direction=Incoming, ReceivedMillis=12:32:51.842, MessageType=17, ServiceId=0, MessagePartCount=1, MessagePartIndex=0, Body=0}
Service=ClusterService{Name=Cluster, State=(SERVICE_STARTED, STATE_ANNOUNCE), Id=0, Version=3.6}

MemberSet=MemberSet(Size=1, BitSetCount=1, ids=[1])

we need either to add

-Dtangosol.coherence.wka=localhost -Dtangosol.coherence.ttl=0 -Dtangosol.coherence.localhost=

to the JVM parameters, or make sure each installation has a unique Coherence cluster multicast address

If you get forever this message:
"Delaying formation of a new cluster; waiting for well-known nodes to respond"

read here:

then remove the wka option and use an explicit address:
-Dtangosol.coherence.clusteraddress= -Dtangosol.coherence.clusterport=3059

Accessing data from Oracle DB XML with OSB

Referring to the excellent post by Chris:

Local OSB protocol is ACTUALLY local

It seems that LOCAL doesn’t load balance stuff..."Local" means "NOT Remote", so all calls are within the same JVM.

I have done this test:

CLIENT -> HTTP PS deployed in cluster -> publish to LOCAL PS

Client sends all requests to only 1 HTTP service on server ms1 of the cluster made by ms1,ms2.

Only the LOCAL PS on the ms1 is invoked. ms2 shows no activity.

What if instead of LOCAL protocol I use some remotable protocol like HTTP? Is Server Affinity going to kick in, so all requests will stay anyway local? I am too lazy to test this now... maybe one day...

Wednesday, December 28, 2011

Test Console service is not running. Contact administrator to start this service

I was unable to test a Proxy/Business service, and getting the error message
"Test Console service is not running. Contact administrator to start this service"

I opened the AdminServer logs and it was full of:

An exception [java.lang.StackOverflowError] was thrown while rendering the content at [/jsp/dashboard/DashboardAlerts.jsp].
javax.servlet.ServletException: java.lang.StackOverflowError
at weblogic.servlet.internal.ServletStubImpl.execute(
at weblogic.servlet.internal.TailFilter.doFilter(
at weblogic.servlet.internal.FilterChainImpl.doFilter(
at org.apache.beehive.netui.pageflow.PageFlowPageFilter.continueChainNoWrapper(
at org.apache.beehive.netui.pageflow.PageFlowPageFilter.doFilter(

It is unclear how the server got itself in that state.... anyway restarting AdminServer and Managed Servers fixed the issue.... weird.

Removing empty optional elements erroneously inserted by mapping

if a XQuery mapping, theoretically you should check for existence of an optional element in the source, and only if it exists you create it on the destination:

if ($myvar/customer/shoesize) then

If the developer likes to take shortcuts (=is a lazy bum), and doesn't do the "if", you must clean the garbage afterwards.

You can use the action:
delete //*[not(node()) and not(.//@*)] from body

Book: The Definitive Guide to SOA Oracle Service Bus

Definitely worth reading, with plenty of source code available at their site:

Tuesday, December 27, 2011

EOL issues on Unix/Windows

in vi, if you want to view a file in HEX mode, do this:


line feed=10=0x0A (\n)
carriage return=13=0x0D (\r)

in Windows, a EOL is defined by \r\n (0D0A)
in Unix, a EOL is defined by \n (0A)

to change EOL to some other character:

tr '\n' '#' < test1.txt > test2.txt

to turn a Windows file into Unix:
dos2unix filename

Excellent Notepad++ to convert one format into another (Edit/EOL conversion)

Disabling debatching in Oracle JCA File Adapter

If in the JCA file adapter file you specify PublishSize=1, the file translator will
consider that every LINE (up to EOL) in your file is a MESSAGE.

Even if the Root Element of my message is a complexType made by a sequence of subtypes, the NXSDTranslator will dispatch a message to OSB PER EACH LINE, and the message will contain ONLY THE SUBTYPE, not the Root Element.

Even if you specify uniqueMessageSeparator="someweirdstring", it will keep doing the same trick.

In the log, you see:

jca.file.BatchIndex=1 (2, 3... up to the number of lines in the file)

(all the messages in the same Batch (=file) have the same jca.file.Batch property)

The only way to avoid this DEBATCHING (split a message in multiple submessages) is to explicitly set the PublishSize to a BLANK value (default is 1).

see doc here

PublishSize: This property indicates whether the file contains multiple messages and how many messages to publish to the BPEL process at a time. The parameter is of type int and is not mandatory. The default value is 1.

For example, if a certain file has 11 records and this parameter is set to 2, then the file will be processed 2 records at a time and the final record will be processed in the sixth iteration.

Pay attention to the JCA file, the PublishSize can be nested there.
Look in the nXSD file, there can be a nxsd:publishSize clause, set it to "" (an empty string)

In the logs, per each batch element you will see a separate invocation to the translator:

Invoking inbound translation for : PuO20111212_164122_1640.txt
InboundTranslatorDelegate:: Ordinary DOM Created
Completed inbound translation for : PuO20111212_164122_1640.txt

Classes to monitor:
(method xlator.translateFromNative(in, res, xlationCtx))

(ProcessorDelegate.process(FileInfo) and does a doXlate)


see also for how to invoke the NXSDTranslatorImpl from CLI

Monday, December 26, 2011

WebLogic and AspectJ

Zillions of times I have wished in my life to be able to tell which methods are being executed in an application deployed in WLS, and the values of the parameters and return values. Call it "tracing method execution in weblogic".
If no debug statements exist in the WLS code or in the application, the only way is to weave the classes with some AOP product.

So here I go:

download AspectJ 1.7

download WLS 12

about load-time weaving with a premain function using javaagent

In setDomainEnv there is a property JAVA_PROFILE
I set it to

after checking the WLS classpath, I see that the . directory (C:\Oracle\Middleware\user_projects\domains\base_domain) is in the classpath (because I have a System Variable CLASSPATH=.)
I create then a C:\Oracle\Middleware\user_projects\domains\base_domain\META-INF\aop.xml file where I define an INLINE ASPECT (no need to precompile separately with ajc):

Here is the aspect, to be compiled and put in the classpath (you will need to add the AspectJ jars to the Eclipse project)

package com.pierre.aop;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;

public abstract class AbstractAspect {

@Before("execution(* *(..))")
public void before(JoinPoint jp) {

@Pointcut("execution(public * *(..))")
public void anyPublicOperation() {

and this is the aop.xml:



<!-- define a concrete aspect inline -->
<concrete-aspect name="com.pierre.aop.MyTracing" extends="com.pierre.aop.AbstractAspect">
<!--pointcut name="tracingScope" expression="within(com.pierre.*)"/-->

<!-- Of the set of aspects declared to the weaver
use aspects matching the type pattern "com.pierre..*" for weaving. -->
<include within="com.pierre..*"/>


<weaver options="-verbose">
<!-- Weave types that are within the javax.* or org.aspectj.*
packages. Also weave all types in the foo package that do
not have the @NoWeave annotation. -->
<include within="com.pierre.*"/>

<!-- Dump all types within the "somepack" package,
both before are after they are woven,
to the "./_ajdump" folder on disk (for diagnostic purposes) -->
<dump within="com.pierre.*" />


for some reasons, it doesn't work....
I can see in the stdout:

[JspClassLoader@72d4e5] info AspectJ Weaver Version 1.7.0.M1 built on Friday Dec 16, 2011 at 16:56:09 GMT
[JspClassLoader@72d4e5] info register classloader weblogic.servlet.jsp.JspClassLoader@72d4e5
[JspClassLoader@72d4e5] info using configuration /C:/Oracle/Middleware/user_projects/domains/base_domain/META-INF/aop.xml
[JspClassLoader@72d4e5] info define aspect com.pierre.aop.MyTracing
[ChangeAwareClassLoader@f45732] info AspectJ Weaver Version 1.7.0.M1 built on Friday Dec 16, 2011 at 16:56:09 GMT
[ChangeAwareClassLoader@f45732] info register classloader weblogic.utils.classloaders.ChangeAwareClassLoader@f45732
[ChangeAwareClassLoader@f45732] info using configuration /C:/Oracle/Middleware/user_projects/domains/base_domain/META-INF/aop.xml
[ChangeAwareClassLoader@f45732] info define aspect com.pierre.aop.MyTracing

My JSP does:

AOPCUT aopcut = new AOPCUT();

where the AOPCUT class is

package com.pierre.aop;

public class AOPCUT {

public void hello(String message) {
System.out.println("Hello " + message);


and the interceptor gets called....

How to remove (hide) the Wikipedia personal appeal?

I have donated money before to Wikipedia, but now I am sick and tired to see the faces for the fathers and mothers founders (at least they could use good looking babes for their campaign!)

On Firefox, install
(needs restart)

To open the Adblock console:

Then by browsing I find the right expression for the AdBlock filter:


It seems to be working for all Wikipedia regional languages.

Let me know when they have removed the ad, I will consider giving more money to thanks them for having stopped this torture.

I hope I am not doing anything illegal with this post!

Talking about Firefox plugins, I really recommend
to display vertical tabs,
essential if you have a laptop with low vertical resolution.

Saturday, December 24, 2011

WebLogic dies on startup: Unable to create a server socket for listening on channel "Default"

Unable to create a server socket for listening on channel "Default". The address might be incorrect or another process is
using port 7001: Cannot assign requested address: JVM_Bind.

Of course there is no running process who listens on the 7001 port, I have done netstat -a to check...

It turned out that I have a dynamic IP on my laptop - with hostname pierrepc - and foolishly I have made an entry in my hosts file saying pierrepc

Idiot me! The IP address is not static, so once I get assigned a different IP, WebLogic still tries to use the IP to create a Socket...

Removing the (foolish) entry from hosts fixed the problem

Transport provider with id 'jca' is not registered

(guest post, the author is Chris)

We are using the ant tasks provided by Oracle to build a sbconfig.jar (task exportFromWorkspace).

Everything worked fine using the common osb artifacts. However for projects where we use JCA adapters we get the following errors when we do a build:

[java] com.bea.wli.config.component.ValidationException: Validation of BusinessService BLA : Diagnostics for BusinessService BLA 20-Dec-2011 17:04:54 [java] 20-Dec-2011 17:04:54 [java] ERROR: <0> Transport provider with id 'jca' is not registered. Failed

Some Googling taught me that is related to the 64 bit installation of OEPE, I can confirm this as I have built the same artifacts from the same projects on a 32 bits OEPE using the same scripts and they work.


WebLogic and Maven

Jeff West makes the best presentations around. He is spot on, no blablabla.

to install WebLogic (wow, this is cool!)
mvn wls:install

to create a domain
mvn wls:create-domain (wow, this is cool!)

to start the server:
mvn wls:start-server

to run a wlst script:
mvn wls:wlst

this is a reference to the preexisting maven plugin for weblogic

WebLogic system properties

There are a number of System Properties (visible for instance with VisualVM) that influence WebLogic behaviour:

















java.rmi.server.randomIDs=true SE Runtime Environment

java.runtime.version=1.6.0_24-b07 Platform API Specification

java.specification.vendor=Sun Microsystems Inc.


java.vendor=Oracle Corporation



java.version=1.6.0_24 mode JRockit(R) Virtual Machine Specification

java.vm.specification.vendor=Sun Microsystems Inc.


java.vm.vendor=Oracle Corporation






























sun.jnu.encoding=UTF-8 JRockit(R) Optimizing Compiler





















Thursday, December 22, 2011

BPEL and OSB Monitoring with Enterprise Manager Grid Control

The books shows some use cases of monitoring and provisioning OSB projects with Enterprise Manager Grid Control

Here the official Oracle documentation:

A SOA Expert is...

An expert is a person who has made all the mistakes that can be made in a very narrow field.

Niels Bohr

Danish physicist (1885 - 1962)

Monday, December 19, 2011

XQuery: how to chain (concat) 2 elements

curly braces will do the job:

let $a := <a>bla</a>
let $b := <b>blu</b>

return { $a, $b }

will return

Custom XPath libraries

We thank again Sandeep Phukan (we wrote about him here) for his excellent library of Custom XPath functions.

Here his wiki.

Sunday, December 18, 2011

Oracle Enterprise Manager 10g Grid Control Handbook

reading right now.... quite interesting.... from one of the main contributors to the Grid Control product: Werner De Gruyter, Matthew Hart, Daniel Nguyen

Grid Control: ORACLE_MIDDLEWARE_HOME_LOCATION subdirectory already exists

I have tried everything to install Grid Control.
I have also tried to "show empty homes" and remove them: it hangs forever and in the log C:\bea11\oracle_common\cfgtoollogs\cfgfw\CfmLogger_2011-12-18_04-17-32-PM.log it shows:

WARNING: Validation of XML schema is disabled because AggregateDescriptions.xsd could not be found
INFO: Creating new CFM connection
WARNING: A CfwClient was destroyed without a proper call to disconnect!

I will start again tomorrow.... but.... what a battle to install Grid Control...


This is an evolving post... it's a collection of posh-"sounds-so-difficult" names for old, well known stuff.

The more difficult we talk, the more people will worship us as gurus and we can avoid any actual physical work and we can avoid having to ACTUALLY solve problems.
This was a common practice in the Middle Ages, professionals (doctors, lawyers, priests) would put enormous energies into learning Latin, so that nobody could understand what they were saying.

Synthetic transactions

Synthetic transactions are a way to check the availability of an application across a network. By definition, a synthetic transaction constitutes an automated, self-contained set of user operations that can be executed against a service in the same way a real consumer of the service operates an application. For example, on the Internet, a synthetic transaction includes a script that goes a stock trading site, tries to look up a stock's price or portfolio valuation, and reports if the series of operations completed successfully. In other words, any fixed set of user operations that can be automated reliably may be defined as a synthetic transactions.

"Synthetic" sounds like Alien technology, something that only Extraterrestrial intelligences can master.... cool!


Hydrate is being used (often incorrectly) instead of the well known "populate" or "persist"... again, its association to a Chemistry term evokes a world of knowledge available only to few specialists...


I have been doing Agile for the first 10 years of my career, when I was coding for food... we were working on VERY tight budgets and even tighter deadlines.... we used to call it "get your fat stinky ass off that chair, work harder, when stuck raise a flag and get things done". It used to work like wonders, and we were delivering at least 10 times faster
than any corporate project I have ever seen.


As defined here, "stakeholder is anyone who will make use of, develop, or have an impact on any aspect of your project". It sounds sooooo much cooler than "people concerned" !


Some people say "the language doesn't have the SEMANTICS to do this".
Here an very clear definition of SEMANTICS:
"Semantics is the study of the meaning of linguistic expressions."

Probably if they used "the capability" or "the API" they would be more.... semantically correct!


Taxonomy is another of those wonderful words to impress your audience. It means nothing more nothing less than Classification, but it will allow you to impersonate the Darwin or the Linnaeus of the block, leaving around you an aura of scientificity and holiness.


Let's give the word credits: Patterns is an excellent sound bite, with the voiceless bilabial plosive "P" at the beginning sending your opponent to the ground.

Whenever in a discussion someone starts swaying the "Pattern" story around like Samson the ass jawbone

- maybe because he is the only person who has actually learned by heart the entire index of the GoF book -

I wonder "is this man trying to COMMUNICATE, or to INTIMIDATE?".

Saturday, December 17, 2011

Beware of free screen recorder...

Googling for "free screen recorder" I have stumbled upon

BEWARE: It tries to install Babylon on your machine (I simply hate Babylon, for having been their customer and having been harassed multiple times by their policy to revoke your license if you install it on a different PC.... I change computer every 3 months, so you can imagine....)...

and it also fails to download the rest of the program.

Here you get a large list of "certified" free or paying screen recording software... never install anything which has not been reviewed by peers.

I used to use CamStudio but I really miss the ability to zoom.

Friday, December 16, 2011

JPA using Coherence as Level 2 Cache

quite cool this video on TopLink grid with COH in WL Cluster.

In a nutshell:

  • Coherence can cache DB data in a cluster-wide manner
  • Grid Cache mode uses Coherence to cache (read-through) objects by ID
  • Grid Read mode turns JPQL queries into COH Grid queries
  • Grid Entity mode supports read and writes directly into the Cache

Grid Entity can be tricky, because updates are asynchronous and they could fail, leaving the cache out of sync with the DB.

Recommended model:
Out-Of-Process, COH is in a different JVM as the Application Server.

In-Process: everything in the same JVM. Good only for development.

Mixed model (some data in near-cache, some in far-cache) can be useful in some applications.

Second part:

it's quite cool, it shows how to create a COH cluster and server, how to configure a WL server for COH. It gives an example of a Grid Entity mode to offload DB writes.

Here the example

and the code is on SVN at


Book: Enterprise Manager Grid Control 11g

Oracle Enterprise Manager Grid Control 11g R1: Business Service Management

Chapter 1.... just skip it, it's blablabla

Chapter 2: OEB DB Control, AS Control, FMW Control, Grid Control. Management Agent.
Monitoring of Targets and Performances.

at Chapter 3 I gave up... .on the whole I find that the official Oracle documentation uses a simpler and more concise language.
From a technical book I expect some real customer stories, some use cases, a more colloquial and entertaining language.

oracle virtual box soa suite : memory for crash kernel (0x0 to 0x0) not within permissible range

If your Oracle Linux VirtualBox doesn't start, and shows a
"memory for crash kernel (0x0 to 0x0) not within permissible range" error (in reality it's only a warning, and presumably not the cause for the crash),

you can either cry, or (see ) Enable IO APIC handler.

Corporal Pierre got promoted today to Sergeant Major on OTN Forum

still a VERY long way from GURU:

I wonder what you become after 1000000 points.... KING of Oraclavia ?

Thursday, December 15, 2011

OSB acknowledging JMS messages part II

see here my original post

3 modes of JMS message acknowledge:


public static final int AUTO_ACKNOWLEDGE

With this acknowledgement mode, the session automatically acknowledges a client's receipt of a message when it has either successfully returned from a call to receive or the message listener it has called to process the message successfully returns.


public static final int CLIENT_ACKNOWLEDGE

With this acknowledgement mode, the client acknowledges a message by calling a message's acknowledge method. Acknowledging a message acknowledges all messages that the Session has consumed.

When client acknowledgment mode is used, a client may build up a large number of unacknowledged messages while attempting to process them. A JMS provider should provide administrators with a way to limit client over-run so that clients are not driven to resource exhaustion and ensuing failure when some resource they are using is temporarily blocked.


public static final int DUPS_OK_ACKNOWLEDGE

This acknowledgement mode instructs the session to lazily acknowledge the delivery of messages. This is likely to result in the delivery of some duplicate messages if JMS fails, it should only be used by consumers that are tolerant of duplicate messages. Its benefit is the reduction of session overhead achieved by minimizing the work the session does to prevent duplicates.

My understanding is that AUTO_ACKNOWLEDGE means "ACKNOWLEDGE if the transaction was successful" (default behaviour, unless you "raise error" in OSB).

Wednesday, December 14, 2011

OSB JMS proxy and "reply with success/reply with failure"

I create a PVQueue, override redelivery count = 3 and redelivery delay = 10000

I consume the messages with a JMS PS, no transaction required, I use the default JMS XA connection factory weblogic.jms.XAConnectionFactory.

If I "reply with success", the JMS message is consumed immediately.

If I "reply with error", the JMS message is consumed immediately.

I set the "Transaction Required" on the Proxy Service, I "reply with error", and the JMS message is consumed immediately.

In all the above cases, in the Operations/Monitoring tab, I see 1 message and 0 errors for the Proxy.

I "Raise Error" and the JMS message is played 4 times (redelivered 3 times + 1 time the first attempt) at 10 seconds interval and then it is consumed and redirected to the Error Destination, where it appears with a JMS_BEA_DeliveryFailureReason=2 and JMSXDeliveryCount=0.
In the Operations/Monitoring tab, I see 4 messages and 4 errors for the Proxy.

Same as above, without "Transaction Required", and it behaves the same way.

The Inner Geek is rejoicing....

reposting this great post:

music made by sending commands to a HP scanner over the SCSI interface

this is really cool stuff

(sorry I am an electronic engineer, I have spent 7 years of my life in front of a Digital State Analyzer and Oscilloscope....)

This is the way the world works

IMF stands for International Monetary Fund, of course. Of the two characters in the Tv screen, one is for sure our glorious Pope Ratzinger, the other seems Bush but I am not sure. On the bottom it says "World bank"

The naked white man might represent the average citizen of the West. His SUV must be parked outside.

Assigning a value to $fault

I was trying to assign a value to $fault in a "Error Reporting" service, to see if the built-in "Report" action could parse the $fault and populate the right fields in the Error Report message.

This is a sample $fault:

<con:fault xmlns:con="">

Unfortunately the $fault variable is meaningful only in the error handler.
If you try to use it in a normal message flow, you get:

Variable name validation failed: The variable "fault" cannot be used here

Tuesday, December 13, 2011

Using JCA JMS Adapter in OSB

[JCATransport:381984]OSB JCA transport does not support adapter type: JMS

This puts an abrupt end to my adventure :o(

Sunday, December 11, 2011

Oracle nXSD in action: parsing EDI to XML

Schema level options:

Element level options:

lots of valuable examples here

I have a EDI document, made by several fixed length segments.
Each segment starts with a fixed label.
Each segment contains multiple fixed length fields.
Segment can appear in groups (sequence of many segments).
Groups can appear multiple times.

Lesson learned:

* since there is no fixed sequence of segments, you should use this construct
xsd:choice minOccurs="0" maxOccurs="1000"
xsd:element name="ACME0001" type="tns:ACME0001_Type" nxsd:startsWith="ACME0001"

xsd:element name="ACME0002" type="tns:ACME0002_Type" nxsd:startsWith="ACME0002"

(using maxOccurs="unbounded" sends the nXSD parser into an infinite loop)

* segments who are not needed, should still be parsed, using a generic element:

xsd:element name="ACME0001" type="tns:Any1064Block_Type" minOccurs="0" maxOccurs="10" nxsd:startsWith="ACME0001 "

where Any1064Block_Type is:

<xsd:complexType name="Any1064Block_Type">
        <xsd:element name="DATA" type="xsd:string" nxsd:style="fixedLength" nxsd:length="1054"/>

where 1054 = 1064 (length of the segment) - length of the "startsWith" element (ACME0001 )

* if the data you are interested in are in the middle of a segment, you can "skip" the initial characters:

xsd:element name="PONbr" type="xsd:string" minOccurs="1" nxsd:style="fixedLength" nxsd:length="35" nxsd:skip="136"

* you should always consume each segment to its end, maybe using a "FLUFF" element just for the sake of telling the parser to skip data:

xsd:element name="FLUFF2" type="xsd:string" minOccurs="1" nxsd:style="fixedLength" nxsd:length="883"

failing to consume a segment to its exact end will stop the parser.

XSD: elements in arbitrary order

my situation is that I have child elements which can occur repeatedly in any order:


Googling around I find this solution:

<xs:complextype mixed="true" name="p">
 <xs:choice maxoccurs="unbounded" minoccurs="0">
  <xs:element name="a">
  <xs:element name="b">

 it seems to work pretty well...

my wish is that XSD contained a native construct like "anyorder", similar to "sequence" or "choice" or "all"

Thursday, December 8, 2011

remote desktop connection change password

I keep forgetting: it's


OSB, finding the WebLogic server name on which a message flow is executing

apparently there is no other way than doing a Java Callout (or better, a Custom XPath) returning System.getProperty("weblogic.Name").

The OSB Reporting puts the server name in the reporting message, but I think it gets it from inside Java code.

Wednesday, December 7, 2011

WebLogic cluster monitor script

#Script to monitor running cluster
#will write thread dumps and other cluster diagnostic info to a file, at regular intervals

#Vernetto 2011-11-11

from import File
from import FileOutputStream
from import FileInputStream
from java.util import HashMap
from java.util import HashSet
from java.util import ArrayList
from time import sleep

import datetime

import zlib
import zipfile
from os import *

configFileProperties = None
isConnected = false
previousStdout = None

# Utility function to load properties from a config file

def loadProps(configPropFile):
    global configFileProperties
    propInputStream = FileInputStream(configPropFile)
    configFileProperties = Properties()

def appendToAlarmLog(alarmmessage):
    alarmsfile = configFileProperties.get('alarmsfile')
    alarmFile = open(alarmsfile, 'a')
    alarmFile.write(getNowTimestamp() + ' ' + alarmmessage + '\n')

def getNowTimestamp():
 now =
 nowtimestamp = now.strftime("%Y%m%dT%H%M%S")
 return nowtimestamp
def monitorServer():
    global isConnected
    fos = None    
    previousStdout = theInterpreter.getOut()
  #initialize variables

  #initialize timestamp to append to log filename
  nowtimestamp = getNowTimestamp()

  #save stdout handle 
  logFileNameWithTimestamp = logFile + '.' + nowtimestamp

  #set new stdout

  print "start the script"

  if (not isConnected) :
      connect(username, password, serverURL)
      isConnected = true

  #redirect output to log file
  f = File(logFileNameWithTimestamp)
  fos = FileOutputStream(f)

  print 'Health', cmo.getHealthState()

  print 'AliveServerCount=', cmo.getAliveServerCount(), ' ServerNames', cmo.getServerNames()

  if (aliveServerCountExpected != cmo.getAliveServerCount()) :
     alarmmessage = 'MONITORALARM, we were expecting AliveServerCount ' + aliveServerCountExpected + ' and we have instead %d , see file %s' % (cmo.getAliveServerCount() , logFileNameWithTimestamp, )
     print alarmmessage 

  print 'DiscoveredGroupLeaders=',  cmo.getDiscoveredGroupLeaders(), ' Groups=', cmo.getGroups(), ' LocalGroupLeaderName=',  cmo.getLocalGroupLeaderName(), ' RemoteGroupsDiscoveredCount=',  cmo.getRemoteGroupsDiscoveredCount(), ' TotalGroupsCount=', cmo.getTotalGroupsCount()

  print 'AcceptCount=' , cmo.getAcceptCount() , ' MessagesReceivedCount=' , cmo.getMessagesReceivedCount() , ' MessagesSentCount=' , cmo.getMessagesSentCount()
  scr = cmo.getServerConnectionRuntimes()
  #scr is an array of weblogic.server.channels.ServerConnectionRuntimeImpl$SerializableConnectionRuntime
  for myscr in scr:
   print "BytesReceivedCount=", myscr.getBytesReceivedCount(), " BytesSentCount=", myscr.getBytesSentCount(), " ConnectTime=", myscr.getConnectTime()," MessagesReceivedCount=",  myscr.getMessagesReceivedCount(), " MessagesSentCount=", myscr.getMessagesSentCount()

  print ""


  cd('/JVMRuntime/' + serverName)
  #this is valid for JRockit
  #print "HeapFreeCurrent=", cmo.getHeapFreeCurrent(), " TotalGarbageCollectionTime", cmo.getTotalGarbageCollectionTime(), " TotalNumberOfThreads=", cmo.getTotalNumberOfThreads()
  #this is valid for JRockit
  print "HeapFreeCurrent=", cmo.getHeapFreeCurrent(), ' HeapSizeCurrent=', cmo.getHeapSizeCurrent()


  print 'HoggingThreadCount=', cmo.getHoggingThreadCount(), ' PendingUserRequestCount', cmo.getPendingUserRequestCount(), ' StandbyThreadCount' , cmo.getStandbyThreadCount()
  print 'CompletedRequestCount=', cmo.getCompletedRequestCount(), ' ExecuteThreadIdleCount=', cmo.getExecuteThreadIdleCount(), ' ExecuteThreadTotalCount=', cmo.getExecuteThreadTotalCount()

  #restore stdout

  #now zip the report
  zipfileLog = zipfile.ZipFile(logFileNameWithTimestamp + '.zip', 'w')
  zipfileLog.write(logFileNameWithTimestamp, compress_type=zipfile.ZIP_DEFLATED)

        isConnected = false
        if (fos != None) :
        print "Unexpected error:", sys.exc_info()[0]


# monitor script init
    # sys.argv[1] is the config properties file
 configFile = sys.argv[1]
 print 'Loading config from :', configFile
 interval = configFileProperties.getProperty('interval')

 while True:
   errorMessage = "ERROR_QUERYING_SERVER %s - %s - %s"% (sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2], )

    print "Unexpected error: ", sys.exc_info()[0]

and the property file contains:


Monday, December 5, 2011


tonight talking with a colleague we envisaged the opportunity of devising a DSL to describe OSB projects without going through all the click-click necessary in Eclipse or in the Web Console.

If anybody wants to join me in this challenge, please drop me an email

publicpierre gmail com

Flogging the dead horse

Often, when confronted with something (people, products, methodologies...) which is clearly underperforming, management is in denial and comes up with all sort of workarounds (rather than burying the horse and buying a new one) as the famous "flog the dead horse" story teaches:

  1. Buying a stronger whip.
  2. Changing riders.
  3. Say things like, “This is the way we have always ridden this horse.”
  4. Appointing a committee to study the horse.
  5. Arranging to visit other sites to see how they ride dead horses.
  6. Increasing the standards to ride dead horses.
  7. Appointing a tiger team to revive the dead horse.
  8. Creating a training session to increase our riding ability.
  9. Comparing the state of dead horses in today’s environment.
  10. Change the requirements declaring that “This horse is not dead.”
  11. Hire contractors to ride the dead horse.
  12. Harnessing several dead horses together for increased speed.
  13. Declaring that “No horse is too dead to beat.”
  14. Providing additional funding to increase the horse’s performance.
  15. Do a Cost Analysis study to see if contractors can ride it cheaper.
  16. Purchase a product to make dead horses run faster.
  17. Declare the horse is “better, faster and cheaper” dead.
  18. Form a quality circle to find uses for dead horses.
  19. Revisit the performance requirements for horses.
  20. Say this horse was procured with cost as an independent variable.
  21. Promote the dead horse to a supervisory position.

I will add more as they come to my mind:

22. ask a consultant to provide the dead horse detailed instructions on how to trot
23. ask a consultant to define SLAs to prove that the horse is actually dead and not simply agonizing

(this things come to my mind because I have desperately tried to push a developer to actually deliver something.... had I done it myself it would have cost me a lot less energies)

Sunday, December 4, 2011

nxsd:validation, nxsd:fieldValidation,

the question is risen here

here the official doc

Top-Level Validation -> nxsd:validation="true"

information about the line and column in the native stream where the error was encountered is not provided by top-level validation.

Field-Level Validation -> nxsd:fieldValidation="true"

only on inbound payloads

information about the exact line and character where the error was encountered is displayed.

So, what is the difference between

a) NOT using any validation at JCA level
b) using nxsd:validation="true" in the nXSD file
c) using nxsd:fieldValidation="true" in the nXSD file
d) using both nxsd:validation="true" and nxsd:fieldValidation="true" in the nXSD file

and submitting a file which has a correct structure but a validation error in a field.

In case a), the file passes the JCA adapter and is handed over to the Proxy Service

In case b), the file is rejected in the JCA adapter, with this message:

Error while translating inbound file : spaceattheend.dat

Error: translated xml document does not conform to xml schema.
error:Invalid text 'PAL ' in element: 'UOM'.
Please ensure that native data is correct. To turnoff result validation, unset flag nxsd:validation in nxsd

at oracle.tip.adapter.file.inbound.InboundTranslatorDelegate.xlate(
at oracle.tip.adapter.file.inbound.InboundTranslatorDelegate.doXlate(
at oracle.tip.adapter.file.inbound.ProcessorDelegate.doXlate(
at oracle.tip.adapter.file.inbound.ProcessorDelegate.process(


Sending message to Adapter Framework for rejection to user-configured rejection handlers : {
file=C:\in\spaceattheend.dat, Exception=ORABPEL-11157

Error: translated xml document does not conform to xml schema.
error:Invalid text 'PAL ' in element: 'UOM'.
Please ensure that native data is correct. To turnoff result validation, unset flag nxsd:validation in nxsd


in case c)

you get a similar message, but it shows also the line and column number

Sending message to Adapter Framework for rejection to user-configured rejection handlers : {
file=C:\in\spaceattheend.dat, Exception=ORABPEL-11156

Error: native data read does not conform to xsd type.
actual-value PAL is not valid for data type . Please check before Line=2, Col=1 in the native stream.
Please ensure that native data conforms to xsd type. To turnoff field validation, unset flag nxsd:fieldValidation in nxsd

in case d)

it's same as c)


So, we need to invoke a XML DB service from OSB

I have 2 main alternatives:

Using Native Oracle XML DB Web Services:

use the "JCA DB Adapter" "invoke stored procedure" option

.... more to come ....

Saturday, December 3, 2011

OSB Proxy Services and Transactions

This is a topic on which I still have to experiment a lot.

This is quite interesting.

- If a global transaction already exists, the transport provider propagates it in the request

- if Service Callouts or Publish actions have the outbound quality of service parameter set to best-effort (the default), Oracle Service Bus executes those actions outside of the transaction context. To have Oracle Service Bus execute those actions in the same request transaction context, set quality of service on those actions to exactly-once.

« Publish « is executed in a separate transaction only if the Quality of Service is “best effort”. If you use “exactly once”, the Publish is executed in the same TX

OSB java callout and presenting ProxyService output as HTML

Linking in the excellent post by Chris

you can have your browser interpret as HTML the response of your Proxy Service, by setting the inbound-response transport parameter "Content-Type" to "text/html"

Best Muppet Shows ever Marathon Tree Staring Context Inchworm Song The Beauty Manamana gargoyle min 3:00 Hugga Wagga minute 4.00 conga Miss Piggy in her tantrums I can't see me loving... and Cousbinian Love insults contest minute 4 I am calm inside the phantom of the Muppet Show
English Country Garden marriage song Camelot Greek dance  Beethoven sleeping  Camel dancing prairie dogs sixty seconds the meaning and purpose of life Boogie in the barnyard when you think you hit the bottom Vikings in the Navy

Examining WebLogic embedded LDAP files with Apache Active Directory

Install Apache Active Directory

You can open either




they should be identical (if they are not, be worried)

you will find something along this line:

(domain, realm, groups, people)

dn: dc=prod_domain
dc: prod_domain
objectclass: top
objectclass: domain
orclguid: D4F9FF20F2B911E0BF1ED596F66B2A93
createTimestamp: 201109092101Z
creatorsName: cn=Admin

dn: ou=myrealm,dc=prod_domain
ou: myrealm
objectclass: top
objectclass: organizationalUnit
orclguid: D4FD8190F2B911E0BF1ED596F66B2A93
createTimestamp: 201109092101Z
creatorsName: cn=Admin

dn: ou=groups,ou=myrealm,dc=prod_domain
ou: groups
objectclass: organizationalUnit
objectclass: top
orclguid: D4FDCFB0F2B911E0BF1ED596F66B2A93
createTimestamp: 201109092101Z
creatorsName: cn=Admin

dn: ou=people,ou=myrealm,dc=prod_domain
ou: people
objectclass: organizationalUnit
objectclass: top
orclguid: D4FDF6C0F2B911E0BF1ED596F66B2A93
createTimestamp: 201109092101Z
creatorsName: cn=Admin

dn: cn=ALSBSystemGroup,ou=groups,ou=myrealm,dc=prod_domain
memberURL: ldap:///ou=groups,ou=myrealm,dc=prod_domain??sub?(&(objectclass=person)(wlsMemberOf=cn=ALSBSystemGroup,ou=groups,ou=myrealm,dc=prod_domain))
description: The ALSBSystemGroup is a built-in group which has access to ALSBs internals artifacts
objectclass: top
objectclass: groupOfUniqueNames
objectclass: groupOfURLs
cn: ALSBSystemGroup
orclguid: D4FF0830F2B911E0BF1ED596F66B2A93
createTimestamp: 201109092101Z
creatorsName: cn=Admin

follow list of all groups

then the users will appear:

dn: uid=OracleSystemUser,ou=people,ou=myrealm,dc=prod_domain
description: Oracle application software system user.
objectclass: inetOrgPerson
objectclass: organizationalPerson
objectclass: person
objectclass: top
objectclass: wlsUser
cn: OracleSystemUser
sn: OracleSystemUser
userpassword:: e3NzaGF9dEFnSFNTS25IMk54WjJhOUNkUGNGaGdTMm1LWUFxcms=
uid: OracleSystemUser
wlsMemberOf: cn=OracleSystemGroup,ou=groups,ou=myrealm,dc=prod_domain
orclguid: D508CC30F2B911E0BF1ED596F66B2A93
createTimestamp: 201109092101Z
creatorsName: cn=Admin

dn: uid=alsb-system-user,ou=people,ou=myrealm,dc=prod_domain
description: The ALSB system user is a built-in system account which belongs to the ALSBSystem role. As such it has access to ALSBs internal artifacts. The password for this account is automatically changed when the admin server boots to prevent direct access to this account.
objectclass: inetOrgPerson
objectclass: organizationalPerson
objectclass: person
objectclass: top
objectclass: wlsUser
cn: alsb-system-user
sn: alsb-system-user
uid: alsb-system-user
wlsMemberOf: cn=ALSBSystemGroup,ou=groups,ou=myrealm,dc=prod_domain
orclguid: D5091A50F2B911E0BF1ED596F66B2A93
createTimestamp: 201109092101Z
creatorsName: cn=Admin
userpassword:: e3NzaGF9UVhWVUVOSzN4VFRsUSs1REVWdWpvRFhKbU83K29VMXo=
modifyTimeStamp: 201110231247Z
modifiersName: cn=Admin

dn: uid=weblogic,ou=people,ou=myrealm,dc=prod_domain
description: This user is the default administrator.
objectclass: inetOrgPerson
objectclass: organizationalPerson
objectclass: person
objectclass: top
objectclass: wlsUser
cn: weblogic
sn: weblogic
userpassword:: e3NzaGF9bVo2RlJqazM1cXJFOFpSbXVlVUdRWUNwQmluUXptUFE=
uid: weblogic
wlsMemberOf: cn=Administrators,ou=groups,ou=myrealm,dc=prod_domain
orclguid: D5096870F2B911E0BF1ED596F66B2A93
createTimestamp: 201109092101Z
creatorsName: cn=Admin

how fascinating...just kidding.

OSB move remote file with JCA FTP Adapter

A common requirement is to add a bit of transactional behavior in FTP operations:


- FTP file1 to remote dir /path/to/myfiles
- FTP file2 to remote dir /path/to/myfiles
- tell remote system that he can start processing file1 and file2

If FTP of file2 fails, you don't want to leave file1 hanging around.
So you should add a fastidious compensation action in the Error Handler of "FTP file2" to undo the "FTP file1" operation.
Also, fastidiously the file could be picked up by remote system before I end transferring it (it should not happen, I guess it depends on the FTP server implementation, it's just one extra concern I have).

This clearly sucks.

Luckily the Oracle JCA FTP Adapter supports moving remote files.

The FTPMove operation with Type="MOVE" has been successfully tested, using Transport Headers to pass the "file name from" and "to" parameters to the JCA Adapter.

Interestingly enough, you can also COPY and DELETE files remotely.

So our flow will be:

- FTP file1 to remote dir /path/to/myfilestemp
- FTP file2 to remote dir /path/to/myfilestemp
- FTP move file1 to /path/to/myfiles
- FTP move file2 to /path/to/myfiles

Ok you will say "what if - ##FTP move file2 to /path/to/myfiles## fails?".
Well, I guess that can happen....

Animated Powerpoint to illustrate business flows

I have experimented adding PowerPoint animation over the Visio (Gregor Hohpe EAI Stencils) diagrams showing our end-to-end solution.

Just use a Message Icon and show it running along from one component to another, generating side error/tracking messages, being bounced back and replayed, being redirected to an error queue/folder.

Animation adds a great value to your documentation when it comes to dynamically illustrate your business flow.

Thursday, December 1, 2011

OSB, how to get the equivalent of System.currentTimeMillis()


(fn:current-dateTime() - xs:dateTime("1970-01-01T00:00:00-00:00")) div xdt:dayTimeDuration("PT0.001S")

(thanks to Luciano for this)

or do a Custom XPath returning System.currentTimeMillis() from Java.

OSB Console: Another session operation is in progress. Please retry later.

I have seen this problem a number of times.
Two people login with the same credentials, and at the time one activates (or even discard!) a OSB Session, he gets this message.

The only solution known to me is to restart the whole environment.
Possibly you must also delete the session in ${DOMAIN_HOME}/osb/config/sessions
Ideally you should create a WebLogic user per operator, to avoid these kind of issues.