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.
JDK 1.6.0 b86 NB 200606090200 Descritpion: ============ When an user wants to create project "EJB with existing sources" from j2ee 1.4 sources, NetBeans throws a NullPointerException followed by an IllegalArgumentException. As an example we will try to open sample project from j2ee 1.4 sdk samples bundle. Steps to reproduce: =================== A) prepare sources and NB 1) download "samples bundle" from http://java.sun.com/j2ee/1.4/download.html 2) extract to your work folder 3) add a glassfish server to NB B) create new project 1) press Ctrl+Shift+N 2) select "EJB module with existing sources" from category "Enterprise" 3) to "Location" field fill "your work folder/ejb/bmp/apps/simple/" 4) fill "Project Name" and "Project Folder" 5) select J2EE version to 1.4 and press "Next" 6) to "Configuration Files Folder" field fill "your work folder/ejb/bmp/apps/simple/src/conf" (freely do that through "Browse" button) 7) press "Finish" Appendix: ========= It doesn't matter whether the user has NB tied to jdk v1.6.0, or to v1.4.2. In case we DO NOT SELECT J2EE version to 1.4, the exceptions would not be thrown.
Created attachment 30912 [details] messages.log
Please note, that you are trying to import J2EE 1.4 Enterprise Application as EJB module. Please use Enterprise Application with Existing Sources wizard for that. If you really want to import EJB module, you must navigate wizard to ejb/bmp/apps/simple/simple-ejb directory, it is location of EJB module in this sample application. If you do that, NetBeans will recognize J2EE version and also config files folder. Mentioned NPE is in fact throwed because there is no ejb-ja.xml file in config files folder you pointed to. I wanted to close this issue as invalid, but NPEs should not appear anyway, so I am just decreasing to P3 and changing to right component.
Sorry, but I can't reproduce it. I used ejb/bmp/apps/simple/src/conf as the configuration files folder and ejb/bmp/apps/simple/simple-ejb/src/java as the source folder and I didn't get any NPE. Marking as incomplete because the NPE is not visible in the attached message log, so I can't tell what went wrong. Please try to reproduce again and provide more information. Thanks.
I just sticked to the steps I wrote in my first report and those exception were fired again (NB 5.5 dev 200606160200, JDK 1.6.0 b87, fresh userdir) And thanks for the notice about EJB and Enterprise Application. I overlooked that.
You should use ejb/bmp/apps/simple, not ejb/bmp/apps/simple/simple-ejb/src/java as a location folder. Maybe we could just throw out an error about unsuccessfull creating a project and free the user from those exceptions.
Created attachment 31601 [details] Stack trace
The NPE is caused by EbjJarProvider.getModuleVersion() not checking the EjbJar for null (which happens when there is no ejb-jar.xml file in a J2EE 1.4 project). Since there is no way to correctly compute the module version in this case, I suggest returning a default value based on the project's Java EE version and the module type (EJB in this case). So for J2EE 1.4 it would return 2.1 and for J2EE 1.3 it would return 2.0. (It already returns 3.0 for Java EE 5.) The same fix could be also used in the web project, whose getModuleVersion() returns 2.5 if there is no web.xml file regardless of the Java EE version. Would need an utility method returning the default module version given the module type and the Java EE version: /** * @param javaEEVersion the Java EE version, e.g. {@link J2eeModule.J2EE_14}. * @param moduleType the module type, e.g {@link J2eeModule.EJB}. */ public String getDefaultModuleVersion(String javaEEVersion, String moduleType); Pavle, does this make sense? Do we already have such a method? Please evaluate and reassign back to me.
*** Issue 74297 has been marked as a duplicate of this issue. ***
*** Issue 67776 has been marked as a duplicate of this issue. ***
I am not sure this API is needed. Issue 83114 is fixed - check for null in getModuleVersion(). For EE 5 you get correct version even if there is not DD bcs it uses the DD computed from annotations. There is a fallback to 2.1 for ejb module if it is not EE5 which I think is OK. I think that web modules should return 2_5 for EE5 and 2_4 otherwise and you can verify and close this issue.
Pavel is rigth. It was fixed in 83114. I tried the steps and the mentioned ejb sample is imported without any exceptions or warnings. dd == null && version != 5.0 -> fallback to Was fixed by: http://j2ee.netbeans.org/source/browse/j2ee/ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/EjbJarProvider.java?r1=1.23.36.6.2.6&r2=1.23.36.6.2.7 However... see issue 83464.