Automatically reconnect to a database after a failure in JBoss EAP 7

My JBoss EAP 7 server couldn’t cope with a failing database. After a database restart or failure, e.g. due to maintenance, it simply would not connect to the database again automatically. The application simply stopped working as soon as the database was unavailable for a short period of time. JBoss’s server.log was full of (not … Read moreAutomatically reconnect to a database after a failure in JBoss EAP 7

How to find the physical file path of the current FUSER of a Natural runtime

Here’s a short subroutine for reading the physical file path of the current FUSER of a Natural (from Software AG) runtime. I’m not sure if it works on a mainframe, but it definitely runs on a Linux system. The subroutine returns the following information, if it runs successfully: P-FUSER-PATH /home/macke/fuser P-RC 0 Otherwise the return … Read moreHow to find the physical file path of the current FUSER of a Natural runtime

How to combine/join file paths in Gradle/Groovy

One might think that joining (or combining) two file paths together with Groovy would be an easy thing to do. I’m used to “nice” methods from Ruby like File.join (see How to do a safe join pathname in ruby?): File.join(“path”, “to”, “join”) As it turns out, there is no such method in Groovy. However, here … Read moreHow to combine/join file paths in Gradle/Groovy

How to use an existing access token to authenticate against the Google API in Ruby

After a few hours of trial and error and finally getting authentication against Google’s API working in Ruby I think it’s time for a blog post 😉 I had a simple (at least I thought it was simple) requirement: Reading the people in a user’s Google+ circles with Ruby. Because I use OmniAuth in my … Read moreHow to use an existing access token to authenticate against the Google API in Ruby

How to enable access logging (accesslog) in JBoss EAP 7

Configuring JBoss EAP 7 to write an access log (e.g. like Apache webserver) is quite easy with the CLI: /subsystem=undertow/server=default-server/host=default-host/setting=access-log:add If you need any additional configuration, take a look at this: Wildfly 10.0.0.Final Model Reference. For example, to change the prefix of the log’s file name: /subsystem=undertow/server=default-server/host=default-host/setting=access-log:write-attribute(name=prefix, value=”my_access”) Alternatively, you could change the configuration in … Read moreHow to enable access logging (accesslog) in JBoss EAP 7

How to seed the database with sample data for an Arquillian test

Arquillian makes it easy to test your Java EE application on a real server. However, if you deploy an application, that uses a database to perform its tasks, how do you make sure a database with test entries is available on the target server? If you set up a “real” database on the server, the … Read moreHow to seed the database with sample data for an Arquillian test

How to test a REST API with Arquillian

Testing a REST API on a real application server with Arquillian is easy – if you know what you need to do 😉 I have this simple REST service, that authenticates a user: @POST @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public Response authenticateUser(final UserData userData) { … return Response .status(401) .entity(false) .build(); } Let’s write a test for this … Read moreHow to test a REST API with Arquillian

How to test JBoss EAP 7 with Arquillian

It took me quite some time to get my Arquillian tests running against a remote JBoss EAP 7.0.0.Beta1 application server, so I thought I’d share my configuration. At the time of this writing, there was no Arquillian container adapter for JBoss EAP 7 available. So I had to use the Arquillian Chameleon Container. However, it … Read moreHow to test JBoss EAP 7 with Arquillian

Using Gradle wrapper behind a proxy server with self-signed SSL certificates

Today, I wanted to add a Gradle Wrapper to my Java project but had a few issues. I am behind a proxy and it changes the SSL certificates to be able to scan traffic for viruses. My first attempt to start gradlew build resulted in: Exception in thread “main” java.net.UnknownHostException: services.gradle.org at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) … Read moreUsing Gradle wrapper behind a proxy server with self-signed SSL certificates

How to export all mapped environments from Natural Studio (SPoD)

A colleague of mine wanted to export all the mapped environments from Natural Studio (SPoD). As we have quite a lot of different environments due to our complex staging concept, manually re-creating this list would be cumbersome. Long story short: we didn’t find a way to export the environments from within Natural Studio. However, after … Read moreHow to export all mapped environments from Natural Studio (SPoD)