You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by "Jean-Louis MONTEIRO (JIRA)" <ji...@apache.org> on 2009/08/12 23:21:14 UTC

[jira] Created: (OPENEJB-1059) altdd support seems broken for persistence.xml files

altdd support seems broken for persistence.xml files
----------------------------------------------------

                 Key: OPENEJB-1059
                 URL: https://issues.apache.org/jira/browse/OPENEJB-1059
             Project: OpenEJB
          Issue Type: Bug
    Affects Versions: 3.1.1
         Environment: win xp
            Reporter: Jean-Louis MONTEIRO
             Fix For: 3.1.2


As reported by Marrck in the user's list http://www.nabble.com/openejb.altdd.prefix-not-working-for-persistence.xml-to24926543.html
altdd support potentially contains a bug with persistence.xml files.

The issue seems located in DeploymentLoader.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (OPENEJB-1059) altdd support seems broken for persistence.xml files

Posted by "David Blevins (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENEJB-1059?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Blevins closed OPENEJB-1059.
----------------------------------

    Resolution: Fixed

Most the duplicate logging was related to OPENEJB-1069.  Did a minor tweak as part of that fix which also worked for duplicate logging that would be caused by this code too.  So we're all good now.

> altdd support seems broken for persistence.xml files
> ----------------------------------------------------
>
>                 Key: OPENEJB-1059
>                 URL: https://issues.apache.org/jira/browse/OPENEJB-1059
>             Project: OpenEJB
>          Issue Type: Bug
>    Affects Versions: 3.1.1
>         Environment: win xp
>            Reporter: Jean-Louis MONTEIRO
>            Assignee: Jean-Louis MONTEIRO
>             Fix For: 3.1.2
>
>
> As reported by Marrck in the user's list http://www.nabble.com/openejb.altdd.prefix-not-working-for-persistence.xml-to24926543.html
> altdd support potentially contains a bug with persistence.xml files.
> The issue seems located in DeploymentLoader.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENEJB-1059) altdd support seems broken for persistence.xml files

Posted by "David Blevins (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENEJB-1059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12742595#action_12742595 ] 

David Blevins commented on OPENEJB-1059:
----------------------------------------

I hadn't noticed that we had an explicit list of URLs in this method.  Maybe we just want to go over each URL individually, create a finder for just that URL, then execute: 

  Map<String, URL> descriptors = altDDSources(finder.getResourcesMap("META-INF/"), false);

Pull just the "persistence.xml" entry out of the list -- guaranteed to be a single URL if present -- and add it to the persistenceUrls list.

Not logging twice might still be a challenge -- not sure if that "urls" list includes the URLs of know modules like EjbModules and so on.  If it does then we might get some double logging which we'd want to avoid somehow.


> altdd support seems broken for persistence.xml files
> ----------------------------------------------------
>
>                 Key: OPENEJB-1059
>                 URL: https://issues.apache.org/jira/browse/OPENEJB-1059
>             Project: OpenEJB
>          Issue Type: Bug
>    Affects Versions: 3.1.1
>         Environment: win xp
>            Reporter: Jean-Louis MONTEIRO
>             Fix For: 3.1.2
>
>
> As reported by Marrck in the user's list http://www.nabble.com/openejb.altdd.prefix-not-working-for-persistence.xml-to24926543.html
> altdd support potentially contains a bug with persistence.xml files.
> The issue seems located in DeploymentLoader.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENEJB-1059) altdd support seems broken for persistence.xml files

Posted by "Jean-Louis MONTEIRO (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENEJB-1059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12745957#action_12745957 ] 

Jean-Louis MONTEIRO commented on OPENEJB-1059:
----------------------------------------------

Actually the related bug is fixed but we still have to find a way to avoid duplicate log lines like
AltDD XXX -> YYY

I tried to create a logger holding recent messages in a Set but i'm facing a problem while undeploying/deploying an application because the warn does not appear anymore.


> altdd support seems broken for persistence.xml files
> ----------------------------------------------------
>
>                 Key: OPENEJB-1059
>                 URL: https://issues.apache.org/jira/browse/OPENEJB-1059
>             Project: OpenEJB
>          Issue Type: Bug
>    Affects Versions: 3.1.1
>         Environment: win xp
>            Reporter: Jean-Louis MONTEIRO
>             Fix For: 3.1.2
>
>
> As reported by Marrck in the user's list http://www.nabble.com/openejb.altdd.prefix-not-working-for-persistence.xml-to24926543.html
> altdd support potentially contains a bug with persistence.xml files.
> The issue seems located in DeploymentLoader.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENEJB-1059) altdd support seems broken for persistence.xml files

