You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Helen Xu (JIRA)" <ji...@apache.org> on 2012/08/01 23:44:02 UTC

[jira] [Created] (OPENJPA-2244) Nested classpath ignored in mapping tool ant task

Helen Xu created OPENJPA-2244:
---------------------------------

             Summary: Nested classpath ignored in mapping tool ant task
                 Key: OPENJPA-2244
                 URL: https://issues.apache.org/jira/browse/OPENJPA-2244
             Project: OpenJPA
          Issue Type: Bug
    Affects Versions: 2.2.0, 2.1.1, 2.0.1
            Reporter: Helen Xu
            Assignee: Helen Xu


The nested classpath element inside the mappingtool ant task are ignored when loading the persistent configuration file. User got the following error:

<openjpa-2.0.2-SNAPSHOT-r422266:1361284M fatal user error> org.apache.openjpa.util.MetaDataException: MetaDataFactory could not be configured (conf.newMetaDataFactoryInstance() returned null). This might mean that no configuration properties were found. Ensure that you have a META-INF/persistence.xml file, that it is available in your classpath, or that the properties file you are using for configuration is available. If you are using Ant, please see the <properties> or <propertiesFile> attributes of the task's nested <config> element. This can also occur if your OpenJPA distribution jars are corrupt, or if your security policy is overly strict.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (OPENJPA-2244) Nested classpath ignored in mapping tool ant task

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

Helen Xu updated OPENJPA-2244:
------------------------------

    Attachment: OPENJPA-2244.patch
    
> Nested classpath ignored in mapping tool ant task
> -------------------------------------------------
>
>                 Key: OPENJPA-2244
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2244
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.0.1, 2.1.1, 2.2.0
>            Reporter: Helen Xu
>            Assignee: Helen Xu
>         Attachments: OPENJPA-2244.patch, OPENJPA-2244.patch
>
>
> The nested classpath element inside the mappingtool ant task are ignored when loading the persistent configuration file. User got the following error:
> <openjpa-2.0.2-SNAPSHOT-r422266:1361284M fatal user error> org.apache.openjpa.util.MetaDataException: MetaDataFactory could not be configured (conf.newMetaDataFactoryInstance() returned null). This might mean that no configuration properties were found. Ensure that you have a META-INF/persistence.xml file, that it is available in your classpath, or that the properties file you are using for configuration is available. If you are using Ant, please see the <properties> or <propertiesFile> attributes of the task's nested <config> element. This can also occur if your OpenJPA distribution jars are corrupt, or if your security policy is overly strict.

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

[jira] [Updated] (OPENJPA-2244) Nested classpath ignored in mapping tool ant task

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

Albert Lee updated OPENJPA-2244:
--------------------------------

    Patch Info: Patch Available
    
> Nested classpath ignored in mapping tool ant task
> -------------------------------------------------
>
>                 Key: OPENJPA-2244
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2244
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.0.1, 2.1.1, 2.2.0
>            Reporter: Helen Xu
>            Assignee: Helen Xu
>         Attachments: OPENJPA-2244.patch, OPENJPA-2244.patch
>
>
> The nested classpath element inside the mappingtool ant task are ignored when loading the persistent configuration file. User got the following error:
> <openjpa-2.0.2-SNAPSHOT-r422266:1361284M fatal user error> org.apache.openjpa.util.MetaDataException: MetaDataFactory could not be configured (conf.newMetaDataFactoryInstance() returned null). This might mean that no configuration properties were found. Ensure that you have a META-INF/persistence.xml file, that it is available in your classpath, or that the properties file you are using for configuration is available. If you are using Ant, please see the <properties> or <propertiesFile> attributes of the task's nested <config> element. This can also occur if your OpenJPA distribution jars are corrupt, or if your security policy is overly strict.

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

[jira] [Updated] (OPENJPA-2244) Nested classpath ignored in mapping tool ant task

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

Helen Xu updated OPENJPA-2244:
------------------------------

    Attachment:     (was: OPENJPA-2244.patch)
    
> Nested classpath ignored in mapping tool ant task
> -------------------------------------------------
>
>                 Key: OPENJPA-2244
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2244
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.0.1, 2.1.1, 2.2.0
>            Reporter: Helen Xu
>            Assignee: Helen Xu
>         Attachments: OPENJPA-2244.patch
>
>
> The nested classpath element inside the mappingtool ant task are ignored when loading the persistent configuration file. User got the following error:
> <openjpa-2.0.2-SNAPSHOT-r422266:1361284M fatal user error> org.apache.openjpa.util.MetaDataException: MetaDataFactory could not be configured (conf.newMetaDataFactoryInstance() returned null). This might mean that no configuration properties were found. Ensure that you have a META-INF/persistence.xml file, that it is available in your classpath, or that the properties file you are using for configuration is available. If you are using Ant, please see the <properties> or <propertiesFile> attributes of the task's nested <config> element. This can also occur if your OpenJPA distribution jars are corrupt, or if your security policy is overly strict.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-2244) Nested classpath ignored in mapping tool ant task

Posted by "Helen Xu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13459075#comment-13459075 ] 

Helen Xu commented on OPENJPA-2244:
-----------------------------------

