Community

Wrong JNDI context returned from EJB

reply from Richard Opalka in EJB 3.0 Development - View the full discussion

The situation is little bit more complicated.

First of all I need to verify if the following usecase is valid.

 

There's a EJB3Bean web service bean

with the following DD. It defines boolean1 env entry.

 

<ejb-jar>

   <enterprise-beans>
    <session>

      <ejb-name>EJB3Bean</ejb-name>
      <ejb-class>org.jboss.test.ws.jaxws.ejb3Integration.injection.webservice.EJB3Bean</ejb-class>

 

      <env-entry>
        <env-entry-name>boolean1</env-entry-name>
        <env-entry-type>java.lang.Boolean</env-entry-type>
        <env-entry-value>true</env-entry-value>
      </env-entry>

 

    </session>

  </enterprise-beans>

</ejb-jar>

 

There's a handler associated with this EJB3Bean

 

@WebService
@HandlerChain(file = "jaxws-handler.xml")
@Stateless
public class EJB3Bean extends AbstractEndpointImpl
{

 

   public String echo(String msg)
   {
      return super.echo(msg) + ":EJB3Bean";
   }

 

}

 

The content of jaxws-handler.xml is:

 

<handler-chains>

  <handler-chain>
    <handler>
      <handler-name>TestHandler</handler-name>
      <handler-class>org.jboss.test.ws.jaxws.ejb3Integration.injection.shared.handlers.TestHandler</handler-class>
    </handler>
  </handler-chain>

</handler-chains>

 

This TestHandler tries to access both EJB3Bean and it's env-entry

 

public final class TestHandler extends GenericSOAPHandler {
   @Resource private Boolean boolean1;
   @EJB private BeanIface bean1;

   ...

}

 

Using global JNDI I'm able to fix @EJB injection.

 

Question for EJB3 team:

Do you think this JAX-WS handler should see env-entry of EJB3Bean?

That would mean required access to EJB3Bean specific JNDI context (the reason why we're using it instead of global JNDI).

 

I'll double check JAX-WS and EE6 specification for clarification, but would like to know your opinion ;)

Reply to this message by going to Community

Start a new discussion in EJB 3.0 Development at Community