<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Tlahtoa axixmiqui</title>
	<atom:link href="http://axixmiqui.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://axixmiqui.wordpress.com</link>
	<description>Andrew Hahn&#039;s Software blog</description>
	<lastBuildDate>Wed, 02 Sep 2009 00:47:07 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='axixmiqui.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/37fc429da83d989e07d91e6f2947a27f?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Tlahtoa axixmiqui</title>
		<link>http://axixmiqui.wordpress.com</link>
	</image>
			<item>
		<title>Spring: Handling incoming JMS messages asynchronously</title>
		<link>http://axixmiqui.wordpress.com/2009/09/02/spring-handling-incoming-jms-messages-asynchronously/</link>
		<comments>http://axixmiqui.wordpress.com/2009/09/02/spring-handling-incoming-jms-messages-asynchronously/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 00:47:07 +0000</pubDate>
		<dc:creator>Andrew Hahn</dc:creator>
				<category><![CDATA[activemq]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jms]]></category>
		<category><![CDATA[spring]]></category>

		<guid isPermaLink="false">http://axixmiqui.wordpress.com/?p=113</guid>
		<description><![CDATA[Handling incoming JMS messages in an asynchronous manner requires, implementing a MessageListener, creating a connection, starting a thread, handling connection loss and thread death, etc&#8230;
Spring&#8217;s MessageListenerContainers provide a &#8220;Message Driven Pojo&#8221; framework that handles all that for you except implementing the MessageListener. 
To take advantage of this you first need to create JMS connection factory [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=axixmiqui.wordpress.com&blog=2128021&post=113&subd=axixmiqui&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Handling incoming JMS messages in an asynchronous manner requires, implementing a MessageListener, creating a connection, starting a thread, handling connection loss and thread death, etc&#8230;<br />
Spring&#8217;s MessageListenerContainers provide a &#8220;Message Driven Pojo&#8221; framework that handles all that for you except implementing the MessageListener. </p>
<p>To take advantage of this you first need to create JMS connection factory and Destination:</p>
<pre class="brush: xml;">
	&lt;bean id=&quot;connectionPool&quot;
		class=&quot;org.springframework.jms.connection.SingleConnectionFactory&quot;&gt;
		&lt;property name=&quot;targetConnectionFactory&quot;&gt;
			&lt;bean class=&quot;org.apache.activemq.ActiveMQConnectionFactory&quot;&gt;
				&lt;property name=&quot;brokerURL&quot; value=&quot;tcp://localhost&quot;/&gt;
			&lt;/bean&gt;
		&lt;/property&gt;
	&lt;/bean&gt;

	&lt;bean id=&quot;messageDestination&quot; class=&quot;org.apache.activemq.command.ActiveMQQueue&quot;&gt;
		&lt;constructor-arg value=&quot;MY.INCOMING&quot; /&gt;
	&lt;/bean&gt;
</pre>
<p>Then implement the MessageListener interface:</p>
<pre class="brush: java;">
@Component(&quot;IncomingMsgProcessor&quot;)
public class IncomingMsgProcessor implements MessageListener {
    @Override
    public void onMessage(Message message)
    {
         //Your message handling code here
    }
}
</pre>
<p>And finally inject an instance into the MessageListenerContainer:</p>
<pre class="brush: xml;">
	&lt;bean id=&quot;incommingMessageListenerContainer&quot;
		class=&quot;org.springframework.jms.listener.DefaultMessageListenerContainer&quot;&gt;
		&lt;property name=&quot;connectionFactory&quot; ref=&quot;connectionPool&quot; /&gt;
		&lt;property name=&quot;destination&quot; ref=&quot;messageDestination&quot; /&gt;
		&lt;property name=&quot;messageListener&quot; ref=&quot;IncomingMsgProcessor&quot; /&gt;
		&lt;!--
			Retry connection every 10 seconds.
		--&gt;
		&lt;property name=&quot;recoveryInterval&quot; value=&quot;10000&quot; /&gt;
	&lt;/bean&gt;
</pre>
<p><code>org.springframework.jms.listener.DefaultMessageListenerContainer</code> gives a nice set of features, but spring offers other implementations if more (or less) is needed. If your message listener needs access to the JMS session you can implement <code>SessionAwareMessageListener</code> which has a method that take the message and session <code>onMessage(Message message, Session session)</code> instead.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/axixmiqui.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/axixmiqui.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/axixmiqui.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/axixmiqui.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/axixmiqui.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/axixmiqui.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/axixmiqui.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/axixmiqui.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/axixmiqui.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/axixmiqui.wordpress.com/113/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=axixmiqui.wordpress.com&blog=2128021&post=113&subd=axixmiqui&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://axixmiqui.wordpress.com/2009/09/02/spring-handling-incoming-jms-messages-asynchronously/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bb74bdec57bafb23131fc84f939939f1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Andy</media:title>
		</media:content>
	</item>
		<item>
		<title>Spring: Injecting JAXB (Un)Marshaller</title>
		<link>http://axixmiqui.wordpress.com/2009/09/01/spring-injecting-jaxb-unmarshaller/</link>
		<comments>http://axixmiqui.wordpress.com/2009/09/01/spring-injecting-jaxb-unmarshaller/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 03:30:44 +0000</pubDate>
		<dc:creator>Andrew Hahn</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[jaxb]]></category>
		<category><![CDATA[spring]]></category>

		<guid isPermaLink="false">http://axixmiqui.wordpress.com/?p=109</guid>
		<description><![CDATA[Create a JAXB context passing an array of root element classes:

	&#60;bean id=&#34;jaxbContext&#34; class=&#34;javax.xml.bind.JAXBContext&#34;
		factory-method=&#34;newInstance&#34;&#62;
		&#60;constructor-arg&#62;
			&#60;list&#62;
				&#60;value type=&#34;java.lang.Class&#34;&#62;my.example.rootclass.Root&#60;/value&#62;
			&#60;/list&#62;
		&#60;/constructor-arg&#62;
	&#60;/bean&#62;

Create prototypes for the marshallers/unmarshallers

	&#60;!-- Pool (un)marshallers to improve performance --&#62;
	&#60;bean id=&#34;marshallerTarget&#34; class=&#34;javax.xml.bind.Marshaller&#34;
		factory-bean=&#34;jaxbContext&#34; factory-method=&#34;createMarshaller&#34;
		scope=&#34;prototype&#34;&#62;
	&#60;/bean&#62;

	&#60;bean id=&#34;unmarshallerTarget&#34; class=&#34;javax.xml.bind.Unmarshaller&#34;
		factory-bean=&#34;jaxbContext&#34; factory-method=&#34;createUnmarshaller&#34;
		scope=&#34;prototype&#34;&#62;
	&#60;/bean&#62;

Wrap these in pool targets:

	&#60;bean id=&#34;poolTargetSource&#34; class=&#34;org.springframework.aop.target.CommonsPoolTargetSource&#34;&#62;
		&#60;property name=&#34;targetBeanName&#34; value=&#34;marshallerTarget&#34; /&#62;
		&#60;property name=&#34;maxSize&#34; value=&#34;25&#34; /&#62;
	&#60;/bean&#62;

	&#60;bean id=&#34;unmarshallerPoolTargetSource&#34; class=&#34;org.springframework.aop.target.CommonsPoolTargetSource&#34;&#62;
		&#60;property name=&#34;targetBeanName&#34; value=&#34;unmarshallerTarget&#34; /&#62;
		&#60;property name=&#34;maxSize&#34; value=&#34;25&#34; /&#62;
	&#60;/bean&#62;

And create pools for reusing marshallers/unmarshallers:

	&#60;bean [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=axixmiqui.wordpress.com&blog=2128021&post=109&subd=axixmiqui&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Create a JAXB context passing an array of root element classes:</p>
<pre class="brush: xml;">
	&lt;bean id=&quot;jaxbContext&quot; class=&quot;javax.xml.bind.JAXBContext&quot;
		factory-method=&quot;newInstance&quot;&gt;
		&lt;constructor-arg&gt;
			&lt;list&gt;
				&lt;value type=&quot;java.lang.Class&quot;&gt;my.example.rootclass.Root&lt;/value&gt;
			&lt;/list&gt;
		&lt;/constructor-arg&gt;
	&lt;/bean&gt;
</pre>
<p>Create prototypes for the marshallers/unmarshallers</p>
<pre class="brush: xml;">
	&lt;!-- Pool (un)marshallers to improve performance --&gt;
	&lt;bean id=&quot;marshallerTarget&quot; class=&quot;javax.xml.bind.Marshaller&quot;
		factory-bean=&quot;jaxbContext&quot; factory-method=&quot;createMarshaller&quot;
		scope=&quot;prototype&quot;&gt;
	&lt;/bean&gt;

	&lt;bean id=&quot;unmarshallerTarget&quot; class=&quot;javax.xml.bind.Unmarshaller&quot;
		factory-bean=&quot;jaxbContext&quot; factory-method=&quot;createUnmarshaller&quot;
		scope=&quot;prototype&quot;&gt;
	&lt;/bean&gt;
</pre>
<p>Wrap these in pool targets:</p>
<pre class="brush: xml;">
	&lt;bean id=&quot;poolTargetSource&quot; class=&quot;org.springframework.aop.target.CommonsPoolTargetSource&quot;&gt;
		&lt;property name=&quot;targetBeanName&quot; value=&quot;marshallerTarget&quot; /&gt;
		&lt;property name=&quot;maxSize&quot; value=&quot;25&quot; /&gt;
	&lt;/bean&gt;

	&lt;bean id=&quot;unmarshallerPoolTargetSource&quot; class=&quot;org.springframework.aop.target.CommonsPoolTargetSource&quot;&gt;
		&lt;property name=&quot;targetBeanName&quot; value=&quot;unmarshallerTarget&quot; /&gt;
		&lt;property name=&quot;maxSize&quot; value=&quot;25&quot; /&gt;
	&lt;/bean&gt;
</pre>
<p>And create pools for reusing marshallers/unmarshallers:</p>
<pre class="brush: xml;">
	&lt;bean id=&quot;marshaller&quot; class=&quot;org.springframework.aop.framework.ProxyFactoryBean&quot;&gt;
		&lt;qualifier value=&quot;marshaller&quot; /&gt;
		&lt;property name=&quot;targetSource&quot; ref=&quot;poolTargetSource&quot; /&gt;
	&lt;/bean&gt;

	&lt;bean id=&quot;unmarshaller&quot; class=&quot;org.springframework.aop.framework.ProxyFactoryBean&quot;&gt;
		&lt;qualifier value=&quot;unmarshaller&quot; /&gt;
		&lt;property name=&quot;targetSource&quot; ref=&quot;unmarshallerPoolTargetSource&quot; /&gt;
	&lt;/bean&gt;
</pre>
<p>This will create one context that will be used to create up to 25 marshallers/unmarshallers. Each will be created on demand until there are 25 in use simultaneously, then calls to them will block until one becomes available. Be careful changing the state on the (un)marshallers. It would probably be a better idea to create prototypes for each configuration and inject a separate pool for each. </p>
<p>These can be injected in the application context or using annotations:</p>
<pre class="brush: java;">
    @Autowired
    @Qualifier(&quot;unmarshaller&quot;)
    private Unmarshaller unmarshaller;

    @Autowired
    @Qualifier(&quot;marshaller&quot;)
    private Marshaller marshaller;
</pre>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/axixmiqui.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/axixmiqui.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/axixmiqui.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/axixmiqui.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/axixmiqui.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/axixmiqui.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/axixmiqui.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/axixmiqui.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/axixmiqui.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/axixmiqui.wordpress.com/109/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=axixmiqui.wordpress.com&blog=2128021&post=109&subd=axixmiqui&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://axixmiqui.wordpress.com/2009/09/01/spring-injecting-jaxb-unmarshaller/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bb74bdec57bafb23131fc84f939939f1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Andy</media:title>
		</media:content>
	</item>
		<item>
		<title>Spring: Injecting ActiveMQ JMS Connection</title>
		<link>http://axixmiqui.wordpress.com/2009/09/01/spring-injecting-activemq-jms-connection/</link>
		<comments>http://axixmiqui.wordpress.com/2009/09/01/spring-injecting-activemq-jms-connection/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 03:03:02 +0000</pubDate>
		<dc:creator>Andrew Hahn</dc:creator>
				<category><![CDATA[activemq]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jms]]></category>
		<category><![CDATA[spring]]></category>

		<guid isPermaLink="false">http://axixmiqui.wordpress.com/?p=106</guid>
		<description><![CDATA[First create a connection factory.

	&#60;bean id=&#34;connectionPool&#34;
		class=&#34;org.springframework.jms.connection.SingleConnectionFactory&#34;&#62;
		&#60;property name=&#34;targetConnectionFactory&#34;&#62;
			&#60;bean class=&#34;org.apache.activemq.ActiveMQConnectionFactory&#34;&#62;
				&#60;property name=&#34;brokerURL&#34; value=&#34;tcp://localhost&#34;/&#62;
			&#60;/bean&#62;
		&#60;/property&#62;
	&#60;/bean&#62;

Create destiation:

	&#60;bean id=&#34;messageDestination&#34; class=&#34;org.apache.activemq.command.ActiveMQQueue&#34;&#62;
		&#60;constructor-arg value=&#34;MY.OUTGOING&#34; /&#62;
	&#60;/bean&#62;

Inject this into spring a template:

	&#60;bean id=&#34;jmsSendTemplate&#34; class=&#34;org.springframework.jms.core.JmsTemplate&#34;&#62;
		&#60;qualifier value=&#34;messageTemplate&#34; /&#62;
		&#60;property name=&#34;connectionFactory&#34;&#62;
			&#60;ref bean=&#34;connectionFactory&#34; /&#62;
		&#60;/property&#62;
		&#60;property name=&#34;defaultDestination&#34;&#62;
			&#60;ref bean=&#34;messageDestination&#34; /&#62;
		&#60;/property&#62;
	&#60;/bean&#62;

Which can then be injected in the application context or using annotations:

    @Autowired
    @Qualifier(&#34;messageTemplate&#34;)
    JmsTemplate jmsReceiveTemplate;

  [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=axixmiqui.wordpress.com&blog=2128021&post=106&subd=axixmiqui&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>First create a connection factory.</p>
<pre class="brush: xml;">
	&lt;bean id=&quot;connectionPool&quot;
		class=&quot;org.springframework.jms.connection.SingleConnectionFactory&quot;&gt;
		&lt;property name=&quot;targetConnectionFactory&quot;&gt;
			&lt;bean class=&quot;org.apache.activemq.ActiveMQConnectionFactory&quot;&gt;
				&lt;property name=&quot;brokerURL&quot; value=&quot;tcp://localhost&quot;/&gt;
			&lt;/bean&gt;
		&lt;/property&gt;
	&lt;/bean&gt;
</pre>
<p>Create destiation:</p>
<pre class="brush: xml;">
	&lt;bean id=&quot;messageDestination&quot; class=&quot;org.apache.activemq.command.ActiveMQQueue&quot;&gt;
		&lt;constructor-arg value=&quot;MY.OUTGOING&quot; /&gt;
	&lt;/bean&gt;
</pre>
<p>Inject this into spring a template:</p>
<pre class="brush: xml;">
	&lt;bean id=&quot;jmsSendTemplate&quot; class=&quot;org.springframework.jms.core.JmsTemplate&quot;&gt;
		&lt;qualifier value=&quot;messageTemplate&quot; /&gt;
		&lt;property name=&quot;connectionFactory&quot;&gt;
			&lt;ref bean=&quot;connectionFactory&quot; /&gt;
		&lt;/property&gt;
		&lt;property name=&quot;defaultDestination&quot;&gt;
			&lt;ref bean=&quot;messageDestination&quot; /&gt;
		&lt;/property&gt;
	&lt;/bean&gt;
</pre>
<p>Which can then be injected in the application context or using annotations:</p>
<pre class="brush: java;">
    @Autowired
    @Qualifier(&quot;messageTemplate&quot;)
    JmsTemplate jmsReceiveTemplate;
</pre>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/axixmiqui.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/axixmiqui.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/axixmiqui.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/axixmiqui.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/axixmiqui.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/axixmiqui.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/axixmiqui.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/axixmiqui.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/axixmiqui.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/axixmiqui.wordpress.com/106/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=axixmiqui.wordpress.com&blog=2128021&post=106&subd=axixmiqui&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://axixmiqui.wordpress.com/2009/09/01/spring-injecting-activemq-jms-connection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bb74bdec57bafb23131fc84f939939f1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Andy</media:title>
		</media:content>
	</item>
		<item>
		<title>Next Sequence Value Using Hibernate Entity Manager</title>
		<link>http://axixmiqui.wordpress.com/2009/09/01/next-sequence-value-using-hibernate-entity-manager/</link>
		<comments>http://axixmiqui.wordpress.com/2009/09/01/next-sequence-value-using-hibernate-entity-manager/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 02:30:53 +0000</pubDate>
		<dc:creator>Andrew Hahn</dc:creator>
				<category><![CDATA[hibernate]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://axixmiqui.wordpress.com/?p=100</guid>
		<description><![CDATA[To retrieve the next value of an Orcale sequence using the Hibernate Entity Manager first create a result set mapping.

@SqlResultSetMapping(name = &#34;NextSequenceVal&#34;, columns = { @ColumnResult(name = &#34;NEXTVAL&#34;) })

The mapping can go anywhere, I like to put it on the entity it is most closely associated with.
Then in your DAO.

    public Long [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=axixmiqui.wordpress.com&blog=2128021&post=100&subd=axixmiqui&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>To retrieve the next value of an Orcale sequence using the Hibernate Entity Manager first create a result set mapping.</p>
<pre class="brush: java;">
@SqlResultSetMapping(name = &quot;NextSequenceVal&quot;, columns = { @ColumnResult(name = &quot;NEXTVAL&quot;) })
</pre>
<p>The mapping can go anywhere, I like to put it on the entity it is most closely associated with.<br />
Then in your DAO.</p>
<pre class="brush: java;">
    public Long getNextElecTransUniqueId()
    {
        Query query = entityManager.createNativeQuery(&quot;SELECT MY_SEQUENCE.NEXTVAL from Dual&quot;,
                &quot;NextSequenceVal&quot;);
        // Workaround for
        // http://opensource.atlassian.com/projects/hibernate/browse/EJB-434
        // which breaks query.getSingleResult()
        return ((BigDecimal) query.getResultList().get(0)).longValue();

    }
</pre>
<p>This example is written for Hibernate 3.3.2, Hibernate Entity Manager 3.4.0, Oracle 10g.</p>
<p><em>Note:</em> in Entity Manager 3.4.0 if you use <code>query.getSingleResult()</code> you will get the exception:<br />
<code>Exception: org.hibernate.exception.SQLGrammarException: could not execute query^M<br />
        at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90)^M<br />
        at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)^M<br />
        at org.hibernate.loader.Loader.doList(Loader.java:2235)^M<br />
        at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2129)^M<br />
        at org.hibernate.loader.Loader.list(Loader.java:2124)^M<br />
        at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:312)^M<br />
        at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1723)^M<br />
        at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165)^M<br />
        at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:175)^M<br />
        at org.hibernate.ejb.QueryImpl.getSingleResult(QueryImpl.java:88)^M<br />
Caused by: java.sql.SQLException: ORA-02287: sequence number not allowed here</code></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/axixmiqui.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/axixmiqui.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/axixmiqui.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/axixmiqui.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/axixmiqui.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/axixmiqui.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/axixmiqui.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/axixmiqui.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/axixmiqui.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/axixmiqui.wordpress.com/100/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=axixmiqui.wordpress.com&blog=2128021&post=100&subd=axixmiqui&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://axixmiqui.wordpress.com/2009/09/01/next-sequence-value-using-hibernate-entity-manager/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bb74bdec57bafb23131fc84f939939f1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Andy</media:title>
		</media:content>
	</item>
		<item>
		<title>Grails fails to start with cryptic error</title>
		<link>http://axixmiqui.wordpress.com/2009/05/25/grails-fails-to-start-with-cryptic-error/</link>
		<comments>http://axixmiqui.wordpress.com/2009/05/25/grails-fails-to-start-with-cryptic-error/#comments</comments>
		<pubDate>Mon, 25 May 2009 17:19:35 +0000</pubDate>
		<dc:creator>Andrew Hahn</dc:creator>
				<category><![CDATA[grails]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[grails groovy closure]]></category>

		<guid isPermaLink="false">http://axixmiqui.wordpress.com/?p=87</guid>
		<description><![CDATA[I ran into a coding error in a Grails (1.0.4, this does not appear to be an issue in 1.1.1) app recently that proved very hard to diagnose. It turned out to be a simple coding error, just hard to spot syntax.
After a simple refactor by someone else I was asked to help figure out [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=axixmiqui.wordpress.com&blog=2128021&post=87&subd=axixmiqui&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I ran into a coding error in a Grails (1.0.4,<em> this does not appear to be an issue in 1.1.1</em>) app recently that proved very hard to diagnose. It turned out to be a simple coding error, just hard to spot syntax.</p>
<p>After a simple refactor by someone else I was asked to help figure out why the app would no longer run. We got a error like:</p>
<p><code> Failed startup of context org.mortbay.jetty.webapp.WebAppContext@59139826{/ClosureTest,/Users/ahahn/devel/src/test/ClosureTest/web-app}<br />
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass<br />
at java.security.AccessController.doPrivileged(Native Method)<br />
at RunApp_groovy$_run_closure2_closure7.doCall(RunApp_groovy:67)<br />
at RunApp_groovy$_run_closure2_closure7.doCall(RunApp_groovy)<br />
at Init_groovy$_run_closure6.doCall(Init_groovy:131)<br />
at RunApp_groovy$_run_closure2.doCall(RunApp_groovy:66)<br />
at RunApp_groovy$_run_closure2.doCall(RunApp_groovy)<br />
at RunApp_groovy$_run_closure1.doCall(RunApp_groovy:57)<br />
at RunApp_groovy$_run_closure1.doCall(RunApp_groovy)<br />
at gant.Gant.dispatch(Gant.groovy:271)<br />
at gant.Gant.this$2$dispatch(Gant.groovy)<br />
at gant.Gant.invokeMethod(Gant.groovy)<br />
at gant.Gant.processTargets(Gant.groovy:436)<br />
at gant.Gant.processArgs(Gant.groovy:372)<br />
Caused by: java.lang.RuntimeException: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass<br />
... 13 more<br />
Caused by: java.lang.reflect.InvocationTargetException<br />
... 13 more<br />
Caused by: org.codehaus.groovy.grails.exceptions.NewInstanceCreationException: Could not create a new instance of class [TestController]!<br />
... 13 more<br />
Caused by: java.lang.VerifyError: (class: TestController$_closure2, method: doCall signature: (Ljava/lang/Object;)Ljava/lang/Object;) Incompatible argument to function<br />
at TestController.(TestController.groovy)<br />
... 13 more<br />
2009-05-25 11:01:25.026::WARN:  Nested in org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass:<br />
java.lang.VerifyError: (class: TestController$_closure2, method: doCall signature: (Ljava/lang/Object;)Ljava/lang/Object;) Incompatible argument to function<br />
at TestController.(TestController.groovy)<br />
at java.security.AccessController.doPrivileged(Native Method)<br />
at RunApp_groovy$_run_closure2_closure7.doCall(RunApp_groovy:67)<br />
at RunApp_groovy$_run_closure2_closure7.doCall(RunApp_groovy)<br />
at Init_groovy$_run_closure6.doCall(Init_groovy:131)<br />
at RunApp_groovy$_run_closure2.doCall(RunApp_groovy:66)<br />
at RunApp_groovy$_run_closure2.doCall(RunApp_groovy)<br />
at RunApp_groovy$_run_closure1.doCall(RunApp_groovy:57)<br />
at RunApp_groovy$_run_closure1.doCall(RunApp_groovy)<br />
at gant.Gant.dispatch(Gant.groovy:271)<br />
at gant.Gant.this$2$dispatch(Gant.groovy)<br />
at gant.Gant.invokeMethod(Gant.groovy)<br />
at gant.Gant.processTargets(Gant.groovy:436)<br />
at gant.Gant.processArgs(Gant.groovy:372)</code></p>
<p>Which I could trace to the TestController code:</p>
<pre class="brush: python;">def list = Test.list( params )
 def testMaps = []
 if(list) {
   list.each {test -&gt;
     if(test.bool) {
       testMaps &lt;&lt; [
         foo: it.foo,
         bar: &quot;Bar ${it.bar}&quot;
       ]
     }
   }
}</pre>
<p>Spot it yet? No really, spot <em><span style="color:#008000;"><strong>it</strong></span></em> yet? It is simply a case of an incomplete refactor, the each closure was changed to have a named parameter &#8216;test&#8217; but not all code in the body was refactored. Most of the references to the current object in the iteration still used the default parameter &#8216;it&#8217;. So what you would expect to be a run time error actual blows up at start up.</p>
<p>Just in case, here it the working code:</p>
<pre class="brush: python;">def list = Test.list( params )
 def testMaps = []
 if(list) {
   list.each {test -&gt;
     if(test.bool) {
       testMaps &lt;&lt; [
         foo: test.foo,
         bar: &quot;Bar ${test.bar}&quot;
       ]
     }
   }
}</pre>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/axixmiqui.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/axixmiqui.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/axixmiqui.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/axixmiqui.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/axixmiqui.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/axixmiqui.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/axixmiqui.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/axixmiqui.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/axixmiqui.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/axixmiqui.wordpress.com/87/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=axixmiqui.wordpress.com&blog=2128021&post=87&subd=axixmiqui&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://axixmiqui.wordpress.com/2009/05/25/grails-fails-to-start-with-cryptic-error/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bb74bdec57bafb23131fc84f939939f1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Andy</media:title>
		</media:content>
	</item>
		<item>
		<title>What jar is that friggin class in?!?!?!</title>
		<link>http://axixmiqui.wordpress.com/2009/03/21/what-jar-is-that-friggin-class-in/</link>
		<comments>http://axixmiqui.wordpress.com/2009/03/21/what-jar-is-that-friggin-class-in/#comments</comments>
		<pubDate>Sat, 21 Mar 2009 17:29:11 +0000</pubDate>
		<dc:creator>Andrew Hahn</dc:creator>
				<category><![CDATA[Web 2.0]]></category>
		<category><![CDATA[grails]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[classpath]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[jar]]></category>
		<category><![CDATA[java.lang.NoClassDefFoundError]]></category>

		<guid isPermaLink="false">http://axixmiqui.wordpress.com/?p=77</guid>
		<description><![CDATA[It seems to me that one of the most common tasks I have to preform when packaging a J2EE project is to find out what jar a class I depend on is in.
I have written (multiple times now) a simple perl script that finds all the jars in a given directory and scans them for [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=axixmiqui.wordpress.com&blog=2128021&post=77&subd=axixmiqui&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>It seems to me that one of the most common tasks I have to preform when packaging a J2EE project is to find out what jar a class I depend on is in.</p>
<p>I have written (multiple times now) a simple perl script that finds all the jars in a given directory and scans them for a file. Thanks to the power of regular expressions you can pass in either <code>com.foo.bar.Class</code> or <code>com/foo/bar/Class</code> which ever is easier to cut-n-paste from the <code>java.lang.NoClassDefFoundError</code>, or similar, stack trace.</p>
<pre class="brush: ruby;">
#!/usr/bin/perl

$JAR_COMMAND = &quot;jar&quot;;
#Uncomment to use fastjar instead
#$JAR_COMMAND = &quot;fastjar&quot;;

$class = &quot;&quot;;
$lookin = &quot;.&quot;;
if(@ARGV &lt; 1) {
    print &quot;USAGE: \n\tclassfinder [dir to search fo jars]
&lt;packageName&gt;\n&quot;;
    exit;
} elsif (@ARGV &gt; 1) {
  $lookin = $ARGV[0];
  $class = $ARGV[1];
} else {
  $class = $ARGV[0];
}

foreach $jar (`find $lookin -name '*\.jar'`) {
    chomp $jar;
    foreach $file (`$JAR_COMMAND -tf $jar`) {
        chomp $file;
        if($file =~ $class) {
            print &quot;$jar:$file\n&quot;}
    }
}
</pre>
<p>The script relies on the standard unix utility <code>find</code>, it works on unix, linux, osx and cygwin. If you have an easy way to do this without using <code>find</code> I&#8217;d love to see it.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/axixmiqui.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/axixmiqui.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/axixmiqui.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/axixmiqui.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/axixmiqui.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/axixmiqui.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/axixmiqui.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/axixmiqui.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/axixmiqui.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/axixmiqui.wordpress.com/77/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=axixmiqui.wordpress.com&blog=2128021&post=77&subd=axixmiqui&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://axixmiqui.wordpress.com/2009/03/21/what-jar-is-that-friggin-class-in/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bb74bdec57bafb23131fc84f939939f1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Andy</media:title>
		</media:content>
	</item>
		<item>
		<title>Minicom ymodem issue</title>
		<link>http://axixmiqui.wordpress.com/2008/05/16/minicom-ymodem-issue/</link>
		<comments>http://axixmiqui.wordpress.com/2008/05/16/minicom-ymodem-issue/#comments</comments>
		<pubDate>Fri, 16 May 2008 16:47:41 +0000</pubDate>
		<dc:creator>Andrew Hahn</dc:creator>
				<category><![CDATA[embedded]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[minicom]]></category>
		<category><![CDATA[ymodem]]></category>

		<guid isPermaLink="false">http://axixmiqui.wordpress.com/?p=21</guid>
		<description><![CDATA[This was a simple fix, but took a while to figure out because of less than informative error messages. While trying to transfer a file (a Linux kernel) using minicom and ymodem we got a protocol failed error when using one machine (my laptop) and it worked on another. After checking versions of minicom, serial [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=axixmiqui.wordpress.com&blog=2128021&post=21&subd=axixmiqui&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>This was a simple fix, but took a while to figure out because of less than informative error messages. While trying to transfer a file (a Linux kernel) using minicom and ymodem we got a <code>protocol failed</code> error when using one machine (my laptop) and it worked on another. After checking versions of minicom, serial adapter drivers, ymodem config, etc&#8230; we noticed that minicom is setup to use <code>/usr/bin/rb</code> and <code>/usr/bin/sb</code> for ymodem comm. Turns out, they weren&#8217;t installed! On Debian (*buntu) the lrzsz package is what is needed. A quick <code>apt-get install lrzsz</code> and we were up and running.</p>
<p>Gotta love cryptic error messages!</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/axixmiqui.wordpress.com/21/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/axixmiqui.wordpress.com/21/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/axixmiqui.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/axixmiqui.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/axixmiqui.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/axixmiqui.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/axixmiqui.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/axixmiqui.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/axixmiqui.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/axixmiqui.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/axixmiqui.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/axixmiqui.wordpress.com/21/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=axixmiqui.wordpress.com&blog=2128021&post=21&subd=axixmiqui&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://axixmiqui.wordpress.com/2008/05/16/minicom-ymodem-issue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bb74bdec57bafb23131fc84f939939f1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Andy</media:title>
		</media:content>
	</item>
		<item>
		<title>Adventures in Grails &#8211; Running more than one version of your app</title>
		<link>http://axixmiqui.wordpress.com/2008/03/29/adventures-in-grails-running-more-than-one-version-of-your-app/</link>
		<comments>http://axixmiqui.wordpress.com/2008/03/29/adventures-in-grails-running-more-than-one-version-of-your-app/#comments</comments>
		<pubDate>Sat, 29 Mar 2008 15:35:17 +0000</pubDate>
		<dc:creator>Andrew Hahn</dc:creator>
				<category><![CDATA[grails]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tomcat]]></category>
		<category><![CDATA[web.xml]]></category>

		<guid isPermaLink="false">http://axixmiqui.wordpress.com/?p=20</guid>
		<description><![CDATA[Update: Posted a patch to the Grails JIRA http://jira.codehaus.org/browse/GRAILS-2771
Grails provides a simple versioning system for your application with the app.version property in application.properties. When you build a .war for deployment the file name is given by "${app.name}-${app.version}.war". For me this is great, I frequently need to run multiple versions of an app to support multiple [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=axixmiqui.wordpress.com&blog=2128021&post=20&subd=axixmiqui&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><b>Update: </b>Posted a patch to the Grails JIRA <a href="http://jira.codehaus.org/browse/GRAILS-2771" title="JIRA Issue 2771">http://jira.codehaus.org/browse/GRAILS-2771</a></p>
<p>Grails provides a simple versioning system for your application with the <code>app.version</code> property in <code>application.properties</code>. When you build a .war for deployment the file name is given by <code>"${app.name}-${app.version}.war"</code>. For me this is great, I frequently need to run multiple versions of an app to support multiple client development branches. However, when I dropped myApp-0.2.war into tomcat&#8217;s webapp dir along side myApp-0.1.war the deployment failed. On tomcat 6.0.16 the error is cryptic and far from helpful <code>SEVERE: Error listenerStart</code>. Tomcat 5.5.26 provided a much more useful error message. It turns out that Grails only includes the version number in the .war file name and not in web.xml where it uses only the app name.</p>
<p>To fix this all you need to do is edit the web.xml of one of the versions and replace the app name with something else. Well, thats not very Groovy! To have Grails do this for you it is a simple change to the Package.groovy script that ships with Grails.</p>
<p>The lines (264-266):</p>
<pre class="brush: python;">

Ant.copy(file:&quot;${grailsHome}/src/war/WEB-INF/web${servletVersion}.template.xml&quot;, tofile:tmpWebXml)

                Ant.replace(file:tmpWebXml, token:&quot;@grails.project.key@&quot;, value:&quot;${grailsAppName}&quot;)
</pre>
<p>get changed to:</p>
<pre class="brush: python;">

Ant.copy(file:&quot;${grailsHome}/src/war/WEB-INF/web${servletVersion}.template.xml&quot;, tofile:tmpWebXml, overwrite:true)

Ant.replace(file:tmpWebXml, token:&quot;@grails.project.key@&quot;, value:&quot;${grailsAppName}-${grailsAppVersion}&quot;)
</pre>
<p>The overwrite:true in the copy task is necessary so that when the version is changed, web.xml is updated. This will break you if you rely on hand made changes to web.tmp.xml if your ~/.grails directory. Though, you might not want to do things that way anyway.On a side note, you may want to define more environments in <code>grails-app/config/DataSources.groovy</code> if you have changed your app&#8217;s DB schema to prevent errors.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/axixmiqui.wordpress.com/20/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/axixmiqui.wordpress.com/20/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/axixmiqui.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/axixmiqui.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/axixmiqui.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/axixmiqui.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/axixmiqui.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/axixmiqui.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/axixmiqui.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/axixmiqui.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/axixmiqui.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/axixmiqui.wordpress.com/20/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=axixmiqui.wordpress.com&blog=2128021&post=20&subd=axixmiqui&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://axixmiqui.wordpress.com/2008/03/29/adventures-in-grails-running-more-than-one-version-of-your-app/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bb74bdec57bafb23131fc84f939939f1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Andy</media:title>
		</media:content>
	</item>
		<item>
		<title>MySQL install fails on Ubuntu with static IP</title>
		<link>http://axixmiqui.wordpress.com/2008/03/12/mysql-install-fails-on-ubuntu-with-static-ip/</link>
		<comments>http://axixmiqui.wordpress.com/2008/03/12/mysql-install-fails-on-ubuntu-with-static-ip/#comments</comments>
		<pubDate>Wed, 12 Mar 2008 21:23:47 +0000</pubDate>
		<dc:creator>Andrew Hahn</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[mysql-server]]></category>
		<category><![CDATA[static ip]]></category>

		<guid isPermaLink="false">http://axixmiqui.wordpress.com/?p=19</guid>
		<description><![CDATA[Update:
It was not the static IP address, but the fact that due to a typo in /etc/network/interfaces the loopback device was not active.
Installing MySQL server on Ubuntu fails if the machine has a static IP address.
sudo apt-get install mysql-server
Results in:
Setting up mysql-server-5.0 (5.0.45-1ubuntu3.1) ...
* Stopping MySQL database server mysqld
...done.
* Starting MySQL database server mysqld
...fail!
invoke-rc.d: initscript [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=axixmiqui.wordpress.com&blog=2128021&post=19&subd=axixmiqui&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><b>Update:</b></p>
<p><i>It was not the static IP address, but the fact that due to a typo in</i> <code>/etc/network/interfaces</code> <i>the loopback device was not active.</i></p>
<p>Installing MySQL server on Ubuntu fails if the machine has a static IP address.</p>
<p><code>sudo apt-get install mysql-server</code></p>
<p>Results in:</p>
<p><code>Setting up mysql-server-5.0 (5.0.45-1ubuntu3.1) ...<br />
* Stopping MySQL database server mysqld<br />
...done.<br />
* Starting MySQL database server mysqld<br />
...fail!<br />
invoke-rc.d: initscript mysql, action "start" failed.<br />
dpkg: error processing mysql-server-5.0 (--configure):<br />
subprocess post-installation script returned error exit status 1<br />
dpkg: dependency problems prevent configuration of mysql-server:<br />
mysql-server depends on mysql-server-5.0; however:<br />
Package mysql-server-5.0 is not configured yet.<br />
dpkg: error processing mysql-server (--configure):<br />
dependency problems - leaving unconfigured<br />
Processing triggers for libc6 ...<br />
ldconfig deferred processing now taking place<br />
Errors were encountered while processing:<br />
mysql-server-5.0<br />
mysql-server<br />
E: Sub-process /usr/bin/dpkg returned an error code (1)</code></p>
<p>To fix this edit <code>/etc/mysql/my.conf</code> and change the <code>bind-address</code> to the static address of the machine. Then rerun apt-get to finish the configuration of the packages.</p>
<p><code>sudo apt-get -f install</code></p>
<p>Reported to <a href="https://bugs.launchpad.net/ubuntu/+source/mysql-dfsg-5.0/+bug/201584">Ubuntu launchpad </a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/axixmiqui.wordpress.com/19/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/axixmiqui.wordpress.com/19/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/axixmiqui.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/axixmiqui.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/axixmiqui.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/axixmiqui.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/axixmiqui.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/axixmiqui.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/axixmiqui.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/axixmiqui.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/axixmiqui.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/axixmiqui.wordpress.com/19/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=axixmiqui.wordpress.com&blog=2128021&post=19&subd=axixmiqui&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://axixmiqui.wordpress.com/2008/03/12/mysql-install-fails-on-ubuntu-with-static-ip/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bb74bdec57bafb23131fc84f939939f1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Andy</media:title>
		</media:content>
	</item>
		<item>
		<title>Adventures in Grails &#8211; Debugging</title>
		<link>http://axixmiqui.wordpress.com/2008/03/11/adventures-in-grails-debugging/</link>
		<comments>http://axixmiqui.wordpress.com/2008/03/11/adventures-in-grails-debugging/#comments</comments>
		<pubDate>Tue, 11 Mar 2008 19:18:05 +0000</pubDate>
		<dc:creator>Andrew Hahn</dc:creator>
				<category><![CDATA[grails]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://axixmiqui.wordpress.com/?p=18</guid>
		<description><![CDATA[Update :
It was  pointed out to me on the Grails user list that the &#8216;grails-debug&#8216; command can be used to do what I posted below. However, the code below is slightly more flexible in that you can control the port, transport and suspend flag with environmental variables.
Working with Grails so far has been great. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=axixmiqui.wordpress.com&blog=2128021&post=18&subd=axixmiqui&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><b>Update :</b></p>
<p><i>It was  pointed out to me on the Grails user list that the</i> &#8216;<code>grails-debug</code>&#8216; <i>command can be used to do what I posted below. However, the code below is slightly more flexible in that you can control the port, transport and suspend flag with environmental variables.</i></p>
<p>Working with Grails so far has been great. However, there is no easy way to (that I could find) to fire up Grails and attach a debugger. So I made a few changes to the startup script <code>$GRAILS_HOME/bin/startGrails</code> to handle a debug argument. This is *NIX systems only (including OS X), I haven&#8217;t worked with batch files in so long (and have no need for it) that I did not make the changes to <code>$GRAILS_HOME/bin/startGrails.bat</code>. Perhaps someone that uses that other OS to develop on could port the changes.</p>
<p>The script uses the environmental variables:</p>
<ul>
<li>JPDA_ADDRESS #the port to listen on, default 8000</li>
<li>JPDA_TRANSPORT #transport to use, default &#8216;dt_socket&#8217;</li>
<li>JPDA_WAIT #if &#8216;y&#8217; then wait for the debugger to attach, default &#8216;n&#8217;</li>
</ul>
<p>If anyone of these is not set it&#8217;s default value is used.</p>
<p>To start the VM for debugging add &#8216;debug&#8217; as the first arg to the grails command.</p>
<p><code>grails debug run-app</code></p>
<p>The changes are in two places. First:</p>
<pre class="brush: python;">

if [ &quot;$1&quot; = &quot;-cp&quot; ] || [ &quot;$1&quot; = &quot;-classpath&quot; ]; then
  CP=$2
  shift 2
fi

ARGUMENTS=$@
</pre>
<p>becomes</p>
<pre class="brush: python;">

#Test for and setup debug option
if [ ! $JPDA_ADDRESS ]
then
   JPDA_ADDRESS=8000
fi

if [ ! $JPDA_TRANSPORT ]
then
   JPDA_TRANSPORT=&quot;dt_socket&quot;
fi

if [ ! $JPDA_WAIT ]
then
   JPDA_WAIT=&quot;n&quot;
fi

if [ $# -ne 0 ]
then
   if [ $1 == &quot;debug&quot; ]
   then
      shift
      GRAILS_DEBUG_OPTS=&quot;-Xdebug -Xrunjdwp:transport=${JPDA_TRANSPORT},address=${JPDA_ADDRESS},server=y,suspend=${JPDA_WAIT}&quot;
   fi
fi

if [ &quot;$1&quot; = &quot;-cp&quot; ] || [ &quot;$1&quot; = &quot;-classpath&quot; ]; then
  CP=$2
  shift 2
fi

ARGUMENTS=$@
</pre>
<p>and in the startGrails function:</p>
<pre class="brush: python;">
startGrails() {
  CLASS=$1
  shift
  JAVA_OPTS=&quot;-server -Xmx512M $JAVA_OPTS&quot;
  # Start the Profiler or the JVM
  if $useprofiler; then
      runProfiler
  else
  	if [ $# -eq 0 ] ; then         # no argument given
         exec &quot;$JAVACMD&quot; $JAVA_OPTS \
          -classpath &quot;$STARTER_CLASSPATH&quot; \
          -Dprogram.name=&quot;$PROGNAME&quot; \
          -Dgroovy.starter.conf=&quot;$GROOVY_CONF&quot; \
          -Dgrails.home=&quot;$GRAILS_HOME&quot; \
          -Dbase.dir=&quot;.&quot; \
          -Dtools.jar=&quot;$TOOLS_JAR&quot; \
          $STARTER_MAIN_CLASS \
          --main $CLASS \
          --conf &quot;$GROOVY_CONF&quot; \
          --classpath &quot;$CP&quot;
  	else
         exec &quot;$JAVACMD&quot; $JAVA_OPTS \
          -classpath &quot;$STARTER_CLASSPATH&quot; \
          -Dprogram.name=&quot;$PROGNAME&quot; \
          -Dgroovy.starter.conf=&quot;$GROOVY_CONF&quot; \
          -Dgrails.home=&quot;$GRAILS_HOME&quot; \
          -Dbase.dir=&quot;.&quot; \
          -Dtools.jar=&quot;$TOOLS_JAR&quot; \
          $STARTER_MAIN_CLASS \
          --main $CLASS \
          --conf &quot;$GROOVY_CONF&quot; \
          --classpath &quot;$CP&quot; \
          &quot;${ARGUMENTS}&quot;
  	fi
  fi
}</pre>
<p>becomes</p>
<pre class="brush: python;">
startGrails() {
  CLASS=$1
  shift
  JAVA_OPTS=&quot;-server -Xmx512M $JAVA_OPTS&quot;
  # Start the Profiler or the JVM
  if $useprofiler; then
      runProfiler
  else
  	if [ $# -eq 0 ] ; then         # no argument given
         exec &quot;$JAVACMD&quot; $JAVA_OPTS \
          -classpath &quot;$STARTER_CLASSPATH&quot; \
          &quot;$GRAILS_DEBUG_OPTS&quot; \
          -Dprogram.name=&quot;$PROGNAME&quot; \
          -Dgroovy.starter.conf=&quot;$GROOVY_CONF&quot; \
          -Dgrails.home=&quot;$GRAILS_HOME&quot; \
          -Dbase.dir=&quot;.&quot; \
          -Dtools.jar=&quot;$TOOLS_JAR&quot; \
          $STARTER_MAIN_CLASS \
          --main $CLASS \
          --conf &quot;$GROOVY_CONF&quot; \
          --classpath &quot;$CP&quot;
  	else
         exec &quot;$JAVACMD&quot; $JAVA_OPTS \
          -classpath &quot;$STARTER_CLASSPATH&quot; \
          &quot;$GRAILS_DEBUG_OPTS&quot; \
          -Dprogram.name=&quot;$PROGNAME&quot; \
          -Dgroovy.starter.conf=&quot;$GROOVY_CONF&quot; \
          -Dgrails.home=&quot;$GRAILS_HOME&quot; \
          -Dbase.dir=&quot;.&quot; \
          -Dtools.jar=&quot;$TOOLS_JAR&quot; \
          $STARTER_MAIN_CLASS \
          --main $CLASS \
          --conf &quot;$GROOVY_CONF&quot; \
          --classpath &quot;$CP&quot; \
          &quot;${ARGUMENTS}&quot;
  	fi
  fi
}</pre>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/axixmiqui.wordpress.com/18/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/axixmiqui.wordpress.com/18/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/axixmiqui.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/axixmiqui.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/axixmiqui.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/axixmiqui.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/axixmiqui.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/axixmiqui.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/axixmiqui.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/axixmiqui.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/axixmiqui.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/axixmiqui.wordpress.com/18/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=axixmiqui.wordpress.com&blog=2128021&post=18&subd=axixmiqui&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://axixmiqui.wordpress.com/2008/03/11/adventures-in-grails-debugging/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bb74bdec57bafb23131fc84f939939f1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Andy</media:title>
		</media:content>
	</item>
	</channel>
</rss>