JEE6, EJB and Glassfish diaries

Some notes while trying to get up on speed with Glassfish and JEE6, mainly about what can go wrong… and there is plenty of it. The most time-consuming activity is researching generic stack traces which hardly ever point to the real cause.

NullPointerException when deploying

Been there, done that: A beans.xml in META-INF might cause a NullPointerException when deploying to glassfish

Good to know for next time…

http://www.java.net/forum/topic/glassfish/glassfish/beansxml-file-produce-npe

javax.naming.NamingException: Lookup failed for SomeStatelessBean#SomeStatelessBean in SerialContext

When SomeStatlessBean is annotated with @Stateless, it shouldn’t implement a generic interface.

Unable to retrieve EntityManagerFactory for unitName null

persistence.xml needs to be in src/META-INF, not webcontent/META-INF

Stateful session beans are instantiated constantly…

Still no idea why. Working around it by annotating the form backing objects with @ManagedBean
@SessionScoped
@Named

JSF @ManagedBean bean getters called multiple times

Yeah, it does that. Pretty annoying if the getter forwards to a service call. Do the service call in a @PostConstruct, keep the results in the bean and service the getter from that.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s