Showing posts with label application server. Show all posts
Showing posts with label application server. Show all posts

Monday, July 15, 2013

On JPA fetch groups

It looks like JPA 2.1 has been released with support for "fetch groups". Hopefully that'll meet the previously identified need for control over JPA fetch behaviour.

It's come too late for me, as I'm no longer working with Java EE or JPA and am feeling badly burned by my experience with the platform after adopting EE 6. Hopefully this'll help others who're struggling with JPA performance issues.

Monday, June 25, 2012

Updated AS7 <-> EclipseLink integration

I've pushed an update to the EclipseLink <-> AS7 integration library github.com/ringerc/as7-eclipselink-integration.

Version 1.1 now produces a proper JBoss AS 7 persistence provider integration module. It'll automatically inject the right properties into EclipseLink, so you don't need to modify persistence.xml or set system properties anymore.

I haven't found a proper solution to the null static metamodel issue or the dynamic weaving issues. Rich's code for VFS integration plus the logging integration code and the rest all just works automagically now, though.

I'd like to add better integration tests, but I'm being held back by today's JBoss AS 7 issue, https://issues.jboss.org/browse/AS7-3955 .

NOTE: This version of the integration code doesn't seem to work on the latest AS nightly, but it's fine on 7.1.1.Final.

Hope this is useful.

Friday, June 22, 2012

Getting EclipseLink to play well on JBoss AS 7

It's currently a bit tricky to get EclipseLink to work smoothly on JBoss AS 7. There's a good write-up on it by Rich DiCroce on the JBoss Community site that I won't repeat; go read it if you want to use EclipseLink with AS7.

I've packaged Rich's VFS integration code, some JBoss loging integration code, and a platform adapter needed for older versions of EclipseLink into a a simple as7-eclipselink-integration library that can be included directly in projects or bundled in the EclipseLink module installed in AS7.

The library build produces a ready-to-install AS7 module for EclipseLink with the integration helper code pre-installed.

It should simplify doing the integration work on a project.

Thursday, June 21, 2012

NullPointerException on @Inject site even with beans.xml?

Are you staring at a stack trace from a NullPointerException thrown by access to a CDI-injected site?

Have you checked to make sure beans.xml is in the right place:


Still not working? Does a message about activating CDI appear in the server log, but injection still not work?

Make sure you used the right @Inject annotation. Especially with code completion and dependencies pulling Google's Guice onto the classpath it's easy to land up accidentally choosing com.google.inject.Inject instead of javax.inject.Inject.

Yep, I just wasted twenty minutes staring at code that wasn't working before I noticed this. Time to find out which dependency is pulling in Guice, add an exclusion, and nag them to make it an <optional>true</optional> dependency. It looks like in my case it's coming from org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-impl-maven, so a quick:

<exclusion>
<groupId>org.sonatype.sisu</groupId>
<artifactId>sisu-inject-plexus</artifactId>
</exclusion>

ensured that mistake wouldn't happen again.

Saturday, June 25, 2011

Java EE application servers - learning from the past

(Edit 15 July 2011: JBoss AS 7 is here, and brings a huge improvement to class loading and memory management. It's not full isolation, but it limits the exposed contact surface between app server and app greatly, and massively improves class loading. Brilliant!)

If you've used a Java EE application server like Glassfish or JBoss AS for long, you will have experienced classloader leaks, though you may not have realized it.

If you've ever seen the error java.lang.OutOfMemoryError: PermGen space at deploy-time, read the linked article above. If you have ever worked on the JVM, on app servers, or on EE applications, please read on.

Even if you haven't hit classloader leaks, you should be aware of the various ways Java EE applications can cause memory leaks in the server and what to do about them.

For those coming here for help fixing an immediate issue with their app: Read the links above, and this article on using jhat's JavaScript interface to find likely leaks. More fancy JavaScript OQL tricks are here.