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.
Summary: | EjbJar project exposes annotated components from libraries it depends on. | ||
---|---|---|---|
Product: | javaee | Reporter: | _ pcw <pcw> |
Component: | EJB Project | Assignee: | Martin Adamek <madamek> |
Status: | RESOLVED FIXED | ||
Severity: | blocker | CC: | abadea, blaha, pjiricka, vkraemer |
Priority: | P1 | ||
Version: | 5.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: | |
Attachments: | Example project. |
Description
_ pcw
2006-10-12 23:12:15 UTC
Created attachment 35171 [details]
Example project.
See also issue 87049, whose severity is impacted by whether this issue is fixed or not. Fixed in release55_dev branch. http://www.netbeans.org/source/browse/j2ee/ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/EjbJarWebServicesSupport.java?r1=1.26.2.5.2.7.6.2&r2=1.26.2.5.2.7.6.3 http://www.netbeans.org/source/browse/j2ee/ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/EjbJarProvider.java?r1=1.23.36.6.2.14.2.2&r2=1.23.36.6.2.14.2.3 http://www.netbeans.org/source/browse/j2ee/ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/classpath/ClassPathProviderImpl.java?r1=1.4.40.1.2.3.16.1&r2=1.4.40.1.2.3.16.2 Adding Andrei for review. Same problem fixed also for WebServices in Web project (when Web project has some other project with annotated WS on classpath) http://www.netbeans.org/source/browse/web/project/src/org/netbeans/modules/web/project/classpath/ClassPathProviderImpl.java?r1=1.19.20.2.2.3.12.1&r2=1.19.20.2.2.3.12.2 http://www.netbeans.org/source/browse/web/project/src/org/netbeans/modules/web/project/WebProjectWebServicesSupport.java?r1=1.30.8.1.2.3.10.3&r2=1.30.8.1.2.3.10.4 verified in release55_dev Description of the fix: Classpath used in annotation listener was stripped to contain only sources and J2EE platform classpath. This was done for classpath of EJB and WS listeners in EJB project and for classpath of WS in Web project. It means that all all Session/MessageDriven beans and WebServices defined in libraries of EJB project will be ignored. Same applies for all WebServices defined in libraries of Web project. If Peter and Vince will agree with proposed fix, I will integrate it into release55 branch on Sunday evening Prague time. The way the fix removes the compilation classpath (apart from the classpath of the J2EE platform) from the classpath used for finding annotations seems correct. I can't tell for sure that removing the compilation classpath won't cause any regressions, but it seems it won't and that it is the right thing to do. Why is the J2eePlatformClassPath in the MetaDataClassPath for the project? It seems like this would make this bug less likely to encounter, but still possible? It looks like this issue was caused by changes for http://www.netbeans.org/issues/show_bug.cgi?id=82450. There is a note about JPA and Web in that issue. I see that you found stuff in web that needed to get changed. Is there a similar issue in JPA? > Why is the J2eePlatformClassPath in the MetaDataClassPath for the project? It is not classpath for the project. It is classpath provided by project ONLY for annotation processing. J2EE platform is needed for resolving types of annotations. > It seems like this would make this bug less likely to encounter, but still possible? I don't know currently about any scenario available in IDE where it could be possible. > It looks like this issue was caused by changes for http://www.netbeans.org/issues/show_bug.cgi?id=82450. I don't think so. Mentioned changes were all intentional. > There is a note about JPA and Web in that issue. I see that you found stuff in web that needed to get changed. Is there a similar issue in JPA? JPA has completely independent classpath infrastructure and in JPA it is required to see Entity classes from class libraries in depending projects (which is opposite what we need in Web/EJB projects with WSs and EJBs) The diffs seem fine to me, though not sure I'm qualified for reviewing classpath impl's (I did notice that the cache mechanism in ClassPathProviderImpl is not threadsafe, but that's beyond the scope of this issue). I've been running with these changes all day and they seem to have fixed the issue I reported and I have no ill effects to report either. Looks good by me. If the user puts an EJB or web service into their J2eePlatform classpath, this issue may re-occur. Since the sun plugin doesn't allow the user to alter the J2EE_PLATFORM_CLASSPATH, there won't be an issue for SJSAS/GF users. If other plugins allow the user to alter this property, the user may encounter this issue again, but they would have to work really hard to get into this state... Probably by doing questionable things in the ServerManager/Server properties dialog... I think this is okay to integrate into release55. I tried forcing Vince's idea by modifying the j2ee_platform_classpath in private.properties and it's looks like it's really hard to get into this state that way (the path is rewritten on every startup, and once read and cached, is not reread, so the only alternative I see is hacking the appserver jars -- not likely) Interesting if other plugins do allow modification of this path and certainly worth reconsidering for later versions - Is there a way to use a "this project only" classpath for finding annotations, with the j2ee_platform_classpath only used for annotation definitions, but nothing else? I think the current plan is perfectly acceptable for 5.5 though. Fixed in release55 branch. http://www.netbeans.org/source/browse/web/project/src/org/netbeans/modules/web/project/classpath/ClassPathProviderImpl.java?r1=1.19.20.2.2.3&r2=1.19.20.2.2.4 http://www.netbeans.org/source/browse/j2ee/ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/EjbJarWebServicesSupport.java?r1=1.26.2.5.2.8&r2=1.26.2.5.2.9 http://www.netbeans.org/source/browse/j2ee/ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/EjbJarProvider.java?r1=1.23.36.6.2.15&r2=1.23.36.6.2.16 http://www.netbeans.org/source/browse/j2ee/ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/classpath/ClassPathProviderImpl.java?r1=1.4.40.1.2.3&r2=1.4.40.1.2.4 http://www.netbeans.org/source/browse/web/project/src/org/netbeans/modules/web/project/WebProjectWebServicesSupport.java?r1=1.30.8.1.2.4&r2=1.30.8.1.2.5 |