Dariusz on Software Quality & Performance

22/04/2010

Recreate Derby Database Under WebSphere

Filed under: en — Tags: , , , — dariusz.cieslak @

WebSphere uses SQL databases for internal managment of MQ queues (Derby database engine under the covers). Sometimes you need to reset their state. Here's the script that erase and recreate BPEDB database state (tested under WS 6.1.2):

rm -rf $WID_HOME/pf/wps/databases/BPEDB
echo "CONNECT 'jdbc:derby:$WID_HOME/pf/wps/databases/BPEDB;create=true' AS BPEDB;"|\
    $WID_HOME/runtimes/bi_v61/derby/bin/embedded/ij.sh /dev/stdin

25/03/2010

Generic Types in Java 1.5

Filed under: en — Tags: , , — dariusz.cieslak @

Generics are very useful Java language feature introduced in Java 1.5. Starting from 1.5 you can statically declare expected types of objects inside collections and compiler will enforce this assumption during compilation:

Map<String, BankAccount> bankAccounts = new HashMap<String, BankAccount>();
bankAccounts.put("a1", bankAccount);
bankAccounts.add("a2", "string"); <-- compilation error
Integer x = bankAccounts.get("a1"); <-- compilation error
bankAccounts.put(new Integer("11"), bankAccount); <-- compilation error

Many projects, however, keep 1.4 compatibility mode for many reasons. I think 1.5 is mature enough (ok, let's say that: old) so it may be used safely.

(more…)

26/11/2009

Eclipse hangs – solved!

Filed under: en — Tags: , , — dariusz.cieslak @

Sometimes you see that Eclipse stops responding and causes 100% of CPU usage (UI controls not redrawn). The only action can be taken then is to kill eclipse process.

I discovered that it's caused by big console output option. Test suite with low level (DEBUG) messages are able to kill Eclipse IDE, after setting log level to WARN no such problems are present.

You can also disable Limiting console output. It helped when no verbosity could be changed by logging configuration.

1

eclipse

06/10/2009

The simplest commons-logging usage

Filed under: en — Tags: , — dariusz.cieslak @

I assume you're a developer and want to control global log level you are getting on your console window in Eclipse. Just log level. You don't want to learn all Log4J machinery to create many log files, customize logging format etc. I'll describe simplest steps to achieve this.

First, create commons-logging.properties file in your src/ directory (or directory on your classpath):

org.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog

Next, create simplelog.properties in the same location:

org.apache.commons.logging.simplelog.defaultlog=warn
org.apache.commons.logging.simplelog.showlogname=false
org.apache.commons.logging.simplelog.showShortLogname=false
org.apache.commons.logging.simplelog.showdatetime=false

That's all! Your app will now log on WARN level and above in short, one-line format. Isn't it simple?

If you want to give different log levels (info for instance) to different packeges:

org.apache.commons.logging.simplelog.log.<package prefix>=info

logo

01/10/2009

libxpcom.so: cannot open shared object file: No such file or directory

Filed under: en — Tags: , , , , — dariusz.cieslak @

When opening JSP file in visual mode in Eclipse (Websphere Integrated Developer 6.1.2) I'm getting the following error (under Debian Lenny):

Caused by: java.lang.UnsatisfiedLinkError: /opt/IBM/WID61/configuration/org.eclipse.osgi/bundles/2374/1/.cp/libswt-mozilla-gtk-3236.so (libxpcom.so: cannot open shared object file: No such file or directory)

I checked for shared library dependicies:

$ ldd /opt/IBM/WID61/configuration/org.eclipse.osgi/bundles/2374/1/.cp/libswt-mozilla-gtk-3236.so
linux-gate.so.1 =>  (0xb7fa9000)
libxpcom.so => not found
libnspr4.so => /usr/lib/libnspr4.so (0xb7f4a000)
libplds4.so => /usr/lib/libplds4.so (0xb7f46000)
libplc4.so => /usr/lib/libplc4.so (0xb7f42000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7e54000)
libm.so.6 => /lib/i686/cmov/libm.so.6 (0xb7e2e000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7e21000)
libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb7cc6000)
libpthread.so.0 => /lib/i686/cmov/libpthread.so.0 (0xb7cac000)
libdl.so.2 => /lib/i686/cmov/libdl.so.2 (0xb7ca8000)
/lib/ld-linux.so.2 (0xb7faa000)

and checked ldconfig:

$ sudo ldconfig -v | grep libxpcom
libxpcom.so.0d -> libxpcom.so.0d
libxpcomglue.so.0d -> libxpcomglue.so.0d

library is installed in system:

$ dpkg -S libxpcom.so
libxul0d: /usr/lib/xulrunner/libxpcom.so
libxul0d: /usr/lib/libxpcom.so.0d
xulrunner-1.9: /usr/lib/xulrunner-1.9/libxpcom.so
icedove: /usr/lib/icedove/libxpcom.so

I linked the missing libraries:

cd /usr/lib
sudo ln -s libxpcom.so.0d libxpcom.so
sudo ln -s libxpcomglue.so.0d libxpcomglue.so

That's all!

Older Posts »

Powered by WordPress