Home » Eclipse Projects » EclipseLink » Attributes missing in metamodel using IBM JDK(Some attributes of registered entities are sometimes missing in the JPA metamodel when running with an IBM JDK)
Attributes missing in metamodel using IBM JDK [message #735296] |
Tue, 11 October 2011 13:22 |
Jan Vermeulen Messages: 11 Registered: September 2010 |
Junior Member |
|
|
I have detected a problem with the registration of @ManyToOne attributes in the JPA metamodel when using an IBM JDK. It has been detected (in production applications using EclipseLink JPA 2 with OSGI), that some @ManyToOne attributes sometimes are not represented in the JPA meta-model, although their mapping is perfectly valid, and they are always correctly represented when using a Sun JDK, and they mostly also are so with the IBM JDK.
I have not found any reliable pattern for the failure, except that the missing attributes always are @ManyToOne associations, and as far as I have seen, always are defined as LAZY. We normally use the dynamic weaving option of the OSGI implementation of EclipseLink, but I disabled that option in a test and the problem still persists, so it is not related with weaving.
Since the problem seems to occur on a random basis, I have created a simplified test that demonstrates the problem. It consists of an OSGI bundle with an Activator, a persistence.xml and a few simple entities. The code of the Activator for the bundle loops eternally, creating each time a new EntityManagerFactory to force (re)deploy,
and checks all registered entities for any missing attributes. Whenever a missing attribute is detected, the EclipseLink exception is logged and the loop is interrupted.
If running this code with a Sun JDK (5 or higher), the application never ends as deploy never fails. If running this code with an IBM JDK (5 or higher), the application ends after a random number of loops, as the deploy seems to fail and an attribute is detected to be missing in the JPA meta-model.
Due to this problem, we are unable to reliable run our JPA-based OSGI applications on a WebSphere 6.1. or 7 server.
Does anyone has had the same problem, or does anyone have a clue as to what is wrong ?
|
|
| | |
Re: Attributes missing in metamodel using IBM JDK [message #879987 is a reply to message #754057] |
Fri, 01 June 2012 08:46 |
Jan Vermeulen Messages: 11 Registered: September 2010 |
Junior Member |
|
|
We have been pursuing an answer to the above presented bug with IBM (since it appears to be their JVM that is failing...), and it has taken us several months and a lot of 'try to get it off of my back' reactions to finally get through to some IBM technician that has investigated the case. His conclusion seems to be that the problem occurs after the GC has removed some specific objects during creation of the EntityManagerFactory. Here is the last reply we got from the IBM Websphere Application Technical Support team:
Quote:
Here is a response from our Level 3 Java team...
-------
We do not have a developer with access to the EclipseLink source code, this is because it is an Oracle project.
The following summarizes my findings:
This issue can only be recreated when a Global GC occurs during the createEntityManagerFactory() method, AFTER the javac.persistence.spi.PersistenceUnitTransactionType.valueof() call has returned.
This GC removes two objects, both of type sun/nio/cs/MS1252$Decoder. I cannot understand why these objects affect the creation of the entity manager.
Unfortunately, we have no way to communicate with EclipseLink to discuss the issue with them, so we need the customer to enquire what occurs after the above javac.persistence.spi.PersistenceUnitTransactionType.valueof() call, during createEntityManager() that could cause this behaviour.
I cannot find any documentation that states that the EclipseLink JPA implementation is supported on Websphere. How firm is the roadmap to switch to the OpenJPA implementation? We have direct access to that source here and we do run testing on it within WebSphere I believe to ensure it is more supported.
-------
Please engage EclipseLink support to discuss the above scenario and provide us with their feedback.
Thank-you for utilizing IBM WebSphere Application Server Technical Support.
Regards
- Ayron Fears
IBM WebSphere Application Server Technical Support
They recognize there is a problem with the IBM JVM, and that it is due to the GC, but they still claim that they have no notion of what the EclipseLink code is doing (although all related EclipseLink source code is available). They even claim there is no guarantee from EclipseLink that their JTA implementation is supported on Websphere (we're not even requiring Websphere, it simply fails in a plain java executable on their JVM).
Does any of the information from IBM rings a bell ? Any remark on this ?
(As a reply to the remark by James Sutherland: we tried several versions of the IBM JDK, and it fails in all of them, even the latest Java6 compliant one. As to why we use the meta-model: we have a framework using the EL JPA implementation for persistence, and it allows us to navigate the datamodel for data-mining. Together with the Criteria API, it is for us the added value of JPA2)
[Updated on: Fri, 01 June 2012 08:50] Report message to a moderator
|
|
|
Re: Attributes missing in metamodel using IBM JDK [message #881923 is a reply to message #879987] |
Tue, 05 June 2012 14:00 |
|
I few things to try (and report the results)
- try the latest EclipseLink 2.4 build
- in your test add a createEntityManager() call before calling the meta-model
- set weaving to false in your persistence.xml
- try with static weaving
- try with dynamic weaving
- does everything else work? Can you query the object and access the missing attribute? Is it only missing from the meta-model, or is it missing in general?
James : Wiki : Book : Blog : Twitter
|
|
|
Re: Attributes missing in metamodel using IBM JDK [message #884978 is a reply to message #881923] |
Tue, 12 June 2012 07:59 |
Jan Vermeulen Messages: 11 Registered: September 2010 |
Junior Member |
|
|
I can assure that the missing attributes are really missing in the ClassDescriptors (not only in the JPA metamodel wrapper). In fact, in this test we consult the metamodel to 'detect' the error, but in real life the error randomly appears f.i. when persisting a new instance of an entity in the database, because a 'non-null' database field is not set (because the corresponding DatabaseMapping is missing). If there are no constraints on the field, the user might not even realize the mapping is missing until he come across missing data for some field that he was certain he had provided.
And in real life, we call createEntityManager() before calling the metamodel
I already experimented with/without weaving to exclude that element. In the last version of the test that I have posted, weaving has been disabled.
I will try your suggestion to run the test with the latest EclipseLink build.
[Updated on: Tue, 12 June 2012 08:15] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Sat May 11 09:58:45 GMT 2024
Powered by FUDForum. Page generated in 0.04292 seconds
|