This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 86723 - Contents of sun-ejb-jar.xml deleted.
Summary: Contents of sun-ejb-jar.xml deleted.
Status: RESOLVED FIXED
Alias: None
Product: serverplugins
Classification: Unclassified
Component: Sun Appserver 9 (show other bugs)
Version: 5.x
Hardware: All All
: P1 blocker (vote)
Assignee: _ pcw
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-07 02:37 UTC by _ pcw
Modified: 2006-10-17 00:08 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Patch as described in above comments. (43.39 KB, text/plain)
2006-10-08 02:48 UTC, _ pcw
Details
Patch for this issue. (38.05 KB, text/plain)
2006-10-09 07:23 UTC, _ pcw
Details

Note You need to log in before you can comment on or make changes to this bug.
Description _ pcw 2006-10-07 02:37:08 UTC
Customer with enterprise pack reported seeing his modifications to
sun-ejb-jar.xml deleted.  He is not sure exactly what steps though it might be
related to version control.  He is using JavaEE5 and the contents of the file
included security-role-mapping and web-service security settings.  He says it
has happened more than once and has also happened to a coworker.

See http://www.netbeans.org/servlets/ReadMsg?list=nbentpack&msgNo=141 and
http://www.netbeans.org/servlets/ReadMsg?list=nbentpack&msgNo=148
Comment 1 _ pcw 2006-10-07 02:45:06 UTC
I think this is related to a autosave event somehow being triggered before
sun-ejb-jar.xml has been fully loaded and/or annotation events not being sent or
sent incorrectly.

Today I wrote a patch that generalizes the fix for issue 78686 & issue 84549 to
all named beans that we have DConfigBean children for.  This should prevent the
config editor from destroying data when an expected DConfigBean has not been
created for any reason.

I am still testing the fix and will check it into release55_dev as soon as I
can, probably sometime tomorrow.

I filed this as a P1 due to the seriousness of the issue and the fact that a
customer has actually reported what previously had been suggested was a
pathological edge condition.  If this fix can be approved for inclusion in
NetBeans 5.5 FCS it would be most helpful.

Also, I will see what I can do to describe a scenario that will deliberately
cause this behavior (so the effect of the patch can be tested).
Comment 2 _ pcw 2006-10-08 02:48:32 UTC
Created attachment 35025 [details]
Patch as described in above comments.
Comment 3 _ pcw 2006-10-08 02:51:34 UTC
I think the patch is complete but I'd still need to do some more code reviews --
that diff may contain some extra stuff like extraneous println's because the
internal cvs tunnel I normally use is down (nice timing, 24 hours and
counting...) and I switched just that one dir over to the czech tunnel to get
the diff.
Comment 4 _ pcw 2006-10-09 07:23:44 UTC
Created attachment 35029 [details]
Patch for this issue.
Comment 5 Petr Jiricka 2006-10-09 14:29:01 UTC
The change looks quite extensive, who would be the best to review it? Also, Can
you get confirmation from the reporter that the fix solves the issue? Thanks.
Comment 6 _ pcw 2006-10-09 22:50:18 UTC
Vince is reviewing the changes this afternoon.
Comment 7 _ pcw 2006-10-10 07:43:04 UTC
Here is one way to artificially produce dataloss with NetBeans 5.5 RC1 (which
would not have this patch of course):

This will work best if this is the only project loaded, as it is a bit time
sensitive.

Create a web project.  Add a web service.  Open the configuration editor for
sun-web.xml, locate the service and configure some security settings.  Select
"Edit As XML", save, and confirm that in sun-web.xml, a servlet entry with a
webservice endpoint containing the aforementioned security settings was
correctly saved.

Exit the IDE and now delete your MDR cache [userdir/var/cache] folder.

*** The following steps must be completed before the startup scan is finished
(and hopefully it will have to scan all the JDK so you have a bit of time) ***

1. Restart the IDE
2. Open sun-web.xml in the config editor again.
3. Modify some field, for example, set an error-url value on the main customizer.
4. Save sun-web.xml
5. Select "Edit as XML" and you should see that your servlet w/ web service
endpoint settings, there previously, are not gone.

A misguided DDBean change event or remove event from the merged annotation-dd
provider could also cause this problem, especially if the configuration UI is
not open because the effects of such changes cause the model to save to disk.

