Uploaded image for project: 'OpenEJB'
  1. OpenEJB
  2. OPENEJB-1977

ear file deployment failed with persistence.xml in ear file's META-INF folder

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Critical
    • Resolution: Unresolved
    • 4.5.1, 4.5.2
    • None
    • tomee
    • None
    • windows, MacOSX

    Description

      I have a ear file which can run the other app server but failed in TOMEE when it has persistence.xml in ear file's META-INF folder. I look at the source code and find the issue.I am sure if it has been fixed in 1.5.2. But I'd like to share my fix.

      in DeploymentLoader.java in openejb-4.5.0\container\openejb-core\src\main\java\org\apache\openejb\config
      in method: AppModule createAppModule(final File jarFile, final String jarPath)

      after the following line:
      appModule.getAltDDs().putAll(appDescriptors);

      we should convert persistence.xml entry to List<URL>. I add a very simple method in the following lines

      private static void convertPersistenceToList(Map map){
      Object url = map.get("persistence.xml");
      if(url!=null && url instanceof URL)

      { List<URL> persistences = new ArrayList<URL>(); persistences.add((URL)url); map.put("persistence.xml", persistences); }

      }

      and call it like the following lines
      Map<String, Object> altDDs = appModule.getAltDDs();
      altDDs.putAll(appDescriptors);
      convertPersistenceToList(altDDs);

      Attachments

        1. DeploymentLoader.java.patch
          1 kB
          Timothy James Ward
        2. jboss-as-kitchensink-ear-ear.ear
          100 kB
          Timothy James Ward

        Activity

          People

            Unassigned Unassigned
            peterhe Peter He
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: