RE: Tomcat 6.0, JPA and Resource Injection
> From: "A. Alonso Domínguez" [mailto:[EMAIL PROTECTED] > Subject: Re: Tomcat 6.0, JPA and Resource Injection > > It seems that Tomcat 6 ignores the "" > element from web.xml, is this correct? I can't find any documentation for such an element in either the 2.4 or the 2.5 servlet specs, which is what Tomcat implements. If you're looking for EJB 3.0 extensions beyond that, I suspect you'll have to move up to an full EE container, such as JBoss. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat 6.0, JPA and Resource Injection
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Alonso, A. Alonso Domínguez wrote: > 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 "" element from web.xml, is this > correct? I don't really know. I haven't been able to find a DTD or schema for web.xml that has the element listed, so I wouldn't be surprised if it's not supported. FWIW I have no experience with this particular technology, so I'm just stabbing in the dark at JNDI issues you might have. Good luck, - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFG6WhD9CaO5/Lv0PARAnYFAJ4z3OxbE3NxzqjRhCxIBCYczTxRAwCgl6FF fVaq4XmJMIXrEW9U0/o7NdI= =OPWm -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]
Re: Tomcat 6.0, JPA and Resource Injection
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 "" 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/..."? jpa/benedetti benedetti 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]
Re: Tomcat 6.0, JPA and Resource Injection
-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/..."? > > > jpa/benedetti >benedetti > Check out http://blogs.sun.com/pblaha/entry/how_to_use_entitymanager_api 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]
Tomcat 6.0, JPA and Resource Injection
Hi there, I'm trying to set up a web application which uses Java Persistence with Tomcat 6.0. I had googled and searched a lot of mailing lists but I didn't found a response for my doubts. My application uses JSF 1.2 from Sun's RI, some of the managed-beans defined at that application have a reference to a EntityManager using the PersistenceContext annotation. This application has been tested using Glassfish and it works perfectly. Testing the same application (with all necessary jar files) with Tomcat throws an exception: javax.naming.NameNotFoundException: The name java:comp is not associated to this context. This is how my config files look like: context.xml: type="javax.sql.DataSource" maxActive="100" maxIdle="30" maxWait="1" username="benedetti" password="nsh67eTds" driverClassName="org.postgresql.Driver" url="jdbc:postgresql://193.168.3.2:5432/benedetti" /> persistence.xml: 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"; version="1.0"> oracle.toplink.essentials.PersistenceProvider jdbc/benedetti benedetti.gestion.entity.Cliente benedetti.gestion.entity.Expediente benedetti.gestion.entity.Factura benedetti.gestion.entity.LineaFactura web.xml: jdbc/benedetti javax.sql.DataSource Container jpa/benedetti benedetti I'm configuring the injection of the entity manager as following: @PersistenceContext(unitName = "benedetti", name = "java:comp/jpa/benedetti") private EntityManager em; About JNDI names, I tried names Almost all I found in the web about this issue is about Tomcat 5.5. There is said in many places that Tomcat 5.5 should be treated as a JSE environment so no dependency injection of "EntityManager" nor "EntityManagerFactory" is possible. But, what about Tomcat 6 ? I did take a look to the DefaultAnnotationProcessor class at "org.apache.catalina.util" and seems to me that class performs dependency injection based on the kind of annotation found. My question is: Can I use entity manager injection with Tomcat 6 or do I need to perform a bootstrap using the Persistence class like in Tomcat 5.5 ? Regards, Alonso - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Resource Injection
Or have a look at www.springframework.org On 7/29/07, Johnny Kewl <[EMAIL PROTECTED]> wrote: > > - Original Message - > From: "John McPeek" <[EMAIL PROTECTED]> > To: "Tomcat Users List" > Sent: Sunday, July 29, 2007 4:47 AM > Subject: Resource Injection > > > >I want to use Resource Injection and I have been looking around, but all I > >can find is threads about stuff that doesn't work related to JSF. Does > >Tomcat 6 support Resource Injection? > > John, no Resource Injection is still very much the domain of the EJB > container, and application server. Tomcat is a pure lite weight servlet > container, although one could argue that there is limited application of the > spec for injecting Resources into servlets, and I do see annotation classes > that seem to be in development in TC's source code, it seems pure Resource > Injection is still not a feature, and may never be. > > Something I havnt tried, but I think its worth a look see, is Apaches > OpenEJB project, I think if you add that to TC, you may get what you want. > I think you will be able to inject resources into beans and use them from > TC, and the framework seems nice and lite... otherwise I think you have to > go for the heavy weights like geronomo, or glassfish. > > Good Luck > > > - > 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]
Re: Resource Injection
- Original Message - From: "John McPeek" <[EMAIL PROTECTED]> To: "Tomcat Users List" Sent: Sunday, July 29, 2007 4:47 AM Subject: Resource Injection I want to use Resource Injection and I have been looking around, but all I can find is threads about stuff that doesn't work related to JSF. Does Tomcat 6 support Resource Injection? John, no Resource Injection is still very much the domain of the EJB container, and application server. Tomcat is a pure lite weight servlet container, although one could argue that there is limited application of the spec for injecting Resources into servlets, and I do see annotation classes that seem to be in development in TC's source code, it seems pure Resource Injection is still not a feature, and may never be. Something I havnt tried, but I think its worth a look see, is Apaches OpenEJB project, I think if you add that to TC, you may get what you want. I think you will be able to inject resources into beans and use them from TC, and the framework seems nice and lite... otherwise I think you have to go for the heavy weights like geronomo, or glassfish. Good Luck - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Resource Injection
I want to use Resource Injection and I have been looking around, but all I can find is threads about stuff that doesn't work related to JSF. Does Tomcat 6 support Resource Injection? Thanks, John - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]