The reason it is designed this way is legacy related to the original NB 3.6
DDAPI and AS 8.0 beta one Deploytool.

The reason the proposed fix resolves such dataloss issues is because it caches
data for potential child DConfigBeans in such a way that the data written back
out again if at the time of the save request, such children have not yet been
created.
Comment 8 _ pcw 2006-10-10 07:45:23 UTC
Vince has done an initial review of my changes and approved them for initial
commit to release55_dev codeline.
Comment 9 _ pcw 2006-10-10 08:05:34 UTC
Committed to release55_dev

http://serverplugins.netbeans.org/source/browse/serverplugins/sun/sunddui/src/org/netbeans/modules/j2ee/sun/share/configbean/WebServices.java?r1=1.1.4.2.2.4.12.1&r2=1.1.4.2.2.4.12.2
http://serverplugins.netbeans.org/source/browse/serverplugins/sun/sunddui/src/org/netbeans/modules/j2ee/sun/share/configbean/EjbRef.java?r1=1.1.16.2.2.4.16.1&r2=1.1.16.2.2.4.16.2
http://serverplugins.netbeans.org/source/browse/serverplugins/sun/sunddui/src/org/netbeans/modules/j2ee/sun/share/configbean/Base.java?r1=1.1.16.4.2.7.6.1&r2=1.1.16.4.2.7.6.2
http://serverplugins.netbeans.org/source/browse/serverplugins/sun/sunddui/src/org/netbeans/modules/j2ee/sun/share/configbean/ServiceRef.java?r1=1.1.16.2.2.4.12.1&r2=1.1.16.2.2.4.12.2
http://serverplugins.netbeans.org/source/browse/serverplugins/sun/sunddui/src/org/netbeans/modules/j2ee/sun/share/configbean/AppRoot.java?r1=1.1.16.4.2.7.6.2&r2=1.1.16.4.2.7.6.3
http://serverplugins.netbeans.org/source/browse/serverplugins/sun/sunddui/src/org/netbeans/modules/j2ee/sun/share/configbean/WebAppRoot.java?r1=1.1.16.5.2.8.10.2&r2=1.1.16.5.2.8.10.3
http://serverplugins.netbeans.org/source/browse/serverplugins/sun/sunddui/src/org/netbeans/modules/j2ee/sun/share/configbean/BaseRoot.java?r1=1.1.16.4.2.4.16.2&r2=1.1.16.4.2.4.16.3
http://serverplugins.netbeans.org/source/browse/serverplugins/sun/sunddui/src/org/netbeans/modules/j2ee/sun/share/configbean/Attic/AppClientRoot.java?r1=1.1.4.8.10.1&r2=1.1.4.8.10.2
http://serverplugins.netbeans.org/source/browse/serverplugins/sun/sunddui/src/org/netbeans/modules/j2ee/sun/share/configbean/BaseEjb.java?r1=1.1.16.2.2.6.16.1&r2=1.1.16.2.2.6.16.3
http://serverplugins.netbeans.org/source/browse/serverplugins/sun/sunddui/src/org/netbeans/modules/j2ee/sun/share/configbean/SecurityRoleMapping.java?r1=1.1.16.1.2.4.10.2&r2=1.1.16.1.2.4.10.3
http://serverplugins.netbeans.org/source/browse/serverplugins/sun/sunddui/src/org/netbeans/modules/j2ee/sun/share/configbean/ServletRef.java?r1=1.1.16.2.2.3.16.1&r2=1.1.16.2.2.3.16.2
http://serverplugins.netbeans.org/source/browse/serverplugins/sun/sunddui/src/org/netbeans/modules/j2ee/sun/share/configbean/EjbJarRoot.java?r1=1.1.16.6.2.11.6.3&r2=1.1.16.6.2.11.6.4
http://serverplugins.netbeans.org/source/browse/serverplugins/sun/sunddui/src/org/netbeans/modules/j2ee/sun/share/configbean/Attic/MessageDestination.java?r1=1.1.2.2.16.1&r2=1.1.2.2.16.2
http://serverplugins.netbeans.org/source/browse/serverplugins/sun/sunddui/src/org/netbeans/modules/j2ee/sun/share/configbean/WebServiceDescriptor.java?r1=1.4.2.2.2.12.6.2&r2=1.4.2.2.2.12.6.3
http://serverplugins.netbeans.org/source/browse/serverplugins/sun/sunddui/src/org/netbeans/modules/j2ee/sun/share/configbean/Attic/MessageDestinationRef.java?r1=1.1.2.2.16.1&r2=1.1.2.2.16.2
Comment 11 _ pcw 2006-10-10 08:31:25 UTC
Oops, in step 5 of the steps described, a few comments, above, it should read:

5. Select "Edit as XML" and you should see that your servlet w/ web service
endpoint settings, there previously, are now gone.
Comment 12 _ pcw 2006-10-10 09:04:43 UTC
Additional info:

The Configuration Editor has child DConfigBeans for the following descriptor
entries:

servlet, ejb [session, message-driven, entity], ejb-ref, resource-ref,
resource-env-ref, service-ref, security-role-mapping, message-destination-ref,
webservice-description (from webservices.xml)

So extrapolate the "instructions to reproduce", above, to an example that has
any combination of the above items (e.g. a Servlet or EJB using resource
injection, for example).
Comment 13 Jan Horvath 2006-10-10 10:32:25 UTC
verified in release55_dev cont. build 20061010-0819

One observation: webservice node in sun-web.xml is missing until classpath scanning is finished.
Is this correct behavior?
Comment 14 _ pcw 2006-10-10 10:51:32 UTC
Unfortunately, yes.  The merged annotation-dd provider is dependent on the class
scan for the annotation information so it cannot notify the plugin about the
annotation related webservice information until the scan is finished (or any
other descriptor entries driven by annotations, e.g. annotated EJB's, resource
injection, and web service clients.)
Comment 16 _ pcw 2006-10-11 22:02:57 UTC
Committed to release55 branch.
Comment 17 _ pcw 2006-10-11 22:11:00 UTC
http://serverplugins.netbeans.org/source/browse/serverplugins/sun/sunddui/src/org/netbeans/modules/j2ee/sun/share/configbean/Attic/AppClientRoot.java?r1=1.1.4.8&r2=1.1.4.9
http://serverplugins.netbeans.org/source/browse/serverplugins/sun/sunddui/src/org/netbeans/modules/j2ee/sun/share/configbean/AppRoot.java?r1=1.1.16.4.2.8&r2=1.1.16.4.2.9
http://serverplugins.netbeans.org/source/browse/serverplugins/sun/sunddui/src/org/netbeans/modules/j2ee/sun/share/configbean/Base.java?r1=1.1.16.4.2.7&r2=1.1.16.4.2.8
http://serverplugins.netbeans.org/source/browse/serverplugins/sun/sunddui/src/org/netbeans/modules/j2ee/sun/share/configbean/BaseEjb.java?r1=1.1.16.2.2.6&r2=1.1.16.2.2.7
http://serverplugins.netbeans.org/source/browse/serverplugins/sun/sunddui/src/org/netbeans/modules/j2ee/sun/share/configbean/BaseRoot.java?r1=1.1.16.4.2.5&r2=1.1.16.4.2.6
http://serverplugins.netbeans.org/source/browse/serverplugins/sun/sunddui/src/org/netbeans/modules/j2ee/sun/share/configbean/EjbJarRoot.java?r1=1.1.16.6.2.12&r2=1.1.16.6.2.13
http://serverplugins.netbeans.org/source/browse/serverplugins/sun/sunddui/src/org/netbeans/modules/j2ee/sun/share/configbean/EjbRef.java?r1=1.1.16.2.2.4&r2=1.1.16.2.2.5
http://serverplugins.netbeans.org/source/browse/serverplugins/sun/sunddui/src/org/netbeans/modules/j2ee/sun/share/configbean/Attic/MessageDestination.java?r1=1.1.2.2&r2=1.1.2.3
http://serverplugins.netbeans.org/source/browse/serverplugins/sun/sunddui/src/org/netbeans/modules/j2ee/sun/share/configbean/Attic/MessageDestinationRef.java?r1=1.1.2.2&r2=1.1.2.3
http://serverplugins.netbeans.org/source/browse/serverplugins/sun/sunddui/src/org/netbeans/modules/j2ee/sun/share/configbean/ResourceEnvRef.java?r1=1.1.16.1.2.3&r2=1.1.16.1.2.4
http://serverplugins.netbeans.org/source/browse/serverplugins/sun/sunddui/src/org/netbeans/modules/j2ee/sun/share/configbean/ResourceRef.java?r1=1.1.16.2.2.5&r2=1.1.16.2.2.6
http://serverplugins.netbeans.org/source/browse/serverplugins/sun/sunddui/src/org/netbeans/modules/j2ee/sun/share/configbean/SecurityRoleMapping.java?r1=1.1.16.1.2.5&r2=1.1.16.1.2.6
http://serverplugins.netbeans.org/source/browse/serverplugins/sun/sunddui/src/org/netbeans/modules/j2ee/sun/share/configbean/ServiceRef.java?r1=1.1.16.2.2.4&r2=1.1.16.2.2.5
http://serverplugins.netbeans.org/source/browse/serverplugins/sun/sunddui/src/org/netbeans/modules/j2ee/sun/share/configbean/ServletRef.java?r1=1.1.16.2.2.3&r2=1.1.16.2.2.4
http://serverplugins.netbeans.org/source/browse/serverplugins/sun/sunddui/src/org/netbeans/modules/j2ee/sun/share/configbean/WebAppRoot.java?r1=1.1.16.5.2.9&r2=1.1.16.5.2.10
http://serverplugins.netbeans.org/source/browse/serverplugins/sun/sunddui/src/org/netbeans/modules/j2ee/sun/share/configbean/WebServiceDescriptor.java?r1=1.4.2.2.2.13&r2=1.4.2.2.2.14
http://serverplugins.netbeans.org/source/browse/serverplugins/sun/sunddui/src/org/netbeans/modules/j2ee/sun/share/configbean/WebServices.java?r1=1.1.4.2.2.5&r2=1.1.4.2.2.6
Comment 18 _ pcw 2006-10-12 00:47:42 UTC
Commit to release55 branch reverted.

