Community
Participate
Working Groups
Build Identifier: I20100511-0800 I've run across an intermittent error in our automated test environment. Creating a project (our specific test projects have the WebLogic WebService facets installed) and adding the JPA facet in the wizard results in an intermittent error that causes an incomplete project to be created. The project is incomplete because only 1 of the 7 expected fixed facets is present on the project (the wst.jsdt.web facet). All of the expected installed facets are present. I've manually reproduced the issue a couple times, but not consistently enough to create reproducible steps. Reproducible: Sometimes Steps to Reproduce: 1. Create faceted project 2. Install JPA 2.0 facet 3. Intermittent error
Created attachment 169416 [details] Stacktrace
Created attachment 169417 [details] Zip of created project when error occurs
This may end up in WTP Java EE Tools or WTP Source Editing, but I am sending it to Dali for initial triage (and possible duplication if this is already a known issue).
Nadeem, can you clarify this statement: "The project is incomplete because only 1 of the 7 expected fixed facets is present on the project (the wst.jsdt.web facet). All of the expected installed facets are present."
Neil, sorry for being unclear. Our automated test does a check of the .settings/org.eclipse.wst.common.project.facet.core.xml file to determine the facet configuration on the project. It checks the XML for <fixed/> and <installed/> elements. For our project type, we expect there to be 7 specific fixed facets and 8 specific installed facets after the new project wizard completes. When we get this intermittent error, the .settings/org.eclipse.wst.common.project.facet.core.xml only contains the wst.jsdt.web facet of the expected 7 fixed facets and contains all expected 8 installed facets.
Thanks for that clarification Nadeem. From what I can tell, the likely situation here is that your code is trying to update the persistence.xml before the file is available. Dali is listening for the facet POST_INSTALL event related to the JPA facet being added and then building a JPA project, followed by the creation of the persistence.xml. My suspicion is that in the cases where this fails, you are getting jpt resource model for a file that does not yet exist (because we haven't gotten around to creating it yet), and when attempting to update it, the resource model ends up working with a proxy object instead of a real StructuredDocumentRegion that represents actual content. As a result the "not implemented" error is thrown.
So is this a case of our code doing something at the wrong time? I.e., instead of listening for the JPA facet to be installed and updating the persistence.xml, it should be listening to some other event? If so, what event should it be listening to?
(In reply to comment #7) > So is this a case of our code doing something at the wrong time? I.e., instead > of listening for the JPA facet to be installed and updating the > persistence.xml, it should be listening to some other event? If so, what event > should it be listening to? Sorry for not answering this in my previous post, but in short, yes, your code is trying to do its work at the wrong time. Listening for the facet changes won't indicate when the JPA project or XML artifacts have been built. You need to listen to the Dali model instead. You can listen for model events concerning JPA projects being built/added and for JPA files being added, in this case you would want to look for persistence.xml specifically. To listen for the newly created JPA project, add a CollectionChangeListener (with the appropriate collectionName)to the JpaProjectManager , which can be obtained from the JptCorePlugin. For files, you would want to add a CollectionChangeListener to the given JpaProject that you are interested in. Let me know if you need more info on this. Closing this bug for now.
Adding Danny. Neil, I am confused by this. Why is JPA facet relying on POST_INSTALL events for creating critical JPA artifacts? I would expect JPA configuration to be complete by the time POST_INSTALL event comes.
(In reply to comment #9) > > I am confused by this. Why is JPA facet relying on POST_INSTALL events for > creating critical JPA artifacts? I would expect JPA configuration to be > complete by the time POST_INSTALL event comes. I'm not completely sure, but trying to get to the bottom of that. It seems like the persistence.xml creation could and perhaps should be done in our install delegate, but there may have been some issue with this that doesn't come to mind at the moment. There are likely further changes that we could make in this area (some are already planned), but I'm reluctant to make those changes at this point in the release, especially since this behavior hasn't changed in quite some time. I'll do some more digging and try to identify the reasons why we have ended up here. It is possible that previous roadblocks to using the install delegate for persistence.xml creation no longer exist.
Update: A recent fix for Dali 2.3.1/WTP 3.2.1 (bug 303670) may have addressed some of the concerns noted in this bug. All XML artifacts are now created in the JPA facet install delegate.