Although there are lots of posts about on the subject I can't get this to work so here goes. I've got
a session bean with a container managed persistence context like this:
and a
JSF managed backing bean like this:
and it's fine, I can access the database from my backing bean just fine. Then I realise that I
need a custom JSF validator that requires a new class and a new file. So I create a new class
for the custom validator:
and this results in a NullPointerException when I try to access the
EJB usersFacade. I gather that with the first
@EJB reference in my code snippets I'm instantiating the EJB, and then again with the second reference (so why
doesn't it work twice?). I read somewhere that I need to do a jndi lookup from my constraint validator class but
to be honest I can't seem to get that working either.
I been experimenting with @EJB(name= and @EJB(mappedName= and @EJB(lookup= and @Stateless(name= etc...
but I can't manage to get everything in the right place at the right time to work.
If anyone can give me a helping hand here I'd be greatly appreciative. I'm using Glassfish v3.
Thanks,
Brendan.