Persistence Unit Name Snafu

I hit an exception:

EntityManagerFactory not found in JNDI

caused by

NameNotFoundException

which was weird because that was after I had already done some database lookups through the EntityManager. I did a search to find where the persistent unit's jndi name was being configured, and I found this in build.xml:

        <condition property="puJndiName" value="java:comp/env/${project.name}/pu" else="java:/${project.name}EntityManagerFactory">

            <available file="${jboss.home}/lib/jboss-vfs.jar"/> 

        </condition>

along with a comment that jboss-vfs.jar is only there for jboss versions 5 and up. I am using jboss 5. Just to see, I replaced that with this line:

<property name="puJndiName" value="java:/${project.name}EntityManagerFactory"/>

and it worked.