Monday, July 30, 2012

SOAPUI and Web Test automation

you can do automated testcases in SOAPUI wor Web Application, by automatically recording a web experience (using the internal SOAPUI browser) and later adding assertions.
http://www.soapui.org/Web-and-HTTP/getting-started.html

This is how to add assertions once you have recorded the web session







Friday, July 27, 2012

loadui unable to load resource http://dl.javafx.com/1.3/javafx-rt.jnlp

loadui unable to load resource http://dl.javafx.com/1.3/javafx-rt.jnlp

the wrapped exception is

java.net.ConnectException: Connection timed out: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
at com.sun.deploy.net.BasicHttpRequest.doRequest(Unknown Source)
at com.sun.deploy.net.BasicHttpRequest.doRequest(Unknown Source)
at com.sun.deploy.net.BasicHttpRequest.doGetRequest(Unknown Source)
at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getCachedFile(Unknown Source)
at com.sun.javaws.LaunchDownload.downloadExtensionsHelper(Unknown Source)
at com.sun.javaws.LaunchDownload.downloadExtensions(Unknown Source)
at com.sun.javaws.Launcher.prepareLaunchFile(Unknown Source)
at com.sun.javaws.Launcher.prepareAllResources(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.launch(Unknown Source)
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)



The exception is


om.sun.deploy.net.FailedDownloadException: Unable to load resource: http://dl.javafx.com/1.3/javafx-rt.jnlp
at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getCachedFile(Unknown Source)
at com.sun.javaws.LaunchDownload.downloadExtensionsHelper(Unknown Source)
at com.sun.javaws.LaunchDownload.downloadExtensions(Unknown Source)
at com.sun.javaws.Launcher.prepareLaunchFile(Unknown Source)
at com.sun.javaws.Launcher.prepareAllResources(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.launch(Unknown Source)
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)


http://www.loadui.org/installing-loadUI/installation-troubleshooting.html


"The workaround for this is to first install JavaFX SDK 1.3.1 and the install loadUI on a different machine which has an Internet connection, and then copy the installation to the desired computer (the one without a connection). Finally, start loadUI with the loadUItest.bat file."

still working on it.... how sad.... it must be because we are behind a proxy service...

ssh Server refused our key

chmod 600 .ssh/authorized_keys

fixed the issue


don't ask me why the login process is so fussy... they should at least give you a warning or hint or something...

loadui: jar resources in JNLP file are not signed by same certificate

javaws -uninstall

this fixed the problem

Thursday, July 26, 2012

HttpClient and HTTPS

javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated

http://javaskeleton.blogspot.ch/2010/07/avoiding-peer-not-authenticated-with.html (too complicated, and the code doesn't give the imports.... grrrrr....)

http://www.koders.com/java/fid22A749424D86D13C8E8530A62ADC9689E7DC6F67.aspx

org.apache.commons.httpclient.contrib.ssl.EasySSLProtocolSocketFactory "can be used to creats SSL Sockets that accept self-signed certificates"

it's in commons-ssl.jar or not-yet-commons-ssl jar http://juliusdavies.ca/commons-ssl/download.html


I try the

Protocol easyHttps = new Protocol("https", new EasySSLProtocolSocketFactory(), 443);
Protocol.registerProtocol("https", easyHttps);

where Protocol is http://hc.apache.org/httpclient-3.x/apidocs/org/apache/commons/httpclient/protocol/Protocol.html and it's part of commons-httpclient-3.1.jar

This gives a full working example:
https://discursive.atlassian.net/wiki/display/CJCOOK/Accepting+a+Self-Signed+Certificate

and the imports are:

import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.security.GeneralSecurityException;

import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;

import org.apache.commons.httpclient.contrib.ssl.EasySSLProtocolSocketFactory;
import org.apache.commons.httpclient.protocol.Protocol;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.FileEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;


I do this:

DefaultHttpClient httpclient = new DefaultHttpClient();
HttpClient httpclientWrapped = wrapClient(httpclient);

where

public static HttpClient wrapClient(HttpClient base) {
 try {
  SSLContext ctx = SSLContext.getInstance("TLS");
  X509TrustManager tm = new X509TrustManager() {

   @Override
   public void checkClientTrusted(
     java.security.cert.X509Certificate[] arg0, String arg1)
     throws java.security.cert.CertificateException {
    // TODO Auto-generated method stub
    
   }

   @Override
   public void checkServerTrusted(
     java.security.cert.X509Certificate[] arg0, String arg1)
     throws java.security.cert.CertificateException {
    // TODO Auto-generated method stub
    
   }

   @Override
   public java.security.cert.X509Certificate[] getAcceptedIssuers() {
    // TODO Auto-generated method stub
    return null;
   }

  };
  
  ctx.init(null, new TrustManager[]{tm}, null);
  SSLSocketFactory ssf = new SSLSocketFactory(ctx);
  ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
  ClientConnectionManager ccm = base.getConnectionManager();
  SchemeRegistry sr = ccm.getSchemeRegistry();
  sr.register(new Scheme("https", ssf, 443));
  return new DefaultHttpClient(ccm, base.getParams());
 } catch (Exception ex) {
  return null;
 }
} 



(change 443 for your own port)


but I still get
Connection reset at java.net.SocketInputStream.read

Wednesday, July 25, 2012

Waiting to synchronize with other running members of mycluster

If using unicast cluster and WebLogic Servers take a long time to startup, you can check for the message "Waiting to synchronize with other running members of " and see if it corresponds to a silence of 30 seconds.
If this is the case, you can change at cluster level the "Member Warmup Timeout":

"Maximum number of seconds that a cluster member will wait to discover and synchronize with other servers in the cluster. Normally, the member will be able to sync in 30 seconds. If the value of this attribute is higher, that does not necessarily mean that it will take longer for the member to warmup. Instead it defines an upper bound on the time that a server will wait to sync with the servers that it has discovered. If the value is set 0, servers will not attempt to discover other running server in the cluster during server initialization"

Running a Unix shell script from JSP on Tomcat

Let's start with the simplest version of Runtime.exec()

if I do:

<%
java.lang.Runtime.getRuntime().exec("/home/soa/proton/runme.sh", new String[] {"MYVAR=FANCULON"});

%>


you pass to the script the System variable MYVAR with the value FANCULON

runme.sh contains:
echo $MYVAR > myvar.log

myvar.log ends up in Tomcat bin directory, which is assumed as "current directory" for the script.


I can do better by specifying the current directory for the process with this other version of exec.

So if I do

java.lang.Runtime.getRuntime().exec("/home/soa/proton/runme.sh", new String[] {"MYVAR=FANCULON"}, new java.io.File("/home/soa/proton/"));

the myvar.log is written in /home/soa/proton/

Tuesday, July 24, 2012

WLST (python) find script folder

this will return the folder from which WLST is run, not the script folder:

import os
print os.getcwd()



this seems to return the FULL PATH of the script:
print sys.argv[0]

then with:

import os
print os.path.dirname(sys.argv[0])

you can get the directory

(update: sys.argv[0] contains only the filename, not the full path, if you run WLST from the same location as the script file)

sys.argv[0] = createDatasourcesFromCMDB.py
os.path.dirname(sys.argv[0]) =
os.getcwd()=/home/soa/proton
os.path.realpath(os.path.dirname(sys.argv[0])) = /home/soa/proton

So the only thing that really works under all circumstances is

os.path.realpath(os.path.dirname(sys.argv[0]))

The beauty of LISTAGG

http://www.oracle-base.com/articles/misc/string-aggregation-techniques.php

I have been struggling for a while looking for a way to CHAIN (CONCAT) a column while GROUP BY another column....

Looked into "OVER (PARTITION BY deptno)" ...(oracle analytics)
Looked into STRAGG....

LISTAGG does it in the simplest possible way.

SELECT deptno, LISTAGG(ename, ',') WITHIN GROUP (ORDER BY ename) AS employees FROM emp GROUP BY deptno;

WLST script skeleton

fileName = sys.argv[1] 
print 'Loading properties from ', fileName
propInputStream = FileInputStream(fileName)
configProps = Properties()
configProps.load(propInputStream)

adminURL = configProps.get("admin.url")
adminUserName = configProps.get("admin.userName")
adminPassword = configProps.get("admin.password")

connect(adminUserName, adminPassword, adminURL)
 try:
  edit()
  startEdit()
  
  cd('/')

.... your code here

  validate() 
  save()
  activate()

 except:
   dumpVariables()
   dumpStack()
   print 'Some error message here'
   print ''
   undo('true', 'y')
   cancelEdit('y')

WLST "Product property file not found" and .product.properties

in com.oracle.cie.domain.script.jython.WLScriptContext
it expects a System property "prod.props.file" to be set, and it should point to a directory where a .product.properties property file should be present.


find /opt/oracle -name .product.properties 2> /dev/null

/opt/oracle/fmw11_1_1_5/wlserver_10.3/.product.properties
/opt/oracle/fmw11_1_1_5/coherence_3.6/.product.properties
/opt/oracle/fmw11_1_1_5/oracle_common/.product.properties
/opt/oracle/fmw11_1_1_5_ORI/wlserver_10.3/.product.properties
/opt/oracle/fmw11_1_1_5_ORI/coherence_3.6/.product.properties
/opt/oracle/fmw11_1_1_5_ORI/oracle_common/.product.properties



less /opt/oracle/fmw11_1_1_5/wlserver_10.3/.product.properties

#Mon May 07 22:37:48 CEST 2012
JAVA_HOME=/usr/lib/jvm/java-1.6.0-sun-1.6.0.31.x86_64
javax.xml.parsers.SAXParserFactory=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
USER_LANGUAGE=en
NODEMGR_PORT=5556
WLS_INSTALL_DIR=/opt/oracle/fmw11_1_1_5/wlserver_10.3
COHERENCE_HOME=/opt/oracle/fmw11_1_1_5/coherence_3.6
LOCALE=ccjk
WLS_JAVA_HOME=/usr/lib/jvm/java-1.6.0-sun-1.6.0.31.x86_64
javax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
WL_HOME=/opt/oracle/fmw11_1_1_5/wlserver_10.3
java.vm.version=20.6-b01
MW_HOME=/opt/oracle/fmw11_1_1_5
WLS_JAVA_VENDOR=Sun
weblogic.server.modules.featurejar=/opt/oracle/fmw11_1_1_5/modules/features/weblogic.server.modules_10.3.5.0.jar
javax.xml.transform.TransformerFactory=com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl
PLATFORMHOME=/opt/oracle/fmw11_1_1_5/wlserver_10.3
WLS_PRODUCT_VERSION=10.3.5.0
java.vm.vendor=Sun Microsystems Inc.
BEAHOME=/opt/oracle/fmw11_1_1_5
DOCSWEBROOT=http\://download.oracle.com/docs/cd/E17904_01/web.1111
CONFIGWIZ_HOME=/opt/oracle/fmw11_1_1_5/wlserver_10.3
JAVAHOME=/usr/lib/jvm/java-1.6.0-sun-1.6.0.31.x86_64
ALSB_INSTALL_DIR=/opt/oracle/fmw11_1_1_5/osb

Monday, July 23, 2012

DBMS_SCHEDULER quick tutorial

http://www.oracle-base.com/articles/10g/scheduler-10g.php

http://docs.oracle.com/cd/B19306_01/appdev.102/b14258/d_sched.htm#ARPLS138

Putting into action: let's create a job running every minute to delete all records from the table PIPPO:


CREATE TABLE "PIPPO" ("NAME" VARCHAR2(20 BYTE)) ;

insert into PIPPO values ('A');
insert into PIPPO values ('B');
commit();



then we create a stored procedure to delete records:

create or replace
PROCEDURE MY_JOB_PROCEDURE AS
BEGIN
delete from PIPPO;
END MY_JOB_PROCEDURE;



then I create the job:

BEGIN
DBMS_SCHEDULER.create_job (
job_name => 'test_full_job_definition',
job_type => 'PLSQL_BLOCK',
job_action => 'BEGIN my_job_procedure; END;',
start_date => SYSTIMESTAMP,
repeat_interval => 'freq=MINUTELY; byminute=0; bysecond=0;',
end_date => NULL,
enabled => TRUE,
comments => 'Job defined entirely by the CREATE JOB procedure.');
END;
/

SOAPUI, setting dynamic properties with Groovy

I have a project POCO
and a Test Suite with a TestCase POCOTest

In the TestCase I create a Groovy Script step:


def project = context.testCase.testSuite.project
def tc = context.testCase
log.info project.name
log.info tc.name








see also:

http://www.soapui.org/Scripting-Properties/tips-a-tricks.html


Now, if I want to set a property, I have a choice of TestCase, TestSuite, Project or Global properties.

For instance, to set a new OrderID per each request:

import static java.util.UUID.randomUUID
def tc = context.testCase
uuid = randomUUID().toString()
testRunner.testCase.setPropertyValue( "OrderID", uuid )
log.info testRunner.testCase.getPropertyValue("OrderID")


After execution of this code (click the Run button in the Groovy Step editir), you have:





now you can add other steps AFTER the Groovy Step, and in the XML requests you can put

