webtier@glassfish.java.net

Re: [webtier] EJB not injected in ManagedBean

From: Jim Driscoll <Jim.Driscoll_at_Sun.COM>
Date: Tue, 20 Oct 2009 00:12:46 -0700

Go to the admin console, go to the update center, and install EJB.

Jim

On 10/19/09 10:50 PM, Felipe Gaścho wrote:
> humm.. when I added Stateless to my ManagedBean, this error happened:
>
> [exec] -------- Deploying to Server Version = GlassFish v3 (build 67)
> [exec] com.sun.enterprise.admin.cli.CommandException: remote
> failure: Exception while loading the app : java.lang.RuntimeException:
> Unable to load EJB module. DeploymentContext does not contain any EJB
> Check archive to ensure correct packaging for
> /home/fgaucho/dev/glassfishv3/glassfish/domains/domain1/applications/arena-puj/arena-jsf20-1.0-SNAPSHOT_war
>
>
> 2009/10/20 Felipe Gaścho<fgaucho_at_gmail.com>:
>> Thanks Arun,
>>
>> I will check that..
>>
>> my problem here seems to be the packaging format... I have this EAR
>> file, and I want to just "add" the JSF 2 application to this ear.
>>
>> inside the ear I have another webapp injecting the EJBs without
>> problem, but I couldn't get it working with JSF.. all examples I found
>> on the web are using the Stateless direct injected in the ManagedBean,
>> but I have the ejb-jar in the EAR lib folder, and if I try to inject
>> the interface, it doesn't work..
>>
>> I will check your references, it should be a simple details.. thanks..
>>
>> On Tue, Oct 20, 2009 at 1:21 AM, Arun Gupta<Arun.Gupta_at_sun.com> wrote:
>>> Hi Felipe,
>>>
>>> Couple of design patterns to inject EJB in a ManagedBean are described at:
>>>
>>> http://blog.arungupta.me/2009/08/totd-95-ejb-3-1-java-server-faces-2-0-jpa-2-0-web-application-getting-started-with-java-ee-6-using-netbeans-6-8-m1-glassfish-v3/
>>>
>>> Let me know if that meets your need. The beauty of Java EE 6 is you don't
>>> need to package EJBs in a separate jar any more.
>>>
>>> On a related node, a JSF managed bean can be converted to JCDI bean (aka
>>> Weld, nee WebBeans) as described at:
>>>
>>> http://blog.arungupta.me/2009/10/totd-109-how-to-convert-a-jsf-managed-bean-to-jsr-299-bean-web-beans/
>>>
>>> However EJB injection using JCDI was still a work in progress few days ago.
>>>
>>> Thanks,
>>> -Arun
>>>
>>> Felipe Gaścho wrote:
>>>>
>>>> I am trying to inject an EJB in a ManagedBean, but the reference is
>>>> always null....
>>>>
>>>> @ManagedBean
>>>> @RequestScoped
>>>> public class TestBean {
>>>> @EJB
>>>> private PujInstitutionFacade facade;
>>>>
>>>> public Collection<PujInstitutionEntity> getPujOwners() {
>>>> return facade.readAllbyRole("PUJ_OWNER", 0, 50); // always
>>>> NullPointer
>>>> }
>>>> }
>>>>
>>>> any hint ?
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: webtier-unsubscribe_at_glassfish.dev.java.net
>>>> For additional commands, e-mail: webtier-help_at_glassfish.dev.java.net
>>>>
>>>
>>> --
>>> Need Application Server ? Download from http://glassfish.org
>>> Blog: http://blog.arungupta.me
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: webtier-unsubscribe_at_glassfish.dev.java.net
>>> For additional commands, e-mail: webtier-help_at_glassfish.dev.java.net
>>>
>>>
>>
>>
>>
>> --
>> Looking for a client application for this service:
>> http://fgaucho.dyndns.org:8080/arena-http/wadl
>>
>
>
>