Tech

20121004

Testing JavaScript on Blogger

Nice to know that I can play a bit with javaScript on blogger. Even if I have to do things by hand... but that is cool...

My example in action is bellow:

testing Script

will be date here.

20121003

java.lang.InternalError: Unexpected CryptoAPI failure generating seed


Throwable: java.lang.InternalError: Unexpected CryptoAPI failure generating seed
Stack Trace:
java.lang.InternalError: Unexpected CryptoAPI failure generating seed
at sun.security.provider.NativeSeedGenerator.getSeedBytes(NativeSeedGenerator.java:43)
at sun.security.provider.SeedGenerator.generateSeed(SeedGenerator.java:117)
at sun.security.provider.SecureRandom.engineGenerateSeed(SecureRandom.java:114)
at java.security.SecureRandom.generateSeed(SecureRandom.java:495)

While generating seed to create random numbers, the exception is being thrown form the method bellow:

{
        // fill array as a side effect
        if (nativeGenerateSeed(result) == false) {
            // should never happen if constructor check succeeds
            throw new InternalError
                            ("Unexpected CryptoAPI failure generating seed");
        }
}

ref:  sun.security.provider.NativeSeedGenerator

To generate random numbers, SSL security code relies upon entropy on a machine. Entropy is activity of the machine,If entropy is minimal or non-existent, then the random number generator will be slow and security operations may time out.

The class generates seeds for strong cryptographically number generator. It uses two techniques:

Computing current system activity:
Default, produced by counting the number of times the VM manages to loop in a perioud of time. Does not reflect machine load, and a number of sleeper threads are generated to add entropy.
Entropy gathering device:
Alternative, is to acquire material from entropy gathering device, such as /dev/random. By setting the "securerandom.source" security property of the /lib/security/java.security file.
Use the bellow command that starts the Java process as a possible solution:
  • -Djava.security.egd=file:///dev/urandom
  • or
  • -Djava.security.egd=file:/dev/./urandom
For further information, see Sun bugs 6202721 and 6521844 at:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6202721
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6521844

Using the WebLogic JarBuilder to power java client programs.

This post is a reference in how to export a full jar with all WLS libs. One good reason is to transport WLS proprietary classes into a java client application. That way a full use of WLS's libs.

Usually engineers only copy/paste the weblogic.jar, but the right way to do it, is to use the WebLogic JarBuilder tool, bellow will show you the following:

  • Creating a wlfullclient.jar for JDK 1.6 and 1.7 client applications
  • Creating a wlfullclient5.jar for JDK 1.5 client applications
wlfullclient.jar file since WLS 10.3
  1. goto: $cd WL_HOME/server/lib
  2. run: $java -jar wljarbuilder.jar
  3. On the same directory you should see this wlfullclient.jar
  4. Copy over to client application's classpath
wlfullclient.jar file for WLS 10.0
  1. goto: $cd WL_HOME/server/lib
  2. run: $java -jar wljarbuilder.jar -profile wlfullclient5
  3. On the same directory you should see this wlfullclient5.jar
  4. Copy over to client application's classpath

The WL_HOME reference to wlserver_12.1, as an example. Also keep in mind the WLS start using JDK 1.6 since WLS 10.3

ref:Using the WebLogic JarBuilder Tool

Starting Coherence with WLS Console.

Easy steps... 
  1. Goto: Admin Console::Servers::Coherence Servers::myCoherenceServer::Configuration::Server Start
  2. Add these two jars to the classpath
    • $MW_HOME/modules/features/weblogic.server.modules.coherence.server_12.1.1.0.jar:$MW_HOME/coherence_3.7/lib/coherence.jar
    • Replace $MW_HOME by the actual directory path of the Middleware Home
  3. Start the Coherence Server from the WLS Admin Console to verify it works fine now. 

Notice, this example is for WebLogic Server 12.1.1

20121001

High Availability for WLS, How to Quickly pack/unpack copy the domain for testing.

We have a domain in which is in production, and you quickly need a testing domain with the same configuration. Since the production domain is in production, you cannot actually run the risk of messing things up. Therefore I am quickly writing this so it helps you on getting a copy of your domain quickly running for testing;

Navegate to your wls home:

1. [Middleware]$ cd 1036bin/wlserver_10.3/common/bin/

2. [bin]$ ls
commEnv.sh  config_builder.sh  config.sh  pack.sh  setPatchEnv.sh  startDerby.sh  startManagedWebLogic.sh  stopDerby.sh  unpack.sh  upgrade.sh  wlscontrol.sh  wlsifconfig.sh  wlst.sh

Use the pack command to build a template, here I am using the tmp directory:

3. [bin]$ ./pack.sh -domain=/home/Oracle/Domains/1036bin -template=/tmp/mydomain.jar -template_name="testingBackup"
<< read domain from "/home/Oracle/Domains/1036bin"
>>  succeed: read domain from "/home/Oracle/Domains/1036bin"
<< write template to "/tmp/mydomain.jar"
....................................................................................................
>>  succeed: write template to "/tmp/mydomain.jar"
<< close template
>>  succeed: close template

Unpack on a different directory, Actually the newDirectory does not exist the unpack will create one:

4. [bin]$ ./unpack.sh -template=/tmp/mydomain.jar -domain=/home/Oracle/newDirectory
<< read template from "/tmp/mydomain.jar"
>>  succeed: read template from "/tmp/mydomain.jar"
<< write Domain to "/home/Oracle/newDirectory"
...............................................................................................
>>  succeed: write Domain to "/home/Oracle/newDirectory"
<< close template
>>  succeed: close template

Goto the newly created newDirctory and start your backup domain:

5. [ bin]$ cd /home/Oracle/newDirectory

6. [newDirectory]$ ls
autodeploy  bin  config  console-ext  fileRealm.properties  fileRealm.properties.bak  init-info  lib  pending  security  servers  startManagedWebLogic_readme.txt  startWebLogic.sh  tmp

6. [ newDirectory]$ ./startWebLogic.sh
.
.
JAVA Memory arguments: -Xms512m -Xmx512m
.
WLS Start Mode=Development
.
.
.
<Oct 1, 2012 2:49:47 PM CLT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RUNNING>
<Oct 1, 2012 2:49:47 PM CLT> <Notice> <WebLogicServer> <BEA-000360> <Server started in RUNNING mode>

This example was run into the same Linux machine, but if you want to transport this domains to a different machine you may just copy the mydomain.jar into the new machine, install the same WLS version and run the steps from 4 - 6 (While WLS installation you may choose the mydomian.jar as a template). This action is mainly use for extending domain into a remote machine, but also can be use to build testing environments with the same configuration as the production.