Category: Java

Simple camel project with full maven instructions

Generate maven project stub directory… mvn archetype:generate -DgroupId=com.yourcompany.it.arch.poc.esb -DartifactId=esbpoc -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false …then create the single class in our POC… package com.yourcompany.it.arch.poc.esb; import javax.jms.ConnectionFactory; import org.apache.activemq.*; import org.apache.camel.*; import org.apache.camel.builder.*; import org.apache.camel.component.jms.*; import org.apache.camel.impl.*; public final class App { public static…

Printing java command line flags

Just a quickie as I often forget this for some reason. If you need to obtain a particular switch, whether the default or as configured in a running process, what is below will get it for you. Normally, outside of…

Creating a barcode in java

Nice little library to do this is located at http://www.barcodelib.com/java_barcode/main.html… import com.barcodelib.barcode.*; public class MyBarCode { public static void main (String args[]) throws Exception { Linear barcode = new Linear(); barcode.setType(Linear.UPCA); java.util.Random r = new java.util.Random(); String str = new…

Finding sensitive data in a heap dump

What is below proves the card holder PAN is in the clear in the dump… public class memSecurity { public static void main (String args[]) throws Exception { String c = “1234567887654321”; Thread.sleep(180000); } } Compile and run what is…

Calculating gaps between full CMS cycles

While troubleshooting a performance issue, we had a need to graph the number of seconds between full collections. We used what is below. This assumes you have added -XX:+PrintGCDetails and -XX:+PrintGCDateStamps as well as a file location for -Xloggc: to…

Dump heap programatically

This is one way you can dump the heap of a running JVM from within a page. This is not something you would place in a running production system, as you don’t want random GET’s to keep dumping the heap…