Re: EJB 3 injections and JNDI look-ups do not work in managed beans (java server faces)
"Siarhei Dudzin" <[email protected]> Thu, 20 Jul 2006 19:13:17 +0200
| Newsgroups | gmane.text.xml.resin.user |
|---|---|
| Message-ID | <[email protected]> |
------=_Part_166458_18209052.1153415597588 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Anyone? Also another question, why do I need to list all the beans I want to be able to look up in in the web.xml (or resin-web.xml), doesn't it defeat the whole purpose of EJB-3? Sergei On 7/20/06, Siarhei Dudzin <[email protected]> wrote: > > 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_166458_18209052.1153415597588 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Anyone?<br><br>Also another question, why do I need to list all the beans I want to be able to look up in in the web.xml (or resin-web.xml), doesn't it defeat the whole purpose of EJB-3?<br><br>Sergei<br><br><div><span class="gmail_quote"> On 7/20/06, <b class="gmail_sendername">Siarhei Dudzin</b> <<a href="mailto:[email protected]">[email protected]</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> <div>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" title="http://caucho.com/ns/resin" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> 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> </div></blockquote></div><br> ------=_Part_166458_18209052.1153415597588--