While contructing projects as test data for a functional test for this patch, I
uncovered a number of regressions in the merged annotation-dd provider (to be
filed).  The effect of this patch on those regressions rendered a number of
common scenarios undeployable, which Vince and I deemed worse than the problem
this fix patches.  Until those regressions are fixed, this patch should not be
released.
Comment 19 Jan Horvath 2006-10-12 13:20:27 UTC
please could you be more specific about this regressions? I was testing it in release55_dev build 
200610120300 and didn't found any errors
Comment 20 _ pcw 2006-10-13 01:49:04 UTC
I reverted this patch due to observations now detailed in issue 87042.  I have
been able to determine that the deployment errors that can be caused by side
effects of 87042 are not the fault of this patch and have recommitted this patch
to release55 codebase.

This issue is fixed now in both release55_dev and release55.
Comment 21 _ pcw 2006-10-13 23:58:51 UTC
One more little change required.  There was an incorrect property name being
used to put cached (not loaded) ejb's back into the tree for saving.  This
caused a logged exception and prevents the file from being saved.

The effect is that if you an ejb entry that has not been loaded yet(ie scan
still running), you cannot save changes to sun-ejb-jar.xml and if you have a
bogus entry (one that will never be loaded, for whatever reason), then you can
_never_ save sun-ejb-jar.xml.

The fix is trivial and is a must fix for NB 5.5.  I already patched it in
release55_dev, asking permission to patch release55 over the weekend.  Here's
the diff:

http://serverplugins.netbeans.org/source/browse/serverplugins/sun/sunddui/src/org/netbeans/modules/j2ee/sun/share/configbean/EjbJarRoot.java?r1=1.1.16.6.2.11.6.4&r2=1.1.16.6.2.11.6.5

Why didn't I catch this before?  When I started testing these changes in Ejb, I
got sucked into the mess we eventually resolved via issue 87042.
Comment 22 Vince Kraemer 2006-10-14 00:52:15 UTC
change approved.
Comment 23 _ pcw 2006-10-14 02:39:07 UTC
See also, this diff which will prevent further damage to the save process in
cases like above.

http://serverplugins.netbeans.org/source/browse/serverplugins/sun/sunddui/src/org/netbeans/modules/j2ee/sun/share/configbean/Base.java?r1=1.1.16.4.2.7.6.2&r2=1.1.16.4.2.7.6.3
Comment 24 Vince Kraemer 2006-10-14 03:46:21 UTC
additional changes appears to be safe and prudent. approved.
Comment 25 Jan Horvath 2006-10-16 12:20:02 UTC
changes verified by QE in release55_dev