<ret:OrderUUID>${#TestCase#OrderID}</ret:OrderUUID>


All the Steps will share the same value of OrderID.

Saturday, July 21, 2012

There are more things in a thistle, Horatio, than are dreamt of in your philosophy



Isaac Asimov could not have invented anything more fantastic than a thistle tree

Tuesday, July 17, 2012

XQuery: Binary search on sorted collection

Big problem with XQuery is that - unlike SQL - it doesn't allow you to specify indexes on a collection of elements. All searches are "full table scan". What a pain. Performance becomes ridiculous when the elements of a collection are numerous.

An improvement can be obtained by sorting the collection with a "order by PK" (PK being the field on which you plan to perform your search), and using a recursive binary search on the collection:

xquery version "1.0" encoding "Cp1252";

declare namespace xf = "http://tempuri.org/FindPrice/";


declare function xf:FindPriceBinarySearch($loopDepth as xs:integer, $intProdId as xs:string, $prices as element()*, $startIndex as xs:integer, $endIndex as xs:integer)
    as element() {
        let $middleIndex := xs:integer(  xs:integer(($endIndex - $startIndex) div 2) + xs:integer($startIndex)) 
        let $middleElement := $prices[$middleIndex]
        let $middleProductId := $middleElement/product_id/text()
        return
        if ($loopDepth < 15 and $middleProductId < $intProdId) then
         xf:FindPriceBinarySearch($loopDepth + 1, $intProdId, $prices, $middleIndex, $endIndex)
        else if ($loopDepth < 15 and $middleProductId > $intProdId) then
           xf:FindPriceBinarySearch($loopDepth+ 1, $intProdId, $prices, $startIndex, $middleIndex)
        else
         $middleElement
          
};

declare function xf:FindPrice($intProdId as xs:string, $prices as element())
    as element() {
        xf:FindPriceBinarySearch(0, $intProdId, $prices//price, 1, count($prices//price))
};

declare variable $product_id as xs:string external;
declare variable $prices as element() external;

xf:FindPrice($product_id, $prices)


this xquery will ALMOST work (I know it doesn't find elements at the end of the collection :o( ), the input being:


<prices>
<price>
<product_id>AAA</product_id>
</price>
<price>
<product_id>BBB</product_id>
</price>
</prices>

Monday, July 16, 2012

How to tie a tie


never tie a tie with the simple "four-in-hand knot", it's too sloppy... the Windsor node is much cooler.

Sunday, July 15, 2012

Genius Loci

This fantastic dog I met today high on the mountains. He is an old cow-dog, spent all his life on the pastures near to the sky.

He reminds me an old devil like the ones depicted in Dante's Divina Commedia, or one of those wild spirits in some Middle Age novel...

Saturday, July 14, 2012

OSB: how to clean a variable from empty elements and attributes

often the result of a transformation is to create empty non-mandatory elements and variables.
if you are bothered by them, run this:

delete path //*[not(node()) and not(.//@*)] in variable myvar

The jar that is being imported is an unsupported version of the product. The version was 11.1.1.6

oh oh, a project developed in OSB 11.1.1.6 cannot be imported in OSB 11.1.1.5....


Invalid configuration file java.lang.IllegalArgumentException: The jar that is being imported is an unsupported version of the product. The version was 11.1.1.6. Supported versions are: 10.3.0.0.dev2, 2.6.0, 3.0.dev2, 2.6.1, 3.0.dev1, 3.0.0, 3.0, 2.6.dev5, 10.3.0.0, 2.6, 2.6.dev4, 2.6.dev3, 2.6.dev2, 2.6.dev1, 11.1.1.2, 11.1.1.3, 11.1.1.4, 11.1.1.5, 10.3.2.0.dev.1, 10.3.2.0.dev.2, 10.3.1.0, 10.3.2.0.dev.3, 3.2.dev1, 3.2.dev2, 11.1.1.2.dev.1, 11.1.1.2.dev.2,

XmlObject Arrays in OSB Custom XPaths

I have lost 20 minutes to find out that, if you return a XmlObject[] in your Java function, in the customxpath.xml descriptor you should put
[Lorg.apache.xmlbeans.XmlObject;
and not
Lorg.apache.xmlbeans.XmlObject;

as the official doc might seem to suggest

osb sample xquery

Since I always need an XQuery skeleton and I am too lazy to run Eclipse, here is one:

xquery version "1.0" encoding "Cp1252";
(:: pragma  parameter="$anyType1" type="xs:anyType" ::)
(:: pragma  type="xs:anyType" ::)

declare namespace xf = "http://tempuri.org/OSB%20Project%201/Sample/";

declare function xf:Sample($anyType1 as element(*))
    as element(*) {
        {count($anyType1)}
};

declare variable $anyType1 as element(*) external;

xf:Sample($anyType1)

ConcurrentHashMap and MultiValueMap - a Map with multiple values per key

a ConcurrentHashMap can only associate 1 value to 1 key:

map.put("a", "bla");
map.put("a", "blu");
map.get("a") will return only "blu".

If I want map.get("a") to return ("bla", "blu") I must use a MultiValueMap to decorate a ConcurrentHashMap

or you can use a Google Collections (Guava) Multimap such as a ArrayListMultimap


Otherwise, if like me you like brewing your own framework, you can decorate yourself a ConcurrentHashmap:


import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;

import org.apache.xmlbeans.XmlObject;

public class ArrayListMultimap {

 private ConcurrentHashMap<String, List> theMap = new ConcurrentHashMap<String, List<XmlObject>>();
 
 public static ArrayListMultimap create(int i, int j) {
  return new ArrayListMultimap();
 }
 
 public List<XmlObject> put(String key, XmlObject value) {
  List<XmlObject> previousvalue = (List<XmlObject>)theMap.get(key);
  if (previousvalue == null) {
   previousvalue = new ArrayList<XmlObject>();
   previousvalue.add(value);
   theMap.put(key, previousvalue);
  }
  return previousvalue;
 }

 public int size() {
  return theMap.size();
 }

}

Friday, July 13, 2012

java-content in OSB XQuery

http://docs.oracle.com/cd/E23943_01/admin.1111/e15867/context.htm#i1106669

The content's metadata (that is, its key) can be handled as any other XML, for example in an XQuery such as $pojo/java-content/@ref. This may be useful for logging or debugging, but the content of the object cannot be directly accessed.


The reference to the Java object cannot be passed to an XQuery, who can in turn pass it to a Custom XPath for further manipulation in Java????

A practical case; I have a Java Callout creating a Java object for me:

public static ConcurrentHashMap createPriceMap() {
ConcurrentHashMap result = new ConcurrentHashMap();
return result ;
}

I assign it to a $mymap variable; if I log $mymap I get:

<con:java-content ref="jcid:72c9f10e:1387982c6c6:-7fb8" xmlns:con="http://www.bea.com/wli/sb/context"/>


Yet I can pass this $mymap as input parameter to other Java Callouts, no tricks, no problem.

Yet it seems that in XQuery there is not a specific syntax to pass $mymap...not a way to get a reference to the pipeline context to retrieve the Java object based on its ref. how sad.

A workaround could be to store the Java Object in a global hashmap, accessible through a Java static method, using the java-content ref as a key, and remember to remove it otherwise it will leak memory...

Thursday, July 12, 2012

WebLogic doesn't utilize all available CPUs

I run 15 client threads, but only 2 CPU are 100% used, the others 22 are completely idle.


I run this code to check if anything is wrong:

public class MultiThreadCPUEater implements Runnable {
    public static void main(String[] args) {
        for (int i = 0; i < 8; i++) {
            MultiThreadCPUEater multiThreadCPUEater = new MultiThreadCPUEater();
            Thread thread = new Thread(multiThreadCPUEater);
            thread.start();
        }
    }

    @Override
    public void run() {
        for (;;) {
        }
    }
}

I run top, press 1 and...
Cpu0  :100.0%us,  0.0%sy,  0.0%ni,  0.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu1  :100.0%us,  0.0%sy,  0.0%ni,  0.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu2  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu3  :100.0%us,  0.0%sy,  0.0%ni,  0.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu4  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu5  :100.0%us,  0.0%sy,  0.0%ni,  0.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu6  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu7  :100.0%us,  0.0%sy,  0.0%ni,  0.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu8  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu9  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu10 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu11 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu12 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu13 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu14 :100.0%us,  0.0%sy,  0.0%ni,  0.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu15 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu16 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu17 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu18 :100.0%us,  0.0%sy,  0.0%ni,  0.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu19 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu20 :100.0%us,  0.0%sy,  0.0%ni,  0.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu21 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu22 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu23 :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st


8 CPUs are completely hogged! Cool!


So, why WebLogic is using only 2??? Investigating....

visual vm unable to connect to jvm

http://docs.oracle.com/javase/6/docs/technotes/guides/visualvm/index.html

I can see the java processes running, but I can't connect to them by runnning jvisualvm on the same box as the java process.

So I try:
./jinfo 10248
Attaching to process ID 10248, please wait...
Error attaching to process: sun.jvm.hotspot.debugger.DebuggerException: Can't attach to the process

All of a sudden I realize that I was logged in with a different Unix login as the Java process.... logging in with the same Unix user and then running jvisualvm fixed the problem.

Putty blue is too dark to see

knock knock knocking on heaven's door...

we have 2 files: /etc/DIR_COLORS /etc/DIR_COLORS.xterm TERM envvar should be "linux" echo $TERM xterm mkdir ~/.dircolors cp /etc/DIR_COLORS $HOME/.dircolors this was quite useless, it simply put me in a b/w mode. https://www.linux.com/community/blogs/127-personal/26944
Category: Window > Colours and select ANSI Blue in the Select a colour to adjust to Red:74 Green:74 Blue:255. I do the same for ANSI Blue Bold to Red:140 Green:140 Blue:255

This sort of works.

SOAPUI and Groovy

Here the official doc, specifically the Property Expansion scripts.




your first script can be:
testRunner.runTestStepByName( "FindDescription" )


This PPT contains useful examples

OSB WebLogic Deployment Plan and deployment name

Excellent article here:

https://blogs.oracle.com/jamesbayer/entry/11gr1_update_and_a_deployment

I create a JMS Proxy Service (reading messages from a JMS queue), and this generates a C:\bea1035\user_projects\domains\dev_domain\sbgen_ALSB_1342038
918975.ear file.

I run the plan generator on it:


C:\bea1035\user_projects\domains\dev_domain\sbgen>..\bin\setDomainEnv.cmd
C:\bea1035\user_projects\domains\dev_domain>cd sbgen

C:\bea1035\user_projects\domains\dev_domain\sbgen>java weblogic.PlanGenerator -all -plan Plan_ALSB_1342038918975.xml _ALSB_1342038
918975.ear
Generating plan for application _ALSB_1342038918975.ear
Export option is: all
<11-Jul-2012 22:37:30 o'clock CEST> <Warning> <Munger> <BEA-2156203> <A version attribute was not found in element application in
the deployment descriptor in c:\Temp\.appmergegen_1342039050034__ALSB_1342038918975.ear/META-INF/application.xml. A version attrib
ute is required, but this version of the Weblogic Server will assume that the JEE5 is used. Future versions of the Weblogic Server
will reject descriptors that do not specify the JEE version.>
<11-Jul-2012 22:37:33 o'clock CEST> <Warning> <Munger> <BEA-2156203> <A version attribute was not found in element ejb-jar in the
deployment descriptor in c:\Temp\.appmergegen_1342039050034__ALSB_1342038918975.ear\ejb.jar/META-INF/ejb-jar.xml. A version attrib
ute is required, but this version of the Weblogic Server will assume that the JEE5 is used. Future versions of the Weblogic Server
will reject descriptors that do not specify the JEE version.>
Exporting properties...
Saving plan to C:\bea1035\user_projects\domains\dev_domain\sbgen\Plan_ALSB_1342038918975.xml...
<11-Jul-2012 22:37:34 o'clock CEST> <Info> <J2EE Deployment SPI> <BEA-260072> <Saved configuration for application, _ALSB_13420389
18975.ear>


This is what gets generated by the PlanGenerator:



  _ALSB_1342038918975.ear
  
    
      ResourceDescription_jms/QueueName_ResourceLink_13420390539690
      
    
    
      ResourceDescription_jms/QueueName_JNDIName_13420390539711
      
    
    
      WeblogicEnterpriseBean_RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7_RunAsPrincipalName_13420390539712
      
    
    
      WeblogicEnterpriseBean_RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7_NetworkAccessPoint_13420390539723
      
    
    
      WeblogicEnterpriseBean_RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7_DispatchPolicy_13420390539724
      
    
    
      WeblogicEnterpriseBean_RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7_PassivateAsPrincipalName_13420390539725
      
    
    
      WeblogicEnterpriseBean_RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7_JNDIName_13420390539736
      
    
    
      WeblogicEnterpriseBean_RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7_RemoveAsPrincipalName_13420390539737
      
    
    
      WeblogicEnterpriseBean_RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7_LocalJNDIName_13420390539738
      
    
    
      WeblogicEnterpriseBean_RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7_CreateAsPrincipalName_13420390539739
      
    
    
      Pool_MaxBeansInFreePool_134203905397410
      
    
    
      Pool_IdleTimeoutSeconds_134203905397411
      
    
    
      TransactionDescriptor_TransTimeoutSeconds_134203905397412
      
    
    
      ResourceDescription_jms/ConnectionFactory_ResourceLink_134203905397413
      
    
    
      ResourceDescription_jms/ConnectionFactory_JNDIName_134203905397514
      
    
    
      MessageDrivenDescriptor_ConnectionFactoryResourceLink_134203905397515
      
    
    
      MessageDrivenDescriptor_DurableSubscriptionDeletion_134203905397516
      
    
    
      MessageDrivenDescriptor_DistributedDestinationConnection_134203905397517
      
    
    
      MessageDrivenDescriptor_DestinationResourceLink_134203905397618
      
    
    
      MessageDrivenDescriptor_DestinationJNDIName_134203905398119
      
    
    
      MessageDrivenDescriptor_JmsPollingIntervalSeconds_134203905398120
      
    
    
      MessageDrivenDescriptor_MaxSuspendSeconds_134203905398121
      
    
    
      MessageDrivenDescriptor_ProviderUrl_134203905398222
      
    
    
      MessageDrivenDescriptor_ResourceAdapterJNDIName_134203905398223
      
    
    
      MessageDrivenDescriptor_Use81StylePolling_134203905398224
      
    
    
      MessageDrivenDescriptor_JmsClientId_134203905398225
      
    
    
      MessageDrivenDescriptor_GenerateUniqueJmsClientId_134203905398226
      
    
    
      MessageDrivenDescriptor_InitSuspendSeconds_134203905398327
      
    
    
      MessageDrivenDescriptor_InitialContextFactory_134203905398328
      
    
    
      MessageDrivenDescriptor_MaxMessagesInTransaction_134203905398329
      
    
    
      MessageDrivenDescriptor_ConnectionFactoryJNDIName_134203905398330
      
    
    
      WeblogicEjbJar_WorkManagers_134203905398431
      
    
    
      SessionDescriptor_DebugEnabled_134203905400332
      
    
    
      SessionDescriptor_CookieMaxAgeSecs_134203905400333
      
    
    
      SessionDescriptor_InvalidationIntervalSecs_134203905400334
      
    
    
      SessionDescriptor_TimeoutSecs_134203905400435
      
    
    
      SessionDescriptor_MonitoringAttributeName_134203905400436
      
    
    
      SessionDescriptor_MaxInMemorySessions_134203905400437
      
    
    
      WeblogicApplication_FairShareRequests_134203905400438
      
    
    
      WeblogicApplication_ResponseTimeRequests_134203905400439
      
    
    
      WeblogicApplication_WorkManagers_134203905400440
      
    
    
      WeblogicApplication_ApplicationAdminModeTrigger_134203905400441
      
    
    
      WeblogicApplication_Capacities_134203905400442
      
    
    
      WeblogicApplication_ContextRequests_134203905400543
      
    
    
      WeblogicApplication_MinThreadsConstraints_134203905400544
      
    
    
      WeblogicApplication_ApplicationParams_134203905400545
      
    
    
      WeblogicApplication_MaxThreadsConstraints_134203905400546
      
    
    
      ApplicationParam_service-ref_ParamValue_134203905400547
      
    
    
      WLDFHarvester_null_Enabled_134203905401848
      
    
    
      WLDFHarvester_null_HarvestedTypes_134203905401849
      
    
    
      WLDFHarvester_null_SamplePeriod_134203905401850
      
    
    
      WLDFInstrumentation_null_Includes_134203905401951
      
    
    
      WLDFInstrumentation_null_Enabled_134203905401952
      
    
    
      WLDFInstrumentation_null_WLDFInstrumentationMonitors_134203905401953
      
    
    
      WLDFInstrumentation_null_Excludes_134203905401954
      
    
    
      WLDFWatchNotification_null_Enabled_134203905402155
      
    
    
      WLDFWatchNotification_null_Severity_134203905402156
      
    
    
      WLDFWatchNotification_null_SMTPNotifications_134203905402157
      
    
    
      WLDFWatchNotification_null_Watches_134203905402158
      
    
    
      WLDFWatchNotification_null_SNMPNotifications_134203905402159
      
    
    
      WLDFWatchNotification_null_JMSNotifications_134203905402160
      
    
    
      WLDFWatchNotification_null_ImageNotifications_134203905402161
      
    
    
      WLDFWatchNotification_null_LogWatchSeverity_134203905402262
      
    
    
      WLDFWatchNotification_null_JMXNotifications_134203905402263
      
    
  
  
    _ALSB_1342038918975.ear
    ear
    
      weblogic-application
      META-INF/weblogic-application.xml
      
        SessionDescriptor_DebugEnabled_134203905400332
        /weblogic-application/session-descriptor/debug-enabled
      
      
        SessionDescriptor_CookieMaxAgeSecs_134203905400333
        /weblogic-application/session-descriptor/cookie-max-age-secs
      
      
        SessionDescriptor_InvalidationIntervalSecs_134203905400334
        /weblogic-application/session-descriptor/invalidation-interval-secs
      
      
        SessionDescriptor_TimeoutSecs_134203905400435
        /weblogic-application/session-descriptor/timeout-secs
      
      
        SessionDescriptor_MonitoringAttributeName_134203905400436
        /weblogic-application/session-descriptor/monitoring-attribute-name
      
      
        SessionDescriptor_MaxInMemorySessions_134203905400437
        /weblogic-application/session-descriptor/max-in-memory-sessions
      
      
        WeblogicApplication_FairShareRequests_134203905400438
        /weblogic-application/fair-share-request
      
      
        WeblogicApplication_ResponseTimeRequests_134203905400439
        /weblogic-application/response-time-request
      
      
        WeblogicApplication_WorkManagers_134203905400440
        /weblogic-application/work-manager
      
      
        WeblogicApplication_ApplicationAdminModeTrigger_134203905400441
        /weblogic-application/application-admin-mode-trigger
      
      
        WeblogicApplication_Capacities_134203905400442
        /weblogic-application/capacity
      
      
        WeblogicApplication_ContextRequests_134203905400543
        /weblogic-application/context-request
      
      
        WeblogicApplication_MinThreadsConstraints_134203905400544
        /weblogic-application/min-threads-constraint
      
      
        WeblogicApplication_ApplicationParams_134203905400545
        /weblogic-application/application-param
      
      
        WeblogicApplication_MaxThreadsConstraints_134203905400546
        /weblogic-application/max-threads-constraint
      
      
        ApplicationParam_service-ref_ParamValue_134203905400547
        /weblogic-application/application-param/[param-name="service-ref"]/param-value
      
    
    
      application
      META-INF/application.xml
    
    
      wldf-resource
      META-INF/weblogic-diagnostics.xml
      
        WLDFHarvester_null_Enabled_134203905401848
        /wldf-resource/harvester/enabled
      
      
        WLDFHarvester_null_HarvestedTypes_134203905401849
        /wldf-resource/harvester/harvested-type
      
      
        WLDFHarvester_null_SamplePeriod_134203905401850
        /wldf-resource/harvester/sample-period
      
      
        WLDFInstrumentation_null_Includes_134203905401951
        /wldf-resource/instrumentation/include
      
      
        WLDFInstrumentation_null_Enabled_134203905401952
        /wldf-resource/instrumentation/enabled
      
      
        WLDFInstrumentation_null_WLDFInstrumentationMonitors_134203905401953
        /wldf-resource/instrumentation/wldf-instrumentation-monitor
      
      
        WLDFInstrumentation_null_Excludes_134203905401954
        /wldf-resource/instrumentation/exclude
      
      
        WLDFWatchNotification_null_Enabled_134203905402155
        /wldf-resource/watch-notification/enabled
      
      
        WLDFWatchNotification_null_Severity_134203905402156
        /wldf-resource/watch-notification/severity
      
      
        WLDFWatchNotification_null_SMTPNotifications_134203905402157
        /wldf-resource/watch-notification/smtp-notification
      
      
        WLDFWatchNotification_null_Watches_134203905402158
        /wldf-resource/watch-notification/watche
      
      
        WLDFWatchNotification_null_SNMPNotifications_134203905402159
        /wldf-resource/watch-notification/snmp-notification
      
      
        WLDFWatchNotification_null_JMSNotifications_134203905402160
        /wldf-resource/watch-notification/jms-notification
      
      
        WLDFWatchNotification_null_ImageNotifications_134203905402161
        /wldf-resource/watch-notification/image-notification
      
      
        WLDFWatchNotification_null_LogWatchSeverity_134203905402262
        /wldf-resource/watch-notification/log-watch-severity
      
      
        WLDFWatchNotification_null_JMXNotifications_134203905402263
        /wldf-resource/watch-notification/jmx-notification
      
    
  
  
    ejb.jar
    ejb
    
      weblogic-ejb-jar
      META-INF/weblogic-ejb-jar.xml
      
        ResourceDescription_jms/QueueName_ResourceLink_13420390539690
        /weblogic-ejb-jar/weblogic-enterprise-bean/[ejb-name="RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7"]/resource-description/[res-ref-name="jms/QueueName"]/resource-link
      
      
        ResourceDescription_jms/QueueName_JNDIName_13420390539711
        /weblogic-ejb-jar/weblogic-enterprise-bean/[ejb-name="RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7"]/resource-description/[res-ref-name="jms/QueueName"]/jndi-name
      
      
        WeblogicEnterpriseBean_RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7_RunAsPrincipalName_13420390539712
        /weblogic-ejb-jar/weblogic-enterprise-bean/[ejb-name="RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7"]/run-as-principal-name
      
      
        WeblogicEnterpriseBean_RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7_NetworkAccessPoint_13420390539723
        /weblogic-ejb-jar/weblogic-enterprise-bean/[ejb-name="RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7"]/network-access-point
      
      
        WeblogicEnterpriseBean_RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7_DispatchPolicy_13420390539724
        /weblogic-ejb-jar/weblogic-enterprise-bean/[ejb-name="RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7"]/dispatch-policy
      
      
        WeblogicEnterpriseBean_RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7_PassivateAsPrincipalName_13420390539725
        /weblogic-ejb-jar/weblogic-enterprise-bean/[ejb-name="RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7"]/passivate-as-principal-name
      
      
        WeblogicEnterpriseBean_RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7_JNDIName_13420390539736
        /weblogic-ejb-jar/weblogic-enterprise-bean/[ejb-name="RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7"]/jndi-name
      
      
        WeblogicEnterpriseBean_RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7_RemoveAsPrincipalName_13420390539737
        /weblogic-ejb-jar/weblogic-enterprise-bean/[ejb-name="RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7"]/remove-as-principal-name
      
      
        WeblogicEnterpriseBean_RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7_LocalJNDIName_13420390539738
        /weblogic-ejb-jar/weblogic-enterprise-bean/[ejb-name="RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7"]/local-jndi-name
      
      
        WeblogicEnterpriseBean_RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7_CreateAsPrincipalName_13420390539739
        /weblogic-ejb-jar/weblogic-enterprise-bean/[ejb-name="RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7"]/create-as-principal-name
      
      
        Pool_MaxBeansInFreePool_134203905397410
        /weblogic-ejb-jar/weblogic-enterprise-bean/[ejb-name="RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7"]/message-driven-descriptor/pool/max-beans-in-free-pool
      
      
        Pool_IdleTimeoutSeconds_134203905397411
        /weblogic-ejb-jar/weblogic-enterprise-bean/[ejb-name="RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7"]/message-driven-descriptor/pool/idle-timeout-seconds
      
      
        TransactionDescriptor_TransTimeoutSeconds_134203905397412
        /weblogic-ejb-jar/weblogic-enterprise-bean/[ejb-name="RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7"]/transaction-descriptor/trans-timeout-seconds
      
      
        ResourceDescription_jms/ConnectionFactory_ResourceLink_134203905397413
        /weblogic-ejb-jar/weblogic-enterprise-bean/[ejb-name="RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7"]/resource-description/[res-ref-name="jms/ConnectionFactory"]/resource-link
      
      
        ResourceDescription_jms/ConnectionFactory_JNDIName_134203905397514
        /weblogic-ejb-jar/weblogic-enterprise-bean/[ejb-name="RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7"]/resource-description/[res-ref-name="jms/ConnectionFactory"]/jndi-name
      
      
        MessageDrivenDescriptor_ConnectionFactoryResourceLink_134203905397515
        /weblogic-ejb-jar/weblogic-enterprise-bean/[ejb-name="RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7"]/message-driven-descriptor/connection-factory-resource-link
      
      
        MessageDrivenDescriptor_DurableSubscriptionDeletion_134203905397516
        /weblogic-ejb-jar/weblogic-enterprise-bean/[ejb-name="RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7"]/message-driven-descriptor/durable-subscription-deletion
      
      
        MessageDrivenDescriptor_DistributedDestinationConnection_134203905397517
        /weblogic-ejb-jar/weblogic-enterprise-bean/[ejb-name="RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7"]/message-driven-descriptor/distributed-destination-connection
      
      
        MessageDrivenDescriptor_DestinationResourceLink_134203905397618
        /weblogic-ejb-jar/weblogic-enterprise-bean/[ejb-name="RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7"]/message-driven-descriptor/destination-resource-link
      
      
        MessageDrivenDescriptor_DestinationJNDIName_134203905398119
        /weblogic-ejb-jar/weblogic-enterprise-bean/[ejb-name="RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7"]/message-driven-descriptor/destination-jndi-name
      
      
        MessageDrivenDescriptor_JmsPollingIntervalSeconds_134203905398120
        /weblogic-ejb-jar/weblogic-enterprise-bean/[ejb-name="RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7"]/message-driven-descriptor/jms-polling-interval-seconds
      
      
        MessageDrivenDescriptor_MaxSuspendSeconds_134203905398121
        /weblogic-ejb-jar/weblogic-enterprise-bean/[ejb-name="RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7"]/message-driven-descriptor/max-suspend-seconds
      
      
        MessageDrivenDescriptor_ProviderUrl_134203905398222
        /weblogic-ejb-jar/weblogic-enterprise-bean/[ejb-name="RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7"]/message-driven-descriptor/provider-url
      
      
        MessageDrivenDescriptor_ResourceAdapterJNDIName_134203905398223
        /weblogic-ejb-jar/weblogic-enterprise-bean/[ejb-name="RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7"]/message-driven-descriptor/resource-adapter-jndi-name
      
      
        MessageDrivenDescriptor_Use81StylePolling_134203905398224
        /weblogic-ejb-jar/weblogic-enterprise-bean/[ejb-name="RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7"]/message-driven-descriptor/use81-style-polling
      
      
        MessageDrivenDescriptor_JmsClientId_134203905398225
        /weblogic-ejb-jar/weblogic-enterprise-bean/[ejb-name="RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7"]/message-driven-descriptor/jms-client-id
      
      
        MessageDrivenDescriptor_GenerateUniqueJmsClientId_134203905398226
        /weblogic-ejb-jar/weblogic-enterprise-bean/[ejb-name="RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7"]/message-driven-descriptor/generate-unique-jms-client-id
      
      
        MessageDrivenDescriptor_InitSuspendSeconds_134203905398327
        /weblogic-ejb-jar/weblogic-enterprise-bean/[ejb-name="RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7"]/message-driven-descriptor/init-suspend-seconds
      
      
        MessageDrivenDescriptor_InitialContextFactory_134203905398328
        /weblogic-ejb-jar/weblogic-enterprise-bean/[ejb-name="RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7"]/message-driven-descriptor/initial-context-factory
      
      
        MessageDrivenDescriptor_MaxMessagesInTransaction_134203905398329
        /weblogic-ejb-jar/weblogic-enterprise-bean/[ejb-name="RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7"]/message-driven-descriptor/max-messages-in-transaction
      
      
        MessageDrivenDescriptor_ConnectionFactoryJNDIName_134203905398330
        /weblogic-ejb-jar/weblogic-enterprise-bean/[ejb-name="RequestEJB-8889852126214353195--458f8ecd.13877990470.-7fd7"]/message-driven-descriptor/connection-factory-jndi-name
      
      
        WeblogicEjbJar_WorkManagers_134203905398431
        /weblogic-ejb-jar/work-manager
      
    
    
      ejb-jar
      META-INF/ejb-jar.xml
    
  
  c:\Temp\pierre\.\config\deployments\_ALSB_1342038918975.ear\plan






Here the schema of application.xml http://java.sun.com/xml/ns/javaee/application_5.xsd
(namespace http://java.sun.com/xml/ns/javaee)
which includes http://java.sun.com/xml/ns/javaee/javaee_5.xsd

Here is the deployment plan XSD http://www.oracle.com/webfolder/technetwork/weblogic/deployment-plan/1.0/deployment-plan.xsd

The display-name in the application.xml is not used.
The application-name in the deployment plan is not considered... the XSD says "application-name: A name associated with the application. This value may be used as the application''s deployed name if not provided through deployment options."

(notice the MAY be used)

Finally the only way I managed to change the application name is hacking in the config.xml the deployment name (I wrote PICIONE instead of ALSB_1342038918975):


PICIONE
AdminServer
ear
sbgen\_ALSB_1342038918975.ear
osb\config\plan
Plan-_ALSB_1342038918975.ear.xml
DDOnly
nostage


and lo and behold:



One should investigate HOW OSB internally generates the deployment name for the Proxy Service.

You can deploy with WLST and choose a deployment name
http://docs.oracle.com/cd/E13222_01/wls/docs90/config_scripting/reference.html#1024285


in WLST:
cd AppDeployments
cd PICIONE
ls
-r-- ApplicationIdentifier PICIONE
-r-- ApplicationName PICIONE
-rw- Name PICIONE

if I do
edit()
startEdit()
cd AppDeployments/PICIONE
cmo.setName('FROCIONE')

I get:
javax.management.InvalidAttributeValueException: The Name attribute cannot be modified after the MBean dev_domain:Name=PICIONE,Type=AppDeployment has been created.

so I do
undeploy('PICIONE')
activate()

deploy('FROCIONE', 'C:/bea1035/user_projects/domains/dev_domain/sbgen/_ALSB_1342038918975.ear')

(I should still provide target and deployment plan - the staging mode for OSB projects is nostage)

and I have changed the Deployment Name!

Something like
deploy('CAZZONE', 'C:/bea1035/user_projects/domains/dev_domain/sbgen/_ALSB_1342067495702.ear', 'AdminServer', 'nostage', 'C:/bea1035/user_projects/domains/dev_domain/osb/config/plan/Plan-_ALSB_1342067495702.ear.xml')

is more complete

Wednesday, July 11, 2012

windows explorer disable drag and drop

I am amazed about how stupid Microsoft can be - this functionality is a KILLER bee and has costed many a lot of pain. Yet there doesn't seem to be an easy (or even difficult) way to disable drag and drop in Windows Explorer.

Windows sucks. Big time. I HATE every Microsoft product, even Excel after they have redesigned the menus. I used to love Excel but Microsoft managed to turn it into a freak.

WLST: The CompatabilityMBeanServer is not initialized properly

wls:/offline> connect('Pierluigi', 'weblogic1', 't3://acme.com:7001')
Connecting to t3://acme:7001 with userid Pierluigi ...

The CompatabilityMBeanServer is not initialized properly.
This might happen if the CompatabilityMBeanServer is
disabled via the JMXMBean.

To view the root cause exception use dumpStack()

WLST detected that the RuntimeMBeanServer is not enabled. This

might happen if the RuntimeMBeanServer is disabled via the JMXMBean.
Please ensure that this MBeanServer is enabled. Online WLST cannot
function without this MBeanServer.
Traceback (innermost last):
File "", line 1, in ?
File "", line 22, in connect
File "", line 646, in raiseWLSTException
WLSTException: Error occured while performing connect : "Cannot connect to WLST." : Bad IPv6 address: acme.com
Use dumpStack() to view the full stacktrace

wls:/offline> dumpStack()
This Exception occurred at Wed Jul 11 17:17:55 CEST 2012.
java.net.MalformedURLException: Bad IPv6 address: acme.com



Don't let yourself fool by the first error message....it could be very well that the root cose has nothing to do with the CompatabilityMBeanServer ! Always do dumpStack()!

Tuesday, July 10, 2012

Bamboo and SOAPUI integration

Install SOAPUI 4.5:

zip soapUI-x32-4_5_0.sh into soapUI-x32-4_5_0.zip (transferring .sh file got corrupted, need to set binary mode)

unzip soapUI-x32-4_5_0.zip on target /home/soa

chmod 755 soapUI-x32-4_5_0.sh
./soapUI-x32-4_5_0.sh

run in non-graphic mode, install to /home/soa/SmartBear/soapUI-4.5.0/

the installer will install also a Java 7 JRE into /home/soa/SmartBear/soapUI-4.5.0/jre, rename this directory to /home/soa/SmartBear/soapUI-4.5.0/jreORI so that SOAPUI will use the default java installation ( with Java 7 I had problems with this error:
[SoapUITestCaseRunner] java.lang.UnsatisfiedLinkError: /home/soa/SmartBear/soapUI-4.5.0/jre/lib/i386/xawt/libmawt.so: libXrender.so.1: cannot open shared object file: No such file or directory)

cd /home/soa/SmartBear/soapUI-4.5.0/bin

copy here your SOAPUI shop.xml test

./testrunner.sh -s"Configuration Service TestSuite" -c"Get terminal configuration" -j "shop.xml"

the -j option will generate a TEST-Configuration_Service_TestSuite.xml file in JUnit format, with the result of the test. The file name comes from 'testSuite name="Configuration Service TestSuite"'

Create a Bamboo plan

choose a "Script" task
you must choose to run a script https://confluence.atlassian.com/display/BAMBOO/Script

Script body= ./testrunner.sh -s"Configuration Service TestSuite" -c"Get terminal configuration" -j "shop.xml"

Working Sub Directory= /home/soa/SmartBear/soapUI-4.5.0/bin

then we add a JUnit Parse task:
Specify custom results directory=/home/soa/SmartBear/soapUI-4.5.0/bin/TEST-*.xml

Enable the project in dashboard
Run it

It fails saying "Could not find test result reports in the /home/soa/bamboohome/xml-data/build-dir/SOAPUITEST-SOAPUITEST-JOB1 "

in fact the /home/soa/bamboohome/xml-data/build-dir/SOAPUITEST-SOAPUITEST-JOB1/ was created, but only build-number.txt is there.

SoapUITestCaseRunner must be told WHERE to write the blessed JUnit TEST-bla.xml result.

The SoapUITestCaseRunner code says:

SoapUIOptions options = new SoapUIOptions( "testrunner" );
options.addOption( "e", true, "Sets the endpoint" );
options.addOption( "s", true, "Sets the testsuite" );
options.addOption( "c", true, "Sets the testcase" );
options.addOption( "u", true, "Sets the username" );
options.addOption( "p", true, "Sets the password" );
options.addOption( "w", true, "Sets the WSS password type, either 'Text' or 'Digest'" );
options.addOption( "i", false, "Enables Swing UI for scripts" );
options.addOption( "d", true, "Sets the domain" );
options.addOption( "h", true, "Sets the host" );
options.addOption( "r", false, "Prints a small summary report" );
options.addOption( "M", false, "Creates a Test Run Log Report in XML format" );
options.addOption( "f", true, "Sets the output folder to export results to" );
options.addOption( "j", false, "Sets the output to include JUnit XML reports" );
options.addOption( "m", false, "Sets the maximum number of TestStep errors to save for each testcase" );
options.addOption( "a", false, "Turns on exporting of all results" );
options.addOption( "A", false, "Turns on exporting of all results using folders instead of long filenames" );
options.addOption( "t", true, "Sets the soapui-settings.xml file to use" );
options.addOption( "x", true, "Sets project password for decryption if project is encrypted" );
options.addOption( "v", true, "Sets password for soapui-settings.xml file" );
options.addOption( "D", true, "Sets system property with name=value" );
options.addOption( "G", true, "Sets global property with name=value" );
options.addOption( "P", true, "Sets or overrides project property with name=value" );
options.addOption( "I", false, "Do not stop if error occurs, ignore them" );
options.addOption( "S", false, "Saves the project after running the tests" );



so I do

/home/soa/SmartBear/soapUI-4.5.0/bin/testrunner.sh -s"Configuration Service TestSuite" -c"Get terminal configuration" -j "/home/soa/SmartBear/soapUI-4.5.0/bin/shop.xml" -f/home/soa/bamboohome/xml-data/build-dir/SOAPUITEST-SOAPUITEST-JOB1/


and the result is written in /home/soa/bamboohome/xml-data/build-dir/SOAPUITEST-SOAPUITEST-JOB1/

the second step is simply
parse junit
Specify custom results directory=**/TEST*.xml


where the meaning of -s and -c parameters are:

<con:entry key="TestSuite" value="Configuration Service TestSuite"/>
<con:entry key="TestCase" value="Get terminal configuration"/>

-s = suite
-c = case


____________________________



Integrating also SVN checkout:

Put your SOAPUI project in SVN

For instance:

https://nessvn1.acme.com/svn/pippov2/PPP_AutomatedTests/SOAPUIArtifacts/shop-conf-soapui-project.xml
Create Bamboo Plan

Name SOAPUITEST
Create SVN repository

Source Repository= Subversion

Display Name = pippo2_SoapUI

Repository URL = https://nessvn1.acme.com/svn/pippov2/PPP_AutomatedTests/SOAPUIArtifacts/

Username= avernetto Password=bla
Create SOAPUI checkout task

Repository = pippo2_SoapUI
Create Script task

Task Description=Testrunner

Script Location=Inline

Script body=/home/soa/SmartBear/soapUI-4.5.0/bin/testrunner.sh -s"Configuration Service TestSuite" -j "/home/soa/bamboohome/xml-data/build-dir/SOAPUITEST-SOAPUITEST-JOB1/shop-conf-soapui-project.xml" -f/home/soa/bamboohome/xml-data/build-dir/SOAPUITEST-SOAPUITEST-JOB1/
Create JUnit Parser task

Task description=parse junit

Specify custom results directories=*/TEST.xml
Run the plan

Examine the content of /home/soa/bamboohome/xml-data/build-dir/SOAPUITEST-SOAPUITEST-JOB1/ folder for all artifacts being generated

Sunday, July 8, 2012

WLSTInterpreter fails to setup

java.lang.NullPointerException
java.io.File.(File.java:222)
weblogic.management.utils.PDevHelper.getUpgradeLaunchLocation(PDevHelper.java:77)
weblogic.management.utils.PDevHelper.getPDevClassLoader(PDevHelper.java:36)
weblogic.management.scripting.utils.WLSTUtil.setupOffline(WLSTUtil.java:226)
weblogic.management.scripting.utils.WLSTInterpreter.(WLSTInterpreter.java:134)
weblogic.management.scripting.utils.WLSTInterpreter.(WLSTInterpreter.java:76)


It turns out that PDevHelper.getUpgradeLaunchLocation is requiring a bea.home property to be set (set it to -Dbea.home=/opt/oracle/fmw11_1_1_5/ )

See also http://www.javamonamour.org/2012/07/error-in-finding-weblogichome.html

error in finding weblogic.Home

java.lang.RuntimeException: error in finding weblogic.Home
weblogic.Home.getInstance(Home.java:91)
weblogic.Home.getPath(Home.java:97)
weblogic.Home.getFile(Home.java:102)
weblogic.management.scripting.utils.WLSTInterpreter.(WLSTInterpreter.java:116)
weblogic.management.scripting.utils.WLSTInterpreter.(WLSTInterpreter.java:76)


To check what is wrong, I do
cd $DOMAIN_HOME
. ./bin/setDomainEnv.sh

then I examine the properties with "set":

ALSB_HOME=/opt/oracle/fmw11_1_1_5/osb
BEA_HOME=/opt/oracle/fmw11_1_1_5
WLS_HOME=/opt/oracle/fmw11_1_1_5/wlserver_10.3/server

so all I need to do is to add
JAVA_OPTS=-Dweblogic.home=/opt/oracle/fmw11_1_1_5/wlserver_10.3 -Dbea.home=/opt/oracle/fmw11_1_1_5/

to my catalina.sh

Saturday, July 7, 2012

Executing a OS command in Java and capture the stdout

 Process proc = Runtime.getRuntime().exec("ls");
 InputStream is = proc.getInputStream();
 DataInputStream in = new DataInputStream(is);
 BufferedReader br = new BufferedReader(new InputStreamReader(in));
 String line = null;
 out.write("result<br/>");
 while ( (line = br.readLine()) != null) {
  out.write(line);
  out.write("<br/>");
 }
 
 out.write("end result<br/>");  

ssh with password

if you want to run the "ls" command on a remote host:

expect -c 'spawn ssh myuser@acmehost ls ; expect assword ; send "mypassword\n" ; interact'


it works like a breeze!

only problem is that you are exposing your password in clear text...

The weird case of a JMS Proxy Service who failed to deploy

But it was reported as "Enabled" in the Operations console...

Some JMS messages were stuck in a AcmeQ

In the JMS Queue monitoring tab, we verified that no consumer was registered in any instance of the queue.

In JNDI tree, all the queues and connection factories were deployed.

In the deploment tab, it was noticed that 11 deploments exists with name _ALSB_nnnnnnnnnn.ear

while in the /opt/oracle/domains/osbpr1do/sbgen/ there were 12 ears.
Each of there ears contain the MDB corresponding to a JMS proxy service.

Unjarring each ear and examining the application.xml revealed that /opt/oracle/domains/osbpr1do/sbgen/_ALSB_1339780728059.ear was the AcmeQ ear,

and that it was NOT in the WebLogic config.xml as a deployment.

(normally there should be a section

<app-deployment>

    <name>_ALSB_1339780726229</name>

    <target>osbpr1cl</target>

    <module-type>ear</module-type>

    <source-path>sbgen/_ALSB_1339780726229.ear</source-path>

    <plan-dir>shared/osb/config/plan</plan-dir>

    <plan-path>Plan-_ALSB_1339780726229.ear.xml</plan-path>

    <security-dd-model>DDOnly</security-dd-model>

    <staging-mode>stage</staging-mode>

  </app-deployment>


for each ALSB ear)



It was taken the resolution to

- export into a sbconfig.jar the Acme OSB project alone

- delete the Acme OSB project and activate

- reimport the Acme OSB project and activate


this fixed the issue and the JMS messages were consumed.

Hidden life of a Materialized View

in order to create a materialized view that can be refreshed (instead of "completely rebuilt") you must create a "materialized view log":

create materialized view log on wli_qs_report_attribute;

after that you can create the matview:

CREATE MATERIALIZED VIEW WLI_QS_REPORT_MAT_VIEW as select * from wli_qs_report_attribute;


this will generate a table mlog$_wli_qs_report_attrib listing all the changes since the last refresh:

select count(*) from mlog$_wli_qs_report_attrib;
3776

desc mlog$_wli_qs_report_attrib
Name Null Type
--------------- ---- -------------
MSG_GUID VARCHAR2(64)
SNAPTIME$$ DATE
DMLTYPE$$ VARCHAR2(1)
OLD_NEW$$ VARCHAR2(1)
CHANGE_VECTOR$$ RAW(255 BYTE)


After you fast refresh the WLI_QS_REPORT_MAT_VIEW MATERIALIZED VIEW, the size of mlog$_wli_qs_report_attrib will drop to 0, and the ERROR sign next to the WLI_QS_REPORT_MAT_VIEW goes away.

Offshore development, pitfalls and myths

When I was called to assist a major "offshore development" effort, my expectations and dreams were set on:

- a permanent operations room (with a nice view on the lake) where all the onshore "architects" could work together to design the solution, with blackboards, paper, high speed unrestricted internet connection, a powerful 17 inches laptop with 16 GB RAM, stationery etc


- pain-free, one click videoconferencing with the team offshore - the distance should be reduced to the minimum with the use of collaboration/communication tools such as Communicator, Skype, Desktop sharing etc

- wiki on the go - wikis are linkable to any section in it, word documents are not. Everything should be one-click-away and searchable

- automated-build environments were people can freely experiment without affecting others (nothing is more distressing than losing days of work because someone nuked the environment where you were working)

The stress should go on: coordination, communication, responsibility, agility, no red tape, trackability. Plan in advance, think in advance.

The idea that some giant throbbing brains onshore should do all the thinking, write down everything to the smallest detail in a gigantic omnicomprehensive Word document, throw it across the wall to a team of coders offshore and get the product delivered... this idea simply doesn't stand to reality.

First, because the architect can have the full picture, but a lot of small details can be perceived only by someone (developer) who fully dedicates himself to a single topic for a long time. The relationship between the architect and the developer can only be one of cooperation and mutual help... the architect takes care of the big picture, the developer of the tiny detail, and they both exchange ideas to accommondate the details into a coherent overall framework.



So, the design a little-code a little-test a little approach is even more winning in an offshore model: all these iterations and interactions help architect and developer to synchronize with each other - all should be tracked in wikis which can be edited by both sides of the ocean.

Word documents are a HUGE pain in the neck, you always end up with a local copy that is painful to synchronize with others. AVOID by all means.

Ideas and visions: things can be achieved only if people share a common vision.
Having educated resources is paramount - you need actively thinking brains, problem solvers, imaginative people, not people who sit waiting for instructions and complain if instructions are not perfect.

Micromanagement of resources is something really annoying - let people organize themselves, if they are old enough to brush their own teeth and buckle their shoes, they surely are able to coordinate with each other.

Visibility and trackabililty are everything, but this has to be streamlined. IMHO lenghty status calls where everyone is supposed to give a status report to the manager are the single biggest waste of time. Just ask each team member to update a wiki with the info, and aggregate all wikis with RSS.
Daily status calls should be max 15 minutes - they should be quick, snappy, and leave room for subsequent individual interactions. Everything else is just waste of neuron-cycles. If a person talks for more than 30 seconds, it's bad.


There are a number of web tools to manage people, tasks, who is doing what, product backlog... in offshore dev it's even more important to use such a tool. Everyone should have one-click access to all info. This way the remote management is not any more the single point of contact for all operations.

Friday, July 6, 2012

Thank God I belong to another generation

Does anyone actually talk to one another

Grab a cup of coffee



Dine out at your favorite restaurant


Spend some time at the museum



Meet at a popular diner



Relax at the beach


Go to a game


Going out on a date


Take a drive around town




But, no worries, the wireless network is on the brink of a planetarian collapse for lack of investments and for forthcoming energy blackouts, so we shall revert soon to more traditional, less power-hungry and less abstract ways to communicate.

Tuesday, July 3, 2012

WebLogic, move JMS messages in Java

Here how to move JMS messages in WLST http://www.javamonamour.org/2011/09/wlst-move-jms-messages.html


Here the Javadoc of the JMSDestinationRuntimeMBean.moveMessages():

http://docs.oracle.com/cd/E24001_01/apirefs.1111/e13951/mbeans/JMSDestinationRuntimeMBean.html?skipReload=true#moveMessages



selector is "JMSMessageID = '${jmsmessageid}'"

javax.management.openmbean.CompositeData you can get it with the JMSDestinationRuntimeMBean.getDestinationInfo() method.



So this code will work:

// ctx is a proper InitialContext

  String destinationJNDI = request.getParameter("destinationJNDI");
  String intermediateJNDI = destinationJNDI.replace("ReprocessQ", "Q");
  String jmsmessageid = request.getParameter("jmsmessageid");
  javax.jms.Queue queue = (javax.jms.Queue) ctx.lookup(destinationJNDI);
  javax.jms.Queue intermediateQueue = (javax.jms.Queue) ctx.lookup(intermediateJNDI);
    
  // lookup the queue connection factory
  QueueConnectionFactory queueConnFactory = (QueueConnectionFactory) ctx.lookup(WEBLOGIC_JMS_XA_CONNECTION_FACTORY);
  // create a queue connection
  QueueConnection queueConn = queueConnFactory.createQueueConnection();
  // create a queue session
  Session queueSession = queueConn.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
  
  // start the connection
  queueConn.start();
  
  JMSDestinationRuntimeMBean reprocessQueueMBean = JMSRuntimeHelper.getJMSDestinationRuntimeMBean( ctx, queue);
  JMSDestinationRuntimeMBean intermediateQueueMBean = JMSRuntimeHelper.getJMSDestinationRuntimeMBean( ctx, intermediateQueue);
  // see http://docs.oracle.com/cd/E24001_01/apirefs.1111/e13951/mbeans/JMSDestinationRuntimeMBean.html?skipReload=true#moveMessages
  reprocessQueueMBean.moveMessages("JMSMessageID = '" + jmsmessageid + "'", intermediateQueueMBean.getDestinationInfo());


Monday, July 2, 2012

weblogic.security.acl.internal.AuthenticatedSubject and weblogic.security.acl.internal.AuthenticatedUser

today I had this REALLY weird error in Tomcat.... it turned out that having weblogic.jar AND wlfullclient.jar in the classpath is NOT good...


java.lang.ClassCastException: weblogic.security.acl.internal.AuthenticatedSubject cannot be cast to weblogic.security.acl.internal.AuthenticatedUser
weblogic.common.internal.RMIBootServiceImpl_1035_WLStub.authenticate(Unknown Source)
weblogic.security.acl.internal.RemoteAuthenticate$1.run(RemoteAuthenticate.java:72)
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
weblogic.security.acl.internal.RemoteAuthenticate.authenticate(RemoteAuthenticate.java:68)
weblogic.jndi.WLInitialContextFactoryDelegate.authenticateRemotely(WLInitialContextFactoryDelegate.java:747)
weblogic.jndi.WLInitialContextFactoryDelegate.pushSubject(WLInitialContextFactoryDelegate.java:679)
weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFactoryDelegate.java:469)
weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:376)
weblogic.jndi.Environment.getContext(Environment.java:315)
weblogic.jndi.Environment.getContext(Environment.java:285)
weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:117)
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
javax.naming.InitialContext.init(InitialContext.java:223)
javax.naming.InitialContext.(InitialContext.java:197)

Small JSP to display the content of a file

pass the filename as ?file=/path/to/myfile.txt

<%@page import="java.io.*"%>

<%

String filename = request.getParameter("file");
FileReader fr = new FileReader(filename); 
BufferedReader br = new BufferedReader(fr);
String line;
while ( (line = br.readLine() ) != null ) {
    out.write(line);
    out.write("\n");
}
br.close();
fr.close();
%>

Oracle DB BLOB to String conversion

the problem is mainly with BLOBs > 2K

This is a collection of strategies:

this doesn't work, I get a "ORA-00932: inconsistent datatypes: expected NUMBER got BLOB" :
select TO_CHAR(DATA_VALUE) from wli_qs_report_data where msg_guid = 'uuid:7f9b72b69446518a:3591707b:1382c7d7451:-73f8';


this one is better, but still gives "ORA-06502: PL/SQL: numeric or value error: raw variable length too long":
select utl_raw.cast_to_varchar2(dbms_lob.substr(DATA_VALUE)) from wli_qs_report_data where msg_guid = 'uuid:7f9b72b69446518a:3591707b:1382c7d7451:-73f8';


this one gives "ORA-06502: PL/SQL: numeric or value error: raw variable length too long":
select DBMS_LOB.SUBSTR(DATA_VALUE, 32767, 1) from wli_qs_report_data where msg_guid = 'uuid:7f9b72b69446518a:3591707b:1382c7d7451:-73f8';


this one gives "ORA-00904: "DBMS_LOB"."CONVERTTOCLOB": invalid identifier":
select dbms_lob.converttoclob(DATA_VALUE) from wli_qs_report_data where msg_guid = 'uuid:7f9b72b69446518a:3591707b:1382c7d7451:-73f8';


after a while I give up, and do stuff directly in Java:


<sql:query var="rsMessageCount" dataSource="jdbc/soainfra" scope="request">
select DATA_VALUE from WLI_QS_REPORT_DATA where MSG_GUID='${msg_guid}'
</sql:query>

and I display ${rsMessageCount.getRowsByIndex()[0][0]} :
its class is oracle.sql.BLOB

I am planning to use http://docs.oracle.com/cd/E11882_01/appdev.112/e13995/oracle/sql/BLOB.html#getBinaryStream__

which is a java.sql.blob

how to display a java.sql.Blob as a String?

http://www.jguru.com/faq/view.jsp?EID=1325

java.sql.Blob blob = (java.sql.Blob)((org.apache.taglibs.standard.tag.common.sql.ResultImpl)(request.getAttribute("rsMessageCount"))).getRowsByIndex()[0][0];

byte[] bdata = blob.getBytes(1, (int) blob.length());

String text = new String(bdata);
text = text.replace("<", "&lt;");

out.write(text);

Sunday, July 1, 2012

Tomcat error on startup: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getSessionCookieConfig()

java.lang.NoSuchMethodError: Caused by: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getSessionCookieConfig()Ljavax/servlet/SessionCookieConfig;


Caused by: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getSessionCookieConfig()Ljavax/servlet/SessionCookieConfig;
at org.apache.catalina.deploy.WebXml.configureContext(WebXml.java:1309)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1310)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:855)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:345)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5161)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)




The offending method is:

SessionCookieConfig scc = context.getServletContext().getSessionCookieConfig();

and context is passed as "configureContext(Context context)"

and Context is "org.apache.catalina.Context"


I found out a different version of the javax.servlet package in wlfullclient.jar



in the servlet-api.jar in Tomcat in the Interface javax.servlet.ServletContext you can find the method:

public abstract SessionCookieConfig getSessionCookieConfig();


The error is triggered in org.apache.catalina.deploy.WebXml class, which is in catalina.jar.




I have tried this and it doesn work:

copy to tomcat/lib directory these files
javax.persistence-2.0.0.jar http://mvnrepository.com/artifact/org.eclipse.persistence/javax.persistence
persistence-api-1.0.2.jar http://mvnrepository.com/artifact/javax.persistence/persistence-api


The only thing which works is detecting the extra jar introducing the wrong version of the javax.servlet package and get it out of the way.