Posted by "David Blevins (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENEJB-1059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12753292#action_12753292 ] 

David Blevins commented on OPENEJB-1059:
----------------------------------------

Didn't notice the comment on #1 vs #2.  Already updated the code, but here's the explanation.  With the list of urls there might be several persistence.xml files, but due to the fact that we are using a map there can only be one entry with the key "persistence.xml" so we will loose all but one.


> altdd support seems broken for persistence.xml files
> ----------------------------------------------------
>
>                 Key: OPENEJB-1059
>                 URL: https://issues.apache.org/jira/browse/OPENEJB-1059
>             Project: OpenEJB
>          Issue Type: Bug
>    Affects Versions: 3.1.1
>         Environment: win xp
>            Reporter: Jean-Louis MONTEIRO
>             Fix For: 3.1.2
>
>
> As reported by Marrck in the user's list http://www.nabble.com/openejb.altdd.prefix-not-working-for-persistence.xml-to24926543.html
> altdd support potentially contains a bug with persistence.xml files.
> The issue seems located in DeploymentLoader.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENEJB-1059) Altdd support broken for persistence.xml files with no ejb-jar.xml

Posted by "David Blevins (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENEJB-1059?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Blevins updated OPENEJB-1059:
-----------------------------------

    Summary: Altdd support broken for persistence.xml files with no ejb-jar.xml  (was: altdd support seems broken for persistence.xml files)

Tweaked description for release notes

> Altdd support broken for persistence.xml files with no ejb-jar.xml
> ------------------------------------------------------------------
>
>                 Key: OPENEJB-1059
>                 URL: https://issues.apache.org/jira/browse/OPENEJB-1059
>             Project: OpenEJB
>          Issue Type: Bug
>    Affects Versions: 3.1.1
>         Environment: win xp
>            Reporter: Jean-Louis MONTEIRO
>            Assignee: Jean-Louis MONTEIRO
>             Fix For: 3.1.2
>
>
> As reported by Marrck in the user's list http://www.nabble.com/openejb.altdd.prefix-not-working-for-persistence.xml-to24926543.html
> altdd support potentially contains a bug with persistence.xml files.
> The issue seems located in DeploymentLoader.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (OPENEJB-1059) altdd support seems broken for persistence.xml files

Posted by "David Blevins (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENEJB-1059?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Blevins closed OPENEJB-1059.
----------------------------------

    Resolution: Fixed
      Assignee: Jean-Louis MONTEIRO

Should be closed enough for now.  We can deal with the duplicate log lines later or as a separate issue (or sub-issue)

> altdd support seems broken for persistence.xml files
> ----------------------------------------------------
>
>                 Key: OPENEJB-1059
>                 URL: https://issues.apache.org/jira/browse/OPENEJB-1059
>             Project: OpenEJB
>          Issue Type: Bug
>    Affects Versions: 3.1.1
>         Environment: win xp
>            Reporter: Jean-Louis MONTEIRO
>            Assignee: Jean-Louis MONTEIRO
>             Fix For: 3.1.2
>
>
> As reported by Marrck in the user's list http://www.nabble.com/openejb.altdd.prefix-not-working-for-persistence.xml-to24926543.html
> altdd support potentially contains a bug with persistence.xml files.
> The issue seems located in DeploymentLoader.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENEJB-1059) altdd support seems broken for persistence.xml files

Posted by "Jean-Louis MONTEIRO (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENEJB-1059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12745070#action_12745070 ] 

Jean-Louis MONTEIRO commented on OPENEJB-1059:
----------------------------------------------

I looked quickly xbean-finder sources and for me both methods are equivalent as xbean seems to go throughout the list.

1.
ResourceFinder finder = new ResourceFinder("", ClassLoader.getSystemClassLoader(), urls);
Map<String, URL> descriptors = altDDSources(finder.getResourcesMap("META-INF/"), false);
...

2.
for (URL url : urls) {
       ResourceFinder finder = new ResourceFinder(urls);
        Map<String, URL> descriptors = altDDSources(finder.getResourcesMap("META-INF/"), false);

       ...
}

isn't it ?

