Wednesday, May 11, 2011

Suse ES networking problem on vmware

After restarting vmware of SES, from time to time, the network interface got changed.
As a result, the network connection would stop working.

The resolution to this issue is to manually edit /etc/udev/rules.d/70-persistent-net.rules file. This file has two entries related to network cards:


# PCI device 0x8086:0x10f5 (e1000e)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:ac:ee:0d:d5", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:0x10f5 (e1000e)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:ac:e0:fd:23", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

The first entry with eth0 is the original virtual machine MAC address. The second entry is the new NIC with the new MAC address.

You must change the MAC address in the first entry from eth0 to eth1 and remove the second entry.

After a reboot, the cloned virtual machine has network connectivity.

The original source of this solution is http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1021624 .

Tuesday, May 03, 2011

Resolving SoapUI starting failure on Linux RedHat ES.

The binary zipfile of SoapUI would not work directly with Linux RH ES.
When the soapui.sh is executed, some error would be reported and the process aborts.
It turned out that it's a known issue, what needs to be done is uncommenting existing line in the soapui.sh script.
# JAVA_OPTS="$JAVA_OPTS -Dsoapui.jxbrowser.disable=true"

The original solution is described here:
https://www.eviware.com/forum/viewtopic.php?t=2802 .

NX: a good remote GUI for Linux

Installing and configuring NX on Linux is easy.
Step1: download all the packages including nxclient, nxnode, nxserver from the server.
Step2: (I downloaded the tar file for installation) copy those tar.gz file to /usr directory. --> the /usr directory is a requirement for installation. Otherwise, you'll get errors such as "could not create configuration file".
Step3: execute installation scripts, as described in http://www.nomachine.com/download-package.php?Prod_Id=2522.
Step4: start the server by using "nxserver --start" command.

Use NX client is also easy. You just need to download and install the NXclient on your windows machine. With the SSH credential, you should be able to access the server which has just been configured.

Tuesday, March 08, 2011

Use mod_dumpio, mod_logio in Apache server

Mod_dumpio and mod_logio enables the logging for http request/response and the size of the request/resposne.
However, they'll not be configured by default installation procedures.

Here are steps to use them:

1. download the apache source files, and upload it to linux server.
2. go to existing apache bin directory, run the following commands:
sudo ./apxs -c /tmp/apache/httpd-2.0.64/modules/loggers/mod_logio.c

sudo ./apxs -i -a -n mod_logio /tmp/apache/httpd-2.0.64/modules/loggers/mod_logio.la

3. change the httpd.conf file and make sure the module is loaded and the logging format is changed.

Wednesday, May 26, 2010

Eclipse configuration issue with Java 3D

While working with Java 3D API, I found the latest version of Eclipse needs a change to the configuration regarding restricted API in order to avoid errors being reported by Eclipse.
The reported error would be
Access restriction: The type ** is not accessible due to restriction on required library j3dutils.jar

The configuration change is described in http://blog.js-development.com/2008/11/type-x-is-not-accessible-due-to.html .

Tuesday, May 18, 2010

Gathering environmental information

Linux OS:
uname -f
cat /etc/issue.net
cat /etc/*-release

Oracle version:
select * from v$version where banner like 'Oracle%';

Monday, April 12, 2010

customized web service invocation with one bpm tool

Lately, I've been working on a customized java service for one bpm tool (Cordys) to invoke platform web services. Here are the implementation details:
1. A method that takes xml message as a string:
public static String invoke(String endpoint, String userName, String password,
String requestMessage) {
SOAPMessage soapResponse = invoke(endpoint, userName, password,
convertStringToSoapMessage(requestMessage));

return convertSoapMessageToString(soapResponse);
}

2. A method that handles SoapMessage data type:
public static SOAPMessage invoke(String endpoint, String userName,
String password, SOAPMessage soapMsg) {
try {
// Create the connection
SOAPConnectionFactory soapConnFactory = SOAPConnectionFactory
.newInstance();
SOAPConnection conn = soapConnFactory.createConnection();

CordysAuthenticator credential = new CordysAuthenticator(userName, password);
// CordysAuthenticator is an "Authenticator" implementation
Authenticator.setDefault(credential);

SOAPMessage soapResponse = conn.call(soapMsg, endpoint);
conn.close();
return soapResponse;
} catch (SOAPException e) {
System.out.println("SOAPException : " + e);
return null;

}
}

3. A method to convert String to SoapMessage:
public static SOAPMessage convertStringToSoapMessage(String requestString) {

try {

// Use SAAJ to convert Document to SOAPElement
// Create SoapMessage
MessageFactory msgFactory = MessageFactory.newInstance();
SOAPMessage message = msgFactory.createMessage();
SOAPPart part=message.getSOAPPart();

byte[] soapBytes=requestString.getBytes();
ByteArrayInputStream stream = new ByteArrayInputStream(soapBytes);
StreamSource source = new StreamSource(stream);
part.setContent(source);
message.saveChanges();

// This returns the SOAPBodyElement
// that contains ONLY the Payload
System.out.print("request message String:"+ requestString);
return message;

} catch (SOAPException e) {
System.out.println("SOAPException : " + e);
return null;

}

}

4. A method to convert SoapMessage to string
public static String convertSoapMessageToString(SOAPMessage soapMessage) {
try {
String result = "";

// Create transformer
TransformerFactory transFactory = TransformerFactory.newInstance();
Transformer transformer = transFactory.newTransformer();
// TransformerConfigurationException


// Get reply content
Source sourceMsg = soapMessage.getSOAPPart().getContent();
// SOAPException

// Set output transformation
StringWriter writer = new StringWriter();
StreamResult resultStream = new StreamResult(writer);
transformer.transform(sourceMsg, resultStream);
// TransformerException
result = writer.toString();
writer.close();
// IOException

return convertToXmlString(result);
} catch (...){}
}


There might be error message such as "invalid soap messages" when the message is sent to the web gateway. This might be caused by the doublequote used in the name space declaration of the xml message. In order to solve the problem, we can use the method String.replaceAll("\"","\\\""); to replace doublequotes with escaped doublequotes.

Thursday, March 25, 2010

Learning Scala

Some interesting read about scala, it could be a replacement for some J2EE implementations:
http://macstrac.blogspot.com/2009/04/scala-as-long-term-replacement-for.html
http://www.scala-lang.org/node/1305
http://programming-scala.labs.oreilly.com/