<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:iweb="http://www.apple.com/iweb" version="2.0">
  <channel>
    <title>Ryan’s Blog</title>
    <link>http://www.cuprak.info/Ryans_Blog/Blog/Blog.html</link>
    <description>A technical Blog devoted to Java and Mac OS X/Linux development with a touch of robotics from time to time.</description>
    <generator>iWeb 2.0.4</generator>
    <image>
      <url>http://www.cuprak.info/Ryans_Blog/Blog/Blog_files/IMG_2284.jpg</url>
      <title>Ryan’s Blog</title>
      <link>http://www.cuprak.info/Ryans_Blog/Blog/Blog.html</link>
    </image>
    <item>
      <title>Launching Tomcat with Launchd</title>
      <link>http://www.cuprak.info/Ryans_Blog/Blog/Entries/2008/12/9_Launching_Tomcat_with_Launchd.html</link>
      <guid isPermaLink="false">3b483e33-0209-4a0d-b816-95535608dfe5</guid>
      <pubDate>Tue, 9 Dec 2008 20:45:06 -0500</pubDate>
      <description>With the release of MacOS 10.4 (aka Tiger) Apple rolled out &lt;a href=&quot;http://developer.apple.com/MacOsX/launchd.html&quot;&gt;launchd&lt;/a&gt; which is a system startup program that replaces cron, xinetd, init, etc. It also replaces /Library/StartupItems which I have typically used in the last for launching &lt;a href=&quot;http://tomcat.apache.org/&quot;&gt;Tomcat&lt;/a&gt; and Postgresql. To run Tomcat on my Mac Mini I decided to finally figure out launchd. Below is my launchd script file.&lt;br/&gt;Save the following file as org.apache.tomcat.plist in your home directory:&lt;br/&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&lt;br/&gt;&amp;lt;!DOCTYPE plist PUBLIC &quot;-//Apple Computer//DTD PLIST 1.0//EN&quot; &quot;&lt;a href=&quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;http://www.apple.com/DTDs/PropertyList-1.0.dtd&lt;/a&gt;&quot;&gt;&lt;br/&gt;&amp;lt;plist version=&quot;1.0&quot;&gt;&lt;br/&gt;&amp;lt;dict&gt;&lt;br/&gt;	&amp;lt;key&gt;Debug&amp;lt;/key&gt;&lt;br/&gt;    &amp;lt;true/&gt;&lt;br/&gt;    &amp;lt;key&gt;GroupName&amp;lt;/key&gt;&lt;br/&gt;    &amp;lt;string&gt;staff&amp;lt;/string&gt;&lt;br/&gt;    &amp;lt;key&gt;Label&amp;lt;/key&gt;&lt;br/&gt;    &amp;lt;string&gt;org.apache.tomcat&amp;lt;/string&gt;&lt;br/&gt;    &amp;lt;key&gt;UserName&amp;lt;/key&gt;&lt;br/&gt;    &amp;lt;string&gt;rcuprak&amp;lt;/string&gt;&lt;br/&gt;    &amp;lt;key&gt;RunAtLoad&amp;lt;/key&gt;&lt;br/&gt;    &amp;lt;true/&gt;&lt;br/&gt;    &amp;lt;key&gt;Program&amp;lt;/key&gt;&lt;br/&gt;    &amp;lt;string&gt;/usr/bin/java&amp;lt;/string&gt;&lt;br/&gt;    &amp;lt;key&gt;ProgramArguments&amp;lt;/key&gt;&lt;br/&gt;    &amp;lt;array&gt;&lt;br/&gt;			&amp;lt;string&gt;-Djava.endorsed.dirs=/Applications/apache-tomcat-6.0.14/endorsed&amp;lt;/string&gt;&lt;br/&gt;			&amp;lt;string&gt;-Dcatalina.base=/Applications/apache-tomcat-6.0.14&amp;lt;/string&gt;&lt;br/&gt;			&amp;lt;string&gt;-Dcatalina.home=/Applications/apache-tomcat-6.0.14&amp;lt;/string&gt;&lt;br/&gt;			&amp;lt;string&gt;-Djava.io.tmpdir=/Applications/apache-tomcat-6.0.14/tmp&amp;lt;/string&gt;&lt;br/&gt;			&amp;lt;string&gt;-classpath&amp;lt;/string&gt;&lt;br/&gt;			&amp;lt;string&gt;/Applications/apache-tomcat-6.0.14/bin/tomcat-juli.jar:/Applications/apache-tomcat-6.0.14/bin/commons-daemon.jar:/Applications/apache-tomcat-6.0.14/bin/commons-logging-api.jar:/Applications/apache-tomcat-6.0.14/bin/bootstrap.jar&amp;lt;/string&gt;&lt;br/&gt;			&amp;lt;string&gt;org.apache.catalina.startup.Bootstrap&amp;lt;/string&gt;&lt;br/&gt;  	&amp;lt;/array&gt;&lt;br/&gt;    &amp;lt;key&gt;WorkingDirectory&amp;lt;/key&gt;&lt;br/&gt;	&amp;lt;string&gt;/Applications/apache-tomcat-6.0.14&amp;lt;/string&gt;&lt;br/&gt;&amp;lt;/dict&gt;&lt;br/&gt;&amp;lt;/plist&gt;&lt;br/&gt;&lt;br/&gt;You made need to adjust the paths to reflect the version of Tomcat that you are using as well as the username under which to run tomcat. &lt;br/&gt;Perform the following operations from the command line:&lt;br/&gt;sudo bash&lt;br/&gt;cd /Library/LaunchDaemons&lt;br/&gt;cp /Users/&amp;lt;your username&gt;/org.apache.tomcat.plist .&lt;br/&gt;launchctl load org.apache.tomcat.plist&lt;br/&gt;launchctl start org.apache.tomcat&lt;br/&gt;&lt;br/&gt;Tomcat should startup and will auto start next time the machine is restarted. Any errors will be recorded to syslog and visible if you run the Console application.&lt;br/&gt;&lt;br/&gt;The paths to tomcat may need to be adjusted depending upon your version of tomcat.&lt;br/&gt;&lt;br/&gt;Save this file to /Library/LaunchDaemons. You must first authenticate as root (sudo bash) before saving the file.&lt;br/&gt;&lt;br/&gt;When the machine shuts down I believe launchd sends a kill signal at the process. There aren’t any hooks for invoking a shutdown logic from what I’ve seen thus far. </description>
    </item>
    <item>
      <title>Detecting Memory Leaks</title>
      <link>http://www.cuprak.info/Ryans_Blog/Blog/Entries/2008/11/19_Detecting_Memory_Leaks.html</link>
      <guid isPermaLink="false">33613ac7-aea7-4da9-ba12-d16567a8a606</guid>
      <pubDate>Wed, 19 Nov 2008 15:49:05 -0500</pubDate>
      <description>Troubleshooting a problem over last weekend I ran into a classic memory leak. Yes, you can have memory leaks in Java! If you hold onto references to objects than the Java virtual machine cannot reclaim those objects. In my case, I was processing millions of records but not giving yielding and allowing an object cache to purge itself (my fault - IDE evidently didn’t copy over an updated config file because I didn’t make a code change). This problem led me to dig into Netbeans and profiling Java processes running as Windows’ services. While Netbeans is a great tool, it does a negative impact upon performance. Obviously a less intrusive tool is needed initially. Java 5 ships with jconsole which drills into a JVM and reports back on heap utilization, thread activity etc. JConsole connects to either local JVM or one on a remote machine. I have also used JConsole to track down a renegade thread that was caught in an IO loop as a result of security software checking for a buffer overrun. &lt;br/&gt;&lt;br/&gt;To enable jconsole connectivity for an application simply adding the following VM parameters:&lt;br/&gt;-Dcom.sun.management.jmxremote.port=8999&lt;br/&gt;-Dcom.sun.management.jmxremote.ssl=false&lt;br/&gt;-Dcom.sun.management.jmxremote.authenticate=false&lt;br/&gt;&lt;br/&gt;Launch your application and then launch jconsole (jconsole should be in your path).&lt;br/&gt;&lt;br/&gt;Below you can see screenshots from my ‘classic’ leak.</description>
    </item>
    <item>
      <title>Profiling Windows Services</title>
      <link>http://www.cuprak.info/Ryans_Blog/Blog/Entries/2008/11/19_Netbeans_Profiler_%26_Wrapper.html</link>
      <guid isPermaLink="false">31910657-94ce-4705-b998-d199785787d1</guid>
      <pubDate>Wed, 19 Nov 2008 13:06:46 -0500</pubDate>
      <description>&lt;a href=&quot;http://www.netbeans.org/&quot;&gt;Netbeans&lt;/a&gt; ships with a robust profiler which is easy to use and minimally invasive. You don’t even have to be using Netbeans as your development environment (I use IntelliJ) or even be on the same machine running the VM you want to profile. Thus you can troubleshoot a production environment from afar. Yesterday I figured out how to profile a java process running as a Windows’ service via &lt;a href=&quot;http://wrapper.tanukisoftware.org/&quot;&gt;The Java Service Wrapper&lt;/a&gt;. The instructions below assume Java 5 on both Mac and the windows machine as well as Netbeans 6.5. &lt;br/&gt;&lt;br/&gt;To get started, launch Netbeans and select Attach Profiler from the Profile menu.</description>
    </item>
    <item>
      <title>First Entry</title>
      <link>http://www.cuprak.info/Ryans_Blog/Blog/Entries/2008/11/13_First_Entry.html</link>
      <guid isPermaLink="false">226e1a38-72ac-4526-8d59-d75e9b7f448b</guid>
      <pubDate>Thu, 13 Nov 2008 18:43:23 -0500</pubDate>
      <description>&lt;a href=&quot;http://www.cuprak.info/Ryans_Blog/Blog/Entries/2008/11/13_First_Entry_files/IMG_2397.jpg&quot;&gt;&lt;img src=&quot;http://www.cuprak.info/Ryans_Blog/Blog/Media/IMG_2397_1.jpg&quot; style=&quot;float:left; padding-right:10px; padding-bottom:10px; width:183px; height:137px;&quot;/&gt;&lt;/a&gt;I am determined to finally get blog off of the ground. I have had several false starts over the past year. </description>
      <enclosure url="http://www.cuprak.info/Ryans_Blog/Blog/Entries/2008/11/13_First_Entry_files/IMG_2397.jpg" length="70102" type="image/jpeg"/>
    </item>
  </channel>
</rss>