For the moment, i chose the first solution. I'm adding some tests to see if it works fine and if i will face logging problems. 

> altdd support seems broken for persistence.xml files
> ----------------------------------------------------
>
>                 Key: OPENEJB-1059
>                 URL: https://issues.apache.org/jira/browse/OPENEJB-1059
>             Project: OpenEJB
>          Issue Type: Bug
>    Affects Versions: 3.1.1
>         Environment: win xp
>            Reporter: Jean-Louis MONTEIRO
>             Fix For: 3.1.2
>
>
> As reported by Marrck in the user's list http://www.nabble.com/openejb.altdd.prefix-not-working-for-persistence.xml-to24926543.html
> altdd support potentially contains a bug with persistence.xml files.
> The issue seems located in DeploymentLoader.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENEJB-1059) altdd support seems broken for persistence.xml files

Posted by "David Blevins (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENEJB-1059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12742593#action_12742593 ] 

David Blevins commented on OPENEJB-1059:
----------------------------------------

The broken code from DeploymentLoader with added comments:

    @SuppressWarnings({"unchecked"})
    protected static void addPersistenceUnits(AppModule appModule, URL... urls) {
        try {
            // any class loader will do here since we are not calling class loading methods of resource finder
            ResourceFinder finder = new ResourceFinder("", ClassLoader.getSystemClassLoader(), urls);
            
            // OPENEJB-1059: Anything in the appModule.getAltDDs() map has already been processed by the 
            // altdd code, so anything in here should not cause OPENEJB-1059
            List<URL> persistenceUrls = (List<URL>) appModule.getAltDDs().get("persistence.xml");
            if (persistenceUrls == null) {
                persistenceUrls = new ArrayList<URL>();
                appModule.getAltDDs().put("persistence.xml", persistenceUrls);
            }
            
            // OPENEJB-1059: This would definitely cause the OPENEJB-1059 issue.
            // Something similar to what is do in discoverModuleType might work
            // i.e. it does Map<String, URL> descriptors = altDDSources(finder.getResourcesMap("META-INF/"), false);
            // though we would want to log.  Tricky thing is we don't want to log the replacement twice.
            // Maybe we need update the logging so that it doesn't log if the url it's replacing is the same.
            // All this is a little strange as here the other entries in the altDd map are [fileName => URL] entries
            // but the persistence.xml entry is [fileName => List<URL>].  Would really have to look closely at the
            // code to see if that posses a challenge.
            persistenceUrls.addAll(finder.findAll("META-INF/persistence.xml"));
        } catch (IOException e) {
            logger.warning("Cannot load persistence-units from 'META-INF/persistence.xml' : " + e.getMessage(), e);
        }
    }


> altdd support seems broken for persistence.xml files
> ----------------------------------------------------
>
>                 Key: OPENEJB-1059
>                 URL: https://issues.apache.org/jira/browse/OPENEJB-1059
>             Project: OpenEJB
>          Issue Type: Bug
>    Affects Versions: 3.1.1
>         Environment: win xp
>            Reporter: Jean-Louis MONTEIRO
>             Fix For: 3.1.2
>
>
> As reported by Marrck in the user's list http://www.nabble.com/openejb.altdd.prefix-not-working-for-persistence.xml-to24926543.html
> altdd support potentially contains a bug with persistence.xml files.
> The issue seems located in DeploymentLoader.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Reopened: (OPENEJB-1059) altdd support seems broken for persistence.xml files

Posted by "David Blevins (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENEJB-1059?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Blevins reopened OPENEJB-1059:
------------------------------------


Darn it.  It just occurred to me that if we log twice, then we could actually be adding the same persistence.xml twice.  Looks like that's the case.  Going to take a stab at fixing this.

> altdd support seems broken for persistence.xml files
> ----------------------------------------------------
>
>                 Key: OPENEJB-1059
>                 URL: https://issues.apache.org/jira/browse/OPENEJB-1059
>             Project: OpenEJB
>          Issue Type: Bug
>    Affects Versions: 3.1.1
>         Environment: win xp
>            Reporter: Jean-Louis MONTEIRO
>            Assignee: Jean-Louis MONTEIRO
>             Fix For: 3.1.2
>
>
> As reported by Marrck in the user's list http://www.nabble.com/openejb.altdd.prefix-not-working-for-persistence.xml-to24926543.html
> altdd support potentially contains a bug with persistence.xml files.
> The issue seems located in DeploymentLoader.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.