Friday, January 15, 2010

Setting up drupal

  • Install drupal/ Db etc. Don't use command line for loading DB
  • install modules Nice Menu/ Views/ tinyMCE/ Image Assist
  • set up categories
  • Add content , this creates menu
  • Adjust setting/ Content Types to have correct defaults for adding content
  • Configure tinyMCE, and imageAssist. Follow install.txt in tinyMce modules dir
  • Create Admin role. administrator/ access control
  • Add tinyMCE permissions to different roles

Weblogic slow to start (and slow cryptography) on linux (unix),

This is a doozie.

Weblogic takes many minutes to start on unix.


Note this would also apply for any java process that uses the random number generator such as cryptography.


Turns out Weblogic uses random number generator during start up. Because of the bug in java it reads ‘randomness’ from /dev/random. /dev/random is very good random numbers generators but it is extremely slow. It takes sometimes 10 minutes or more to generate one number. /dev/urandom is not that good, but it is instant.
Java somehow maps /dev/urandom file to /dev/random. That’s why default settings in $JAVA_HOME/jre/lib/security/java.security are useless.

Possible solutions:
1) Add “-Djava.security.egd=file:/dev/./urandom” (/dev/urandom does not work) to java parameters.

Worse but working solution is:
2) mv /dev/random /dev/random.ORIG ; ln /dev/urandom /dev/random

3) Best solution is to change $JAVA_HOME/jre/lib/security/java.security
Replace securerandom.source with

securerandom.source=file:/dev/./urandom

This problem does not happen under windows because it uses different implementation of /dev/random.

It takes seconds to start weblogic server now.

Wednesday, January 13, 2010

Using AES from Java

The following exception

java.security.InvalidKeyException: Illegal key size or default parameters
at javax.crypto.Cipher.a(DashoA13*..)
at javax.crypto.Cipher.a(DashoA13*..)
at javax.crypto.Cipher.a(DashoA13*..)
at javax.crypto.Cipher.init(DashoA13*..)
at javax.crypto.Cipher.init(DashoA13*..)
...

Searching java forums reveals that I need to download the Unrestricted Policy Files from JDK Distribution Center.

After much searching I found it at

Under Additional Resources/ Other Downloads.

Simply copy the jars included in it into %JRE_HOME%/lib/security overwriting what is there

On my system that means doing it in multiple locations (eclipse JRE/ Oracle JRE etc.) to make