Tag cloud

JBoss (16) Fedora (5) Linux (4) Red Hat (4) JON (3) command line (3) 4.3 (2) JEE (2) JVM (2) Java (2) KVM (2) Oracle (2) Portal (2) Weblogic (2) installation (2) vs (2) /boot partition (1) Add-ons (1) Apache (1) Bundles (1) Business model (1) Byteman (1) CLASSPATH (1) EAP (1) EPP (1) Eclipse (1) Failover (1) Gnome (1) JAVA_OPTS (1) JBDS (1) JBoss Tools (1) JBossON (1) JConsole (1) JDK (1) JMS (1) JVM options (1) KDE (1) MBean (1) Network (1) Open Source (1) RHQ (1) Red Hat subscription (1) Thunderbird (1) Troubleshooting (1) Virtulization (1) WS (1) Webservices (1) Wireshark (1) classloading (1) clustering (1) comparison (1) debug (1) deployment (1) disable SELinux (1) disksize (1) error (1) fun (1) jboss.org (1) log (1) log4j (1) lvm (1) messaging (1) multiple WARs (1) patent FOSS (1) performance tuning (1) provisionning (1) scripting (1) services (1) switch (1) troll (1) upgrade (1) video (1) war (1) webapp (1) yum (1)

01 March 2011

JBoss and JMS



Over the years the JMS providers have changed within JBoss, here an overview:

JBoss JMS Messaging
Community project
(newest on top)
Latest
version
Enterprise
JBoss versions
Latest supported
enterprise version
JBoss HornetQ
(standalone)
HornetQ2.1.2
(2010-08-17)
EAP 5.2+
EAP 5.2 (n/a yet)
JBoss Messaging
(standalone)
JBM1.4.5
(2009-09-30)
EAP4.3 -
EAP5.1
EAP 5.1 (1.4.6.GA-SP1)
JbossMQ
(only with JBossAS)
JBoss4.2.3
(2008-07-18)
Until JbossAS4.0.5
JbossAS4.0.5
End of life
Note that all cited versions are compliant to the JMS specification 1.1 !
The enterprise version was renamed in 2006 from JBossAS to EAP ! 

Clustering JMS :
For JBoss Messaging follow http://community.jboss.org/wiki/JBMCluster.
JMS redelivery
JBoss transaction exist from JbossMQ on. But the idea of DLQ (Dead Letter Queue) only exist from JBoss Messaging on. The idea is that after a couple of unsuccessful deliveries of a message (meaning that message is non-acknoleged and client session timed out) the message will be put in a special queue (DLQ) and won't be delivered again. You can set the number of tries with the parameter DefaultMaxDeliveryAttempts which defaults to 10. You can also retry to send the message by delaying it with DefaultRedeliveryDelay (defaults to 0).
JMS transaction
- local transactions
- distributed transactions XA













http://www.javaworld.com/javaworld/jw-02-2002/jw-0315-jms.html

Example of inline code

http://www.commonitman.com/2010/09/how-to-use-syntax-highlighter-3-in.html

public class ConditionCheck
{
    private GUIInstallData installdata;
    private ResourceManager resourceManager;
    private RulesEngine rules;


    public ConditionCheck(GUIInstallData installdata, ResourceManager resourceManager, RulesEngine rules)
    {
        this.installdata = installdata;
        this.resourceManager = resourceManager;
        this.rules = rules;
    }

