You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Vitor Rodrigues (JIRA)" <ji...@apache.org> on 2007/11/01 18:40:50 UTC

[jira] Created: (OPENJPA-428) Confusing error message regarding "openjpa.Id"

Confusing error message regarding "openjpa.Id"
----------------------------------------------

                 Key: OPENJPA-428
                 URL: https://issues.apache.org/jira/browse/OPENJPA-428
             Project: OpenJPA
          Issue Type: Bug
    Affects Versions: 1.0.0
            Reporter: Vitor Rodrigues
            Priority: Minor


Hi all, this bug is to report a confusing and misplaced error message. Problem is described below. Feel free to request more info from me.

When running my project with OpenJPA, I get the following error message:

140  INFO   [http-0.0.0.0-8080-Processor23] openjpa.Runtime - Starting OpenJPA 1.0.0
380  INFO   [http-0.0.0.0-8080-Processor23] openjpa.jdbc.JDBC - Using dictionary class "org.apache.openjpa.jdbc.sql.DB2Dictionary".
20  WARN   [http-0.0.0.0-8080-Processor25] openjpa.Runtime - The property named "openjpa.Id" was not recognized and will be ignored, although the name closely matches a valid property called "openjpa.Id".
100  INFO   [http-0.0.0.0-8080-Processor25] openjpa.Runtime - Starting OpenJPA 1.0.0
300  INFO   [http-0.0.0.0-8080-Processor25] openjpa.jdbc.JDBC - Using dictionary class "org.apache.openjpa.jdbc.sql.DB2Dictionary".

As you can see, the two property names printed are the same, not different or similar. I retyped all my @Id annotations to make sure there was no special character in one of them coming from copy&paste.
Furthermore, I was able to identify that the error message was being printed only when I removed the @Id annotation from one of my classes (all the other classes still have @Id).

Here is a sample of my class without @Id annotation:
@Entity
@Table(name="TAX", schema="JPA_SC")
public class Tax  {
	
	// Class variables  
	protected double taxamount;
 
	public Tax(){
		
	}
	
	public Tax(double taxamount){
		this.taxamount = taxamount;
	}
//plus getter and setter for taxamount

}

Regards,
Vitor Rodrigues

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


[jira] Commented: (OPENJPA-428) Bad error message regarding "openjpa.Id"

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

Fay Wang commented on OPENJPA-428:
----------------------------------

There is another scenario to get the message of 'The property named "openjpa.Id" was not recognized and will be ignored, although the name closely matches a valid property called "openjpa.Id". ':

C:\was70\bin>set classpath=D:\db2jcc.jar;D:\db2jcc_license_cu.jar;D:\pdq.jar;D:\pdqmgmt.jar;D:\META-INF

C:\was70\bin>wsdb2gen -pu CustomerEJB3 -url jdbc:db2://localhost:50000/DEMODB -user user1 -pw password1
Start WsJpaDB2Gen for CustomerEJB3...
94  WARN   [main] openjpa.Runtime - The configuration property named "openjpa.Id" was not recognized and will be ignored, although the name closely matches a valid property called "openjpa.Id".
url from user is jdbc:db2://localhost:50000/DEMODB
URL from user is jdbc:db2://localhost:50000/DEMODB
ConnectionProperties: DriverType=4, DatabaseName=DEMODB, PortNumber=50000, ServerName=localhost
1203  INFO   [main] openjpa.jdbc.JDBC - Using dictionary class "com.ibm.ws.persistence.jdbc.sql.DB2Dictionary".
1719  INFO   [main] openjpa.Runtime - Starting OpenJPA 2.0.0-M3
2047  INFO   [main] openjpa.jdbc.JDBC - Using dictionary class "com.ibm.ws.persistence.pdqstatic.jdbc.sql.StaticDB2Dictionary".
Done!

Note that the persistence.xml is in D:\META-INF. However, the classpath is set to D:\META-INF. If the classpath is changed to D:\ , the project works fine. No more the message about openjpa.Id. 




> Bad error message regarding "openjpa.Id"
> ----------------------------------------
>
>                 Key: OPENJPA-428
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-428
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.0.0
>            Reporter: Vitor Rodrigues
>            Priority: Minor
>         Attachments: OPENJPA-428-test.jar
>
>
> Hi all, this bug is to report a confusing and misplaced error message. Problem is described below. Feel free to request more info from me.
> When running my project with OpenJPA, I get the following error message:
> 140  INFO   [http-0.0.0.0-8080-Processor23] openjpa.Runtime - Starting OpenJPA 1.0.0
> 380  INFO   [http-0.0.0.0-8080-Processor23] openjpa.jdbc.JDBC - Using dictionary class "org.apache.openjpa.jdbc.sql.DB2Dictionary".
> 20  WARN   [http-0.0.0.0-8080-Processor25] openjpa.Runtime - The property named "openjpa.Id" was not recognized and will be ignored, although the name closely matches a valid property called "openjpa.Id".
> 100  INFO   [http-0.0.0.0-8080-Processor25] openjpa.Runtime - Starting OpenJPA 1.0.0
> 300  INFO   [http-0.0.0.0-8080-Processor25] openjpa.jdbc.JDBC - Using dictionary class "org.apache.openjpa.jdbc.sql.DB2Dictionary".
> As you can see, the two property names printed are the same, not different or similar. I retyped all my @Id annotations to make sure there was no special character in one of them coming from copy&paste.
> Furthermore, I was able to identify that the error message was being printed only when I removed the @Id annotation from one of my classes (all the other classes still have @Id).
> Here is a sample of my class without @Id annotation:
> @Entity
> @Table(name="TAX", schema="JPA_SC")
> public class Tax  {
> 	
> 	// Class variables  
> 	protected double taxamount;
>  
> 	public Tax(){
> 		
> 	}
> 	
> 	public Tax(double taxamount){
> 		this.taxamount = taxamount;
> 	}
> //plus getter and setter for taxamount
> }
> Regards,
> Vitor Rodrigues

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


