You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by afryer <ap...@hotmail.com> on 2011/08/08 06:02:32 UTC

Re: Accessing an EJB by name from a servlet init method fails in collapsed ear if is specified for the servlet

Can you refer me to the spec where it says the environment naming context
should not be accessible in callbacks like @PostConstruct?  I'm searching
through the javaee_platform_6_0-fr-spec.pdf and servlet-3_0-pfd-spec.pdf and
can't find mention of that.  In fact i think it says @PostConstruct gets
called when after the class constructor and after all resources have been
injected, implying that the environment naming context would be populated at
that point.  Although its possible i'm missing something because I haven't
read the spec with a fine tooth comb and it doesn't seem to explicitely
detail the lifecycle, my impression is that the environment should be
populated before the servlet init method is called.

javaee_platform-6_0-fr-spec.pdf...


> *EE.5.3.4 Java EE Product Provider’s Responsibilities*
> The Java EE Product Provider has the following responsibilities:
> ...
> •Implement the java:comp, java:module, java:app and java:global
> environment naming contexts, and provide them to the application component
> instances at runtime. The naming context must include all the entries
> declared by the Application Component Provider, with their values supplied
> in the deployment descriptor or set by the Deployer. The environment
> naming context must allow the Deployer to create subcontexts if they are
> needed by an application component. Certain entries in the naming context
> may have to be initialized with the values of other entries, specifically
> when the “lookup” facility is used. In this case, it is an error if there
> are any circular dependencies between entries. Similarly, it is an error
> if looking up the specified JNDI name results in a resource whose type is
> not compatible with the entry being created. The deployment tool may allow
> the deployer to correct either of these classes of errors and continue the
> deployment.
> 

--
View this message in context: http://openejb.979440.n4.nabble.com/Accessing-an-EJB-by-name-from-a-servlet-init-method-fails-in-collapsed-ear-if-load-on-startup-is-spet-tp3604528p3726049.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Accessing an EJB by name from a servlet init method fails in collapsed ear if is specified for the servlet

Posted by afryer <ap...@hotmail.com>.
I just tested the snapshot build with my app, and you did fix it.  Nice work.

--
View this message in context: http://openejb.979440.n4.nabble.com/Accessing-an-EJB-by-name-from-a-servlet-init-method-fails-in-collapsed-ear-if-load-on-startup-is-spet-tp3604528p3780272.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Accessing an EJB by name from a servlet init method fails in collapsed ear if is specified for the servlet

Posted by David Blevins <da...@gmail.com>.
FYI, I think I just fixed this last night in trunk (4.0.0-SNAPSHOT).  I Published new binaries to the nexus snapshot repo.

Grab the latest build from here:

  http://openejb.staging.apache.org/dyn/latest.cgi


-David

On Aug 7, 2011, at 9:02 PM, afryer wrote:

> Can you refer me to the spec where it says the environment naming context
> should not be accessible in callbacks like @PostConstruct?  I'm searching
> through the javaee_platform_6_0-fr-spec.pdf and servlet-3_0-pfd-spec.pdf and
> can't find mention of that.  In fact i think it says @PostConstruct gets
> called when after the class constructor and after all resources have been
> injected, implying that the environment naming context would be populated at
> that point.  Although its possible i'm missing something because I haven't
> read the spec with a fine tooth comb and it doesn't seem to explicitely
> detail the lifecycle, my impression is that the environment should be
> populated before the servlet init method is called.
> 
> javaee_platform-6_0-fr-spec.pdf...
> 
> 
>> *EE.5.3.4 Java EE Product Provider’s Responsibilities*
>> The Java EE Product Provider has the following responsibilities:
>> ...
>> •Implement the java:comp, java:module, java:app and java:global
>> environment naming contexts, and provide them to the application component
>> instances at runtime. The naming context must include all the entries
>> declared by the Application Component Provider, with their values supplied
>> in the deployment descriptor or set by the Deployer. The environment
>> naming context must allow the Deployer to create subcontexts if they are
>> needed by an application component. Certain entries in the naming context
>> may have to be initialized with the values of other entries, specifically
>> when the “lookup” facility is used. In this case, it is an error if there
>> are any circular dependencies between entries. Similarly, it is an error
>> if looking up the specified JNDI name results in a resource whose type is
>> not compatible with the entry being created. The deployment tool may allow
>> the deployer to correct either of these classes of errors and continue the
>> deployment.
>> 
> 
> --
> View this message in context: http://openejb.979440.n4.nabble.com/Accessing-an-EJB-by-name-from-a-servlet-init-method-fails-in-collapsed-ear-if-load-on-startup-is-spet-tp3604528p3726049.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.