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.
Profiler 070427 NetBeans IDE 6.0 Preview (M9, build 070430) 1.5.0_06; Java HotSpot(TM) Client VM 1.5.0_06-68 Mac OS X version 10.4.7 running on i386 ru_RU (nb); MacCyrillic Steps to reproduce: - install NB using default installation directories - unzip Apache Tomcat 5.5.23 and make it executable - register it in IDE - verify that NB is able to run projects targeted Tomcat - try to Profile Application targeted Tomcat - RESULT: Server is failed to start: Error occurred during initialization of VM Could not find agent library in absolute path: /Applications/NetBeans
The situation is on any Unix platform, when netbeans is installed in directory with space.
According to my investigation, profiler correctly pass the jvm arguments to nbstartprofiledserver task. Unfortunately org.netbeans.modules.tomcat5.ide.StartTomcat.StartRunnable adds all jvm args together without doing any quoting. Reassigning to tomcatint for evaluation.
It does not seem to me that the bug is in the Tomcat plugin. The right place to do the quoting is most likely the profiler. Tomcat plugin does not know anything about the -agentpath:.. argument and how it is supposed to be quoted. See also the following issue: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6276819.
As I said, it looks to me like bug in tomcat plug-in. Look at the following code: String[] profJvmArgs = profilerSettings.getJvmArgs(); // TODO solve conflicts between profiler and tomcat vm args StringBuffer catalinaOpts = new StringBuffer(); for (int i = 0; i < profJvmArgs.length; i++) { catalinaOpts.append(profJvmArgs[i]).append(" "); // NOI18N } Profiler provides _array_ of jvm arguments, which should be added to other jvm options. It is wrong to concat them with space without any test that the profJvmArgs[i] does not contain space. This is very similar situation how ant handle command-line arguments (http://ant.apache.org/manual/ using.html#arg) or unix execv(2) handles it. User of the API provides _list_ of arguments (which can contain spaces) and the implementation of the API is responsible to correctly pass arguments to newly started process. BTW: It has nothing to do with -agentpath:.. argument and http://bugs.sun.com/ bugdatabase/view_bug.do?bug_id=6276819
At this point I do not really know how to fix this issue. Escaping the spaces does not seem to be easy, especially since we cannot modify the catalina.sh startup script. I talked to Tomas and the profiler team will try to fix the issue some other way. Closing the issue as WONTFIX.
*** Issue 114124 has been marked as a duplicate of this issue. ***
Reassigning back to profiler to let "profiler team try to fix the issue some other way" according to last comments.
*** Issue 117150 has been marked as a duplicate of this issue. ***
There is a problem also that NetBeans installer on Mac doesn't allow to specify the installation directory.
The last comment is directed more towards the installer component than the profiler, i dare say - see issue #115779 The problem is that we can't pass to tomcat any argument containing space - such an argument would be split by spaces, effectively destroying any information in the original argument. A solution could be to notify the user about this problem and let her change the location of the profiler files to the one without spaces. However, this would involve more changes in the profiler UI and at this stage of release cycle it doesn't seem to be feasible. Should be targeted in the next release. The easiest workaround would be not to a path with spaces as a default NB IDE installation location. Passing to installer for evaluation
Why just not quote the argument on windows and escape spaces ( " "->"\ " or " "->"\\ ") on unix when creating catalinaOpts? If Tomcat itself does work bad with spaces (not the NetBeans plugin) then the issue should be filed against tomcat server. Imagine that the user uses the netbeans zip and extract it somewhere in the path with spaces - it will get the same issue without useg the installer. Not the installer problem, really.
We are not passing any arguments. Most of the servers (including tomcat) accepts the environment variables. Such variables are hard to escape in any way because there is no shell expansion performed. I think this is impossible to escape, partly due to http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6276819.
One more idea. We can create symbolic link to NetBeans directory and use it instead of full path. It could be placed in .nbprofiler or .netbeans folder. I checked that this approach works very well with profiling.
Little summary. Other possibilities follows (aside the previous one - I'm not sure about java support for symbolic link) - as sent to Jaroslav Bachorik. I prefer the first and the second option. 1) silently copy profiler required stuff to some directory without spaces (temp for example) and use it from this temporary directory 2) display warning about the space in the path - done in profiler code (and probably dialog warning when starting the server in profile mode by hand) 3) display warning in nbstartprofiledserver (console, unfortunately) and dialog warning when starting the server in profile mode by hand 4) waive, won'tfix
*** Issue 110882 has been marked as a duplicate of this issue. ***
Workaround on profler side committed to trunk. Checking in IntegrationUtils.java; /cvs/profiler/libs/common/src/org/netbeans/lib/profiler/common/integration/IntegrationUtils.java,v <-- IntegrationUtils.java new revision: 1.2; previous revision: 1.1 done It is really ugly workaround. It uses Runtime.exec, it uses ugly name created by File.createTempFile(). Hopefully only one such link is created for every profiler session. If NetBeans is terminated abruptly, those links will not be deleted. I am not sure if there will be any problems caused by the fact that the path for profiler agent is not under netbeans installation directory. I think that this workaround should be used as backup solution if the user explicitly installs NetBeans in the directory with the space(s). Default installation should have no spaces, since this configuration is very well tested. Reassigning to installer. If possible please change default name on Mac OS X to be one without spaces.
+1. Having spaces in the install path causes headaches for more then just the profiler.
So you are requesting a change of default installtion directory. I have filed a separate issue for that http://www.netbeans.org/issues/show_bug.cgi?id=121067. We have to evaluate.
closing this one as fixed, as there is a workaround in the profiler and a separate issue filed for the installer
Verified with Product Version: NetBeans IDE Dev (Build 200711060000) Java: 1.5.0_07; Java HotSpot(TM) Client VM 1.5.0_07-87 System: Mac OS X version 10.4.10 running on i386; MacCyrillic; ru_RU (nb)
Removing RELNOTE keyword, fixed.