 |
Using the NetBeans 6 M10 profiler with Tomcat and Mac OS X
Posted by fabriziogiudici on July 25, 2007 at 01:11 AM | Comments (6)
One of the (many) neat features of NetBeans, coming from older versions but improved in 6M10, is the integrated profiler. Since NetBeans comes also with an out-of-the-box integration with Tomcat (and other application servers), theoretically profiling your web applications should be just a matter of pushing two buttons.
But this didn't worked for me as I wasn't able to have Tomcat started in "profiling mode" - I always had error messages about the profiling agent not being found.
After some investigation I found out that the problem is... spaces in classpaths! It's a kind of problem that haunts Java since the inception, and it's still here!
Well, my NetBeans 6 M10 got installed in a directory named:
/Users/fritz/Applications/NetBeans 6.0M10.app
and you see there's that space after NetBeans. First, I removed it to have:
/Users/fritz/Applications/NetBeans6.0M10.app
Second, inside that directory there is other stuff, of course. The real set of NetBeans files is in:
/Users/fritz/Applications/NetBeans6.0M10.app/Contents/Resources/NetBeans 6.0M10
because of the Mac OS X application bundle structure. You see that other space after NetBeans. So I removed it to have:
/Users/fritz/Applications/NetBeans6.0M10.app/Contents/Resources/NetBeans6.0M10
There's a final step to perform: there are a couple of symbolic links that still point to the old path with the spaces:
/Users/fritz/Applications/NetBeans6.0M10.app/Contents/Resources/icons.icns /Users/fritz/Applications/NetBeans6.0M10.app/Contents/MacOS/executable
I fixed them and now... my Tomcat profiler just runs in a matter of a couple of mouse clicks!
While some parts of that stuff are Mac OS X related, indeed the same problem could be found on other operating systems (I didn't tried them yet). What's your experience?
Technorati Tags: NetBeans, profiler
Bookmark blog post: del.icio.us Digg DZone Furl Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment
-
Issue filed at http://www.netbeans.org/issues/show_bug.cgi?id=110882
Posted by: fabriziogiudici on July 25, 2007 at 01:26 AM
-
Filenames supporting spaces is one of the worst ideas coming out of Redmond (I think), ever. I avoid that like the plague, even going to the trouble of ignoring Windows's standard folders and creating my own root folders for programs, user documents etc. Spaces (and too-long filenames) are also awkward for command-line diehards like me. The most irritating thing is how Microsoft actually pushed spaces in names that didn't need to have them, perhaps just to force developers and users to be compatible / get used to that... see for example "Program Files" - why "Files"? Is there any folder in your entire HD that doesn't contain files? Just "Programs" would be perfect. But I digress...
UNC names, like \\server\folder\dir, are another common cause of problems. The java.io APIs suport these names on Windows since 1997, but I still run into some Java apps (especially installers) that fail if executed out of a UNC path. I guess this is related to custom pathname parsing and lazy developers who don't test that code on unmapped network paths on Windows networks. On the flipside, it's not exceedingly rare also to find modern native Win32 apps that don't like UNC paths. Major guilty here is Windows, which whole filesystem story is a mess.
Posted by: opinali on July 25, 2007 at 06:19 AM
-
when running the netbeans profiler tutorial , exercise 2 (which profiles a servlet method running on tomcat)
http://www.netbeans.org/kb/55/profiler-tutorial.html
I get "failed to establish socket connection with target VM" . The sample app runs fine on tomcat without the profiler.
I am running on Windows and I have Java and Netbeans 5.5 installed in the stupid "Program Files" directory, so maybe that is the problem (?)
Posted by: caroljmcdonald on July 25, 2007 at 07:32 AM
-
@opinali "even going to the trouble of ignoring Windows's standard folders and creating my own root folders" - Yes, I do the same - fortunately I work with Windows just a bit, basically for testing multi-platform applications.
@caroljmcdonald: it could be. Sometimes it isn't easy to reckon the spaces-in-the-path problem since it could manifest with a set of side effect (e.g. the profiler agent just didn't start, you didn't notice it and you only get the "can't connect" stuff. As it's quite easy to re-install / fix NetBeans into a directory with no spaces, I'd give it a try before looking at other stuff.
Posted by: fabriziogiudici on July 25, 2007 at 08:21 AM
-
actually I just got it working. the tutorial doc was a little misleading. I needed to calibrate the jdk.
Posted by: caroljmcdonald on July 25, 2007 at 08:26 AM
-
Fabrizio,
This blog entry would make a fantastic article for the NetBeans Community Docs wiki. Could you please add it?
http://wiki.netbeans.org/wiki/view/CommunityDocs
Thanks,
James Branam
NetBeans Community Docs Manager
james.branam@sun.com
Posted by: jambra on July 26, 2007 at 11:57 PM
|