tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "A. Alonso Domínguez" <alonso.doming...@social-labs.com>
Subject Re: Tomcat 6.0, JPA and Resource Injection
Date Thu, 13 Sep 2007 16:26:33 GMT
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: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>   


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


Mime
View raw message