users@glassfish.java.net

Couldn't create bookstore database bean: Unable to retrieve EntityManagerFa

From: <glassfish_at_javadesktop.org>
Date: Thu, 23 Jul 2009 13:29:14 PDT

There is a german proverb "vor lauter Bäumen den Wald nicht sehen" which literally means "not seeing the forest due to all the trees". I don't know how do you say that in english but you might give me some English lessons :-).

After spending that much time of uninstalling and installing all the different kinds of v3 installations I forgot to take a close look at the log but I got at least a hint where the problem now is. The console says:

INFO: Couldn't create bookstore database bean: Unable to retrieve EntityManagerFactory for unitName null

The error occurs in com.sun.bookstore1.listeners.ContextListener:

public final class ContextListener implements ServletContextListener {
    @PersistenceUnit
    private EntityManagerFactory emf;
...
        try {
            BookDBAO bookDB = new BookDBAO(emf);
            context.setAttribute("bookDB", bookDB);
        } catch (Exception ex) {
            System.out.println(
                    "Couldn't create bookstore database bean: "
                    + ex.getMessage());
        }

It seems that the EntityManagerFactory does not get injected. I will do some further investigation and keep you posted. Any hint but somebody?

Tai
[Message sent by forum member 'taitruong' (taitruong)]

http://forums.java.net/jive/thread.jspa?messageID=357299