Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
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 Go to next message
Jan Vermeulen is currently offline Jan VermeulenFriend
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 #754013 is a reply to message #735296] Mon, 31 October 2011 13:13 Go to previous messageGo to next message
Jan Vermeulen is currently offline Jan VermeulenFriend
Messages: 11
Registered: September 2010
Junior Member
Not much activity here...

We have reported the problem to IBM (as we assume the problem is with the IBM JVM, not with the EclipseLink JPA implementation), but they consider it to be a problem of the EclipseLink implementation.

To further exclude possible sources, I have attached a simplified version of the test code, that does not run in an OSGI platform: just a simple plain java executable. The attached zip contains the contents of a simple Eclipse Java project to run the test. It does not contain the dependent libs, as the zip would exceed the permitted size. It requires the following: eclipselink.jar (EclipseLink JPA implementation version 2.1.3), javax.persistence_2.0.1 (JPA 2 api) and derby.jar (Embedded database). Those are publicly available on internet.

If this simple test (randomly) fails on an IBM JVM, I don't see how anyone can reliably use EclipseLink JPA in a web-application running on WebSphere. And I suppose we're not the only ones using that combination...
Re: Attributes missing in metamodel using IBM JDK [message #754057 is a reply to message #754013] Mon, 31 October 2011 15:44 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Very odd, not sure what in the IBM JVM is causing the issue. You can log a bug on EclipseLink with the test and the exact IBM JVM version required.

The meta-model is not normally required, so depending on what you are doing, you may be able to avoid the issue. What are you using the meta-model for?


James : Wiki : Book : Blog : Twitter
Re: Attributes missing in metamodel using IBM JDK [message #879987 is a reply to message #754057] Fri, 01 June 2012 08:46 Go to previous messageGo to next message
Jan Vermeulen is currently offline Jan VermeulenFriend
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 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

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 Go to previous message
Jan Vermeulen is currently offline Jan VermeulenFriend
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

Previous Topic:Proxy could not create EMF from provider org.eclipse.persistence.jpa.osgi.PersistenceProvider
Next Topic:MOXy jaxb binding error for redefine element
Goto Forum:
  


Current Time: Thu Mar 28 11:53:59 GMT 2024

Powered by FUDForum. Page generated in 0.06247 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top