You can use the PortableRemoteObject.narrow() to cast the JNDI object
to the approriate type is JBoss. Look at the jbosstest org/jboss/test/web
unit test ear which includes numerous examples of servlets accessing ejbs
and resources from the standard ENC namespace. The jbosstest-web.ear
can be built by executing

    ant web-subproject

from within the jbosstest/src/build directory

----- Original Message -----
From: G.L. Grobe
To: [EMAIL PROTECTED]
Sent: Sunday, July 08, 2001 11:46 AM
Subject: [JBoss-user] can't use java:comp/env ???


I was wondering if maybe I have found my problem and wanted to verify this
with someone (though I can't get it to work, I might be on the right track).

Under the section 'Standard behaviour of JBoss' on this page
http://jboss.org/documentation/HTML/ch06s02.html it states that "JBoss does
not currently allow you to use the java:comp/env namespace to call your
beans from your clients."

Also, it says that a cast will work in JBoss and no need to use the narrow()
operation. Can I still use it as it works this way for me on other servers?

So because I'm using this lookup in my servlets ...

      Object result = ctx.lookup("java:comp/env/ejb/DBaseFetchHome");

      DBaseFetchHome home = (DBaseFetchHome)
         javax.rmi.PortableRemoteObject.narrow(result,
            DBaseFetchHome.class);

and my ejb-jar.xml looks like this ...

 <session>
   <ejb-name>DBaseFetch</ejb-name>
   <home>com.neuroquest.cais.ejb.session.dbaseFetch.DBaseFetchHome</home>
   <remote>com.neuroquest.cais.ejb.session.dbaseFetch.DBaseFetch</remote>

<ejb-class>com.neuroquest.cais.ejb.session.dbaseFetch.DBaseFetchBean</ejb-cl
ass>
   <session-type>Stateful</session-type>
   <transaction-type>Container</transaction-type>
   </session>

So all in all, I'm still confused because the docs say this and it's been
suggested I do differently. I still can't get this to work.


_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to