Browsed by
Category: Tech

JavaLand 2018

JavaLand 2018

JavaLand Logo Disclaimer: I may be a bit biased on the topic as I really like the conference from the beginning and attended in this years session review process.
The 2018 edition of the still very young, community driven, Java conference JavaLand took place in the theme park “Phantasialand” in Brühl next to Cologne from March 13th-15th. The conference was splitted into two conference days (13th and 14th) and one workshop day. It was just the fifth edition of JavaLand and I was able to attend the conference days.
What makes JavaLand pretty special and very unique is the venue. It is not only located in a theme park but as it is early in the year the season for the park has not yet begun and the park is opened for JavaLand attendees only. To be honest they just open up a part of the park but it is still pretty cool. As part of the social event on the first conference day there are some park rides opened for the attendees which shifts the spirit of the attendees pretty fast away from the technical part and makes it really easy to come together with new people even if you are not the type to make new contacts fast.
The conference itself mostly consists of 40 minute talks mixed up with some panels and just a couple of hands on workshops per day.

Sessions:
A huge part of the sessions is in german which should be no surprise as it is a german conference which tries to get new speakers from the community involved and as common as it is that most of us speak and understand english these days it is not the mother tongue and there still are many people who don’t speak english frequently which leads to not being comfortable and practiced enough to hold a talk in english. Nevertheless the program committee has an eye on having some english talks at any time so that non german speaking visitors can attend a session at any time.
This year I could hardly make out any new hype topic in the talks. The topics were nicely spread so there should be something interesting for everyone most of the time.
I for myself attended a lot of core Java topics and listened to some panels about the future of JavaEE/JakartaEE as well as the distribution of the JDK and the changes in the support for desktop technologies.
Besides that I got a nice introduction to gRPC which I only knew by name so far and am now in a better position to sort the application possibilities out.

Read More Read More

Automation via shell aliases

Automation via shell aliases

terminal-appWhen working on software development projects there are many repetitive tasks to do, may it be the deployment of a binary, starting of different servers in docker containers or standalone, the exchange of config files for different environments, the migration of a database or something simple as the navigation to deep paths on the command line to do some editings or server starts there. All this tasks can be annoying and over time they add up to a significant amount of time which is not very productive. The logical counter measure for a developer should be to automate as much as possible of this recurring tasks. For example you can bundle up the start of different docker containers via docker compose or delegate some tasks to a CI server but in the end some tasks will remain which you have to trigger manually -at least on your development machine- which is where your shell can become handy with a feature called ‘alias’. An alias is an automation feature which at least every popular Linux/Unix/macOS shell provides. With an alias you can define a new command that executes a series of shell commands completely automatic.
I have a rule of thumb defined where I try to automate every manual task by an alias which I have to do at a minimum of three times a week (to be honest I also do an alias if I have to do a task two times every week just because it is such a handy feature).
To define a new alias all you have to do is to add it to the config file of your shell. In the case of the very popular bash shell this file is called .bashrc (on macOS you have to use the .bash_profile file when you use bash) while for zsh it is called .zshrc but in both cases the file sits in the users home folder. All you have to do is to open your rc file with an text editor, scroll to the end and add a new line starting with the keyword ‘alias’ followed by the alias name you chose and the command that should be executed. A sample command could look like this:

alias cdwildfly="cd ~/programming/java/servers/wildfly/"

Read More Read More

Integrating Flyway with Java EE and using its datasource

Integrating Flyway with Java EE and using its datasource

Flyway is my favourite tool when it comes to database migrations because its convention over configuration approach makes it fairly easy to use while bootstrapping and configuration is reduced to a minimum. For those of you who don’t know anything about database migration tools (evolutionary database design) in short the concept is to track SQL scripts with your source code which reflect the actual version of your database that matches the code version to run properly. This could be done without any framework but what tools like Flyway or liquibase bring to the table is the ability to check automatically at build- or start-time if the database is at the latest available version and if not run all available SQL scripts from the actual database version to the newest one available. Flyway can be used with all the major SQL dialects, many different relational databases and has plugins for a huge variety of frameworks to be integrated into. For more detailed information visit the projects website.

As I’m a heavy Java EE user I ran into the problem that Java EE has no special support by Flyway. My problems with this are that there is no build in way to get the actual JPA datasource (defined in the persistence.xml) and there is no solution provided that wires Flyway in the startup process to run the migration scripts at startup. Flyway provides integration plugins with this functionalities for other frameworks like Spring Boot but fortunately it is not that complicated to realise the same thing in Java EE.

In many scenarios it is no problem to trigger Flyway in the right moment as it is possible to integrate it in the maven build process or start it manually via the command line but both solutions doesn’t fit my needs. I want to have Flyway check my database at startup as the production server is not the server where the build process happens and I want to avoid a situation where I have to execute a shell command manually after deploying a new version. For this cases Flyway can be started from the source code as well. As it has to be run before the application starts and tries using the database you have to make sure that the Flyway scripts are run before that. I found two solutions to make this work. The first one uses Hibernates “Service Provider Interface” (SPI) -I use WildFly in this example which comes with Hibernate- to register a new integrator and grab the datasource via a little bit of reflection code while the second approach (which is my favourited solution) defines a new singleton bean which uses @resource injection to get the datasource.

Hibernate SPI integrator solution

Read More Read More

Find and kill a process on a specific port (lsof)

Find and kill a process on a specific port (lsof)

terminal-app
You might all have experienced the situation when you want to start a server either from within your IDE or via the terminal to only get the error that the “port is already in use” and the startup is aborted. This is mostly caused by aborting the server or a crash of the IDE which started it and not terminating it properly. When using macOS (or any other BSD or a Linux) there is a simple solution for this.

For such purposes macOS comes with the “lsof” command which stands for “list open files”. Its purpose is to show who is using a specific file or in our case who is using a specific port. After identifying the process it is easy to terminate it using the “kill” command.

Read More Read More

Apple MacBook Pro late 2016

Apple MacBook Pro late 2016

apple.com

This blog should not transform to yet another Apple blog but as a Java Developer the Mac is my preferred platform which I use daily. This is the reason why I tend to take a closer look when Apple shows the next generation of macOS or Mac hardware even if I’m not buying a new one immediately. I want to get a feeling were the platform is going to. Last week Apple showed its last iteration of the MacBook Pro to the public and I want to share my thoughts as a developer about it.

At first I like the new look, the lower weight is really great for me as I often travel around with the MacBook being in my backpack and every grams you could save there is a win. The first thing that got me thinking was if it really is a good idea to start the 13″ model with just 8GB of RAM. From a developer standpoint I think that this is the absolute minimum and you should get an upgrade here if possible. When you are a Java developer and start your app server (sometimes multiple servers at once), a database in a VM, your IDE, Browser, Mail etc this will lead very fast to eating up all the RAM and swapping out to the SSD. SSDs are very fast these days but they are no match to the RAM and it will slow down your system. 16GB will be a better solution here and that Apple doesn’t offer 32GB for the 13″ model is a shame. That they commented afterwards that this decision was made because 32GB would have used to much of the battery is a reason but not one that I like. I would much more like to work a shorter time with a faster system then work longer with a slow system that has used up all its memory because this often makes effective working impossible and I guess in the future we will need more RAM than today instead of less.

Read More Read More