<?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>gregs &#187; grails</title>
	<atom:link href="http://gregs.tcias.co.uk/category/grails/feed/" rel="self" type="application/rss+xml" />
	<link>http://gregs.tcias.co.uk</link>
	<description>helping me remember what I figure out</description>
	<lastBuildDate>Fri, 03 Feb 2012 01:04:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Deploying grails webapp to Jetty &#8211; resolving a few issues&#8230;</title>
		<link>http://gregs.tcias.co.uk/2010/03/23/deploying-grails-webapp-to-jetty-resolving-a-few-issues/</link>
		<comments>http://gregs.tcias.co.uk/2010/03/23/deploying-grails-webapp-to-jetty-resolving-a-few-issues/#comments</comments>
		<pubDate>Tue, 23 Mar 2010 13:39:03 +0000</pubDate>
		<dc:creator>gregs</dc:creator>
				<category><![CDATA[grails]]></category>
		<category><![CDATA[jetty]]></category>

		<guid isPermaLink="false">http://gregs.tcias.co.uk/?p=506</guid>
		<description><![CDATA[So you have deployed your app and can access the start page of your grails app. If you are like me deploying your app to a Debian\Jetty type of configuration you might come across the following error: PLAIN TEXT CODE: &#8230; <a href="http://gregs.tcias.co.uk/2010/03/23/deploying-grails-webapp-to-jetty-resolving-a-few-issues/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So you have deployed your app and can access the start page of your grails app. If you are like me deploying your app to a Debian\Jetty type of configuration you might come across the following error:</p>
<div class="igBar"><span id="lcode-4"><a href="#" onclick="javascript:showPlainTxt('code-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-4">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">java.<span style="">lang</span>.<span style="">NoClassDefFoundError</span>: javax/servlet/jsp/jstl/core/Config </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>When trying to access a controller from the default start page. I traced this to <a href="http://n4.nabble.com/Grails-1-2-0-JSTL-lib-from-war-td1355918.html#a1355918">a missing dependency in grails</a> (I use SpringSource Tool Suite for development so that maybe the root cause). By opening and editing your /project/grails-app/conf/(default package)/BuildConfig.groovy, add the following under grails.project.dependency.resolution. </p>
<div class="igBar"><span id="lcode-5"><a href="#" onclick="javascript:showPlainTxt('code-5'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-5">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">grails.<span style="">project</span>.<span style="">dependency</span>.<span style="">resolution</span> = <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; ...</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="">dependencies</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; runtime <span style="color:#CC0000;">"javax.servlet:jstl:1.1.2"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// runtime 'mysql:mysql-connector-java:5.1.5'</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Build your war and re-deploy. Still getting an error?? I was. For jetty there was still an issue with calling the controller. After spending some time exploring, it looks like Jetty support was removed from Grails 1.2. I stumbled across a post mentioning installing the <a href="http://www.grails.org/plugin/jetty">grails Jetty plugin</a> with:</p>
<div class="igBar"><span id="lcode-6"><a href="#" onclick="javascript:showPlainTxt('code-6'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-6">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">. <span style="">grails</span> install-plugin jetty </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>After running this, and re-building my war file and re-deploying it one final time, bingo it all worked.</p>
]]></content:encoded>
			<wfw:commentRss>http://gregs.tcias.co.uk/2010/03/23/deploying-grails-webapp-to-jetty-resolving-a-few-issues/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deploying grails app to Jetty</title>
		<link>http://gregs.tcias.co.uk/2010/03/20/deploying-grails-app-to-jetty/</link>
		<comments>http://gregs.tcias.co.uk/2010/03/20/deploying-grails-app-to-jetty/#comments</comments>
		<pubDate>Sat, 20 Mar 2010 13:35:59 +0000</pubDate>
		<dc:creator>gregs</dc:creator>
				<category><![CDATA[*nix]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[grails]]></category>
		<category><![CDATA[jetty]]></category>

		<guid isPermaLink="false">http://gregs.tcias.co.uk/?p=489</guid>
		<description><![CDATA[Short and sweet, step by step guide for creating a grails war and deploying it to your Jetty server (includes apache2 proxy steps) grails war (your app), in this case epic.war Copy to server PLAIN TEXT CODE: scp epic.war user@server:/location &#8230; <a href="http://gregs.tcias.co.uk/2010/03/20/deploying-grails-app-to-jetty/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Short and sweet, step by step guide for creating a grails war and deploying it to your Jetty server (includes apache2 proxy steps)</p>
<ol>
<li>grails war (your app), in this case epic.war</li>
<li>Copy to server
<div class="igBar"><span id="lcode-17"><a href="#" onclick="javascript:showPlainTxt('code-17'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-17">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">scp epic.<span style="">war</span> user@server:/location </div>
</li>
</ol>
</div>
</div>
</div>
<p></li>
<li>On Debian the location for jetty webapps is: /var/lib/jetty/webapps</li>
<li>Copy from upload location to the above folder (I used sudo)</li>
<li>Change permissions:
<div class="igBar"><span id="lcode-18"><a href="#" onclick="javascript:showPlainTxt('code-18'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-18">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sudo chown jetty:adm epic-<span style="color:#800000;color:#800000;">0</span>-<span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">1</span>.<span style="">war</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></li>
<li>created a *.xml context file in /etc/jetty/contexts, with something like this [note case is important!!]:
<div class="igBar"><span id="lcode-19"><a href="#" onclick="javascript:showPlainTxt('code-19'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-19">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;?xml version=<span style="color:#CC0000;">"1.0"</span>&nbsp; encoding=<span style="color:#CC0000;">"ISO-8859-1"</span>?&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;!DOCTYPE Configure PUBLIC <span style="color:#CC0000;">"-//Mort Bay Consulting//DTD Configure//EN"</span> <span style="color:#CC0000;">"http://jetty.mortbay.org/configure.dtd"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;Configure class=<span style="color:#CC0000;">"org.mortbay.jetty.webapp.WebAppContext"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &lt;Set name=<span style="color:#CC0000;">"contextPath"</span>&gt;/epic&lt;/Set&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &lt;Set name=<span style="color:#CC0000;">"war"</span>&gt;&lt;SystemProperty name=<span style="color:#CC0000;">"jetty.home"</span> default=<span style="color:#CC0000;">"."</span>/&gt;/webapps/epic-<span style="color:#800000;color:#800000;">0</span>-<span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">1</span>.<span style="">war</span>&lt;/Set&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/Configure&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></li>
<li>restart jetty :
<div class="igBar"><span id="lcode-20"><a href="#" onclick="javascript:showPlainTxt('code-20'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-20">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sudo /etc/init.<span style="">d</span>/jetty restart </div>
</li>
</ol>
</div>
</div>
</div>
<p> (try stop/start as well)</li>
<li>test with :
<div class="igBar"><span id="lcode-21"><a href="#" onclick="javascript:showPlainTxt('code-21'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-21">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">lynx http:<span style="color:#FF9933; font-style:italic;">//localhost:8080/epic/ </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></li>
<li>Nice but I'd like http://localhost/epic/ so enable mod_proxy in apache if you haven't already :
<div class="igBar"><span id="lcode-22"><a href="#" onclick="javascript:showPlainTxt('code-22'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-22">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">a2enmod proxy </div>
</li>
</ol>
</div>
</div>
</div>
<p></li>
<li>edit /etc/apache2/mods-enabled/proxy.load and if not present add at end:
<div class="igBar"><span id="lcode-23"><a href="#" onclick="javascript:showPlainTxt('code-23'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-23">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.<span style="">so</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></li>
<li>edit your virtualhost conf file I am using 000-default and add:
<div class="igBar"><span id="lcode-24"><a href="#" onclick="javascript:showPlainTxt('code-24'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-24">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ProxyRequests Off</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;Proxy *&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; Order deny,allow</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;Allow from all</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/Proxy&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ProxyPass        /epic http:<span style="color:#FF9933; font-style:italic;">//localhost:8080/epic</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ProxyPassReverse /epic http:<span style="color:#FF9933; font-style:italic;">//localhost:8080/epic</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ProxyPreserveHost On </div>
</li>
</ol>
</div>
</div>
</div>
<p></li>
<li>restart apache : 
<div class="igBar"><span id="lcode-25"><a href="#" onclick="javascript:showPlainTxt('code-25'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-25">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sudo /etc/init.<span style="">d</span>/apache2 restart </div>
</li>
</ol>
</div>
</div>
</div>
<p></li>
<li>now you can
<div class="igBar"><span id="lcode-26"><a href="#" onclick="javascript:showPlainTxt('code-26'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-26">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">lynx http:<span style="color:#FF9933; font-style:italic;">//localhost/epic/ </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></li>
</ol>
<p><strong>Update: </strong> I had omitted the <code>ProxyPreserveHost On</code>  from the Apache configuration, which resulted in css, images and external javascripts not loading. It also caused an issue with accessing controllers.</p>
<p>Sources:</p>
<ul>
<li><a href="http://docs.codehaus.org/display/JETTY/Configuring+mod_proxy">Configuring mod_proxy</a></li>
<li><a href="http://www.enavigo.com/2008/08/29/deploying-a-web-application-to-jetty/">Deploying a web application to Jetty</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://gregs.tcias.co.uk/2010/03/20/deploying-grails-app-to-jetty/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

