As Scott said, you should still use PortableRemoteObject's narrow method
(for other-container-vendor compatibility). However, that's not your
problem.
In addition to your ejb-jar.xml, you should have a jboss.xml in your
META-INF directory (in your jar) that looks something like this ("cais"
I just guessed from your note - it could be anything but is usually the
name of your app or utility package):
<?xml version="1.0"?>
<jboss>
<enterprise-beans>
<session>
<ejb-name>DBaseFetch</ejb-name>
<jndi-name>cais/DBaseFetch</jndi-name>
</session>
</enterprise-beans>
</jboss>
and you should have a jboss-web.xml in your WEB-INF directory (in your
war) that looks something like this:
<?xml version="1.0"?>
<jboss-web>
<ejb-ref>
<ejb-ref-name>ejb/DBaseFetch</ejb-ref-name>
<jndi-name>cais/DBaseFetch</jndi-name>
</ejb-ref>
</jboss-web>
and finally, in your web.xml file in your WEB-INF directory (in your
war), you should have an entry like this:
...
<ejb-ref>
<ejb-ref-name>ejb/DBaseFetch</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>
com.neuroquest.cais.ejb.session.dbaseFetch.DBaseFetchHome
</home>
<remote>
com.neuroquest.cais.ejb.session.dbaseFetch.DBaseFetch
</remote>
</ejb-ref>
...
You see, there's a lot more that you need to glue everything together in
addition to just ejb-jar.xml. It seems like a lot, but is a necessary
abstraction for decoupling purposes. Every container vendor does it,
but in different ways (usually via xml, though).
Last but not least, yes, the jboss doc is confusing when it says "JBoss
does not currently allow you to use the java:comp/env namespace to call
your beans from your clients." I stumbled over this when I started with
JBoss, too. In reality, JBoss *does* support java:comp/env from your
*WEB* components (if you want to consider those "clients" of your EJBs).
What JBoss does *NOT* currently support is java:comp/env from
standalone "not-in-JBoss' jvm" application clients. If you use the
deployment descriptors I typed up above, a command line client, for
instance, would do a lookup on the name "cais/DBaseFetch".
Hope all this helps,
David
--
G.L. Grobe wrote:
> 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-class>
> <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.
>
>
>
--
-----------------------------------------------------------------------
David Ward [EMAIL PROTECTED]
Senior Software Engineer http://www.dotech.com
Distributed Object Technologies, Inc. 716-381-8320 (phone)
500 Linden Oaks, Rochester, NY 14625 716-381-0598 (fax)
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user