<?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>tOMPSON's blog</title>
	<atom:link href="http://dertompson.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://dertompson.com</link>
	<description>some personal, more technical - by Thomas Einwaller</description>
	<lastBuildDate>Fri, 09 Dec 2011 23:04:09 +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>The m2e connectors mess</title>
		<link>http://dertompson.com/2011/12/10/the-m2e-connectors-mess/</link>
		<comments>http://dertompson.com/2011/12/10/the-m2e-connectors-mess/#comments</comments>
		<pubDate>Fri, 09 Dec 2011 23:04:09 +0000</pubDate>
		<dc:creator>tompson</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://dertompson.com/?p=979</guid>
		<description><![CDATA[I am using Spring Source Toolsuite as my favorite Eclipse distribution for about two years now and I am very happy with it. It contains most of the plugins I use prepacked and it easy to install the rest via the provided extension list: grails, groovy, m2e, egit, subversive, mylyn ...

With versions 2.8.0 STS ...]]></description>
			<content:encoded><![CDATA[<p>I am using <a href="http://www.springsource.com/developer/sts">Spring Source Toolsuite</a> as my favorite Eclipse distribution for about two years now and I am very happy with it. It contains most of the plugins I use prepacked and it easy to install the rest via the provided extension list: grails, groovy, m2e, egit, subversive, mylyn &#8230;</p>
<p>With versions 2.8.0 STS suddenly included a completely new version 1.0 of m2e (the maven plugin for eclipse) which is incompatible to the old 0.9.x versions. Projects had to be converted and suddenly <a href="http://wiki.eclipse.org/M2E_plugin_execution_not_covered">some of the maven plugins I used were not supported anymore</a>.</p>
<p>In my case especially the JAXB2 generation plugin made problems because it was not executed anymore. I had to add a separate plugin entry to my pom file to get it work again. But still the generated java files were not added to the build path anymore &#8211; adding the manually was no option because every time I executed &#8220;Update project configuration&#8221; it was removed again.</p>
<p>Of course there were already <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=350299">other people having the same problems</a>. <a href="http://grumpyapache.blogspot.com/2011/08/mess-that-is-m2e-connectors.html">There are people</a> that are very unhappy with the current direction of the m2e plugin end Eclipse plugins in general.</p>
<p>It seems that the m2e refactoring was made to solve issues with plugins that modified the filesystem to often which made the developer doing refresh/clean cycle to often:</p>
<blockquote><p>Probably even worse, it did not *always* work for many projects, so we had to go through series of refresh/update dependencies/update configuration/rebuild voodoo (or &#8220;m2eclipse dance&#8221; as some called it) to get projects in a good state. For example MNGECLIPSE-823 was the most voted issue in m2e jira and it was a direct manifestation of this &#8220;flakiness&#8221;.</p></blockquote>
<p>This even triggered a STS 2.8.1 release shortly after the 2.8.0 release that came with the ability to downgrade the m2e plugin to the old 0.9.x version. </p>
<p>I decided to go with the new version and did some more research. It turns out that you need to add the matching m2e connector plugin for any maven plugin you want to use. Via Preferences -> Maven -> Discover I was able to find a JAXB connector which I installed. To get it working I had to upgrade the m2e plugin manually to 1.1 via <a href="http://download.eclipse.org/technology/m2e/milestones/1.1/">http://download.eclipse.org/technology/m2e/milestones/1.1/</a></p>
<p class="wp-flattr-button"></p> <p><a href="http://dertompson.com/?flattrss_redirect&amp;id=979&amp;md5=cd6c0ec38509a36890a339df45323d57" title="Flattr" target="_blank"><img src="http://dertompson.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://dertompson.com/2011/12/10/the-m2e-connectors-mess/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JDBC connection to SQL Server 2008 hangs because of JDK 1.6 u29</title>
		<link>http://dertompson.com/2011/11/29/jdbc-connection-to-sql-server-2008-hangs-because-of-jdk-1-6-u29/</link>
		<comments>http://dertompson.com/2011/11/29/jdbc-connection-to-sql-server-2008-hangs-because-of-jdk-1-6-u29/#comments</comments>
		<pubDate>Tue, 29 Nov 2011 15:52:15 +0000</pubDate>
		<dc:creator>tompson</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[jdbc]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://dertompson.com/?p=969</guid>
		<description><![CDATA[Normally I use MySQL on Mac OS X for developing our timr tracking application timr.com, but some enterprise customers are using it with SQL Server so I have to test it on that database to.

Last week I took it for another spin and found that I was not able to connect to the SQL ...]]></description>
			<content:encoded><![CDATA[<p>Normally I use MySQL on Mac OS X for developing our timr tracking application <a href="http://timr.com">timr.com</a>, but some enterprise customers are using it with SQL Server so I have to test it on that database to.</p>
<p>Last week I took it for another spin and found that I was not able to connect to the SQL Server 2008 running in my VMWare fusion machine anymore. I could see that there was a process at the SQL server for the connection but no data went through. After blaming Windows firewall and SQL Server TCP/port settings if found <a href="http://stackoverflow.com/questions/7841411/driver-getconnection-hangs-using-sqlserver-driver-and-java-1-6-0-29">this discussion on stackoverflow.com</a>.</p>
<p>As it turns out this was caused by an issue introduced with the Java 1.6 u29 as described in <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7103725">this bug report</a>. The SQL server connection uses encryption and something was changed in this area by the Java update.</p>
<p>Running <code>java -version</code> in the command line showed that I had exactlty that version on my system. No wonder &#8211; it came on 2011/11/11 with <a href="http://support.apple.com/kb/HT5045">Java for Mac OS X 10.7 Update 1</a></p>
<p>A workaround is to replace the <code>jsse.jar</code> in the jre/lib folder of the JDK with a version from an older JDK.</p>
<p>&nbsp;</p>
<p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://dertompson.com/2011/11/29/jdbc-connection-to-sql-server-2008-hangs-because-of-jdk-1-6-u29/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Microsoft Exchange Server messes up multipart alternative messages</title>
		<link>http://dertompson.com/2011/07/17/microsoft-exchange-server-messes-up-multipart-alternative-messages/</link>
		<comments>http://dertompson.com/2011/07/17/microsoft-exchange-server-messes-up-multipart-alternative-messages/#comments</comments>
		<pubDate>Sun, 17 Jul 2011 21:09:27 +0000</pubDate>
		<dc:creator>tompson</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[alternative]]></category>
		<category><![CDATA[exchange]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[mime]]></category>
		<category><![CDATA[mulitpart]]></category>

		<guid isPermaLink="false">http://dertompson.com/?p=935</guid>
		<description><![CDATA[For our product timr we are currently implementing new HTML email templates for sending registration mails and other information. The application is based using the Spring Framework and we use Velocity templates for creating the emails.

I put a lot of time into making sure that the emails are displayed correct in as many email ...]]></description>
			<content:encoded><![CDATA[<p>For our product <a href="http://timr.com">timr</a> we are currently implementing new HTML email templates for sending registration mails and other information. The application is based using the Spring Framework and we use Velocity templates for creating the emails.</p>
<p>I put a lot of time into making sure that the emails are displayed correct in as many email clients as possible and we are adding a plain text alternative too. The plain text alternative is included in the mail via <strong>multipart/alternative</strong>. I tried sending the mails to my private gmail account and my company account viewing the received mails via the browser interfaces (gmail and outlook web) and different clients (Outlook, Apple Mail, Thunderbird, &#8230;).</p>
<p>While doing these tests I noticed something I could not explain: The emails sent to my office account <strong>did not allow me to view the plain text alternative</strong> regardless of which client I used.  After wondering a while I started to look for possible explanations and found out that this was caused by the Microsoft Exchange Server we are using.</p>
<p>It seems like the Microsoft Exchange Server decides which part of an email the user can see. Unlike defined in the email standard, where the user (or the client that is used to view the email) decides which part of the email should be displayed. But this is not the first case where Microsoft does not comply with the standards (looking at you Internet Explorer!)</p>
<p>There is <a href="http://www.eggheadcafe.com/microsoft/Exchange-Clients/30509248/preventing-exchange-from-messing-up-multipartalternative-messages.aspx">a forum discussion about this topic here</a>, which is kind of funny to read (flamewar).</p>
<p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://dertompson.com/2011/07/17/microsoft-exchange-server-messes-up-multipart-alternative-messages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tomcat classloader</title>
		<link>http://dertompson.com/2011/06/19/tomcat-classloader/</link>
		<comments>http://dertompson.com/2011/06/19/tomcat-classloader/#comments</comments>
		<pubDate>Sun, 19 Jun 2011 09:56:39 +0000</pubDate>
		<dc:creator>tompson</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[classpath]]></category>
		<category><![CDATA[spring]]></category>
		<category><![CDATA[tomcat]]></category>
		<category><![CDATA[websphere]]></category>

		<guid isPermaLink="false">http://dertompson.com/?p=957</guid>
		<description><![CDATA[I am using Tomcat for deploying my Java Web and Web Service applications for over 10 years now (yes, since the early 3.x versions). In the early days mostly for Struts applications and today for applications based on the Spring Framework (Spring MVC, Spring WebServices, Grails, ...). In many of the projects I am ...]]></description>
			<content:encoded><![CDATA[<p>I am using Tomcat for deploying my Java Web and Web Service applications for over 10 years now (yes, since the early 3.x versions). In the early days mostly for Struts applications and today for applications based on the Spring Framework (Spring MVC, Spring WebServices, Grails, &#8230;). In many of the projects I am consulting, we are using Tomcat in development and production environments too but the topic of this post has only been a discussion within the last few months, in one project.</p>
<p>The customer just started using Tomcat for some applications in production, instead of their default environment WebSphere. I think coming from WebSphere and doing a lot of J2EE applications with EJB is one of the reasons for their idea of putting a lot of dependencies into the library folders of the Tomcat, instead of putting them into the WAR file of the application.</p>
<p>In all of my other projects we are always putting all the required dependencies of an application into its WAR file, so that they are put into the WEB-INF/lib folder of the application. The only things I put in the Tomcat/lib folder are the JAR files for JDBC connections managed by tomcat. This allows me to use different versions of the dependencies in different applications deployed in the same Tomcat (e.g. Spring 2.5 and Spring 3 or JAX-WS 2.1 and JAX-WS 2.2).</p>
<p>Another benefit of the<strong> fat WAR</strong> file is, that the behavior of the application is more consistent. Putting it into different Tomcat installations in development, test or production environments has the same result.</p>
<p>This is also true for development: a new team member just has to download the default Tomcat distribution, fetch the application from the SCM system and start it up. All the required dependencies will be fetched via maven or ivy and put into the application. Requiring developers to put something into their local Tomcat installation (or <strong>even worse into their JDK</strong>) leads to different development environments across the team and issues that are very hard to track.</p>
<p>To support my arguments I did some research and found this article about <a href="http://www.mulesoft.com/tomcat-classpath">Understanding The Tomcat Classpath</a> from MuleSoft. MuleSoft provides a <strong>great Tomcat Enterprise Server named tcat</strong> with many management and monitoring features. In the article they discuss common problems and solutions for Tomcat classpath problems and provide tips and best practice advices. Their best practice advice is:</p>
<blockquote>
<ul>
<li> <strong>Avoid loading libraries and packages other than the standard ones  distributed with Tomcat using the Commons Loader</strong>.  This can cause  compatibility errors.  If you need to share a single library or package  between multiple applications, create &#8220;shared/lib&#8221; and &#8220;shared/classes&#8221;  directories and configure them under the Shared loader in  catalina.properties</li>
<li> An exception to this rule is any common third party shared library,  such as a JDBC driver.  These should be placed directly into  $CATALINA_HOME/lib</li>
<li> When possible, it is a good idea to use Apache Tomcat as recommended  by its developers, as this represents conformance to the Servlet  specification.  <strong>If you&#8217;re finding that you have to configure classpath  rather frequently, you may want to re-think your development process.</strong></li>
</ul>
</blockquote>
<p>Additionally I posted a question on Stackoverflow about <a href="http://stackoverflow.com/questions/6397334/third-party-libraries-best-practice-in-tomcat">Third party libraries best practice in Tomcat</a>. I think the answers pretty much support me in my opinion.</p>
<p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://dertompson.com/2011/06/19/tomcat-classloader/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Hibernate schema update does not create database indices</title>
		<link>http://dertompson.com/2011/06/11/hibernate-schema-update-does-not-create-database-indexes/</link>
		<comments>http://dertompson.com/2011/06/11/hibernate-schema-update-does-not-create-database-indexes/#comments</comments>
		<pubDate>Sat, 11 Jun 2011 21:02:49 +0000</pubDate>
		<dc:creator>tompson</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[grails]]></category>
		<category><![CDATA[hibernate]]></category>
		<category><![CDATA[index]]></category>
		<category><![CDATA[indices]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://dertompson.com/?p=933</guid>
		<description><![CDATA[In one of my Grails consulting projects we tried to define database indices via the static mapping element in the domain classes. A team member tried it an told me that this does not work so I digged a bit deeper to find out what the problem was.

I created a simple test project, configured ...]]></description>
			<content:encoded><![CDATA[<p>In one of my Grails consulting projects we tried to define<strong> database indices</strong> via the<strong> static mapping element in the domain classes</strong>. A team member tried it an told me that this does not work so I digged a bit deeper to find out what the problem was.</p>
<p>I created a simple test project, configured <code>hbm2ddl</code> auto to update, like I am used to and let Grails create a MySQL database schema. It seemed lie my colleague was right, the defined indices were not created (using Grails 1.3.7). Doing some web research brought up <a href="http://stackoverflow.com/questions/3533301/creating-indexes-on-db-with-hibernate-index-annotation">this Stackoverflow posting</a> suggesting that indices are only created when <code>hbm2ddl</code> auto was set to create (or create-drop) &#8211; which seemed to be the case.</p>
<p>In my opinion this had to be a bug in hibernate but some searches on the hibernate.org website brought up <a href="http://community.jboss.org/wiki/HibernateFAQ-MiscellaneousFAQs#The_hibernatehbm2ddlautoupdate_setting_doesnt_create_indexes">a statement about this in the official FAQ</a>:</p>
<blockquote>
<h3 id="The_hibernatehbm2ddlautoupdate_setting_doesnt_create_indexes">The hibernate.hbm2ddl.auto=update setting doesn&#8217;t create indexes</h3>
<p>SchemaUpdate  is activated by this configuration setting. SchemaUpdate is not really  very powerful and comes without any warranties. For example, it does not  create any indexes automatically. Furthermore, SchemaUpdate is only  useful in development, per definition (a production schema is never  updated automatically). You don&#8217;t need indexes in development.</p></blockquote>
<p>I do not agree with that, in our project it is necessary to have indices in development, otherwise we are not able to import the data we need for testing!</p>
<p>Luckily I found issue <a href="http://opensource.atlassian.com/projects/hibernate/browse/HHH-1012">HHH-1012</a> in the Hibernate which states that this behavior was changed (fixed) in current hibernate versions &#8211; I tried it with Hibernate 3.6.4 and this version created indices even when the <code>hbm2ddl</code> setting is configured with update. Grails 1.4 will be using 3.6.x of Hibernate to so it seems like this issue will be resolved soon for our project.</p>
<p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://dertompson.com/2011/06/11/hibernate-schema-update-does-not-create-database-indexes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java .properties files and native2ascii</title>
		<link>http://dertompson.com/2011/06/08/java-properties-files-and-native2ascii/</link>
		<comments>http://dertompson.com/2011/06/08/java-properties-files-and-native2ascii/#comments</comments>
		<pubDate>Wed, 08 Jun 2011 15:04:54 +0000</pubDate>
		<dc:creator>tompson</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[encoding]]></category>

		<guid isPermaLink="false">http://dertompson.com/?p=945</guid>
		<description><![CDATA[In one of our project we lately had some issues with our resource bundle .properties files because not every developer in the team was aware about the specifications of .properties files - http://en.wikipedia.org/wiki/.properties provides quite a good overview.

The most important thing to keep in mind is:
The encoding of a .properties file is ISO-8859-1, also ...]]></description>
			<content:encoded><![CDATA[<p>In one of our project we lately had some issues with our resource bundle .properties files because not every developer in the team was aware about the specifications of .properties files &#8211; <a href="http://en.wikipedia.org/wiki/.properties">http://en.wikipedia.org/wiki/.properties</a> provides quite a good overview.</p>
<p>The most important thing to keep in mind is:</p>
<blockquote><p>The encoding of a .properties file is <a title="ISO/IEC 8859-1" href="http://en.wikipedia.org/wiki/ISO/IEC_8859-1">ISO-8859-1</a>, also known as Latin-1. All non-Latin-1 characters must be entered by using <a title="Unicode" href="http://en.wikipedia.org/wiki/Unicode">Unicode</a> escape characters, e. g. \uHHHH where HHHH is a hexadecimal index of the character in the Unicode character set.</p></blockquote>
<p>In our case a developer did not follow this rule and added characters outside the ISO-8859-1 encoding which lead to problems. The file could not be read by the ResourceBundle classes and it was displayed wrong by some IDE&#8217;s.</p>
<p>Fortunately there is a little tool in every JDK called <code>native2ascii</code> that makes it easy to convert such files into the correct format and to translate all the invalid characters into Unicode escape characters.</p>
<p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://dertompson.com/2011/06/08/java-properties-files-and-native2ascii/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Spring Batch in Grails applications</title>
		<link>http://dertompson.com/2011/05/10/using-spring-batch-in-grails-applications/</link>
		<comments>http://dertompson.com/2011/05/10/using-spring-batch-in-grails-applications/#comments</comments>
		<pubDate>Tue, 10 May 2011 13:12:23 +0000</pubDate>
		<dc:creator>tompson</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[batch]]></category>
		<category><![CDATA[grails]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[hibernate]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[spring]]></category>

		<guid isPermaLink="false">http://dertompson.com/?p=924</guid>
		<description><![CDATA[In one of my grails projects we are using Spring Batch for processing huge amounts of data. We are processing 100000 database entries in one run. When using HibernatePagingItemReader or  HibernateCursorItemReader we ran into OutOfMemory errors.

Using the Eclipse Memory Analyzer I quickly found the reason for this behavior. When starting the Spring Batch ...]]></description>
			<content:encoded><![CDATA[<p>In one of my grails projects we are using <a href="http://static.springsource.org/spring-batch/">Spring Batch</a> for processing huge amounts of data. We are processing 100000 database entries in one run. When using <code>HibernatePagingItemReader</code> or  <code>HibernateCursorItemReader</code> we ran into <code>OutOfMemory</code> errors.</p>
<p>Using the <a href="http://www.eclipse.org/mat/">Eclipse Memory Analyzer</a> I quickly found the reason for this behavior. When starting the <code>Spring Batch Job</code> via the <code>JobLauncher</code> from a <code>Grails Quartz Plugin Job</code> it creates a <code>HibernateSession</code> per default. Even if the Spring Batch jobs handle the HibernateSession correct by fetching only a few items and committing small blocks of elements per transaction all the read items are still held by outer <code>HibernateSession</code> of the <code>Quartz Job</code>. This is how the nested session structure looks like while the job is running:</p>
<p><a href="http://dertompson.com/wp-content/uploads/2011/05/Screen-shot-2011-05-10-at-13.56.48.png"><img class="aligncenter size-full wp-image-925" title="Screen shot 2011-05-10 at 13.56.48" src="http://dertompson.com/wp-content/uploads/2011/05/Screen-shot-2011-05-10-at-13.56.48.png" alt="" width="365" height="222" /></a></p>
<p>The solution was to set the flag<br />
<code><br />
def sessionRequired = false<br />
</code><br />
in the Quartz Job, so it does not require Grails to provide a session. This allows the Spring Batch jobs to handle their sessions without a surrounding session and resolves the memory issue.</p>
<p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://dertompson.com/2011/05/10/using-spring-batch-in-grails-applications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL Row size too large</title>
		<link>http://dertompson.com/2011/04/01/mysql-row-size-too-large/</link>
		<comments>http://dertompson.com/2011/04/01/mysql-row-size-too-large/#comments</comments>
		<pubDate>Fri, 01 Apr 2011 21:18:33 +0000</pubDate>
		<dc:creator>tompson</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[grails]]></category>
		<category><![CDATA[hibernate]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://dertompson.com/?p=918</guid>
		<description><![CDATA[Lately a customer I am helping to build a Grails application had an issue with creating tables in MySQL. They got the following error message when Hibernate tried to create the tables for their domain model:

Column length too big for column 'text' (max = 21845); use BLOB or TEXT instead

The reason was that the ...]]></description>
			<content:encoded><![CDATA[<p>Lately a customer I am helping to build a Grails application had an issue with creating tables in MySQL. They got the following error message when Hibernate tried to create the tables for their domain model:</p>
<p><code>Column length too big for column 'text' (max = 21845); use BLOB or TEXT instead</code></p>
<p>The reason was that the <code>maxSize</code> constraint of this property was set to 40000 and Hibernate tried to create a <code>VARCHAR(40000)</code> column in the MySQL table. Why did Hibernate want to do this? Another interesting thing was that Hibernate was able to create tables for the same model on other developer machines before.</p>
<p>I turned out that on of the developers upgraded the local MySQL installation from 5.1.x to 5.5.x and it was not possible to create any table on the new MySQL version. This was caused by the Hibernate dialect <code>MySQLInnoDBDialect</code> which was used. Switching to <code>MySQL5InnoDBDialect</code> worked partially but brought up the error mentioned  above. So what was the difference?</p>
<p>Looking in the source of the different Hibernate dialect classes helped me understand the reasons. <code>MySQLInnoDBDialect</code> appends <code>type=InnoDB</code> to the create table string which was removed from the syntax in 5.5. It was deprecated in 5.1 already in favor of <code>engine=InnoDB</code> but it did still work. I was not aware that the team did still use the <code>MySQLDialect</code> classes and I advice to use the <code>MySQL5Dialect</code> for applications running on MySQL 5.x databases.</p>
<p>The difference between <code>MySQLDialect</code> and <code>MySQL5Dialect</code> that causes the column length can be found in the registerVarcharTypes method:</p>
<pre class="brush: java">protected void registerVarcharTypes() {
  registerColumnType( Types.VARCHAR, "longtext" );
// registerColumnType( Types.VARCHAR, 16777215, "mediumtext" );
  registerColumnType( Types.VARCHAR, 65535, "varchar($l)" );
}</pre>
<p>This methods defines that for String properties up to 65535 chars length a <code>VARCHAR</code> column should be used while in the <code>MySQLDialect</code> version it looks like:</p>
<pre class="brush: java">protected void registerVarcharTypes() {
  registerColumnType( Types.VARCHAR, "longtext" );
// registerColumnType( Types.VARCHAR, 16777215, "mediumtext" );
// registerColumnType( Types.VARCHAR, 65535, "text" );
  registerColumnType( Types.VARCHAR, 255, "varchar($l)" );
}</pre>
<p>In this versions Strings with a length greater than 255 chars will be stored in a <code>LONGTEXT</code> column which makes perfect sense. You could store one <code>VARCHAR</code> column with 20000 chars in a table row but if you try to add more you get the following error:</p>
<p><code>Error Code: 1118<br />
Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs</code></p>
<p>I think this a bug in the MySQL5Dialect and<a href="http://opensource.atlassian.com/projects/hibernate/browse/HHH-6075"> I filed one in the Hibernate JIRA</a>. Meanwhile you can work around this problem by defining the column type explicitly for your properties.</p>
<p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://dertompson.com/2011/04/01/mysql-row-size-too-large/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>YUI File Upload</title>
		<link>http://dertompson.com/2011/03/28/yui-file-upload/</link>
		<comments>http://dertompson.com/2011/03/28/yui-file-upload/#comments</comments>
		<pubDate>Mon, 28 Mar 2011 21:20:58 +0000</pubDate>
		<dc:creator>tompson</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[yui]]></category>

		<guid isPermaLink="false">http://dertompson.com/?p=915</guid>
		<description><![CDATA[Today I implemented a file upload dialog for a Spring MVC application using Apache commons fileupload on the server side and YUI on the client side. Everything worked nice as described in the Spring reference - only the response from the server was not handled by the upload handler method defined in the callback ...]]></description>
			<content:encoded><![CDATA[<p>Today I implemented a file upload dialog for a Spring MVC application using Apache commons fileupload on the server side and <a href="http://developer.yahoo.com/yui/2/">YUI</a> on the client side. Everything worked nice as described <a href="http://static.springsource.org/spring/docs/current/spring-framework-reference/html/mvc.html#mvc-multipart">in the Spring reference</a> &#8211; only the response from the server was not handled by the upload handler method defined in the callback object of the asyncRequest. After the file was successfully handled by the controller on the server the browser asked me if I want to download the JSON response.</p>
<p>After searching for a long time (to long!) I found <a href="http://yuilibrary.com/forum/viewtopic.php?p=22663">this forum post</a> describing a similar behavior. Seems like the YUI Connect object uses an invisible iframe to do the file upload and the iframe can not handle the response if the content type is unknown. In my case I used <code>application/json</code> which caused the download dialog to pop up. After changing the content type of the response to <code>text/html</code> everything worked as expected.</p>
<p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://dertompson.com/2011/03/28/yui-file-upload/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Splitting Spring configuration in Grails applications</title>
		<link>http://dertompson.com/2011/03/27/splitting-spring-configuration-in-grails-applications/</link>
		<comments>http://dertompson.com/2011/03/27/splitting-spring-configuration-in-grails-applications/#comments</comments>
		<pubDate>Sun, 27 Mar 2011 21:17:25 +0000</pubDate>
		<dc:creator>tompson</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[grails]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[spring]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://dertompson.com/?p=904</guid>
		<description><![CDATA[My colleague Andre wrote an interesting post about this topic already and I have to do a follow up. In one of our projects we followed the assumptions Andre made and we found out that there are some things you might be careful not to stumble over them.

First when experimenting with Spring bean configurations ...]]></description>
			<content:encoded><![CDATA[<p>My colleague <a href="http://blog.andresteingress.com/2010/10/13/grails-quicky-splitting-up-resources-groovy/">Andre wrote an interesting post about this topic</a> already and I have to do a follow up. In one of our projects we followed the assumptions Andre made and we found out that there are some things you might be careful not to stumble over them.</p>
<p>First when experimenting with Spring bean configurations in your Grails application it is useful to change the log level for <code>org.codehaus.groovy.grails.commons</code> to at least <code>warning</code> level. It is configured for <code>error</code> per default which does not show if something is wrong in your XML configuration files.</p>
<p>No on to the problem and my findings. If you try to import Spring XML bean configuration files via your resources.groovy file it would like the following:</p>
<pre>beans = {
  importBeans('file:grails-app/conf/spring/context.xml')
}</pre>
<p>The problem is that this seems to work, but only if you run the application via <code>grails run-app</code> with the embedded servlet container.</p>
<p>As soon as you create a WAR file and deploy it into a tomcat you are getting into trouble. The Spring XML bean configuration files are moved into the folder <code>WEB-INF/spring</code> inside the WAR file. This means the XML files are not reachable via the configured path anymore. The spring folder is not in the classpath so using the classpath: prefix will not work either.</p>
<p>Of course you could make some weird configuration hacks that use a different path in the production environment but the best way in my opinion is to not import Spring XML configurations from the groovy DSL files and vice versa. Just add an additional resources.xml for Spring XML configuration and import other XML files from there with a relative path. You can have both a resources.groovy and a resources.xml side by side.</p>
<p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://dertompson.com/2011/03/27/splitting-spring-configuration-in-grails-applications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

