We had an issue during a deployment in which an ORA-01002 was thrown. The interesting part is when we compile and run what is below… import java.sql.*; public class test { public static void main (String args[]) throws Exception {…
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…
“Unable to find valid certification path to requested target” exception
In a JBOSS environment, the issue was the connector in the server.xml file is only used for *inbound* connections, not ones out from JBOSS to another SSL enabled service. If you compile and run the following test class below… [sa-jboss@cmhldecomecm01…
Verifying an SSL certificate expiration with java
We came up with this as a one-off to alert us when a certificate was close to expiration (we were burned one too many times)… import java.net.*; import java.security.cert.*; import javax.net.ssl.*; public class GetCertDates { public static void main(String []…
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…
Examples of connecting to kerberos hive in JDBC
We had a need to authenticate user requests against AD in a kerberos enabled cluster, and allow “local” hive sessions to use only a keytab. Below are the examples of each. First, we show how to connect over a binary…
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…