1 2 Previous Next 16 Replies Latest reply on Jan 7, 2002 3:33 PM by jimotte

    Local Interfaces for JBoss 2.4.x

    Frank Villarreal Newbie

      Hello Jboss gurus!

      Is there a patch or workaround for enabling the use of local interfaces with Jboss 2.4.x? I know this is not available by default. Are there any plans for merging that functionality into the 2.4.x series ... or should I just shut up and wait for the 3.0 series?

      -Frank

        • 1. Re: Local Interfaces for JBoss 2.4.x
          Andreas Schouten Newbie

          Hi Frank,

          we use local interfaces with jboss 2.4.1 without any problems.

          Have You defined local references fore the beans You want access the local interfaces?
          You can only lookup local interfaces in the comp/env namespace.

          Andreas

          • 2. Re: Local Interfaces for JBoss 2.4.x
            Frank Villarreal Newbie

            Hi Andreas ... I'm curious, since local interfaces are a feature of EJB 2.0, how are you using them with jboss 2.4.1? What jars do you need to create this effect? I know that EJB 2.0 spec states that ejbs that wish to utilize local interfaces must implement EJBLocalObject and/or EJBLocalHome interfaces. Is this what you are doing with your ejbs?

            • 3. Re: Local Interfaces for JBoss 2.4.x
              Frank Villarreal Newbie

              P.S.: I also forgot to ask ... is there anything special you're having to do in the ejb-jar.xml, jboss.xml, jboss.jcml, etc...

              • 4. Re: Local Interfaces for JBoss 2.4.x
                Frank Villarreal Newbie

                I answered one of my own questions .... the EJBLocalHome and EJBLocalObject are already included in the jboss-ejb.jar. However, I still don't know what needs to be done to any configuration files in order to utilize them.

                • 5. Re: Local Interfaces for JBoss 2.4.x
                  Frank Villarreal Newbie

                  Once again ... I answered another question of mine ... local interfaces are defined as <local-home/> and elements within ejb-jar.xml. I'll try this out and see if this works...

                  • 6. Re: Local Interfaces for JBoss 2.4.x
                    Andreas Schouten Newbie

                    Hi Frank,

                    You made this topic number one in 'Popular Discussions' ;-).

                    jBoss 2.4.x support not all, but some feature of the ejb 2.0 spec.
                    It does not support relationships, but it support local interfaces. (and MDB ...)
                    We use the MVCSoft persistence manager (mvcsoft.com), which provide us with the full features of ejb 2.0 persistency. The implementation of local interfaces is from the same auther as this pm.

                    By the way, I published a editor which may help You configureing the ejb-jar.xml rigth.


                    http://groups.yahoo.com/group/EJB-Developer/files/dev-tools/

                    Andreas

                    • 7. Re: Local Interfaces for JBoss 2.4.x
                      Frank Villarreal Newbie

                      Thanks Andreas! I check out that tool.

                      • 8. Re: Local Interfaces for JBoss 2.4.x
                        Frank Villarreal Newbie

                        Well ... I couldn't get it working. I created a stateless session bean (w/remote interface) that accesses another stateless session bean (w/local interface & local home) ... both beans are in the same VM. Every time I do the lookup for the local bean from the remote bean, I get a "not bound" NamingException from JBoss. Did I understand correctly that the lookup must be performed according to the following syntax...

                        System.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
                        System.setProperty("java.naming.provider.url", "localhost:1099");
                        InitialContext jndiContext = new InitialContext();
                        jndiInitialContxt.lookup("java:comp/env/MYLOCALBEAN");

                        Is it also correct that Jboss 2.4.x supports local interfaces without MVCSoft add-on? JBoss seems to be deploying my local-interface bean ... but by monitoring the jboss log, I notice that it does not get "bound" anywhere. Can someone please advise?

                        - Frank

                        • 9. Re: Local Interfaces for JBoss 2.4.x
                          Andreas Schouten Newbie

                          Hi Frank,

                          You don't need set up this system properties, they should already been setted while starting jBoss.
                          We only lookup local entity interfaces but Your lookup should work anyway. MYLOCALBEAN must be the name specified by the local reference of the first bean.
                          On Monday I will send some example code.

                          Andreas

                          • 10. Re: Local Interfaces for JBoss 2.4.x
                            Andreas Schouten Newbie

                            Hi Frank,

                            here is my dd:

                            <enterprise-beans>

                            The EACM Session
                            <ejb-name>EACMSession</ejb-name>
                            eacm.ejb.EACMSessionHome
                            eacm.ejb.EACMSession
                            <ejb-class>eacm.ejb.EACMSessionBean</ejb-class>
                            <session-type>Stateless</session-type>
                            <transaction-type>Container</transaction-type>
                            <ejb-local-ref>
                            <ejb-ref-name>PersonEntity</ejb-ref-name>
                            <ejb-ref-type>Entity</ejb-ref-type>
                            <ejb-link>PersonEJB</ejb-link>
                            <local-home>eacm.ejb.PersonHome</local-home>
                            eacm.ejb.Person
                            </ejb-local-ref>


                            <ejb-name>PersonEJB</ejb-name>
                            <local-home>eacm.ejb.PersonHome</local-home>
                            eacm.ejb.Person
                            <ejb-class>eacm.ejb.PersonBean</ejb-class>
                            <persistence-type>Container</persistence-type>
                            <prim-key-class>java.lang.String</prim-key-class>
                            True
                            <cmp-version>2.x</cmp-version>
                            <abstract-schema-name>PersonBean</abstract-schema-name>
                            <cmp-field>
                            <field-name>userID</field-name>
                            </cmp-field>
                            ....

                            an in session bean class:
                            try {
                            Context initial = new InitialContext();
                            personHome= (PersonHome) initial.lookup("java:/comp/env/PersonEntity");
                            } catch (NamingException nex) {
                            throw new EacmException("'PersonEntity unknown by naming service.");
                            }

                            • 11. Re: Local Interfaces for JBoss 2.4.x
                              Oliver Henlich Newbie

                              Hi Andreas.

                              I was wondering if you have experienced any of the stuff being discussed in:
                              http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t=forums/ whether you had any hints/ideas
                              cheers
                              Oliver

                              • 12. Re: Local Interfaces for JBoss 2.4.x
                                Frank Villarreal Newbie

                                Thanks Andreas!

                                Your code example made all the difference! I was able to get local interfaces working for my ejbs after examing your example. Thanks again.

                                - Frank

                                • 13. Re: Local Interfaces for JBoss 2.4.x
                                  Titto Assini Newbie

                                  It didn't work for me :-(

                                  Could you provide a full example?

                                  Thanks

                                  • 14. Re: Local Interfaces for JBoss 2.4.x
                                    jimotte Newbie

                                    Andreas or Frank- I too get the name not bound exception for a stateless session bean with local interfaces-
                                    my dd:


                                    <ejb-name>PageDimensionSessionBean</ejb-name>
                                    <local-jndi-name>PageDimensionSessionBean</local-jndi-name>
                                    <local-home>com.company.aq.session.PageDimensionSessionHome</local-home>
                                    com.company.aq.session.PageDimensionSession
                                    <ejb-class>com.company.aq.session.PageDimensionSessionBean</ejb-class>
                                    <session-type>Stateless</session-type>
                                    <transaction-type>Container</transaction-type>



                                    and my lookup is :

                                    Object obj = new InitialContext().lookup("local/PageDimensionSessionBeanPage");

                                    I still get :

                                    [ERROR,EJBUtil] Failed initializing bean access.
                                    [ERROR,Default] javax.naming.NameNotFoundException: local not bound
                                    [ERROR,Default] at org.jnp.server.NamingServer.getBinding(NamingServer.j
                                    ava:495)

                                    which is the same error I get when I lookup like this:

                                    Object obj = new InitialContext().lookup("PageDimensionSessionBean");

                                    the error:

                                    [ERROR,EJBUtil] Failed initializing bean access.
                                    [ERROR,Default] javax.naming.NameNotFoundException: PageDimensionSessionBean not
                                    bound

                                    even though I can clearly see the name on port 8082 and when JBoss starts I get the following message:

                                    [INFO,PageDimensionSessionBean] Initializing
                                    [INFO,PageDimensionSessionBean] Initialized
                                    [INFO,PageDimensionSessionBean] Starting
                                    [INFO,PageDimensionSessionBean] Started


                                    Both lookups fail-
                                    Could you show us some of your lookup code that helped Frank- or point out what is the problem here- I am running 2.4.4 with Tomcat 4 when this prob. occurs

                                    thanx a million

                                    Jim

                                    1 2 Previous Next