[jira] Updated: (OPENJPA-428) Confusing error message regarding "openjpa.Id"

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

Patrick Linskey updated OPENJPA-428:
------------------------------------

    Attachment: OPENJPA-428-test.jar

Attached is a test case (source and compiled classes) that attempts to emulate this issue, but when run against OpenJPA 1.0.0, I don't see the error message.

Issue428Entity.class is enhanced in the attached jar; I also ran the test without the enhancer. I saw no errors in either environment.

> Confusing error message regarding "openjpa.Id"
> ----------------------------------------------
>
>                 Key: OPENJPA-428
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-428
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.0.0
>            Reporter: Vitor Rodrigues
>            Priority: Minor
>         Attachments: OPENJPA-428-test.jar
>
>
> Hi all, this bug is to report a confusing and misplaced error message. Problem is described below. Feel free to request more info from me.
> When running my project with OpenJPA, I get the following error message:
> 140  INFO   [http-0.0.0.0-8080-Processor23] openjpa.Runtime - Starting OpenJPA 1.0.0
> 380  INFO   [http-0.0.0.0-8080-Processor23] openjpa.jdbc.JDBC - Using dictionary class "org.apache.openjpa.jdbc.sql.DB2Dictionary".
> 20  WARN   [http-0.0.0.0-8080-Processor25] openjpa.Runtime - The property named "openjpa.Id" was not recognized and will be ignored, although the name closely matches a valid property called "openjpa.Id".
> 100  INFO   [http-0.0.0.0-8080-Processor25] openjpa.Runtime - Starting OpenJPA 1.0.0
> 300  INFO   [http-0.0.0.0-8080-Processor25] openjpa.jdbc.JDBC - Using dictionary class "org.apache.openjpa.jdbc.sql.DB2Dictionary".
> As you can see, the two property names printed are the same, not different or similar. I retyped all my @Id annotations to make sure there was no special character in one of them coming from copy&paste.
> Furthermore, I was able to identify that the error message was being printed only when I removed the @Id annotation from one of my classes (all the other classes still have @Id).
> Here is a sample of my class without @Id annotation:
> @Entity
> @Table(name="TAX", schema="JPA_SC")
> public class Tax  {
> 	
> 	// Class variables  
> 	protected double taxamount;
>  
> 	public Tax(){
> 		
> 	}
> 	
> 	public Tax(double taxamount){
> 		this.taxamount = taxamount;
> 	}
> //plus getter and setter for taxamount
> }
> Regards,
> Vitor Rodrigues

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


[jira] Commented: (OPENJPA-428) Bad error message regarding "openjpa.Id"

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

Kevin Sutter commented on OPENJPA-428:
--------------------------------------

