geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Xh <>
Subject Geronimo 2.0.1 and entity bean problem
Date Wed, 05 Sep 2007 00:08:42 GMT
Hi All!

I'm trying to create my first ejb3 entity bean in Geronimo 2.0.1.

I base on this wiki:

I've created simple WebModule and annoted it, just like this:

public class WebModule implements Serializable {

Acording to the above wiki openejb-jar.xml is only to define module and artifactId, so do
In addition, I have META-INF/persistance.xml that looks like this:

<?xml version="1.0" encoding="UTF-8"?>

    xmlns:xsi="" version="1.0"
    <persistence-unit name="WebModulePU">
            <property name="openjpa.ConnectionURL"
                value="jdbc:derby:target/dataweaver" />
            <property name="openjpa.ConnectionUserName" value="dw" />
            <property name="openjpa.ConnectionPassword"
                value="admin123" />
            <property name="openjpa.ConnectionDriverName"
                value="org.apache.derby.jdbc.EmbeddedDriver" />

Later on, in my Servlet I have:

// thread-safe, class level context
@PersistenceContext(unitName = "WebModulePU", name = "persistence/em")
public class DispatcherServlet extends HttpServlet implements Servlet {
EntityManager em = null;
        try {
            em = (EntityManager) (new InitialContext())
        } catch (NamingException e) {

The thing is that my application deploys and starts without any errors.
But I cannot see my entity bean in the JNDI Viewer; 
as a result, when I access my Servlet I keep getting:
javax.naming.NotContextException: persistence/em

Can some one provide an example of working entity bean and its persistance.xml?

thanks and best regards

Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail

View raw message