Hi Christopher,

I have tried "java:comp/env/...", "java:/comp/env/...", "java:jpa/..." and "jpa/..." as values for the "name" attribute of PersistenceContext annotation. None of that paths worked for me. It seems that Tomcat 6 ignores the "<persistence-context-ref>" element from web.xml, is this correct?

Christopher Schultz escribió:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Alonso,

A. Alonso Domínguez wrote:
javax.naming.NameNotFoundException: The name
java:comp is not associated to this context.

[snip]

@PersistenceContext(unitName = "benedetti",
           name = "java:comp/jpa/benedetti")
   private EntityManager em;

Have you tried "java:/comp/..."?

   <persistence-context-ref>
       
<persistence-context-ref-name>jpa/benedetti</persistence-context-ref-name>
       <persistence-unit-name>benedetti</persistence-unit-name>
   </persistence-context-ref>

Check out http://blogs.sun.com/pblaha/entry/how_to_use_entitymanager_api
I've had take a look to that blog but the example posted there talks about GlassFish. My app has been tested in GlassFish and there it works, what I want to try is the same app deployed on a standalone Tomcat.

They are putting their JNDI resource in a different place in the tree
(in java:/comp/env/...). You may not be using the right path based on
where Tomcat puts these resources.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFG6Uhl9CaO5/Lv0PARAhIdAJ94Mfa3/RhgCHpewfn7Vd+oL0+BewCePWRH
JbuDjWxwho0U8n5Ft8/+s/k=
=CJAX
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to