Peter He created OPENEJB-1977:
---------------------------------

             Summary: ear file deployment failed with persistence.xml in ear 
file's META-INF folder
                 Key: OPENEJB-1977
                 URL: https://issues.apache.org/jira/browse/OPENEJB-1977
             Project: OpenEJB
          Issue Type: Bug
          Components: tomee
    Affects Versions: 4.5.1
         Environment: windows
            Reporter: Peter He


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);



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to