Unable to retrieve EntityManagerFactory

I am receiving an error

Unable to retrieve EntityManagerFactory for unitName nulljava.lang.IllegalStateException: Unable to retrieve EntityManagerFactory for unitName null

from

package session;

import javax.ejb.Remote;

import javax.ejb.Stateless;

import javax.persistence.EntityManager;

import javax.persistence.PersistenceContext;

import javax.persistence.Query;

import entity.PersonObj;

import session.PersonDAO;

import javax.ejb.EJBException;

@Stateless

public class PersonDAOBean implements PersonDAO

{

@PersistenceContext

private EntityManager em;

public void addPerson(PersonObj person)

{

System.out.println("in the addperson");

try

{

em.persist(person);

System.out.println("after persist");

}catch(Throwable t)

{

System.out.println("EXCEPTION:" + t.getMessage() + t.toString());

}

}

}

this is the persistence.xml file

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

<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">

<persistence-unit name="book" transaction-type="JTA">

<jta-data-source>jdbc/__personnel</jta-data-source>

</persistence-unit>

</persistence>

The method is being called from a backing bean

package backing;

import entity.*;

import session.PersonDAO;

import javax.ejb.*;

import javax.naming.*;

public class PersonFormImpl extends PersonObj implements PersonForm

{

private PersonObj personobj;

private PersonDAO persondao=null;

public String submit()

{

try

{

InitialContext ic = new InitialContext();

persondao = (PersonDAO) ic.lookup(PersonDAO.class.getName());

personobj=new PersonObj();

personobj.setId(this.getId());

personobj.setFname(this.getFname());

personobj.setLname(this.getLname());

persondao.addPerson(personobj);

return "success";

}catch(Exception e)

{

System.out.println(e.toString());

return "failure";

}

}

}

[2376 byte] By [ashrestha] at [2007-10-3 3:30:20]
# 1
Where is your persistence.xml packaged? It must be either in the ejb-jar or at the .ear level for the stateless session bean to have visibility to the persistence unit. --ken
ksaksa at 2007-7-14 21:24:14 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...