12 Replies Latest reply on Nov 25, 2008 4:43 AM by alesj

    ApplicationMetaData Error in JBoss5 CR2

    choudhury

      Hi All,

      I urgently need your help to resolve a issue with ApplicationMetaData. A snippet from the log file is given below

      ERROR [org.jboss.ejb.plugins.LogInterceptor] (main) Unexpected Error in method: public abstract void ejbloader.EjbLoaderFacadeLocal.doImport(java.lang.String)
      java.lang.NoSuchMethodError: org.jboss.metadata.ApplicationMetaData: method ()V not found

      2008-11-19 16:06:27,833 ERROR [ejbloader.ExportManager] (main) Caught RuntimeException: Unexpected Error
      java.lang.NoSuchMethodError: org.jboss.metadata.ApplicationMetaData: method ()V not found
      at ejbloader.ejb.MetaData.getJbossMeta(MetaData.java:138)
      at ejbloader.ejb.MetaData.(MetaData.java:55)
      at ejbloader.EjbLoader.importEjb(EjbLoader.java:149)
      at ejbloader.EjbLoaderFacadeBean.doImport(EjbLoaderFacadeBean.java:69)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)


      Looking at the log, I understood the problem might be related with the compiled version of ApplicationMetaData with jboss. With Jboss4.0.2, ApplicationMetaData class comes in jboss.jar but in Jboss5 CR2, it is moved to jboss-metadata.jar. So when I removed the old jboss.jar and introduce new jboss and jboss-metadata.jar, my build failed with following error

      [javac] Compiling 16 source files to SOURCES/ejbloader/build
      [javac]ejbloader/ejb/MetaData.java:138: cannot find symbol
      [javac] symbol : constructor ApplicationMetaData()
      [javac] location: class org.jboss.metadata.ApplicationMetaData
      [javac] ApplicationMetaData amd = new ApplicationMetaData();
      [javac] ^
      [javac] Note MetaData.java uses or overrides a deprecated API.
      [javac] Note: Recompile with -Xlint:deprecation for details.
      [javac] Note: Some input files use unchecked or unsafe operations.
      [javac] Note: Recompile with -Xlint:unchecked for details.
      [javac] 1 error

      A code snippet about how I am using is given below

      URL url = getResource(UserLocalHome.class, "META-INF/ejb-jar.xml");
      if (log.isDebugEnabled())
      log.debug("Using ejb-jar.xml: " + url);
      ApplicationMetaData amd = new ApplicationMetaData(url);
      amd.setUrl(url);
      amd.importEjbJarXml(xfl.getDocumentFromURL(url).getDocumentElement());

      I am also getting depricated warning for EntityMetaData,beanMetaData and relationMetaData.

      Please let me know how can I overcome from the above problem so that my build doesn't fail. I tried to look for resources about ApplicationMetaData on internet but didn't get much help. Looking from you guys to get some input. Any help will be highly appreciated.

        • 1. Re: ApplicationMetaData Error in JBoss5 CR2
          alesj

           

          "choudhury" wrote:

          Looking at the log, I understood the problem might be related with the compiled version of ApplicationMetaData with jboss. With Jboss4.0.2, ApplicationMetaData class comes in jboss.jar but in Jboss5 CR2, it is moved to jboss-metadata.jar. So when I removed the old jboss.jar and introduce new jboss and jboss-metadata.jar, my build failed with following error

          If I understand this correctly, you're mixing 4.0.2 code with 5.0.0.CR2?
          What JBossAS version are you running?

          • 2. Re: ApplicationMetaData Error in JBoss5 CR2
            choudhury

            I am deploying and running my application on 5.0.0 CR2

            • 3. Re: ApplicationMetaData Error in JBoss5 CR2
              choudhury

              Just to add, my application is running perfectly OK with jboss 4.0.2. I am getting problem once I migrated AS to 5.0.0CR2

              • 4. Re: ApplicationMetaData Error in JBoss5 CR2
                alesj

                 

                "choudhury" wrote:
                Just to add, my application is running perfectly OK with jboss 4.0.2. I am getting problem once I migrated AS to 5.0.0CR2

                But you're using some impl details of JBoss4:
                A code snippet about how I am using is given below
                
                URL url = getResource(UserLocalHome.class, "META-INF/ejb-jar.xml");
                if (log.isDebugEnabled())
                log.debug("Using ejb-jar.xml: " + url);
                ApplicationMetaData amd = new ApplicationMetaData(url);
                amd.setUrl(url);
                amd.importEjbJarXml(xfl.getDocumentFromURL(url).getDocumentElement());
                

                so that's not really a surprise.

                Check how this is now done in metadata project:
                - http://anonsvn.jboss.org/repos/jbossas/projects/metadata/trunk/

                I'm pretty sure it's not that different from what you've already done.
                Just need to tweak your code appropriately to match the latest changes.

                • 5. Re: ApplicationMetaData Error in JBoss5 CR2
                  choudhury

                   

                  "alesj wrote:

                  I'm pretty sure it's not that different from what you've already done.
                  Just need to tweak your code appropriately to match the latest changes.


                  Thanks buddy for your help. I am looking at the link you provided. Just a request, if you find time please investigate a bit to tweak that code as well. I am also doing the same but probably need your help again

                  • 6. Re: ApplicationMetaData Error in JBoss5 CR2
                    alesj

                     

                    "choudhury" wrote:

                    Just a request, if you find time please investigate a bit to tweak that code as well.

                    I don't think this is the way it goes. :-)

                    There are few issues that don't really work here:
                    - I have no clue what your code does, nor am I interested
                    - I also have little idea what our metadata does, apart from global idea and things I wrote
                    - I would actually be doing your work ;-)

                    btw: more precise questions lead to more precise answers
                    --> nobody can help you with you showing 3 lines of code

                    • 7. Re: ApplicationMetaData Error in JBoss5 CR2
                      jaikiran

                      To add to what Ales mentioned - You are using JBoss specific files and there's no guarantee that file will be present in later version and even if it's present, you may not get the same output as in JBoss-4.x.

                      • 8. Re: ApplicationMetaData Error in JBoss5 CR2
                        choudhury

                        Thanks Ales and Jai. I understand what you people are trying to say. To start with Jai, I know JBoss specific files may not be present in the future relese of JBoss but a workaround will definately be provided. It may be related with changing our code a bit or so but some sloution will surely be there. Moreover, since I am using those files for quite some time suddenly I can't change my design. It will require to involve many people and proper argument also need to be provide.


                        Ales, I am mainly looking for the answer of the following questions

                        1) ApplicationMetaData with Jboss4-x were previously instantiated like the following way
                        ApplicationMetaData amd = new ApplicationMetaData();

                        How can I instantiate the same now with Jboss 5?

                        Note:- I tried like these way
                        ApplicationMetaData amd = new ApplicationMetaData(new JBossMetaData());


                        2) setUrl() and importEjbJarXml() method of ApplicationMetaData now always through UnsupportedoperationException. So what are the alternatives of using these two method?


                        • 9. Re: ApplicationMetaData Error in JBoss5 CR2
                          alesj

                           

                          "choudhury" wrote:

                          1) ApplicationMetaData with Jboss4-x were previously instantiated like the following way
                          ApplicationMetaData amd = new ApplicationMetaData();

                          How can I instantiate the same now with Jboss 5?

                          Note:- I tried like these way
                          ApplicationMetaData amd = new ApplicationMetaData(new JBossMetaData());

                          Its @Deprecate mark hints you shouldn't use it any more. ;-)
                          Afaik + reading its header:
                           * The top level meta data from the jboss.xml and ejb-jar.xml descriptor.
                          

                          this should be changed with JBossMetaData.

                          "choudhury" wrote:

                          2) setUrl() and importEjbJarXml() method of ApplicationMetaData now always through UnsupportedoperationException. So what are the alternatives of using these two method?

                          Dunno.
                          As I have no idea what they used to do.
                          Look around JBossMetaData for anything similar.

                          • 10. Re: ApplicationMetaData Error in JBoss5 CR2
                            choudhury

                            Hi Ales, Thanks a lot for your reply. Let me just try to explain what exactly my problem is.

                            setURL() is the method of ApplicationMetaData which takes an URL object as the parameter. This URL object refers to the ejb-jar.xml,jboss.xml and standardjboss.xml . This is called only once.

                            After that we used to call importEjbJarXml() and importJbossXml() of ApplicationMetaData.Each of this method takes an Element object as the parameter.

                            e.g. amd.importEjbJarXml(xfl.getDocumentFromUrl(url).getDocumentElement())

                            amd.importJBossXml(xfl.getDocumentFromUrl(url).getDocumentElement())

                            where amd is the ApplicationMetaData object
                            xfl is the XmlFileLoader object and
                            url is the URL object.URL object refers to the following xmls ejb-jar.xml,jboss.xml and standardjboss.xml

                            Once that is done we can call getEnterpriseBeans() and getRelationships() of ApplicationMetaData to get the list of all enterprise beans and relationships etc.

                            Now my problem is I don't see any method in the JBossMetaData or on any other class where I can pass these xmls so that I can retrieve my list of enterprise beans and relatioship.

                            I tried with EjbJar21MetaData and JBoss50MetaData assuming that I only need to call the default constructor and the rest will be taken care by Jboss but that didn't work. Please help with some technical inputs from your side. Please let me know which api class will understand about my xmls.

                            • 11. Re: ApplicationMetaData Error in JBoss5 CR2
                              jaikiran

                               

                              "arabinda30" wrote:

                              Once that is done we can call getEnterpriseBeans() and getRelationships() of ApplicationMetaData to get the list of all enterprise beans and relationships etc.



                              Just curious - Why do you need that information in your application? Are you building your own deployment framework or something similar?

                              • 12. Re: ApplicationMetaData Error in JBoss5 CR2
                                alesj

                                 

                                "arabinda30" wrote:

                                I tried with EjbJar21MetaData and JBoss50MetaData assuming that I only need to call the default constructor and the rest will be taken care by Jboss but that didn't work. Please help with some technical inputs from your side. Please let me know which api class will understand about my xmls.

                                Check the new deployers that handle these new metadata classes.
                                - http://anonsvn.jboss.org/repos/jbossas/trunk/server/src/main/org/jboss/deployment/
                                And then follow their trail.
                                It will eventually lead you to how they get this info out of the metadata.