Kevin-

It could, but it would just be a spec compliance. OpenJPA does allow you to have final classes. The spec just prohibits it because one of the ways to implement support for property access is to dynamically generate a subclass to the entity (which isn't possible if the entity is final).



On Feb 12, 2007, at 4:33 AM, Kevin Sutter wrote:

Marc (and others),
Shouldn't OpenJPA be detecting these final classes and issuing an error
message?

Kevin

On 2/12/07, Marc Prud'hommeaux <[EMAIL PROTECTED]> wrote:

Craig-

You're right that the classes shouldn't be final, but I don't think
that's the cause of the problem.

I've committed a fix to the final class issue, though. Thanks for
pointing it out.



On Feb 10, 2007, at 10:07 PM, Craig L Russell wrote:

> Hi Kevin,
>
> I don't know if it's relevant, but persistent classes must not be
> final. It seems that the entities in the model.company packages are
> (all) final, which is wrong. From spec 2.1, "The entity class must
> not be final. No methods or persistent instance variables of the
> entity class may be final. "
>
> The relevant part of the stack trace appears to be:
>> Caused by: java.lang.NoSuchMethodException: <unbound>=Class.create
>> (Class);
>>        at java.beans.Statement.invoke(Statement.java:269)
>>        at <unknown class>.<unknown method>(Unknown Source)
>>        at com.sun.beans.ObjectHandler.eval(ObjectHandler.java:148)
>>        at com.sun.beans.ObjectHandler.startElement
>> (ObjectHandler.java:250)
>>        at org.apache.xerces.parsers.AbstractSAXParser.startElement
>> (Unknown
>> Source)
>>        at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement
>> (Unknown
>
> which sounds like an issue with the xerces parser. Don't you hate
> exceptions from parsers rather than error messages?
>
> Craig
>
> On Feb 10, 2007, at 8:08 PM, Kevin Sutter wrote:
>
>> Marc,
>> It took a while to reproduce, but I finally got the following...
>> Does this
>> help?  Thanks for your help!
>>
>> Kevin
>>
>> Running
>> org.apache.openjpa.persistence.models.company.propertyaccess.TestProp
>> ertyCompanyModel
>> 0  test  INFO   [main] openjpa.Runtime - Starting OpenJPA 0.0.0
>> 0  test  INFO   [main] openjpa.jdbc.JDBC - OpenJPA will now
>> connect to the
>> database to attempt to determine what type of database dictionary
>> to use.
>> To prevent this connection in the future, set your
>> openjpa.jdbc.DBDictionaryconfiguration property to the appropriate
>> value for your database (see the
>> documentation foravailable values).
>> 0 test INFO [main] openjpa.jdbc.JDBC - Using dictionary class " >> org.apache.openjpa.jdbc.sql.DerbyDictionary" (Apache Derby 10.2.2.0 -
>> (485682) ,Apache Derby
>> Embedded JDBC Driver 10.2.2.0 - (485682)).
>> 10  test  INFO   [main] openjpa.MetaData - Found 10 classes with
>> metadata in
>> 0 milliseconds.
>> 20  test  INFO   [main] openjpa.MetaData - Found 10 classes with
>> metadata in
>> 10 milliseconds.
>> 20  test  INFO   [main] openjpa.MetaData - Parsing class "
>> org.apache.openjpa.persistence.models.company.propertyaccess.Product"
>> .
>> 20  test  INFO   [main] openjpa.MetaData - Parsing package "
>> org.apache.openjpa.persistence.models.company.propertyaccess.Product"
>> .
>> 30  test  INFO   [main] openjpa.MetaData - Parsing class "
>> org.apache.openjpa.persistence.models.company.propertyaccess.Company"
>> .
>> 30  test  INFO   [main] openjpa.MetaData - Parsing class "
>> org.apache.openjpa.persistence.models.company.propertyaccess.Address"
>> .
>> 40  test  INFO   [main] openjpa.MetaData - Parsing class "
>> org.apache.openjpa.persistence.models.company.propertyaccess.Employee
>> ".
>> 40  test  INFO   [main] openjpa.MetaData - Parsing class "
>> org.apache.openjpa.persistence.models.company.propertyaccess.Person".
>> 50  test  INFO   [main] openjpa.MetaData - Parsing class "
>> org.apache.openjpa.persistence.models.company.propertyaccess.FullTime
>> Employee
>> ".
>> 50  test  INFO   [main] openjpa.MetaData - Parsing class "
>> org.apache.openjpa.persistence.models.company.propertyaccess.LineItem
>> ".
>> 60  test  INFO   [main] openjpa.MetaData - Parsing class "
>> org.apache.openjpa.persistence.models.company.propertyaccess.ProductO
>> rder".
>> 60  test  INFO   [main] openjpa.MetaData - Parsing class "
>> org.apache.openjpa.persistence.models.company.propertyaccess.Customer
>> ".
>> 70  test  INFO   [main] openjpa.MetaData - Parsing class "
>> org.apache.openjpa.persistence.models.company.propertyaccess.PartTime
>> Employee
>> ".
>> 70  test  INFO   [main] openjpa.jdbc.Schema - Reading table
>> information for
>> schema name "null", table name "PRP_Address".
>> 80  test  INFO   [main] openjpa.jdbc.Schema - Reading table
>> information for
>> schema name "null", table name "PRP_Company".
>> 80  test  INFO   [main] openjpa.jdbc.Schema - Reading table
>> information for
>> schema name "null", table name "PRP_LineItem".
>> 80  test  INFO   [main] openjpa.jdbc.Schema - Reading table
>> information for
>> schema name "null", table name "PRP_Person".
>> 80  test  INFO   [main] openjpa.jdbc.Schema - Reading table
>> information for
>> schema name "null", table name "PRP_Product".
>> 110  test  INFO   [main] openjpa.jdbc.Schema - Reading table
>> information for
>> schema name "null", table name "PRP_ProductOrder".
>> 120  test  INFO   [main] openjpa.jdbc.Schema - Reading table
>> information for
>> schema name "null", table name "PRP_ProductOrder_PRP_LineItem".
>> 120  test  INFO   [main] openjpa.jdbc.Schema - Reading table
>> information for
>> schema name "null", table name "PRP_Product_PRP_Company".
>> 140  test  INFO   [main] openjpa.jdbc.Schema - Reading sequence
>> information
>> for schema "null", sequence name "null".
>> 3856  test  INFO   [main] openjpa.MetaData - Parsing class "
>> org.apache.openjpa.persistence.models.company.propertyaccess.Company"
>> .
>> 3856  test  INFO   [main] openjpa.MetaData - Parsing package "
>> org.apache.openjpa.persistence.models.company.propertyaccess.Company"
>> .
>> 3866  test  INFO   [main] openjpa.MetaData - Parsing class "
>> org.apache.openjpa.persistence.models.company.propertyaccess.Address"
>> .
>> 3866  test  INFO   [main] openjpa.MetaData - Parsing class "
>> org.apache.openjpa.persistence.models.company.propertyaccess.Employee
>> ".
>> 3866  test  INFO   [main] openjpa.MetaData - Parsing class "
>> org.apache.openjpa.persistence.models.company.propertyaccess.Person".
>> 3876  test  INFO   [main] openjpa.MetaData - Parsing class "
>> org.apache.openjpa.persistence.models.company.propertyaccess.Product"
>> .
>> 3876  test  INFO   [main] openjpa.MetaData - Parsing class "
>> org.apache.openjpa.persistence.models.company.propertyaccess.FullTime
>> Employee
>> ".
>> 3936  test  INFO   [main] openjpa.MetaData - Parsing class "
>> org.apache.openjpa.persistence.models.company.propertyaccess.ProductO
>> rder".
>> 3966  test  INFO   [main] openjpa.MetaData - Parsing class "
>> org.apache.openjpa.persistence.models.company.propertyaccess.Customer
>> ".
>> 3976  test  INFO   [main] openjpa.MetaData - Parsing class "
>> org.apache.openjpa.persistence.models.company.propertyaccess.LineItem
>> ".
>> 4026  test  INFO   [main] openjpa.MetaData - Parsing class "
>> org.apache.openjpa.persistence.models.company.propertyaccess.PartTime
>> Employee
>> ".
>> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed:
>> 4.336 sec
>> <<< FAILURE!
>> testBasicQueries(
>> org.apache.openjpa.persistence.models.company.propertyaccess.TestProp
>> ertyCompanyModel)
>> Time elapsed: 4.326 sec  <<< ERROR!
>> java.lang.IllegalStateException: java.lang.NoSuchMethodException:
>> <unbound>=
>> Class.create(Class);
>>        at
>> org.apache.openjpa.persistence.models.company.CompanyModelTest.checkM
>> odel(
>> CompanyModelTest.java:194)
>>        at
>> org.apache.openjpa.persistence.models.company.CompanyModelTest.setUp(
>> CompanyModelTest.java:66)
>>        at junit.framework.TestCase.runBare(TestCase.java:125)
>> at junit.framework.TestResult$1.protect(TestResult.java: 106)
>>        at junit.framework.TestResult.runProtected(TestResult.java:
>> 124)
>>        at junit.framework.TestResult.run(TestResult.java:109)
>>        at junit.framework.TestCase.run(TestCase.java:118)
>>        at junit.framework.TestSuite.runTest(TestSuite.java:208)
>>        at junit.framework.TestSuite.run(TestSuite.java:203)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke(
>> NativeMethodAccessorImpl.java:64)
>>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(
>> DelegatingMethodAccessorImpl.java:43)
>>        at java.lang.reflect.Method.invoke(Method.java:615)
>>        at org.apache.maven.surefire.junit.JUnitTestSet.execute(
>> JUnitTestSet.java:210)
>>        at
>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTes
>> tSet(
>> AbstractDirectoryTestSuite.java:135)
>>        at
>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(
>> AbstractDirectoryTestSuite.java:122)
>> at org.apache.maven.surefire.Surefire.run(Surefire.java: 129) >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke(
>> NativeMethodAccessorImpl.java:64)
>>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(
>> DelegatingMethodAccessorImpl.java:43)
>>        at java.lang.reflect.Method.invoke(Method.java:615)
>>        at
>> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(
>> SurefireBooter.java:225)
>>        at org.apache.maven.surefire.booter.SurefireBooter.main(
>> SurefireBooter.java:747)
>> Caused by: java.lang.NoSuchMethodException: <unbound>=Class.create
>> (Class);
>>        at java.beans.Statement.invoke(Statement.java:269)
>>        at <unknown class>.<unknown method>(Unknown Source)
>>        at com.sun.beans.ObjectHandler.eval(ObjectHandler.java:148)
>>        at com.sun.beans.ObjectHandler.startElement
>> (ObjectHandler.java:250)
>>        at org.apache.xerces.parsers.AbstractSAXParser.startElement
>> (Unknown
>> Source)
>>        at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement
>> (Unknown
>> Source)
>>        at
>> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElemen
>> t(Unknown
>> Source)
>>        at
>> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl
>> $FragmentContentDispatcher.dispatch(Unknown
>> Source)
>>        at
>> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument
>> (Unknown
>> Source)
>>        at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown
>> Source)
>>        at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown
>> Source)
>> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
>>        at org.apache.xerces.parsers.AbstractSAXParser.parse
>> (Unknown Source)
>> at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
>>        at javax.xml.parsers.SAXParser.parse(Unknown Source)
>>        at java.beans.XMLDecoder.readObject(XMLDecoder.java:220)
>>        at
>> org.apache.openjpa.persistence.models.company.CompanyModelTest.checkM
>> odel(
>> CompanyModelTest.java:191)
>>        ... 22 more
>>
>>
>> On 2/10/07, Marc Prud'hommeaux <[EMAIL PROTECTED]> wrote:
>>>
>>> Kevin-
>>>
>>> Weird. From the error message, it looks like there is some problem
>>> with deserializing the default model from the companies.xml file
>>> from
>>> the XMLDecoder.
>>>
>>> I've put some extra debugging logic in the CompanyModelTest.java
>>> that
>>> should throw a better error when the deserialization fails. Can you
>>> update and re-run the test and let us know if the stack trace
>>> changes?
>>>
>>>
>>>
>>> On Feb 10, 2007, at 6:21 PM, Kevin Sutter wrote:
>>>
>>> > Hi,
>>> > After synching up with the latest changes in SVN, I am hitting an
>>> > intermittent problem while running the new tests in
>>> > openjpa-persistence-jdbc.  Every once in a while, I am getting
>>> > hundreds of
>>> > messsages like the following:
>>> >
>>> > Running
>>> >
>>> org.apache.openjpa.persistence.models.company.propertyaccess.TestPro
>>> pe
>>> > rtyCompanyModel
>>> > 0  test  INFO   [main] openjpa.Runtime - Starting OpenJPA 0.0.0
>>> > 0  test  INFO   [main] openjpa.jdbc.JDBC - OpenJPA will now
>>> connect
>>> > to the
>>> > database to attempt to determine what type of database dictionary
>>> > to use.
>>> > To prevent this connection in the future, set your
>>> > openjpa.jdbc.DBDictionaryconfiguration property to the appropriate
>>> > value for your database (see the
>>> > documentation foravailable values).
>>> > 10  test  INFO   [main] openjpa.jdbc.JDBC - Using dictionary
>>> class "
>>> > org.apache.openjpa.jdbc.sql.DerbyDictionary" (Apache Derby
>>> 10.2.2.0 -
>>> > (485682) ,Apache Derby Embedded JDBC Driver 10.2.2.0 - (485682)). >>> > 20 test INFO [main] openjpa.MetaData - Found 10 classes with
>>> > metadata in
>>> > 0 milliseconds.
>>> > :
>>> > :
>>> > 4046  test  INFO   [main] openjpa.MetaData - Parsing class "
>>> >
>>> org.apache.openjpa.persistence.models.company.propertyaccess.LineIte
>>> m"
>>> > .
>>> > java.lang.NoSuchMethodException: <unbound>=Class.create(Class);
>>> > Continuing ...
>>> > java.lang.NullPointerException: target should not be null
>>> > Continuing ...
>>> > java.lang.NoSuchMethodException: <unbound>=Class.create(Class);
>>> > Continuing ...
>>> > java.lang.NullPointerException: target should not be null
>>> > Continuing ...
>>> > java.lang.NoSuchMethodException: <unbound>=Class.create(Class);
>>> > Continuing ...
>>> > java.lang.NullPointerException: target should not be null
>>> > Continuing ...
>>> > java.lang.NoSuchMethodException: <unbound>=Class.create(Class);
>>> > Continuing ...
>>> > java.lang.NullPointerException: target should not be null
>>> > Continuing ...
>>> > java.lang.NoSuchMethodException: <unbound>=Class.create(Class);
>>> > Continuing ...
>>> > :
>>> > :   <these type of messages continue -- several dozen repeats>
>>> > :
>>> > Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed:
>>> > 4.346 sec
>>> > <<< FAILURE!
>>> > testBasicQueries(
>>> >
>>> org.apache.openjpa.persistence.models.company.propertyaccess.TestPro
>>> pe
>>> > rtyCompanyModel)
>>> > Time elapsed: 4.336 sec  <<< FAILURE!
>>> > junit.framework.AssertionFailedError: expected:<2> but was:<0>
>>> >        at junit.framework.Assert.fail(Assert.java:47)
>>> >        at junit.framework.Assert.failNotEquals(Assert.java:282)
>>> >        at junit.framework.Assert.assertEquals(Assert.java:64)
>>> >        at junit.framework.Assert.assertEquals(Assert.java:201)
>>> >        at junit.framework.Assert.assertEquals(Assert.java:207)
>>> >        at
>>> >
>>> org.apache.openjpa.persistence.models.company.CompanyModelTest.verif
>>> yM
>>> > odel(
>>> > CompanyModelTest.java:211)
>>> >        at
>>> >
>>> org.apache.openjpa.persistence.models.company.CompanyModelTest.check
>>> Mo
>>> > del(
>>> > CompanyModelTest.java:195)
>>> >        at
>>> >
>>> org.apache.openjpa.persistence.models.company.CompanyModelTest.setUp
>>> (
>>> > CompanyModelTest.java:66)
>>> >        at junit.framework.TestCase.runBare(TestCase.java:125)
>>> >        at junit.framework.TestResult$1.protect(TestResult.java:
>>> 106)
>>> >        at junit.framework.TestResult.runProtected
>>> (TestResult.java:124)
>>> >        at junit.framework.TestResult.run(TestResult.java:109)
>>> >        at junit.framework.TestCase.run(TestCase.java:118)
>>> >        at junit.framework.TestSuite.runTest(TestSuite.java:208)
>>> >        at junit.framework.TestSuite.run(TestSuite.java:203)
>>> >        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>>> Method)
>>> >        at sun.reflect.NativeMethodAccessorImpl.invoke(
>>> > NativeMethodAccessorImpl.java:64)
>>> >        at sun.reflect.DelegatingMethodAccessorImpl.invoke(
>>> > DelegatingMethodAccessorImpl.java:43)
>>> >        at java.lang.reflect.Method.invoke(Method.java:615)
>>> >        at org.apache.maven.surefire.junit.JUnitTestSet.execute(
>>> > JUnitTestSet.java:210)
>>> >        at
>>> >
>>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTe
>>> st
>>> > Set(
>>> > AbstractDirectoryTestSuite.java:135)
>>> >        at
>>> >
>>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(
>>> > AbstractDirectoryTestSuite.java:122)
>>> >        at org.apache.maven.surefire.Surefire.run(Surefire.java:
>>> 129)
>>> >        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>>> Method)
>>> >        at sun.reflect.NativeMethodAccessorImpl.invoke(
>>> > NativeMethodAccessorImpl.java:64)
>>> >        at sun.reflect.DelegatingMethodAccessorImpl.invoke(
>>> > DelegatingMethodAccessorImpl.java:43)
>>> >        at java.lang.reflect.Method.invoke(Method.java:615)
>>> >        at
>>> >
>>> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(
>>> > SurefireBooter.java:225)
>>> >        at org.apache.maven.surefire.booter.SurefireBooter.main(
>>> > SurefireBooter.java:747)
>>> >
>>> > They seem to most often happen when I do a complete top-down build
>>> > from the
>>> > openjpa directory (mvn clean && mvn install) and let it
>>> traverse the
>>> > sub-projects.  This is from the command line (not Eclipse).
>>> >
>>> > I can immediately turn around and do a "mvn test" from the openjpa
>>> > directory
>>> > and everything tests out just fine.
>>> >
>>> > Any ideas on what is causing these type of errors?  I don't see
>>> > anywhere in
>>> > our code where we are producing these type of messages. I'm not
>>> > sure if
>>> > it's related to one of our dependencies (serp?), or maybe it's
>>> > another IBM
>>> > JDK anomaly (haven't been able to reproduce with Sun yet, but
>>> it is an
>>> > intermittent problem).
>>> >
>>> > Thanks,
>>> > Kevin
>>>
>>>
>
> Craig Russell
> Architect, Sun Java Enterprise System http://java.sun.com/ products/jdo
> 408 276-5638 mailto:[EMAIL PROTECTED]
> P.S. A good JDO? O, Gasp!
>



Reply via email to