-
1. Re: does JBoss support ejb-local-ref in web.xml
cjhieen Aug 6, 2002 2:21 PM (in response to chumps)In your web.xml, did you try the following DOCTYPE:
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd"> -
2. Re: does JBoss support ejb-local-ref in web.xml
chumps Aug 7, 2002 4:41 PM (in response to chumps)Yes, I certainly did. But it didn;t do no good.
-
3. Re: does JBoss support ejb-local-ref in web.xml
cjhieen Aug 8, 2002 8:29 AM (in response to chumps)I ran Oracle's CMP example in JBoss-3.0.0_Tomcat-4.0.3
In my war file, I have the following in web.xml:
<ejb-local-ref >
<ejb-ref-name>ejb/Dept</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>ejb.cmplocal.DeptLocalHome</local-home>
ejb.cmplocal.DeptLocal
<ejb-link>Dept</ejb-link>
</ejb-local-ref>
(the Dept entity bean is called in a JSP page)
In my ejb-jar.xml, I have the following:
<!-- Entity Beans -->
<display-name>Department Bean</display-name>
<ejb-name>Dept</ejb-name>
<local-home>ejb.cmplocal.DeptLocalHome</local-home>
ejb.cmplocal.DeptLocal
<ejb-class>ejb.cmplocal.DeptBean</ejb-class>
....
And I packaged web and ejb into ear file. -
4. Re: does JBoss support ejb-local-ref in web.xml
chumps Aug 12, 2002 11:46 AM (in response to chumps)That's it. The only way this seems to work is if you package everything in an ear file and have an <ejb-link> element linking directly to the Bean. But I was wondering how could I link to a previously deployed bean that was in another jar file by using its JNDI name. Meaning I want to do somehting like:
previously deployed jar:
(ejb-jar.xml)
<display-name>DatabaseBrokerEJB</display-name>
<ejb-name>DatabaseBrokerEJB</ejb-name>
DatabaseBrokerHome
DatabaseBroker
<ejb-class>DatabaseBrokerEJB</ejb-class>
...
(jboss.xml)
<ejb-name>DatabaseBrokerEJB</ejb-name>
<jndi-name>ejb/SimpleDatabaseBroker</jndi-name>
my servlet war file:
(web.xml)
<ejb-ref>
<ejb-ref-name>ejb/DatabaseBrokerHome</ejb-ref-name>
DatabaseBrokerHome
DatabaseBroker
</ejb-ref>
(jboss-web.xml)
<ejb-ref>
<ejb-ref-name>ejb/DatabasebrokerHome</ejb-ref-name>
<jndi-name>ejb/SimpleDatabaseBroker</jndi-name>
</ejb-ref>
As I understand it JBoss should use the jndi name ejb/SimpleDatabaseBroker to link my servlet with the previously deployed bean DatabaseBrokerEJB and I shouldn't have to package everything in a ear file. Am I wrong?
Thanks for the help. I appreciate. -
5. Re: does JBoss support ejb-local-ref in web.xml
adrian.brock Aug 12, 2002 1:32 PM (in response to chumps)The servlet spec isn't very specific.
The ejb spec says
20.3.2 Application Assembler's reponsibilities
"The target enterprise bean can be in any ejb-jar file in
the same J2EE application as the referencing application
component."
Which doesn't actually disallow what you want, if
you read it carefully.
But yes, JBoss only looks in the same deployment.
If you want it, code it and submit the patch on
sourceforge.
Regards,
Adrian -
6. Re: does JBoss support ejb-local-ref in web.xml
adrian.brock Aug 12, 2002 1:40 PM (in response to chumps)I forgot to mention,
You can specify a <jndi-name> in jboss-web.xml
for ejb-ref (but not ejb-local-ref) which will
let you bind an ejb-ref to an ejb outside
the deployment.
Regards,
Adrian -
7. Re: does JBoss support ejb-local-ref in web.xml
chumps Aug 12, 2002 1:51 PM (in response to chumps)Well actually it doesn't quite work (see JNDI question topic posted today). Maybe I'm doing somethign wrong but When I deploy the first jar with the DatabaseBrokerEJB bean, it's not bound to the <jndi-name> I specify in jboss.xml. For some reason, it's bound to the <ejb-name> found in the ejb-jar.xml. I know this is the default behavior, but how come Jboss doesn't use the name specified in jboss.xml? Is it a bug? or do I have to configure something. Here the relevant part of my server.log
2002-08-12 12:42:22,656 DEBUG [org.jboss.ejb.StatelessSessionContainer] Begin java:comp/env for EJB: DatabaseBrokerEJB
2002-08-12 12:42:22,656 DEBUG [org.jboss.ejb.StatelessSessionContainer] TCL: java.net.URLClassLoader@33c658
2002-08-12 12:42:22,657 DEBUG [org.jboss.ejb.StatelessSessionContainer] Binding an EJBLocalReference ejb/Legislation
2002-08-12 12:42:22,658 DEBUG [org.jboss.ejb.StatelessSessionContainer] Binding ejb/Legislation to bean source: LegislationEJB
2002-08-12 12:42:22,659 DEBUG [org.jboss.ejb.StatelessSessionContainer] Binding an EJBLocalReference ejb/CollectionType
2002-08-12 12:42:22,659 DEBUG [org.jboss.ejb.StatelessSessionContainer] Binding ejb/CollectionType to bean source: CollectionTypeEJB
2002-08-12 12:42:22,659 DEBUG [org.jboss.ejb.StatelessSessionContainer] Binding an EJBLocalReference ejb/Jurisdiction
2002-08-12 12:42:22,660 DEBUG [org.jboss.ejb.StatelessSessionContainer] Binding ejb/Jurisdiction to bean source: JurisdictionEJB
2002-08-12 12:42:22,660 DEBUG [org.jboss.ejb.StatelessSessionContainer] Binding an EJBLocalReference ejb/Collection
2002-08-12 12:42:22,661 DEBUG [org.jboss.ejb.StatelessSessionContainer] Binding ejb/Collection to bean source: CollectionEJB
2002-08-12 12:42:22,662 DEBUG [org.jboss.ejb.StatelessSessionContainer] End java:comp/env for EJB: DatabaseBrokerEJB
2002-08-12 12:42:22,662 DEBUG [org.jboss.ejb.plugins.local.BaseLocalContainerInvoker] DatabaseBrokerEJB cannot be Bound, doesn't have local and local home interfaces
2002-08-12 12:42:23,075 DEBUG [org.jboss.proxy.ejb.ProxyFactory] Bound DatabaseBrokerEJB to DatabaseBrokerEJB
Shouldn't the ProxyFactory object user the name specified in jboss.xml?
Thanks -
8. Re: does JBoss support ejb-local-ref in web.xml
chumps Aug 12, 2002 3:12 PM (in response to chumps)Ok someone pointed out my mistake in my deployment descriptors. Thanks, for your help