Apache NetBeans version
Apache NetBeans 29
What happened
Apache NetBeans version
Apache NetBeans 29
What happened
Opening any .jsp file via the Projects window causes the editor tab to flash open and immediately close. The IDE log shows a NullPointerException in JspParserImpl.createParseProxy(JspParserImpl.java:234):
java.lang.NullPointerException: Cannot invoke "org.netbeans.api.j2ee.core.Profile.isAtLeast(org.netbeans.api.j2ee.core.Profile)" because the return value of "org.netbeans.modules.web.api.webmodule.WebModule.getJ2eeProfile()" is null
at org.netbeans.modules.web.jspparser.JspParserImpl.createParseProxy(JspParserImpl.java:234)
at org.netbeans.modules.web.jspparser.JspParserImpl.getParseProxy(JspParserImpl.java:225)
at org.netbeans.modules.web.jspparser.JspParserImpl.getJspOpenInfo(JspParserImpl.java:177)
at org.netbeans.modules.web.core.jsploader.TagLibParseSupport.getCachedOpenInfo(TagLibParseSupport.java:246)
at org.netbeans.modules.web.core.jsploader.JspDataObject.findFileEncoding(JspDataObject.java:287)
at org.netbeans.modules.web.core.jsploader.JspDataObject.getFileEncoding(JspDataObject.java:276)
at org.netbeans.modules.web.core.jsploader.BaseJspEditorSupport.verifyEncoding(BaseJspEditorSupport.java:276)
at org.netbeans.modules.web.core.jsploader.BaseJspEditorSupport.open(BaseJspEditorSupport.java:257)
at org.openide.actions.OpenAction.performAction(OpenAction.java:59)
...
A follow-up IllegalStateException is then logged from BaseJspEditorSupport$4.propertyChange during the resulting document-close cleanup, which is why the tab disappears instantly:
INFO [org.netbeans.modules.web.core.jsploader.BaseJspEditorSupport$4]: property change fired with both new and old value null!
java.lang.IllegalStateException
at org.netbeans.modules.web.core.jsploader.BaseJspEditorSupport$4.propertyChange(BaseJspEditorSupport.java:166)
...
at org.openide.text.DocumentOpenClose$DocumentClose.run(DocumentOpenClose.java:985)
Root cause appears to be that JspParserImpl.createParseProxy calls webModule.getJ2eeProfile().isAtLeast(...) without guarding against getJ2eeProfile() returning null. WebModule.getJ2eeProfile() legitimately returns null for projects that aren't registered as Jakarta EE web modules — free-form projects, Ant Java projects that happen to contain .jsp files, GWT projects with a webapp/ directory, or .jsp files opened standalone from the Favorites window.
This is a regression introduced by #8976 (Enable parsing of JSP 3.0 (Jakarta) based sources) in NetBeans 29.
Language / Project Type / NetBeans Component
JSP / enterprise/web.jspparser
How to reproduce
- Have any project containing
.jsp files where WebModule.getJ2eeProfile() returns null (e.g. Ant free-form project, or a Java/GWT project with .jsp files under a webapp folder but no Jakarta EE profile configured).
- Double-click a
.jsp file in the Projects window.
- The editor tab opens and immediately closes; the NPE above appears in
messages.log.
Did this work correctly in an earlier version?
Yes — works correctly in Apache NetBeans 28.
Operating System
Linux — Ubuntu MATE 24.04 (kernel 6.x, amd64)
JDK
Apache NetBeans packaging
Anything else
Likely fix: null-guard the WebModule.getJ2eeProfile() call in JspParserImpl.createParseProxy (and getParseProxy), falling back to the JSP 2.x parsing path when no profile is set. As a current workaround, disabling the org.netbeans.modules.web.jspparser module (Tools → Plugins → Installed) lets .jsp files open again, but obviously without JSP parsing/completion.
cc @matthiasblaesing — author of #8976.
Are you willing to submit a pull request?
Language / Project Type / NetBeans Component
No response
How to reproduce
Simply open .jsp file with active "Java Web and EE".
Did this work correctly in an earlier version?
Apache NetBeans 28
Operating System
Ubuntu
JDK
JDBK 25
Apache NetBeans packaging
Apache NetBeans binary zip
Anything else
No response
Are you willing to submit a pull request?
No
Apache NetBeans version
Apache NetBeans 29
What happened
Apache NetBeans version
Apache NetBeans 29
What happened
Opening any
.jspfile via the Projects window causes the editor tab to flash open and immediately close. The IDE log shows aNullPointerExceptioninJspParserImpl.createParseProxy(JspParserImpl.java:234):A follow-up
IllegalStateExceptionis then logged fromBaseJspEditorSupport$4.propertyChangeduring the resulting document-close cleanup, which is why the tab disappears instantly:Root cause appears to be that
JspParserImpl.createParseProxycallswebModule.getJ2eeProfile().isAtLeast(...)without guarding againstgetJ2eeProfile()returningnull.WebModule.getJ2eeProfile()legitimately returnsnullfor projects that aren't registered as Jakarta EE web modules — free-form projects, Ant Java projects that happen to contain.jspfiles, GWT projects with awebapp/directory, or.jspfiles opened standalone from the Favorites window.This is a regression introduced by #8976 (Enable parsing of JSP 3.0 (Jakarta) based sources) in NetBeans 29.
Language / Project Type / NetBeans Component
JSP /
enterprise/web.jspparserHow to reproduce
.jspfiles whereWebModule.getJ2eeProfile()returnsnull(e.g. Ant free-form project, or a Java/GWT project with.jspfiles under a webapp folder but no Jakarta EE profile configured)..jspfile in the Projects window.messages.log.Did this work correctly in an earlier version?
Yes — works correctly in Apache NetBeans 28.
Operating System
Linux — Ubuntu MATE 24.04 (kernel 6.x, amd64)
JDK
Apache NetBeans packaging
Anything else
Likely fix: null-guard the
WebModule.getJ2eeProfile()call inJspParserImpl.createParseProxy(andgetParseProxy), falling back to the JSP 2.x parsing path when no profile is set. As a current workaround, disabling theorg.netbeans.modules.web.jspparsermodule (Tools → Plugins → Installed) lets.jspfiles open again, but obviously without JSP parsing/completion.cc @matthiasblaesing — author of #8976.
Are you willing to submit a pull request?
Language / Project Type / NetBeans Component
No response
How to reproduce
Simply open .jsp file with active "Java Web and EE".
Did this work correctly in an earlier version?
Apache NetBeans 28
Operating System
Ubuntu
JDK
JDBK 25
Apache NetBeans packaging
Apache NetBeans binary zip
Anything else
No response
Are you willing to submit a pull request?
No