When user specifies the properties attribute inside the config element to point to a specific persistence config file and persistent unit, the persistence config file or unit cannot be loaded from the nested classpath as well. here is an example:
<mappingtool schemaAction="build" sqlFile="create.sql">  
      	<classpath>
      		<pathelement location="mapping-tool-pi.jar" /> 
      		<pathelement location="mapping-tool-persistenceunit-pi.jar" /> 
      		<pathelement location="./" />
      	</classpath>
        <config propertiesFile=""persistence.xml#mappingtool-pu" connectionDriverName="com.ibm.db2.jcc.DB2Driver"/>
</mappingtool> 

user will get the following exception
Caused by: java.util.MissingResourceException: persistence.xml#mappingtool-pu
	at org.apache.openjpa.lib.conf.ProductDerivations.load(ProductDerivations.java:286)
	at org.apache.openjpa.lib.conf.ConfigurationImpl.setProperties(ConfigurationImpl.java:858)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
	at java.lang.reflect.Method.invoke(Method.java:611)
	at org.apache.tools.ant.IntrospectionHelper$AttributeSetter.setObject(IntrospectionHelper.java:1498)
	at org.apache.tools.ant.IntrospectionHelper.setAttribute(IntrospectionHelper.java:405)

The reason it failed to load the config is:
1. It doesn't have the properties value parsing to separate the file name and persistent unit name
2. ConfigurationImpl.setProperties() didn't take the ant class loader when it try to load the config file, or it loaded the config file too early. Ideally it should wait until all the classpath setting loaded. 
This problem will happen for all types of OPENJPA ant task.

I have created a fix for this problem. please refer to the patch file for details.

                
> Nested classpath ignored in mapping tool ant task
> -------------------------------------------------
>
>                 Key: OPENJPA-2244
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2244
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.0.1, 2.1.1, 2.2.0
>            Reporter: Helen Xu
>            Assignee: Helen Xu
>         Attachments: OPENJPA-2244.patch
>
>
> The nested classpath element inside the mappingtool ant task are ignored when loading the persistent configuration file. User got the following error:
> <openjpa-2.0.2-SNAPSHOT-r422266:1361284M fatal user error> org.apache.openjpa.util.MetaDataException: MetaDataFactory could not be configured (conf.newMetaDataFactoryInstance() returned null). This might mean that no configuration properties were found. Ensure that you have a META-INF/persistence.xml file, that it is available in your classpath, or that the properties file you are using for configuration is available. If you are using Ant, please see the <properties> or <propertiesFile> attributes of the task's nested <config> element. This can also occur if your OpenJPA distribution jars are corrupt, or if your security policy is overly strict.

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

[jira] [Updated] (OPENJPA-2244) Nested classpath ignored in mapping tool ant task

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

Helen Xu updated OPENJPA-2244:
------------------------------

    Attachment: OPENJPA-2244.patch

The fix is to add the ant classloader before loading the configuration file.

patch attached.
                
> Nested classpath ignored in mapping tool ant task
> -------------------------------------------------
>
>                 Key: OPENJPA-2244
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2244
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.0.1, 2.1.1, 2.2.0
>            Reporter: Helen Xu
>            Assignee: Helen Xu
>         Attachments: OPENJPA-2244.patch
>
>
> The nested classpath element inside the mappingtool ant task are ignored when loading the persistent configuration file. User got the following error:
> <openjpa-2.0.2-SNAPSHOT-r422266:1361284M fatal user error> org.apache.openjpa.util.MetaDataException: MetaDataFactory could not be configured (conf.newMetaDataFactoryInstance() returned null). This might mean that no configuration properties were found. Ensure that you have a META-INF/persistence.xml file, that it is available in your classpath, or that the properties file you are using for configuration is available. If you are using Ant, please see the <properties> or <propertiesFile> attributes of the task's nested <config> element. This can also occur if your OpenJPA distribution jars are corrupt, or if your security policy is overly strict.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (OPENJPA-2244) Nested classpath ignored in mapping tool ant task

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

Helen Xu updated OPENJPA-2244:
------------------------------

    Attachment: OPENJPA-2244.patch

new patch attached to load context classloader only when it is needed.
                
> Nested classpath ignored in mapping tool ant task
> -------------------------------------------------
>
>                 Key: OPENJPA-2244
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2244
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.0.1, 2.1.1, 2.2.0
>            Reporter: Helen Xu
>            Assignee: Helen Xu
>         Attachments: OPENJPA-2244.patch
>
>
> The nested classpath element inside the mappingtool ant task are ignored when loading the persistent configuration file. User got the following error:
> <openjpa-2.0.2-SNAPSHOT-r422266:1361284M fatal user error> org.apache.openjpa.util.MetaDataException: MetaDataFactory could not be configured (conf.newMetaDataFactoryInstance() returned null). This might mean that no configuration properties were found. Ensure that you have a META-INF/persistence.xml file, that it is available in your classpath, or that the properties file you are using for configuration is available. If you are using Ant, please see the <properties> or <propertiesFile> attributes of the task's nested <config> element. This can also occur if your OpenJPA distribution jars are corrupt, or if your security policy is overly strict.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira