users@glassfish.java.net

Re: the dependency does't work

From: Alexis Moussine-Pouchkine <alexis.mp_at_sun.com>
Date: Tue, 23 Sep 2008 09:43:24 +0200

Injection can only happen in managed code (EJB, Servlet, JSF Managed
Bean), not in arbitrary POJOs.
Maybe that's the issue you're facing. No need to deal with
InitialContext btw.
-Alexis

On Sep 23, 2008, at 3:55, glassfish_at_javadesktop.org wrote:

> I had created a JavaMail Session Resource with the glassfish UI
> administion tool.
> And the code which contained in a EJBproject does't work, a
> NullPointerException return!
>
> code :
>
> @Resource(name="mailSession")
> javax.mail.Session session;
> private void doTest() {
> InitailContext ic=new InitialContext();
> System.out.println(session.toString());
> }
> And I use the method InitialContext.list("") to list all contents, I
> find the resource I created among them!
>
> How to resolve it, and make the dependency work correctly?
> [Message sent by forum member 'prospectyang' (prospectyang)]
>
> http://forums.java.net/jive/thread.jspa?messageID=300907
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>