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&nbsp; 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> &lt;<a href="mailto:[email protected]">[email protected]</a>&gt; 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=&quot;example&quot;) ) 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>&lt;web-app xmlns=&quot;<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>
&quot;&gt;<br><br>&nbsp;&nbsp; &nbsp;&lt;character-encoding&gt;UTF-8&lt;/character-encoding&gt;<br>&nbsp;&nbsp;  <br>&nbsp;&nbsp; &nbsp;&lt;database jndi-name=&quot;jdbc/EDB&quot;&gt;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;driver type=&quot;com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource

&quot;&gt;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;url&gt;jdbc:mysql://localhost:3306/edb&lt;/url&gt;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;user&gt;edb&lt;/user&gt;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;password&gt;edb&lt;/password&gt;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;/driver&gt;<br>&nbsp;&nbsp; &nbsp;&lt;/database&gt;
<br>&nbsp;&nbsp; &nbsp;<br>&nbsp;&nbsp;&nbsp; &lt;!--<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; - configuration for the JNDI server.<br>&nbsp;&nbsp; &nbsp;&nbsp; --&gt;<br>&nbsp;&nbsp; &nbsp;&lt;ejb-server&gt;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;jndi-name&gt;java:comp/env/ejb&lt;/jndi-name&gt;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;data-source&gt;jdbc/EDB&lt;/data-source&gt;
<br>&nbsp;&nbsp; &nbsp;&lt;/ejb-server&gt;<br>&nbsp;<br>&lt;/web-app&gt;<br><br>Thank you in advance,<br>Sergei<br>

</div></blockquote></div><br>

------=_Part_166458_18209052.1153415597588--