On Aug 8, 2008, at 11:11 AM, lupu.slobodu wrote:


Here it is what I've been trying:

1)Resource Factory configuration in tomcat context.xml

 <Resource
      name="bean/ParamsFactory"
      auth="Container"
      type="sample.jndi.ResourceBean"
      factory="sample.jndi.GenericObjectFactory"
                value="ContextResource"
      />

2)test web application's  web.xml

<resource-env-ref>
 <description>
   Object factory for ResourceBean instances.
 </description>
 <resource-env-ref-name>
    bean/ParamsFactory
 </resource-env-ref-name>
 <resource-env-ref-type>
   sample.jndi.ResourceBean
 </resource-env-ref-type>
</resource-env-ref>


I can look it up successfully from a servlet like this

                Context initCtx = new InitialContext();
                Context envCtx = (Context) initCtx.lookup("java:comp/env");
ResourceBean bean = (ResourceBean) envCtx.lookup("bean/ ParamsFactory");


The same look up fails  when performed inside a session bean.

I tried to integrate the declarations in the openejb web module web.xml
descriptor also but with no success.

If you can look it up from a Servlet, we're not too far! Post the ejb- jar.xml you using if you can. You would need an identical resource- env-ref in there for your session bean.

-David

Reply via email to