I just wanted to make a small post regarding an issue I spent almost a day getting rid off. I have a quite typical web architecture :

  • jar module encapsulating business logic (EJBs)
  • war module providing front end web access
  • war module for web service access (using JAX-RS)

The headache

Each war module depends on the ejb-client counterpart present in WEB-INF/lib. The problem I faced is that my @EJB injections was raising ClassNotFoundExceptions. I tried bypassing automatic injection with manual JNDI lookups but the same errors occurred. Playing with the debugger I found that the jars present in lib folder were not added into the web application's classloader.

The workaround

I spent a lot of time trying many things to fix this and found out the trick by downloading Jersey's sample. You simply have to have a sun-web.xml with the following content :

<sun-web-app>
  <class-loader delegate="true"></class-loader>
</sun-web-app>

I hope it will help someone else!

Swift macro : @VisibleForTesting

As an ancient Java developer, I’ve learned to use a set of annotations to bring meta programming in my projects. Meta programming can be ...… Continue reading

Dark Mode iOS Snapshot

Published on January 10, 2021

Git-gone

Published on December 31, 2020