Re: [JBoss-user] EJB in ear referencing EJB outside of ear
The java:comp/env/ejb namespace is available from anything running in the JBoss environment, not just something in an ear. I use it when one EJB wants to call another EJB. - Original Message - From: "Joost v.d. Wijgerd" <[EMAIL PROTECTED]> To: "Richard Doust" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Friday, November 16, 2001 3:33 AM Subject: RE: [JBoss-user] EJB in ear referencing EJB outside of ear Hi, If you deploy a bean outside an ear file (e.g. as a bean-jar not as another ear file) you can reference the bean only with it's JNDI name. You can't user java:comp/env/ejb namespace bacause that can only be used within one enterprise archive. So if the jndi name of your bean is "MyBean" then just call InitialContext.lookup("MyBean") and you'll be alright. (at least I am when I do this). If the problem persists, maybe you can provide a stacktrace for the CommunicationException.. cheers, JOost. -Original Message- From: Richard Doust [mailto:[EMAIL PROTECTED]] Sent: Friday, November 16, 2001 4:51 AM To: [EMAIL PROTECTED] Subject: [JBoss-user] EJB in ear referencing EJB outside of ear Hi. I'm confused by the J2EE Spec. I know it's possible for an EJB packaged in a jar and deployed inside of an ear to reference an EJB that does not exist inside the ear. I have gone from packaging all EJBs inside the ear to deploying one externally, (on my way to deplolying most of them externally), so that a different application deployed in the same container can access the EJBs without having to have the EJBs packaged inside two different ears. I've modified my deployment descriptors according to the specification, and when I run JBoss, the JNDIView shows me that all of the namespaces are established as I would expect. Yet, when I try to access the externally deployed EJB from an EJB inside the ear (doing a lookup on its Home using InitialContext), I get a CommunicationException. From the description, it seems like a weird exception to have. If anyone is interested in trying to help me figure this out, I could provide more details. Thanks. ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
RE: [JBoss-user] EJB in ear referencing EJB outside of ear
JOost, Thanks for the advice. I appreciate your taking the time to respond. I do have a better understanding of my problem this morning, having solved it last night, and the solution didn't involve referencing the bean within the code by its JNDI name. In fact, I think referencing a bean by its JNDI name breaks the deployer's ability to point your code to a different implementation at deployment time. What got me there was finding that the root cause of the CommunicationException was a ClassNotFoundError. All I needed to do was package the referenced bean's jar into the same ear (it's deployment descriptor is ignored by the container during deployment) and add the jar to the manifest.mf for the referencing bean's jar. Because the referencing bean has an ejb-ref in its deployment descriptor, and the jboss.xml file maps that reference to a JNDI name, everything works fine. Thanks again. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Joost v.d. Wijgerd Sent: Friday, November 16, 2001 3:33 AM To: Richard Doust; [EMAIL PROTECTED] Subject: RE: [JBoss-user] EJB in ear referencing EJB outside of ear Hi, If you deploy a bean outside an ear file (e.g. as a bean-jar not as another ear file) you can reference the bean only with it's JNDI name. You can't user java:comp/env/ejb namespace bacause that can only be used within one enterprise archive. So if the jndi name of your bean is "MyBean" then just call InitialContext.lookup("MyBean") and you'll be alright. (at least I am when I do this). If the problem persists, maybe you can provide a stacktrace for the CommunicationException.. cheers, JOost. -Original Message- From: Richard Doust [mailto:[EMAIL PROTECTED]] Sent: Friday, November 16, 2001 4:51 AM To: [EMAIL PROTECTED] Subject: [JBoss-user] EJB in ear referencing EJB outside of ear Hi. I'm confused by the J2EE Spec. I know it's possible for an EJB packaged in a jar and deployed inside of an ear to reference an EJB that does not exist inside the ear. I have gone from packaging all EJBs inside the ear to deploying one externally, (on my way to deplolying most of them externally), so that a different application deployed in the same container can access the EJBs without having to have the EJBs packaged inside two different ears. I've modified my deployment descriptors according to the specification, and when I run JBoss, the JNDIView shows me that all of the namespaces are established as I would expect. Yet, when I try to access the externally deployed EJB from an EJB inside the ear (doing a lookup on its Home using InitialContext), I get a CommunicationException. From the description, it seems like a weird exception to have. If anyone is interested in trying to help me figure this out, I could provide more details. Thanks. ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
RE: [JBoss-user] EJB in ear referencing EJB outside of ear
Hi, If you deploy a bean outside an ear file (e.g. as a bean-jar not as another ear file) you can reference the bean only with it's JNDI name. You can't user java:comp/env/ejb namespace bacause that can only be used within one enterprise archive. So if the jndi name of your bean is "MyBean" then just call InitialContext.lookup("MyBean") and you'll be alright. (at least I am when I do this). If the problem persists, maybe you can provide a stacktrace for the CommunicationException.. cheers, JOost. -Original Message- From: Richard Doust [mailto:[EMAIL PROTECTED]] Sent: Friday, November 16, 2001 4:51 AM To: [EMAIL PROTECTED] Subject: [JBoss-user] EJB in ear referencing EJB outside of ear Hi. I'm confused by the J2EE Spec. I know it's possible for an EJB packaged in a jar and deployed inside of an ear to reference an EJB that does not exist inside the ear. I have gone from packaging all EJBs inside the ear to deploying one externally, (on my way to deplolying most of them externally), so that a different application deployed in the same container can access the EJBs without having to have the EJBs packaged inside two different ears. I've modified my deployment descriptors according to the specification, and when I run JBoss, the JNDIView shows me that all of the namespaces are established as I would expect. Yet, when I try to access the externally deployed EJB from an EJB inside the ear (doing a lookup on its Home using InitialContext), I get a CommunicationException. From the description, it seems like a weird exception to have. If anyone is interested in trying to help me figure this out, I could provide more details. Thanks. ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user