Skip to content

René Link

I'm a software developer since 2002 and founded my company Link Intersystems in 2011. My favorite programming language is Java, but I m also experienced in other languages. I focus on design and architecture of java enterprise applications with spring, hibernate or jee. Software quality and therefore clean code belong to my basic principles. ---- If you want others to take you seriously, than take your craftsmanship seriously - be a professional ---- Visit me on careers 2.0 and follow me on

How to create an independent branch in git

In a git repository everything normally starts with an initial commit and all other commits are ancestors of this first commit. But is it possible to create a second initial commit or even a third? Another initial commit with a complete different working directory? Yes it is.

Clean Code with underscores in literals

As of java 1.7 the java language specification allows integer literals to contain underscores in order to make them more readable. If it is applied in a good way it can enormously increase the readability of your code. In java 1.6 one had to define integer literals like this: int iterations = 10000000; long bytes = 0b11010010011010011001010010010010; With java 1.7 such integer literals can be written more readably by using the underscore as a  thousands separators. int iterations = 10_000_000; or when using binary literals one can use the underscores to group bytes long bytes = 0b11010010_01101001_10010100_10010010;   Further information can be found at Recommended Reading  

How to fix java.lang.ClassNotFoundException: in eclipse

If you use IBM’s WebSphere plugin for eclipse you might have the problem that other plugins can’t establish an SSL connection anymore. The result is most times a ClassNotFoundException: This blog explains the reason behind the problem and gives a workaround to prevent that exception. Problem description When a component within eclipse (e.g. atlassian jira connector) tries to connect to an SSL socket a ClassNotFoundException: is thrown. This exception is often the root cause of other exceptions. Caused by: java.lang.ClassNotFoundException: at at at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke( at sun.reflect.DelegatingMethodAccessorImpl.invoke( at java.lang.reflect.Method.invoke( at org.apache.commons.httpclient.protocol.ReflectionSocketFactory.createSocket( at org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.createSocket( at at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$ at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry( at org.apache.commons.httpclient.HttpMethodDirector.executeMethod( at org.apache.commons.httpclient.HttpClient.executeMethod( at com.sun.jersey.client.apache.DefaultApacheHttpMethodExecutor.executeMethod( … 18 more… Read More »How to fix java.lang.ClassNotFoundException: in eclipse

Remove directories and files permanently from git

Some day you might want to remove files or directories from git permanently, because someone committed sensitive data or large binary files that should not reside in the repository to keep clone times short.  In this blog I want to show you how to delete directories and files permanently from a git repository. The first chapter is a short answer and is intended for those of you who only want to quickly remove files and don’t want to undestand it in-depth. The section chapter dives into the depth of git and gives you links to other resources to understand how files are managed in git and thus can be removed. The short answer… Read More »Remove directories and files permanently from git

How to fix IBM Websphere ant task error: Unable to parse setupCmdLine: null\bin\setupCmdLine.bat

When trying to execute a wsadmin command using ant you might get the error Unable to parse setupCmdLine: null\bin\setupCmdLine.bat  (The system cannot find the path specified) This error is caused when you don’t provide the user.install.root system property or no wsadmin task profileName property. In order to fix you can either add a user.install.root property and point it to your websphere profile directory (in default installations e.g. AppSrv01) or you can just add a profileName attribute to the wsadmin task. In this case the wsadmin task resolves the profile directory for you, because of the wasHome attribute that you must provide. The analyse of the error Reproduce the error Before we dive into the analyse we need an example project to… Read More »How to fix IBM Websphere ant task error: Unable to parse setupCmdLine: null\bin\setupCmdLine.bat

How to fix IBM Websphere JNDI exception “cannot find the factory for this scheme: java”

Some time ago I stumbled on a weird exception when deploying an EAR on IBM WebSphere Application Server 8.5. The EAR got successfully installed, but when the application server tried to start the WAR archive of my EAR I got this exception: javax.naming.ConfigurationException: NamingManager.getURLContext cannot find the factory for this scheme: java at at at at org.apache.aries.jndi.DelegateContext.lookup( at javax.naming.InitialContext.lookup( After searching the web for this exception I came to the conclusion that I have to debug it on my own. Some days of debugging later I found out that there was a configuration problem that was not obvious. So I decided to write this blog and I hope that it can safe… Read More »How to fix IBM Websphere JNDI exception “cannot find the factory for this scheme: java”

Stateless Rest Service Authentication

REST Services are considered stateless. Therfore a Rest Service must not hold any client state. If so REST Services can be scaled easily by adding new server nodes without to worry about session replication. But this also means that a REST-Client must send all authentication information with every request. There are several techniques to handle that and each of them has it’s pros and cons. This blog wants to discuss some different approaches. Why not just using stateful application services? The simplest way to implement authentication in an application service is to make it stateful. This means that the application service is aware of requests that the client made before some request. Therefore… Read More »Stateless Rest Service Authentication

A type-safe named query design approach for JPA

The starting point In a JEE you normally use the Java-Persistence-API JPA to access the data. JPA provides named queries which are statically defined queries with an unmodifiable query string. Because the query string is unmodifiable a client must still be able to provide parameters that concretize a query. Those query parameters are placed in the query string in a special format, e.g. :username. So if we define a named query in the simplest way it will look like this: @Entity @NamedQueries( { @NamedQuery( name = "findOrdersByUsername", query = "select distinct o from Order o JOIN order.user AS u where u.username = :username") } ) public class Order { ...… Read More »A type-safe named query design approach for JPA

The MVC pattern implemented with java swing

MVC Pattern Basics The MVC pattern describes a way to organize the components of a graphical user interface. Therefore it must cover all aspects of a user’s interaction with an application. If we take an analytic look at a graphical user interface we will understand why the MVC pattern is composed of the 3 elements model, view and controller. Model A model is an abstraction of something that you want to present the user in a view. Therefore there are two stereotypes of models: UI-model A ui model is an abstraction of a ui component’s state. Therefore it has properties like: focus, enablement, selection and so on. A good example… Read More »The MVC pattern implemented with java swing