EJB 3 injections and JNDI look-ups do not work in managed beans (java server faces)
"Siarhei Dudzin" <[email protected]> Thu, 20 Jul 2006 02:13:27 +0200
| Newsgroups | gmane.text.xml.resin.user |
|---|---|
| Message-ID | <[email protected]> |
------=_Part_150139_17350650.1153354407633
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Hi All,
I am trying to use EJB3 on resin 3.0.19. First I was trying to use
dependency injection and all ijnections returned null (and session beans and
EntityManager). After that I tried to perform lookup via InitialContext and
all lookups returned null (no NameNotFound exceptions were thrown). After
that I checked the only difference between my implementaion and the examples
from the website of resin was that in the examples the lookups are done in
servlets. So I simply copied the same dependency injection (
@PersistenceContext(name="example") ) from the managed bean and put it in a
servlet and it worked!
I would be very grateful if somebody could tell me how to resolve this
problem. My resin-web.xml is the following:
<web-app xmlns="http://caucho.com/ns/resin">
<character-encoding>UTF-8</character-encoding>
<database jndi-name="jdbc/EDB">
<driver type="
com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource">
<url>jdbc:mysql://localhost:3306/edb</url>
<user>edb</user>
<password>edb</password>
</driver>
</database>
<!--
- configuration for the JNDI server.
-->
<ejb-server>
<jndi-name>java:comp/env/ejb</jndi-name>
<data-source>jdbc/EDB</data-source>
</ejb-server>
</web-app>
Thank you in advance,
Sergei
------=_Part_150139_17350650.1153354407633
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Hi All,<br><br><br>I am trying to use EJB3 on resin 3.0.19. First I was trying to use dependency injection and all ijnections returned null (and session beans and EntityManager). After that I tried to perform lookup via InitialContext and all lookups returned null (no NameNotFound exceptions were thrown). After that I checked the only difference between my implementaion and the examples from the website of resin was that in the examples the lookups are done in servlets. So I simply copied the same dependency injection ( @PersistenceContext(name="example") ) from the managed bean and put it in a servlet and it worked!
<br>I would be very grateful if somebody could tell me how to resolve this problem. My resin-web.xml is the following:<br><br><br><web-app xmlns="<a href="http://caucho.com/ns/resin">http://caucho.com/ns/resin</a>
"><br><br> <character-encoding>UTF-8</character-encoding><br> <br> <database jndi-name="jdbc/EDB"><br> <driver type="com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
"><br> <url>jdbc:mysql://localhost:3306/edb</url><br> <user>edb</user><br> <password>edb</password><br> </driver><br> </database>
<br> <br> <!--<br> - configuration for the JNDI server.<br> --><br> <ejb-server><br> <jndi-name>java:comp/env/ejb</jndi-name><br> <data-source>jdbc/EDB</data-source>
<br> </ejb-server><br> <br></web-app><br><br>Thank you in advance,<br>Sergei<br>
------=_Part_150139_17350650.1153354407633--