[javaee-spec users] Re: Question about ejb modules

From: Linda DeMichiel <>
Date: Mon, 21 Oct 2013 15:45:38 -0700

On 10/19/13 7:54 AM, John D. Ament wrote:
> Experts,
> I ran into an interesting issue on GlassFish 4, which I hadn't seen
> before in other application servers. It appears that if I want to
> deploy an EAR, I cannot put CDI beans into a standalone module, expect
> it to be scanned and added to the application.
> Previously, I had used a trick by marking the module as an EJB module
> it would scan for CDI beans and make them available within my EAR.
> Now ignoring the CDI scoping issues at play, I am seeing an error come
> back from GlassFish 4 stating that an EJB module must contain at least
> one session bean/entity bean/MDB.
> Is this expected? If so, which spec actually defines this behavior? I
> was having a hard time finding it.


Thanks for your post.

While the EJB spec should have been more explicit as to whether an
ejb-jar file must contain EJB beans, I think it is safe to say
that this is the intention of the spec. For example, see section 15.1:

     "An ejb-jar file produced by the Bean Provider contains one or
     more enterprise beans that typically do not contain application
     assembly instructions. The ejb-jar file produced by an Application
     Assembler (which can be the same person or organization as the
     Bean Provider) contains one or more enterprise beans, plus
     application assembly information describing how the enterprise
     beans are combined into a single application deployment unit."

Please file a JIRA issue at, so
that we can track this item for purposes of discussion and clarification
in the next release.

As to the GlassFish behavior, my understanding is that GlassFish
introduced the error-checking for this case back in the Java EE 5 days.

For further follow-up with our GlassFish team, please post with more
details about your use case to or file a JIRA
issue at



> Thanks,
> John