1 2 Previous Next 16 Replies Latest reply on Dec 6, 2009 5:52 AM by amira manai

    Migrating 4.2.3.GA to 5.1.0.GA - JNDI missing?

    Richard Kennard Novice

      Hi all,

      In JBoss 4.2.3, I used to be able to do...

      new InitialContext().lookup( "ear-name/ejb-name/local" )

      ...and it worked great, even from servlet filters. But in 5.1.0.GA, I can find no such mapping, even though the logs say the beans are all deployed.

      I see a lot of references in the documentation to 'global' or 'module', but those JNDI namespaces don't exist either.

      Is there something additional I need to do in 5.1.0.GA?

      Regards,

      Richard.

        • 1. Re: Migrating 4.2.3.GA to 5.1.0.GA - JNDI missing?
          jaikiran pai Master

          What do you see in the console when the beans are being deployed. Can you post the console (not server.log) logs?

          While posting logs or xml content or code, please remember to wrap it in a code block by using the Code button in the message editor window. Please use the Preview button to ensure that your post is correctly formatted.

          • 2. Re: Migrating 4.2.3.GA to 5.1.0.GA - JNDI missing?
            Richard Kennard Novice

            jaikiran,

            Thank you for your fast reply. Here is a snippet of the console output (the actual output is very long, as you can imagine). Let us say I am after the bean 'DocumentBean'. Here is everything from the console that mentions DocumentBean:

            ...lots of output...
            2009-06-15 13:03:31,687 WARN [org.jboss.ejb3.Ejb3AnnotationHandler] (main) JBMETA-4: did not find any bean meta data for annotation bean DocumentBean, will create some
            ...lots of output...
            2009-06-15 13:03:33,687 INFO [org.jboss.ejb3.deployers.JBossASKernel] (main) installing bean: jboss.j2ee:ear=avant-ss-app.ear,jar=avant-ss-ejb.jar,name=DocumentBean,service=EJB3
            2009-06-15 13:03:33,687 INFO [org.jboss.ejb3.deployers.JBossASKernel] (main) with dependencies:
            2009-06-15 13:03:33,687 INFO [org.jboss.ejb3.deployers.JBossASKernel] (main) and demands:
            2009-06-15 13:03:33,687 INFO [org.jboss.ejb3.deployers.JBossASKernel] (main) jboss.ejb:service=EJBTimerService
            2009-06-15 13:03:33,687 INFO [org.jboss.ejb3.deployers.JBossASKernel] (main) and supplies:
            2009-06-15 13:03:33,687 INFO [org.jboss.ejb3.deployers.JBossASKernel] (main) Class:com.kennardconsulting.core.ejb.session.isession.IDiskFileBean
            2009-06-15 13:03:33,687 INFO [org.jboss.ejb3.deployers.JBossASKernel] (main) Added bean(jboss.j2ee:ear=avant-ss-app.ear,jar=avant-ss-ejb.jar,name=DocumentBean,service=EJB3) to KernelDeployment of: avant-ss-ejb.jar
            2009-06-15 13:03:33,687 INFO [org.jboss.ejb3.deployers.JBossASKernel] (main) installing bean: jboss.j2ee:ear=avant-ss-app.ear,jar=avant-ss-ejb.jar,name=AdviserBean,service=EJB3
            ...lots of output...
            
            2009-06-15 13:03:34,296 INFO [org.jboss.ejb3.session.SessionSpecContainer] (main) Starting jboss.j2ee:ear=avant-ss-app.ear,jar=avant-ss-ejb.jar,name=DocumentBean,service=EJB3
            2009-06-15 13:03:34,296 INFO [org.jboss.ejb3.EJBContainer] (main) STARTED EJB: com.avant.ss.ejb.session.DocumentBean ejbName: DocumentBean
            2009-06-15 13:03:34,296 INFO [org.jboss.ejb3.proxy.impl.jndiregistrar.JndiSessionRegistrarBase] (main) Binding the following Entries in Global JNDI:
            (two blank lines)
            2009-06-15 13:03:34,359 INFO [org.jboss.ejb3.session.SessionSpecContainer] (main) Starting jboss.j2ee:ear=avant-ss-app.ear,jar=avant-ss-ejb.jar,name=AdvisersCsvBean,service=EJB3
            


            Regards,

            Richard.


            • 3. Re: Migrating 4.2.3.GA to 5.1.0.GA - JNDI missing?
              jaikiran pai Master

               

              2009-06-15 13:03:34,296 INFO [org.jboss.ejb3.proxy.impl.jndiregistrar.JndiSessionRegistrarBase] (main) Binding the following Entries in Global JNDI:
              (two blank lines)


              This is strange. Can you post the bean implementation code (along with the annotations and the import statements) and any ejb-jar.xml/jboss.xml contents? And are you using EJB3 or EJB2.x? Where is the avant-ss-ejb.jar located in the avant-ss-app.ear?

              • 4. Re: Migrating 4.2.3.GA to 5.1.0.GA - JNDI missing?
                Richard Kennard Novice

                jaikiran,

                Thanks again for being so helpful. Again there is rather a lot of code involved. I will try to post the relevant bits:

                package com.avant.ss.ejb.session;
                
                import java.io.File;
                
                import javax.ejb.Stateful;
                
                import com.avant.ss.ejb.entity.Document;
                import com.kennardconsulting.core.ejb.session.DiskFileBean;
                import com.kennardconsulting.core.ejb.session.isession.IDiskFileBean;
                import com.kennardconsulting.core.util.EjbUtils;
                
                @Stateful
                public class DocumentBean
                 extends DiskFileBean<Document>
                 implements IDiskFileBean<Document>
                {
                 ...lots of code...
                


                package com.kennardconsulting.core.ejb.session.isession;
                
                import java.io.InputStream;
                import java.util.List;
                
                import com.kennardconsulting.core.ejb.entity.DiskFile;
                import com.kennardconsulting.core.simpletype.ListState;
                
                public interface IDiskFileBean<DF extends DiskFile>
                 extends IBaseSessionBean
                {
                 ...code...
                


                There is nothing related to DocumentBean in either jboss.xml or ejb-jar.xml.

                Regards,

                Richard.



                • 5. Re: Migrating 4.2.3.GA to 5.1.0.GA - JNDI missing?
                  jaikiran pai Master

                  The important part:

                  "jaikiran" wrote:


                  Where is the avant-ss-ejb.jar located in the avant-ss-app.ear?


                  Also do you list avant-ss-ejb.jar in any MANIFEST.MF files of the jars? If yes, remove it from those MANIFEST.MF files

                  • 6. Re: Migrating 4.2.3.GA to 5.1.0.GA - JNDI missing?
                    Richard Kennard Novice

                    jaikiran,

                    Apologies. My deployment is exploded, so avant-ss-ejb.jar is a folder at:

                    N:\jboss-5.1.0.GA\server\all\deploy\avant-ss-app.ear\avant-ss-ejb.jar\

                    No, avant-ss-ejb.jar is not mentioned in any MANIFEST.MF. Only in application.xml:

                    <?xml version="1.0" encoding="UTF-8"?>
                    <application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd">
                    
                     <display-name>Avant SS</display-name>
                    
                     <module id="avant-ss-ejb.jar">
                     <ejb>avant-ss-ejb.jar</ejb>
                     </module>
                    
                     <module id="avant-ss-web.war">
                     <web>
                     <web-uri>avant-ss-web.war</web-uri>
                     <context-root>/avant-ss</context-root>
                     </web>
                     </module>
                    
                    </application>


                    • 7. Re: Migrating 4.2.3.GA to 5.1.0.GA - JNDI missing?
                      jaikiran pai Master

                      Everything looks right. This log is suspicious though:

                      2009-06-15 13:03:31,687 WARN [org.jboss.ejb3.Ejb3AnnotationHandler] (main) JBMETA-4: did not find any bean meta data for annotation bean DocumentBean, will create some

                      This usually happens when the EJB (jar) is being picked up from some lib folder of the deployment or the MANIFEST.MF of the jars and is considered as an "library" instead of a "deployment". Can you just double check that this jar file is not present in any other location within your AS?

                      • 8. Re: Migrating 4.2.3.GA to 5.1.0.GA - JNDI missing?
                        Richard Kennard Novice

                        It is not present anywhere else, or reference in any MANIFEST files, sorry.

                        But note it is not a JAR file either: it is an exploded folder named '.jar'. This is okay in 4.2.3.GA - is it still okay in 5.1.0.GA?

                        • 9. Re: Migrating 4.2.3.GA to 5.1.0.GA - JNDI missing?
                          jaikiran pai Master

                          Yes an exploded jar file should be fine. I don't see a reason why the metadata is not created for this jar. Please create a JIRA in EJBTHREE project here https://jira.jboss.org/jira/browse/EJBTHREE and assign it to me. Also, if possible please attach the small application which reproduces this.

                          • 10. Re: Migrating 4.2.3.GA to 5.1.0.GA - JNDI missing?
                            Richard Kennard Novice

                            jaikiran,

                            Okay I believe I have located the problem. I have not opened a JIRA yet because this may well be spec, though it seems a strange spec to me (and certainly different from JBoss 4.2.3).

                            Basically: the presence of an <app.ear>/<ejbs.jar>/META-INF/ejb-jar.xml file, even an empty one, short-circuits the annotation-based detection completely. I have put together a little example here:

                            http://kennardconsulting.com/tmp/avant-ss-app.zip

                            You will need to extract it into the deploy/ folder of a fresh JBoss 5.1.0.GA installation.

                            You will find it deploys okay (it errors if you don't give it a -ds.xml, but that's okay) but it has the JBMETA-4 warning and does not set up the JNDI. But if you go in and delete the ejb-jar.xml then it detects the bean via the annotations.

                            This may be intentional. But in 4.2.3 you could specify some beans in your ejb-jar.xml and leave the annotation processing to find the rest. In particular, you could configure some beans with <env-entry>'s and the like without having to specify every bean.

                            So has this changed deliberately? And is there a way to revert to the old behaviour?

                            Richard.

                            • 11. Re: Migrating 4.2.3.GA to 5.1.0.GA - JNDI missing?
                              Richard Kennard Novice

                              jaikiran,

                              Okay I believe I have located the problem. I have not opened a JIRA yet because this may well be spec, though it seems a strange spec to me (and certainly different from JBoss 4.2.3).

                              Basically: the presence of an <app.ear>/<ejbs.jar>/META-INF/ejb-jar.xml file, even an empty one, short-circuits the annotation-based detection completely. I have put together a little example here:

                              http://kennardconsulting.com/tmp/avant-ss-app.zip

                              You will need to extract it into the deploy/ folder of a fresh JBoss 5.1.0.GA installation.

                              You will find it deploys okay (it errors if you don't give it a -ds.xml, but that's okay) but it has the JBMETA-4 warning and does not set up the JNDI. But if you go in and delete the ejb-jar.xml then it detects the bean via the annotations.

                              This may be intentional. But in 4.2.3 you could specify some beans in your ejb-jar.xml and leave the annotation processing to find the rest. In particular, you could configure some beans with <env-entry>'s and the like without having to specify every bean.

                              So has this changed deliberately? And is there a way to revert to the old behaviour?

                              Richard.

                              • 12. Re: Migrating 4.2.3.GA to 5.1.0.GA - JNDI missing?
                                jaikiran pai Master

                                Hmm, this is a weird ejb-jar.xml:

                                <?xml version="1.0" encoding="UTF-8"?>
                                
                                <ejb-jar>
                                
                                </ejb-jar>


                                Can you change it to:

                                <?xml version="1.0" encoding="UTF-8"?>
                                <ejb-jar version="3.0"
                                 xmlns="http://java.sun.com/xml/ns/javaee"
                                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">
                                </ejb-jar>
                                


                                and see if that works?

                                • 13. Re: Migrating 4.2.3.GA to 5.1.0.GA - JNDI missing?
                                  Richard Kennard Novice

                                  jaikiran,

                                  Yes, that worked. Terrific. Thank you so much.

                                  If I may suggest, though, leaving off the namespace from <ejb-jar> is not so weird. Lots of examples on the Web do that, and it used to work in JBoss 4.

                                  If your ejb-jar.xml is machine generated it'll probably have a namespace, but many hand-written ejb-jar.xml's may not. Perhaps some more informative warning message would be helpful?

                                  Just a suggestion.

                                  Regards,

                                  Richard.

                                  • 14. Re: Migrating 4.2.3.GA to 5.1.0.GA - JNDI missing?
                                    jaikiran pai Master

                                    A ejb-jar.xml without an EJB3 namespace isn't considered a EJB3 deployment. That was the reason for the deployment to be skipped (or rather incorrectly handled). I am not sure whether adding a warning is the right thing to do, but let's see how we can handle this better.

                                    1 of 1 people found this helpful
                                    1 2 Previous Next