How to use BOM file with Maven?

A bom is a so called bill of materials – it bundles several dependencies to assure that the versions will work together. JBoss has boms for many of it’s projects, including Arquillian and the JBoss AS itself. There is an explanation of the bom usage in the maven docs – it is hidden well below. … Read more

How do you specify the root context in your tags in web.xml?

This can’t be done in an appserver agnostic way. Context root isn’t part of the standard web.xml file. It’s either specified when you deploy the app or in an appserver specific descriptor. Glassfish: sun-web.xml; JBoss: jboss-web.xml; Weblogic: weblogic.xml; Tomcat: context.xml; WebSphere: ibm-web-ext.xml. Note: the above applies to deploying WAR files. EAR files are a different … Read more

How to enable TLS 1.2 in Java 7

There are many suggestions but I found two of them most common. Re. JAVA_OPTS I first tried export JAVA_OPTS=”-Dhttps.protocols=SSLv3,TLSv1,TLSv1.1,TLSv1.2″ on command line before startup of program but it didn’t work for me. Re. constructor Then I added the following code in the startup class constructor and it worked for me. try { SSLContext ctx = … Read more

How to call a stored procedure from Java and JPA

JPA 2.1 now support Stored Procedure, read the Java doc here. Example: StoredProcedureQuery storedProcedure = em.createStoredProcedureQuery(“sales_tax”); // set parameters storedProcedure.registerStoredProcedureParameter(“subtotal”, Double.class, ParameterMode.IN); storedProcedure.registerStoredProcedureParameter(“tax”, Double.class, ParameterMode.OUT); storedProcedure.setParameter(“subtotal”, 1f); // execute SP storedProcedure.execute(); // get result Double tax = (Double)storedProcedure.getOutputParameterValue(“tax”); See detailed example here.

Using HeapDumpOnOutOfMemoryError parameter for heap dump for JBoss

Here’s what Oracle’s documentation has to say: By default the heap dump is created in a file called java_pid.hprof in the working directory of the VM, as in the example above. You can specify an alternative file name or directory with the -XX:HeapDumpPath= option. For example -XX:HeapDumpPath=/disk2/dumps will cause the heap dump to be generated … Read more