netbeans: Javadoc http server fails to load

Apache NetBeans version

Apache NetBeans 18 release candidate

What happened

Right-clicking upon a dependency the View Javadoc context menu option displays;

image

Looking at the IDE log, I’m seeing;

java.lang.IllegalStateException: Unable to create the directory [/tomcat.8082] to use as the base directory
	at org.apache.catalina.startup.Tomcat.initBaseDir(Tomcat.java:868)
	at org.apache.catalina.startup.Tomcat.getServer(Tomcat.java:652)
	at org.netbeans.modules.httpserver.HttpServerModule.buildServer(HttpServerModule.java:179)
[catch] at org.netbeans.modules.httpserver.HttpServerModule.initHTTPServer(HttpServerModule.java:109)
	at org.netbeans.modules.httpserver.HttpServerSettings.setRunning(HttpServerSettings.java:206)
	at org.netbeans.modules.httpserver.HttpServerURLMapper.getURL(HttpServerURLMapper.java:146)
	at org.openide.filesystems.URLMapper.findURL(URLMapper.java:115)
	at org.netbeans.modules.extbrowser.URLUtil.getURLOfAppropriateType(URLUtil.java:147)
	at org.netbeans.modules.extbrowser.URLUtil.createExternalURL(URLUtil.java:77)
	at org.netbeans.modules.extbrowser.MacBrowserImpl.loadURLInBrowserInternal(MacBrowserImpl.java:61)
	at org.netbeans.modules.extbrowser.ExtBrowserImpl$1.run(ExtBrowserImpl.java:141)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1419)
	at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
	at org.openide.util.lookup.Lookups.executeWith(Lookups.java:287)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2034)

This is happening for all methods opening Javadoc except when using the Javadoc index search with uses the inbuilt browser.

How to reproduce

Within a maven java project, include a dependency for which Javadoc exists remotely. Download the Javadoc using the context menu of the dependency, or the top-level Dependencies folder.

Right click upon the dependency when the Javadoc is loaded, indicated by the J in the upper right corner of the dependency icon.

Did this work correctly in an earlier version?

Apache NetBeans 16

Operating System

macOS 13.1.3 M1 (aarch64)

JDK

17.0.7 (arm64) “Azul Systems, Inc.” - “Zulu 17.42.19”

Apache NetBeans packaging

Apache NetBeans provided installer

Anything else

This occurs on every occasion over multiple reloads.

Are you willing to submit a pull request?

Yes

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 16 (15 by maintainers)

Commits related to this issue

Most upvoted comments

Ah f*** ok, I see.

This is probably macOS specific (haven’t tested Windows as yet!). And most likely caused by #5530

On macOS, it seems that user.dir is the root, not the home directory. And creating the Tomcat directory fails - see also https://github.com/apache/tomcat/blob/9.0.x/java/org/apache/catalina/startup/Tomcat.java#L847

As a workaround, find the userdir - eg. ~/Library/Application Support/NetBeans/18/. Inside, add a <userdir>/etc/netbeans.conf file with the following contents -

netbeans_default_options="-J-Dcatalina.base=/Users/<user>/TOMCAT $netbeans_default_options"

I’m assuming we haven’t got any UI to set the Tomcat location? cc/ @matthiasblaesing Possibly another fix for an 18-u1 if we have one?

PR is open. Tested with Windows where I reproduced the problem by running from a directory where I explicitly denied write permissions. With the fix it works.