Category Archives: Java

IntelliJ 2020.3 cli command – run idea from your shell again

My latest IntelliJ installation didn’t come with a command line idea command so I wrote a short script and put it to /usr/local/bin/idea on my local machine.

"/Applications/IntelliJ" $@ &

This will only work on a mac. If you’re facing the lack of the command as well you need to find the path to your and put it in a script the same way i did and can use the same place as well. $@ just forwards all arguments you give the script to the called command and & will run it in the background – if you skip the & you will see intellij logs in your shell – so its running in the forground.

IntelliJ .http/.rest cli support

I’m a big fan of the IntelliJ .http/.rest files but only being able to run them from within the IDE was not very satisfying. So I was looking for a way to run them from the cli as well and found This project offers a cli tool named rest-cli that is able to run IntelliJ’s files including env files. So those can also be integrated into CI/CD or other workflows that don’t use IntelliJ.

On the release page you can find the latest version of the tool as zip or brew package. If I remember correctly I was able to install the brew package with

brew install -f

But just downloading it and putting it into the path also works fine.

gradle jacoco plugin with java 15

In my latest experiments I upgraded a project to Java 15 and received exceptions during the build from jacoco that state that the used Java version isn’t supported. Here the exceptions stacktrace I received:

java.lang.instrument.IllegalClassFormatException: Error while instrumenting sun/util/resources/cldr/provider/CLDRLocaleDataMetaInfo.
        at org.jacoco.agent.rt.internal_43f5073.CoverageTransformer.transform(
        at java.instrument/java.lang.instrument.ClassFileTransformer.transform(
        at java.instrument/sun.instrument.TransformerManager.transform(
        at java.instrument/sun.instrument.InstrumentationImpl.transform(
        at java.base/java.lang.ClassLoader.defineClass2(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(
        at java.base/
        at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(
        at java.base/jdk.internal.loader.BuiltinClassLoader.findClassInModuleOrNull(
        at java.base/jdk.internal.loader.BuiltinClassLoader.findClass(
        at java.base/java.lang.ClassLoader.loadClass(
        at java.base/java.lang.Class.forName(
        at java.base/java.util.ServiceLoader.loadProvider(
        at java.base/java.util.ServiceLoader$ModuleServicesLookupIterator.hasNext(
        at java.base/java.util.ServiceLoader$2.hasNext(
        at java.base/java.util.ServiceLoader$3.hasNext(
        at java.base/sun.util.cldr.CLDRLocaleProviderAdapter$
        at java.base/sun.util.cldr.CLDRLocaleProviderAdapter$
        at java.base/
        at java.base/sun.util.cldr.CLDRLocaleProviderAdapter.<init>(
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(
        at java.base/java.lang.reflect.Constructor.newInstance(
        at java.base/sun.util.locale.provider.LocaleProviderAdapter.forType(
        at java.base/sun.util.locale.provider.LocaleProviderAdapter.findAdapter(
        at java.base/sun.util.locale.provider.LocaleProviderAdapter.getAdapter(
        at java.base/java.util.Calendar.createCalendar(
        at java.base/java.util.Calendar.getInstance(
        at java.base/java.text.SimpleDateFormat.initializeCalendar(
        at java.base/java.text.SimpleDateFormat.<init>(
        at java.base/java.text.SimpleDateFormat.<init>(
        at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.getLastResortErrorLogFile(
Caused by: Error while instrumenting sun/util/resources/cldr/provider/CLDRLocaleDataMetaInfo.
        at org.jacoco.agent.rt.internal_43f5073.core.instr.Instrumenter.instrumentError(
        at org.jacoco.agent.rt.internal_43f5073.core.instr.Instrumenter.instrument(
        at org.jacoco.agent.rt.internal_43f5073.CoverageTransformer.transform(
        ... 37 more
Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 59
        at org.jacoco.agent.rt.internal_43f5073.asm.ClassReader.<init>(
        at org.jacoco.agent.rt.internal_43f5073.asm.ClassReader.<init>(
        at org.jacoco.agent.rt.internal_43f5073.asm.ClassReader.<init>(
        at org.jacoco.agent.rt.internal_43f5073.core.internal.instr.InstrSupport.classReaderFor(
        at org.jacoco.agent.rt.internal_43f5073.core.instr.Instrumenter.instrument(
        at org.jacoco.agent.rt.internal_43f5073.core.instr.Instrumenter.instrument(
        ... 38 more

Especially “Unsupported class file major version 59” is a good indicator that Java 15 isn’t supported yet. To get around that you need to upgrade the jacoco tool version in your gradle project by adding:

jacoco {
    toolVersion = "0.8.6"

You need at least 0.8.6 because there experimental Java 15 was added. You can find the release history under Right now 0.8.6 is the latest release that solves the issue without the need to go to a snapshot build of 0.8.7.

IntelliJ IDEA on Mac OS

When using IntelliJ IDEA with Spring Boot on a Mac make sure you have the entry <hostname>.local

in your /etc/hosts file. Replace <hostname> with your Mac’s name. Also make sure that the result of the command ‘hostname’ is in your /etc/hosts file as well pointing to your local address.

Java 9 released

After years of development Oracle has released Java 9. It is available to download from the Oracle page as usual. Here is the EOL message for Java 8:

End of Public Updates for Oracle JDK 8

Oracle will not post further updates of Java SE 8 to its public download sites for commercial use after September 2018. Customers who need continued access to critical bug fixes and security fixes as well as general maintenance for Java SE 8 or previous versions can get long term support through Oracle Java SE Advanced, Oracle Java SE Advanced Desktop, or Oracle Java SE Suite. For more information, and details on how to receive longer term support for Oracle JDK 8, please see the Oracle Java SE Support Roadmap.

IntelliJ use system proxy settings

  • Go to the IntelliJ installation folder and open the bin-directory
  • Add “” at the end of the idea64.vmoptions file (without 64 on a 32-bit system)
  • Restart IntelliJ and configure it to automatically configure proxy (Settings > Appearance & Behavior > System Settings > HTTP Proxy)

How to access BeanManager in a JEE application

There are different ways to get a reference to javax.enterprise.inject.spi.BeanManager in an JEE application:

  • @Inject private BeanManager beanManager;
  • private BeanManager bm = javax.enterprise.inject.spi.CDI.current().getBeanManager();

Especially the second one can be very handy if you hit a part that doesn’t support CDI already.

External ActiveMQ with Wildfly 9.0.1

Target of this post is to configure a vanilla Wildfly 9.0.1 to use an external vanilla ActiveMQ 5.12.0. These are the latest releases on 2015-09-18. I got it running with following steps:

  1. Download Wildfly 9.0.1 if you don’t have it already:
  2. Download ActiveMQ 5.12.0 if you don’t have it already:
  3. Download ActiveMQ Resource Adapter if you don’t have it already:
  4. Extract all the downloaded files. You can place Wildfly and ActiveMQ wherever you want. The resource adapter should go to $WILDFLY/modules/org/apache/activemq/main. All files in should go to this folder.
  5. Edit $WILDFLY/modules/org/apache/activemq/main/META-INF/ra.xml and remove the part marked with <!– NOTE disable the following property if you do not wish to deploy an embedded broker –>
  6. Add the file $WILDFLY/modules/org/apache/activemq/main/module.xml with this content
    <module xmlns="urn:jboss:module:1.1" name="org.apache.activemq" xmlns:xsi="">
        <resource-root path="."/>
        <resource-root path="activemq-broker-5.9.1.jar"/>
        <resource-root path="activemq-client-5.9.1.jar"/>
        <resource-root path="activemq-jms-pool-5.9.1.jar"/>
        <resource-root path="activemq-kahadb-store-5.9.1.jar"/>
        <resource-root path="activemq-openwire-legacy-5.9.1.jar"/>
        <resource-root path="activemq-pool-5.9.1.jar"/>
        <resource-root path="activemq-protobuf-1.1.jar"/>
        <resource-root path="activemq-ra-5.9.1.jar"/>
        <resource-root path="activemq-spring-5.9.1.jar"/>
        <resource-root path="aopalliance-1.0.jar"/>
        <resource-root path="commons-pool-1.6.jar"/>
        <resource-root path="commons-logging-1.1.3.jar"/>
        <resource-root path="hawtbuf-1.9.jar"/>
        <resource-root path="spring-aop-3.2.5.RELEASE.jar"/>
        <resource-root path="spring-beans-3.2.5.RELEASE.jar"/>
        <resource-root path="spring-context-3.2.5.RELEASE.jar"/>
        <resource-root path="spring-core-3.2.5.RELEASE.jar"/>
        <resource-root path="spring-expression-3.2.5.RELEASE.jar"/>
        <resource-root path="xbean-spring-3.15.jar"/>
        <exclude path="org/springframework/**"/>
        <exclude path="org/apache/xbean/**"/>
        <exclude path="org/apache/commons/**"/>
        <exclude path="org/aopalliance/**"/>
        <exclude path="org/fusesource/**"/>
        <module name="javax.api"/>
        <module name="org.slf4j"/>
        <module name="javax.resource.api"/>
        <module name="javax.jms.api"/>
        <module name=""/>
  7. Edit $WILDFLY/standalone/configuration/standalone.xml and add the following parts:
    • Under urn:jboss:domain:ejb3:3.0 add
        <resource-adapter-ref resource-adapter-name="activemq-rar.rar"/>
        <bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
    • Under urn:jboss:domain:resource-adapters:3.0 add the resource adapter
          <resource-adapter id="activemq-rar.rar">
              <module slot="main" id="org.apache.activemq"/>
              <config-property name="ServerUrl">tcp://localhost:61616</config-property>
                  <connection-definition class-name="org.apache.activemq.ra.ActiveMQManagedConnectionFactory" jndi-name="java:/ConnectionFactory" enabled="true" use-java-context="true" pool-name="ConnectionFactory"/>
                  <admin-object class-name="org.apache.activemq.command.ActiveMQQueue" jndi-name="queue/test-queue" use-java-context="true" pool-name="test_queue">
                      <config-property name="PhysicalName">testQueue</config-property>
  8. In your project you will need to activate javax.jms.api in your jboss-deployment-structure.xml file (placed in WEB-INF folder):
    <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">
                <module name="javax.jms.api" export="true"/>
  9. Now you should be able to write your MDB like this
    import javax.ejb.ActivationConfigProperty;
    import javax.ejb.MessageDriven;
    import javax.jms.Message;
    import javax.jms.MessageListener;
    @MessageDriven(activationConfig = {
        @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
        @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/test-queue"),
        @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
    public class TestMDB implements MessageListener {
        public void onMessage(Message msg) {
            // do something
  10. You will find the ActiveMQ management gui under http://localhost:8161/admin/. The default credentials are admin/admin.