>From Harold on our Users forum (http://openjpa.208410.n2.nabble.com/Confusing-warning-about-openjpa-jdbc-SynchronizeMappings-tc5495438.html#a5495438)...

Hi Kevin,

I can't offer a fix (yet), but I think I've pinpointed the problem. Here is
a little test case:

import static org.junit.Assert.assertEquals;
import org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl;
import org.junit.Test;

public class ConfigurationTest {

   @Test
   public void cloneTest() {
       JDBCConfigurationImpl config = new JDBCConfigurationImpl();
       JDBCConfigurationImpl newConfig = (JDBCConfigurationImpl)
config.clone();
       assertEquals(config, newConfig);
   }
}

The warning message about the configuration property
openjpa.jdbc.SynchronizeMappings is logged during config.clone().

clone() is implemented by invoking first toProperties(true) and then
fromProperties() on the resulting properties map.

fromProperties() removes all known properties from the map and then issues
warnings for all remaining ones - at least that seems to be the intention.

The problem is that SynchronizeMappings has no default value, or rather a
default value of null. Thus, the map generated by toProperties(true)
contains the key openjpa.jdbc.SynchronizeMappings with a value of null.

fromProperties() in fact only removes the known properties with a non-null
value,  so the key openjpa.jdbc.SynchronizeMappings remains in the map and
causes the warning.

The warning would not appear if clone() invoked toProperties(false), but I'm
not sure if this has any side effects.

Moreover, in my test case, the assertion

  assertEquals(config, newConfig);

fails - now the Javadoc of Object.clone() states that x.clone().equals(x) is
not an absolute requirement (without giving any good reasons), but in this
case I would definitely expect the clone of a configuration to be equal to
the original.

The assertion failure is caused by LockTimeout:0[int] != LockTimeout:0[int],
so it appears that for x of class IntValue the invariant

x.clone().equals(x)

does not hold either (why?).

Incidentally, the comment of ConfigurationImpl.toProperties() is outdated.
It references a non-existing parameter getAll and a non-existing method
getAllProperties().

Hopefully, this is enough input for someone familiar with the implementation
details to come up with a fix...

Best regards,

Harald

> Bad error message regarding "openjpa.Id"
> ----------------------------------------
>
>                 Key: OPENJPA-428
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-428
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.0.0
>            Reporter: Vitor Rodrigues
>            Priority: Minor
>         Attachments: OPENJPA-428-test.jar
>
>
> Hi all, this bug is to report a confusing and misplaced error message. Problem is described below. Feel free to request more info from me.
> When running my project with OpenJPA, I get the following error message:
> 140  INFO   [http-0.0.0.0-8080-Processor23] openjpa.Runtime - Starting OpenJPA 1.0.0
> 380  INFO   [http-0.0.0.0-8080-Processor23] openjpa.jdbc.JDBC - Using dictionary class "org.apache.openjpa.jdbc.sql.DB2Dictionary".
> 20  WARN   [http-0.0.0.0-8080-Processor25] openjpa.Runtime - The property named "openjpa.Id" was not recognized and will be ignored, although the name closely matches a valid property called "openjpa.Id".
> 100  INFO   [http-0.0.0.0-8080-Processor25] openjpa.Runtime - Starting OpenJPA 1.0.0
> 300  INFO   [http-0.0.0.0-8080-Processor25] openjpa.jdbc.JDBC - Using dictionary class "org.apache.openjpa.jdbc.sql.DB2Dictionary".
> As you can see, the two property names printed are the same, not different or similar. I retyped all my @Id annotations to make sure there was no special character in one of them coming from copy&paste.
> Furthermore, I was able to identify that the error message was being printed only when I removed the @Id annotation from one of my classes (all the other classes still have @Id).
> Here is a sample of my class without @Id annotation:
> @Entity
> @Table(name="TAX", schema="JPA_SC")
> public class Tax  {
> 	
> 	// Class variables  
> 	protected double taxamount;
>  
> 	public Tax(){
> 		
> 	}
> 	
> 	public Tax(double taxamount){
> 		this.taxamount = taxamount;
> 	}
> //plus getter and setter for taxamount
> }
> Regards,
> Vitor Rodrigues

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


[jira] Updated: (OPENJPA-428) Bad error message regarding "openjpa.Id"

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

Craig Russell updated OPENJPA-428:
----------------------------------

    Summary: Bad error message regarding "openjpa.Id"  (was: Confusing error message regarding "openjpa.Id")

> Bad error message regarding "openjpa.Id"
> ----------------------------------------
>
>                 Key: OPENJPA-428
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-428
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.0.0
>            Reporter: Vitor Rodrigues
>            Priority: Minor
>         Attachments: OPENJPA-428-test.jar
>
>
> Hi all, this bug is to report a confusing and misplaced error message. Problem is described below. Feel free to request more info from me.
> When running my project with OpenJPA, I get the following error message:
> 140  INFO   [http-0.0.0.0-8080-Processor23] openjpa.Runtime - Starting OpenJPA 1.0.0
> 380  INFO   [http-0.0.0.0-8080-Processor23] openjpa.jdbc.JDBC - Using dictionary class "org.apache.openjpa.jdbc.sql.DB2Dictionary".
> 20  WARN   [http-0.0.0.0-8080-Processor25] openjpa.Runtime - The property named "openjpa.Id" was not recognized and will be ignored, although the name closely matches a valid property called "openjpa.Id".
> 100  INFO   [http-0.0.0.0-8080-Processor25] openjpa.Runtime - Starting OpenJPA 1.0.0
> 300  INFO   [http-0.0.0.0-8080-Processor25] openjpa.jdbc.JDBC - Using dictionary class "org.apache.openjpa.jdbc.sql.DB2Dictionary".
> As you can see, the two property names printed are the same, not different or similar. I retyped all my @Id annotations to make sure there was no special character in one of them coming from copy&paste.
> Furthermore, I was able to identify that the error message was being printed only when I removed the @Id annotation from one of my classes (all the other classes still have @Id).
> Here is a sample of my class without @Id annotation:
> @Entity
> @Table(name="TAX", schema="JPA_SC")
> public class Tax  {
> 	
> 	// Class variables  
> 	protected double taxamount;
>  
> 	public Tax(){
> 		
> 	}
> 	
> 	public Tax(double taxamount){
> 		this.taxamount = taxamount;
> 	}
> //plus getter and setter for taxamount
> }
> Regards,
> Vitor Rodrigues

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