Relentless Coding

A Developer’s Blog

  • Tomcat7 Maven Plugin Invalid Byte Tag in Constant Pool 19

    I use tomcat7-maven-plugin to spin up a Tomcat 7 container where I can run my web application. When I added dependencies for log4j2 (version 2.11.0) to my project, I got the error:

    org.apache.tomcat.util.bcel.classfile.ClassFormatException:
    Invalid byte tag in constant pool: 19
    

    Apparently, log4j2 is a multi-release jar and older versions of Tomcat can’t handle that. So I needed to upgrade my Tomcat maven plugin.

    Read more…
  • How to Write a Custom Appender in Log4j2

    Ever wanted to test whether a log statement is triggered? Or whether the format is the way you want? In this post, we’re going to create a custom log appender so we can be sure logging is behaving the way we expect.

    Read more…
  • Unit Test Log4j2 Log Output

    Sometimes you want to test if certain log output gets generated when certain events happen in your application. Here is how I unit test that using log4j2 (version 2.11.0).

    Read more…
  • JMockit Fakes

    If you are working with microservices, you may find that you are having a lot of dependencies on other services. If you want your tests to be autonomous, that is, running in isolation of those dependencies, you can either use a tool like WireMock, or you can use a mocking framework.

    Recently, I came across JMockit, a mocking framework for Java.

    Read more…
  • Bash Magic Space

    Sometimes, a little feedback is appreciated when writing some of the more complex Bash constructs. The “magic space” is one the things that can help us get quick feedback.

    Read more…
  • Unit Test Grails GORM Formulas

    Let’s take a look at how we can test GORM formulas in Grails.

    Read more…
  • Import Contacts Vcards Into Nextcloud

    In this post, we’re going to export our contacts from Google in vCard version 3 format, split the contacts file and use cadaver to upload all files individually to your address book.

    Read more…
  • Always on Vpn and Captive Portals

    I was attending a meetup that was taking place in a bar in Utrecht. The first thing you want to do is to make a connection to the internet and get started. The location used a captive portal, however. You know: you have the name of the wireless network (SSID) and the password, but when you try to open any web page, you are directed towards a login page where you have to accept the terms and conditions of whoever is operating the network.

    But what if you use an always-on VPN? You cannot connect to the network, because your MAC and IP address are not whitelisted yet by the operator. And you cannot get to the login page, because you do not allow any traffic outside your VPN.

    Read more…
  • Tutorial Rapid GUI Development With Qt Designer and PyQt

    Confession: I am the opposite of the lazy coder. I like doing things the hard way. Whether it’s developing Java in Vim without code completion, running JUnit tests on the command line (don’t forget to specify all 42 dependencies in the colon-separated classpath!), creating a LaTeX graph that looks “just right”, or writing sqlplus scripts instead of using SQL Developer (GUIs are for amateurs), I always assumed that doing so would make me a better programmer.

    Read more…
  • How to Use Groovy's CliBuilder

    Let’s use Groovy’s CliBuilder to create CLI programs that can take flags.

    Read more…