    public void check() throws Exception
    {
        checkJavaVersion();
        checkJDKAvailable();
        // Check for already running instance
        checkLockFile();
        checkLangPackAvaible();
    }

sdffdsfdsfssfsdsf

28 February 2011

JVM Performance tuning

To understand that tuning your Java Virtual Machine should not be underestimated, take a look at the various parameter that can be set starting your Java program (dates 28 Aug 2007):
http://blogs.sun.com/watt/resource/jvm-options-list.html
or the official Oracle list:
http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html
and the Tagtraum list:
http://www.tagtraum.com/gcviewer-vmflags.html

Also check out the article "Java Performance Tuning, Profiling, and Memory Management" on Dzone by :
http://java.dzone.com/articles/java-performance-tuning

And the last good pointer is the article of Pete Freitag:
http://www.petefreitag.com/articles/gctuning/

I also really liked this JVM deck of Simon Ritter :
http://www.javapassion.com/javase/GC_Performance.pdf

Ritter points out that:
--> Most new objects will die young
--> Concentrate effort on young generation (Eden)
--> Use the right tool for the job (Different GC algorithms for each generation)


Howto read gc.log
After adding the following JVM options:
-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xloggc:/tmp/gc.log
You will find in the generated /tmp/gc.log something like:
[GC 34000 kb -> 21000 kb (0.018 sec] (The GC collects the young generation)
[Full GC 60000 kb -> 12000 kb (0.430 sec] (The Full GC collects the old generation, costs more CPU)


To analyse the /tmp/gc.log open it with the tool GCViewer.

Choose the Just-In-Time compiler
-classic (no JIT)
-client  (a lot of JIT compiling)
-server (optimized JIT compiling, for production environment)
this JVM option needs to be the first one in the list

JVM options to consider

For JVM performance tuning you will have to choose the
- Young generation option
- Old generation option

Generation
Collector
JVM options
Description
Young
Serial New
-XX:+UseSerialGC
(default until J2EE 1.4)
Single-threaded, stop-the-world, copying collector
Young
Parallel Scavenge /
Throughput
-XX:+UseParallelGC
(default JEE 5+)
Multi-threaded, stop-the-world, copying collector (CAN NOT to be used with CMS). Automatically used when -XX:+AggressiveHeap was specified.
Young
Parallel New
-XX:+UseParNewGC
Multi-threaded, stop-the-world, copying collector CAN be used along with CMS. Automatically used when CMS was specified for Old Gen.
Old
Serial Old /
Mark Sweep
Compact
-XX:+UseSerialGC




Single-threaded, stop-the-world, mark-sweep-compact (MSC) collector
Old
Parallel Old
-XX:+UseParallelOldGC
(JEE 6+)
Multi-threaded, stop-the-world, copying collector
Old
Concurrent Mark-Sweep / Concurrent Low Pause
-XX:+UseConcMarkSweepGC
Concurrent low pause collector that works sharing the application threads.
For example :
-server -Xms2000m -Xmx2000m -Xss512k -XX:+AggressiveHeap -XX:+UseParallelGC -verbose:gc -XX:+PrintGCTimeStamps -XX:+DisableExplicitGC -Xloggc:/tmp/jboss_GC.log

Sets the ratio between young and old generation.
-XX:NewRatio=3 means that the ratio between the young and old generation is 1:3; in other words, the combined size of eden and the survivor spaces will be one fourth of the heap.

Use cases
Q: Which GC to use when I have applications with a very large young generation heaps ?
A: -XX:+UseParallelGC


Monitor your JVM
JConsole
VisualVM
JRockit
JMAP

As you probably still have questions, refer to:

http://www.oracle.com/technetwork/java/hotspotfaq-138619.html

09 February 2011

Fedora yum usage within a VM

When using a virtual machine with the network sitting behind a host that has a internet connection via a proxy, consider the following steps:

vi /etc/yum.conf -->
add line proxy=http://myproxy:8080/ (replace myproxy with actual IP address to avoid DNS lookup problems)
change line: gpgcheck=1 to gpgcheck=0


vi /etc/hosts --> add line:
80.239.156.215          mirrors.fedoraproject.org

vi /etc/yum.repos.d/fedora.repo -->
- change line: gpgcheck=1 to gpgcheck=0
- uncomment line: baseurl ...
- comment line: #mirrorlist ...


Problems you might run into:
[root]# yum update
Loaded plugins: presto, refresh-packagekit
Error: Cannot retrieve repository metadata (repomd.xml) for repository: fedora. Please verify its path and try again

[root]# yum update
...
[Errno 14] PYCURL ERROR 7 - "" fedora

02 February 2011

Troubleshooting JON server

After having imported elements into your JON server, you might face the problem that some are not available.
If it is a JBoss EAP server that is not available, the JMX credientials might be missing!











Solution :
Click on the JBoss server that is having the red 'not available' sign and click on Inventory. Scroll down and click 'Edit' to be able to change the credentials. After having saved the changes the green availability sign should come up.

24 January 2011

Howto recompile and patch JBoss from SVN

Summary:
Within this post you will see
1. Howto download JBoss sources
2. Howto compile the downloaded JBoss sources
3. Howto run tests to check the integrity of the code (you might change a class to see the difference)


Main post:

- The first thing to do is to get a user/pw for jboss.org
- Then you will have to install Subversion (SVN) on your machine

- Download the current source code with the command line "svn export https://svn.jboss.org/repos/jbossas/trunk /app/my_jboss_dev/" (takes more than an hour)

- If you want to get an older/specific JBoss.org version browse all version with Firefox:
https://svn.jboss.org/repos/jbossas/branches/
and adapt the URL in the command line, for example :

$ svn export https://svn.jboss.org/repos/jbossas/branches/JBPAPP_4_3_0_GA_CP08_JBPAPP-5432 /app/my_jboss_dev/

- After having downloaded the source files make sure to use the right Java compiler (JEE 5 in my case)
$ export JAVA_HOME=/app/java/jdk1.5.0_21/
$ export PATH=$PATH:$JAVA_HOME/bin

- Install the right ANT version (in my case 1.6 (not 1.7+). When using Fedora remove the latest ant from your machine via "sudo yum remove ant"
$ export ANT_HOME=/app/middleware/apache-ant-1.6.5
$ export PATH=$PATH:$ANT_HOME/bin

- Set the flag to be able to run test cases
$ cd <JBoss>/build
$ vi build.properties
(change build.unsecure=true)

- Build the server
$ cd <JBoss>/build
$ ./build.sh
(output can be found in <JBoss>/build/output)
- Start the server
$ cd <JBoss>/build/output/jboss-4.3.0.GA_CP08/bin
$ ./run.sh -c production

- Build all the testcase ( choose the right ANT version, here 1.6)
$ cd <JBoss>/testsuite
(output can be found in <JBoss>/testsuite/output)
$ export ANT_HOME=/app/middleware/apache-ant-1.6.5/
$ export PATH=$PATH:$ANT_HOME/bin
$ ./build.sh

- Run the testcases one by one
$ ./build.sh one-test -Dtest=org.jboss.test.cmp2.optimisticlock.test.OptimisticLockUnitTestCase
result: [junit] Running org.jboss.test.cmp2.optimisticlock.test.OptimisticLockUnitTestCase
    [junit] Tests run: 18, Failures: 0, Errors: 0, Time elapsed: 5.276 sec

$ ./build.sh one-test -Dtest=org.jboss.test.tm.test.TransactionManagerUnitTestCase
result: [junit] Running org.jboss.test.tm.test.TransactionManagerUnitTestCase
    [junit] Tests run: 28, Failures: 0, Errors: 0, Time elapsed: 0.823 sec

10 January 2011

Howto install JBoss Tools to Eclipse

If you want to use the ESB / BPEL, etc. features of Red Hat JBoss within your Eclipse, just add the following URL to your Eclipse software repositories:
http://download.jboss.org/jbosstools/updates/JBossTools-x.x.x.GA
(check on http://download.jboss.org/jbosstools/updates to find latest stable version)
Help --> Install new software ... Add after "Work with:" the URL above and hit Enter...




















Than you can choose the JBoss developpment tools you want to install.

To get the nightly build versions of JBoss Tools do the following :
Goto http://download.jboss.org/jbosstools/builds/nightly/trunk/latestBuild.html
--> all --> repo --> copy the URL from your browser -->
http://download.jboss.org/jbosstools/builds/nightly/trunk/20xx-xx-xx_xx-xx-xx-xxxxx/all/repo/
Paste it into "Work with:" and you can start installing...

03 January 2011

Howto add JVM options to JBoss

There are two useful files to add JVM options to JBoss.

1. <JBOSS>/bin/run.sh (when you need to reference the JBoss path)
Add this after line 12 GREP="grep" in the run.sh file for JBoss 4.3
JAVA_OPTS="-javaagent:$DIRNAME/../server/all/deploy/jboss-aop-jboss5.deployer/pluggable-instrumentor.jar"
or  this for JBoss 5
JAVA_OPTS="-javaagent:$DIRNAME/../server/all/deployers/jboss-aop-jboss5.deployer/pluggable-instrumentor.jar"
In this example I needed to specify the complete path of the JBoss instance using the $DIRNAME variable which points to the directory of the run.sh file. You see in 2. that via the run.conf file you will not be able to do this.

2. <JBOSS>/bin/run.conf (when no path is needed)
# Add this at the end of the file: Enables the jconsole agent locally
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote"