<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ghattu&#039;s Technology Blog &#187; jython syntax</title>
	<atom:link href="http://ghattus.com/category/jython-syntax/feed/" rel="self" type="application/rss+xml" />
	<link>http://ghattus.com</link>
	<description>A blog about technology that I work on in my day to day job</description>
	<lastBuildDate>Thu, 03 Dec 2009 00:56:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>How are python.cachedir and the error &quot;*sys-package-mgr*: can&#039;t create package cache dir&quot; are related</title>
		<link>http://ghattus.com/2009/08/04/how-are-python-cachedir-and-the-error-sys-package-mgr-cant-create-package-cache-dir-are-related/</link>
		<comments>http://ghattus.com/2009/08/04/how-are-python-cachedir-and-the-error-sys-package-mgr-cant-create-package-cache-dir-are-related/#comments</comments>
		<pubDate>Tue, 04 Aug 2009 10:50:02 +0000</pubDate>
		<dc:creator>sghattu</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[jython]]></category>
		<category><![CDATA[jython syntax]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[WebLogic]]></category>
		<category><![CDATA[wlst]]></category>
		<category><![CDATA[/var/tmp]]></category>
		<category><![CDATA[cachedir]]></category>
		<category><![CDATA[ImportError]]></category>
		<category><![CDATA[sys-package-mgr]]></category>

		<guid isPermaLink="false">http://ghattus.com/?p=57</guid>
		<description><![CDATA[Resolving "*sys-package-mgr*: can't create package cache dir" errors with WLST]]></description>
			<content:encoded><![CDATA[<p>While starting <a href="http://edocs.bea.com/wls/docs91/config_scripting/index.html">WLST </a>or for that matter <a href="http://www.jython.org">Jython</a>, you might have seen this annoying error message,</p>
<blockquote><p>*sys-package-mgr*: can&#8217;t create package cache dir, &#8216;/tmp/cachedir/packages&#8217;<br />
Traceback (innermost last):<br />
File &#8220;&lt;iostream&gt;&#8221;, line 12, in ?<br />
ImportError: no module named java</p></blockquote>
<p><span id="more-57"></span></p>
<p>When Jython initializes it scans all the jar files it can find at startup to build the package and class structure available to the JVM. This information is written to files in a directory named &#8216;cachedir&#8217;, WLST chooses your &#8216;java.io.tmpdir&#8217; to store these files. There is a problem with this approach especially on Unix machines.</p>
<p><strong>Problem:</strong></p>
<p>Most Unix machines are shared across a number of users. Say &#8220;user1&#8243; first logs into the machine and fired up &#8216;java weblogic.WLST&#8217;, Jython will create the &#8216;cachedir&#8217; under <strong>&#8216;/var/tmp/&#8217;</strong> and this directory will be owned by &#8216;user1&#8242;. This user will have no problems using WLST. Now &#8216;user2&#8242; logs in and fires up WLST, this process will try to write to the same directory, <strong>&#8216;/var/tmp/cachedir&#8217;</strong> which is now owned by &#8216;user1&#8242; and hence fails with the above error message.</p>
<p><strong>Solution:</strong></p>
<p>There is a pretty simple and straight forward solution to this problem. Jython supports a System property (<strong>python.cachedir</strong>) that you can set which will determine the directory where this &#8216;cachedir&#8217; is created. So in our case to start WLST you will use,</p>
<blockquote><p>java -Dpython.cachedir=/home/user1 weblogic.WLST</p></blockquote>
<p>This will create the cachedir under /home/user1, and this way all users can have their own cachedir&#8217;s without running into each other. For a more elegant solution you can create a simple unix script that wraps the call to WLST and adding the right cachedir location per user. Sample is shown below,</p>
<blockquote><p>#!/bin/sh</p>
<p># Setup classpath, probably execute setDomainEnv.sh</p>
<p>java -Dpython.cachedir=~ weblogic.WLST</p></blockquote>
<p>As long as the<strong> &#8216;~&#8217;</strong> resolves properly to the home directory for the user executing WLST you will never have to worry about this &#8216;cachedir&#8217; related error messages.. <img src='http://ghattus.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://ghattus.com/2009/08/04/how-are-python-cachedir-and-the-error-sys-package-mgr-cant-create-package-cache-dir-are-related/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Easing WLST syntax while navigating MBeans in interactive mode</title>
		<link>http://ghattus.com/2008/12/12/easing-wlst-syntax-while-navigating-mbeans-in-interactive-mode/</link>
		<comments>http://ghattus.com/2008/12/12/easing-wlst-syntax-while-navigating-mbeans-in-interactive-mode/#comments</comments>
		<pubDate>Fri, 12 Dec 2008 11:45:00 +0000</pubDate>
		<dc:creator>sghattu</dc:creator>
				<category><![CDATA[cd]]></category>
		<category><![CDATA[jython syntax]]></category>
		<category><![CDATA[ls]]></category>
		<category><![CDATA[wlst]]></category>

		<guid isPermaLink="false">http://ghattus.com/2008/12/easing-wlst-syntax-while-navigating-mbeans-in-interactive-mode/</guid>
		<description><![CDATA[This is something I have implemented in WLST but never exposed as a supported feature. If you have used WLST in interactive mode I bet you are tired of typing those quotes around arguments for each command and not to mention the opening and closing brackets. Well not sure about you but I was definitely [...]]]></description>
			<content:encoded><![CDATA[<p><span>This is something I have implemented in WLST but never exposed as a supported feature.<span id="more-38"></span></span></p>
<p><span>If you have used WLST in interactive mode I bet you are tired of typing those quotes around arguments for each command and not to mention the opening and closing brackets. Well not sure about you but I was definitely tired of this while developing WLST. Hence I have implemented a way to ease this syntax at least while navigating MBeans. The way it works is, while you are in Online mode execute the command ‘<span style="font-weight: bold">easeSyntax()</span>’. After this, for commands like ‘<span style="font-weight: bold">cd</span>’ and <span style="font-weight: bold">‘ls</span>’ you do not need to follow the jython syntax. As an example, currently<span style="font-weight: bold"> </span> to navigate to Server MBeans you will use,</span></p>
<p><span> </span></p>
<blockquote><p><span>cd(“/Servers/testServer”)</span></p>
<p><span>ls()</span></p></blockquote>
<p><span> </span></p>
<p><span> </span></p>
<p><span>After executing easeSyntax() to navigate around you will use.<br />
</span></p>
<p><span> </span></p>
<blockquote><p><span>cd /Servers/testServer</span></p>
<p><span>ls</span></p></blockquote>
<p><span> </span></p>
<p><span>aah, I know what you are thinking. Sorry, there is no tab complete .. <img src='http://ghattus.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
</span></p>
]]></content:encoded>
			<wfw:commentRss>http://ghattus.com/2008/12/12/easing-wlst-syntax-while-navigating-mbeans-in-interactive-mode/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

