<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6086730485636404739</id><updated>2012-01-23T03:55:13.694-08:00</updated><category term='VBScript'/><category term='VBA'/><category term='SMS'/><category term='Tomcat'/><category term='GWT'/><category term='MyEclipse'/><category term='MySQL'/><category term='Bugs'/><category term='Outlook'/><category term='ORM'/><category term='Selenium'/><category term='Hibernate'/><category term='Hibernate Annotations'/><category term='Spring'/><category term='JUnit'/><category term='Log4J'/><category term='Java'/><category term='HTC Incredible S'/><category term='Cell Broadcast'/><category term='AVG'/><category term='Testing'/><title type='text'>Glennn's Stuff</title><subtitle type='html'>A collection of information that I want to record for later use.  Mainly regarding Java, Hibernate, MySql, Javascript and related issues.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://drglennn.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://drglennn.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Glennn</name><uri>http://www.blogger.com/profile/11073435827711258234</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>27</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6086730485636404739.post-8439159794657161458</id><published>2012-01-09T14:54:00.000-08:00</published><updated>2012-01-09T15:17:48.619-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='HTC Incredible S'/><category scheme='http://www.blogger.com/atom/ns#' term='SMS'/><category scheme='http://www.blogger.com/atom/ns#' term='Cell Broadcast'/><title type='text'>HTC Incredible S Android Update - SMS/Messages Problem</title><content type='html'>This morning I got a notification on my phone to upgrade to Android Version 2.3.5 and the new version of HTC Sense (3.0).  That's great - and I'm really happy with the upgrade.&lt;br /&gt;&lt;br /&gt;However, one annoying side-effect for me is I immediately started receiving SMS notifications which were blank (or just said "SMS message") and displayed the location I was in (for example my suburb or nearby suburbs).  Each message came with the option to "save" or "cancel".  If I selected 'cancel' it would just go away. If I select save, it appears in my text messages coming from the sender '50'.  &lt;br /&gt;&lt;br /&gt;The annoying part is that these messages just kept coming. As I move my phone around the house it would every minute or so get messages from the sender "50" and give me an annoying notification that I had to respond to.&lt;br /&gt;&lt;br /&gt;It turns out that these messages appear to be "Cell Broadcast" messages.  &lt;a href="http://www.cellbroadcastforum.org/whatisCB/index.html"&gt;The cell broadcast forum&lt;/a&gt; states that: &lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;Cell Broadcast (CB) is a mobile technology that allows messages (currently of up to 15 pages of up to 93 characters) to be broadcast to all mobile handsets and similar devices within a designated geographical area. The broadcast range can be varied, from a single cell to the entire network.&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;There's more information about it at &lt;a href="http://en.wikipedia.org/wiki/Cell_Broadcast"&gt;Wikipedia - Cell Broadcast&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;In any case, it seems that the update to Android 2.3.5 and HTC Sense 3.0 on the HTC phone has caused it to start notifying me of each Cell Broadcast messages coming from channel 50.  (Presuming they didn't just start broadcasting in my area this morning at the exact time I did my update, at least!)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Solution:&lt;/span&gt; I decided I would leave Cell Broadcasts generally enabled on the phone, but simply disable this channel.  &lt;br /&gt;&lt;br /&gt;To do this, you go to Settings on your Android phone. Then select Call.  In this menu you have the option to enable or disable "Cell broadcast". I left it enabled and clicked on the "Cell broadcast settings" option, further down the list.  Here I found the broadcast channel causing the problems (50) and clicked on it to select "disable".  &lt;br /&gt;&lt;br /&gt;This fixed the problem and my phone is back to its normal, quiet self!  I guess I could have disabled "Cell Broadcast" entirely, but, who knows?  One day there may be a flood coming to my area and I'll be glad I left it on!&lt;br /&gt;&lt;br /&gt;I couldn't find anything about this specific issue on the internet, so thought I'd record this for others who experience the same problem. I'd be interested in comments if others know more about this and there is a better way to handle it. Was it just me, or are others are also experiencing this problem?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6086730485636404739-8439159794657161458?l=drglennn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://drglennn.blogspot.com/feeds/8439159794657161458/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6086730485636404739&amp;postID=8439159794657161458' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/8439159794657161458'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/8439159794657161458'/><link rel='alternate' type='text/html' href='http://drglennn.blogspot.com/2012/01/htc-incredible-s-android-update.html' title='HTC Incredible S Android Update - SMS/Messages Problem'/><author><name>Glennn</name><uri>http://www.blogger.com/profile/11073435827711258234</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6086730485636404739.post-2611425035632813597</id><published>2010-01-28T01:05:00.000-08:00</published><updated>2010-01-28T04:03:50.106-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GWT'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Testing'/><category scheme='http://www.blogger.com/atom/ns#' term='JUnit'/><title type='text'>Problems with Unit Testing using GWTTestCase and GWT FlexTable()</title><content type='html'>I'm currently writing a web-application using Google Web Toolkit (GWT).  To provide test-coverage for the app, I'm writing client-side unit tests that extend GWTTestCase.&lt;br /&gt;&lt;br /&gt;Recently I found that some (previously passing) tests were failing.  They threw a JavaScript Exception (&lt;span style="font-style: italic;"&gt;com.google.gwt.core.client.JavaScriptException (null) null)&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;java.lang.RuntimeException: Remote test failed at 192.168.1.1 / Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    at com.google.gwt.junit.JUnitShell.processTestResult(JUnitShell.java:1083)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:1203)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:1198)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:1198)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:1104)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    at com.google.gwt.junit.JUnitShell.runTest(JUnitShell.java:523)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    at com.google.gwt.junit.client.GWTTestCase.runTest(GWTTestCase.java:406)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    at junit.framework.TestCase.runBare(TestCase.java:134)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    at junit.framework.TestResult$1.protect(TestResult.java:110)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    at junit.framework.TestResult.runProtected(TestResult.java:128)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    at junit.framework.TestResult.run(TestResult.java:113)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    at junit.framework.TestCase.run(TestCase.java:124)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    at com.google.gwt.junit.client.GWTTestCase.run(GWTTestCase.java:282)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    at junit.framework.TestSuite.runTest(TestSuite.java:232)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    at junit.framework.TestSuite.run(TestSuite.java:227)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    at junit.framework.TestSuite.runTest(TestSuite.java:232)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    at junit.framework.TestSuite.run(TestSuite.java:227)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    at org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:76)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Caused by: com.google.gwt.core.client.JavaScriptException: (null): null&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    at &lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;...&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The tests were failing on a GWT constructor call designed to create a new FlexTable:&lt;br /&gt;&lt;br /&gt;        FlexTable flexTable = new FlexTable();&lt;br /&gt;&lt;br /&gt;Confused about what could be going on, I created a simple test which just called this constructor and found that it failed:&lt;b&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(127, 0, 85);"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:trackmoves/&gt;   &lt;w:trackformatting/&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:donotpromoteqf/&gt;   &lt;w:lidthemeother&gt;EN-AU&lt;/w:LidThemeOther&gt;   &lt;w:lidthemeasian&gt;X-NONE&lt;/w:LidThemeAsian&gt;   &lt;w:lidthemecomplexscript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;    &lt;w:splitpgbreakandparamark/&gt;    &lt;w:dontvertaligncellwithsp/&gt;    &lt;w:dontbreakconstrainedforcedtables/&gt;    &lt;w:dontvertalignintxbx/&gt;    &lt;w:word11kerningpairs/&gt;    &lt;w:cachedcolbalance/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;   &lt;m:mathpr&gt;    &lt;m:mathfont val="Cambria Math"&gt;    &lt;m:brkbin val="before"&gt;    &lt;m:brkbinsub val="&amp;#45;-"&gt;    &lt;m:smallfrac val="off"&gt;    &lt;m:dispdef/&gt;    &lt;m:lmargin val="0"&gt;    &lt;m:rmargin val="0"&gt;    &lt;m:defjc val="centerGroup"&gt;    &lt;m:wrapindent val="1440"&gt;    &lt;m:intlim val="subSup"&gt;    &lt;m:narylim val="undOvr"&gt;   &lt;/m:mathPr&gt;&lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" defunhidewhenused="true" defsemihidden="true" defqformat="false" defpriority="99" latentstylecount="267"&gt;   &lt;w:lsdexception locked="false" priority="0" semihidden="false" unhidewhenused="false" qformat="true" name="Normal"&gt;   &lt;w:lsdexception locked="false" priority="9" semihidden="false" unhidewhenused="false" qformat="true" name="heading 1"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 2"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 3"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 4"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 5"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 6"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 7"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 8"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 9"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 1"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 2"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 3"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 4"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 5"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 6"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 7"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 8"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 9"&gt;   &lt;w:lsdexception locked="false" priority="35" qformat="true" name="caption"&gt;   &lt;w:lsdexception locked="false" priority="10" semihidden="false" unhidewhenused="false" qformat="true" name="Title"&gt;   &lt;w:lsdexception locked="false" priority="1" name="Default Paragraph Font"&gt;   &lt;w:lsdexception locked="false" priority="11" semihidden="false" unhidewhenused="false" qformat="true" name="Subtitle"&gt;   &lt;w:lsdexception locked="false" priority="22" semihidden="false" unhidewhenused="false" qformat="true" name="Strong"&gt;   &lt;w:lsdexception locked="false" priority="20" semihidden="false" unhidewhenused="false" qformat="true" name="Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="59" semihidden="false" unhidewhenused="false" name="Table Grid"&gt;   &lt;w:lsdexception locked="false" unhidewhenused="false" name="Placeholder Text"&gt;   &lt;w:lsdexception locked="false" priority="1" semihidden="false" unhidewhenused="false" qformat="true" name="No Spacing"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" unhidewhenused="false" name="Revision"&gt;   &lt;w:lsdexception locked="false" priority="34" semihidden="false" unhidewhenused="false" qformat="true" name="List Paragraph"&gt;   &lt;w:lsdexception locked="false" priority="29" semihidden="false" unhidewhenused="false" qformat="true" name="Quote"&gt;   &lt;w:lsdexception locked="false" priority="30" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Quote"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="19" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="21" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="31" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Reference"&gt;   &lt;w:lsdexception locked="false" priority="32" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Reference"&gt;   &lt;w:lsdexception locked="false" priority="33" semihidden="false" unhidewhenused="false" qformat="true" name="Book Title"&gt;   &lt;w:lsdexception locked="false" priority="37" name="Bibliography"&gt;   &lt;w:lsdexception locked="false" priority="39" qformat="true" name="TOC Heading"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face  {font-family:"Cambria Math";  panose-1:2 4 5 3 5 4 6 3 2 4;  mso-font-charset:0;  mso-generic-font-family:roman;  mso-font-pitch:variable;  mso-font-signature:-1610611985 1107304683 0 0 159 0;} @font-face  {font-family:Calibri;  panose-1:2 15 5 2 2 2 4 3 2 4;  mso-font-charset:0;  mso-generic-font-family:swiss;  mso-font-pitch:variable;  mso-font-signature:-1610611985 1073750139 0 0 159 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal  {mso-style-unhide:no;  mso-style-qformat:yes;  mso-style-parent:"";  margin-top:0cm;  margin-right:0cm;  margin-bottom:10.0pt;  margin-left:0cm;  line-height:115%;  mso-pagination:widow-orphan;  font-size:11.0pt;  font-family:"Calibri","sans-serif";  mso-ascii-font-family:Calibri;  mso-ascii-theme-font:minor-latin;  mso-fareast-font-family:Calibri;  mso-fareast-theme-font:minor-latin;  mso-hansi-font-family:Calibri;  mso-hansi-theme-font:minor-latin;  mso-bidi-font-family:"Times New Roman";  mso-bidi-theme-font:minor-bidi;  mso-fareast-language:EN-US;} p.MsoNoSpacing, li.MsoNoSpacing, div.MsoNoSpacing  {mso-style-priority:1;  mso-style-unhide:no;  mso-style-qformat:yes;  mso-style-parent:"";  margin:0cm;  margin-bottom:.0001pt;  mso-pagination:widow-orphan;  font-size:11.0pt;  font-family:"Calibri","sans-serif";  mso-ascii-font-family:Calibri;  mso-ascii-theme-font:minor-latin;  mso-fareast-font-family:Calibri;  mso-fareast-theme-font:minor-latin;  mso-hansi-font-family:Calibri;  mso-hansi-theme-font:minor-latin;  mso-bidi-font-family:"Times New Roman";  mso-bidi-theme-font:minor-bidi;  mso-fareast-language:EN-US;} .MsoChpDefault  {mso-style-type:export-only;  mso-default-props:yes;  mso-ascii-font-family:Calibri;  mso-ascii-theme-font:minor-latin;  mso-fareast-font-family:Calibri;  mso-fareast-theme-font:minor-latin;  mso-hansi-font-family:Calibri;  mso-hansi-theme-font:minor-latin;  mso-bidi-font-family:"Times New Roman";  mso-bidi-theme-font:minor-bidi;  mso-fareast-language:EN-US;} .MsoPapDefault  {mso-style-type:export-only;  margin-bottom:10.0pt;  line-height:115%;} @page Section1  {size:595.3pt 841.9pt;  margin:72.0pt 72.0pt 72.0pt 72.0pt;  mso-header-margin:35.4pt;  mso-footer-margin:35.4pt;  mso-paper-source:0;} div.Section1  {page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable  {mso-style-name:"Table Normal";  mso-tstyle-rowband-size:0;  mso-tstyle-colband-size:0;  mso-style-noshow:yes;  mso-style-priority:99;  mso-style-qformat:yes;  mso-style-parent:"";  mso-padding-alt:0cm 5.4pt 0cm 5.4pt;  mso-para-margin-top:0cm;  mso-para-margin-right:0cm;  mso-para-margin-bottom:10.0pt;  mso-para-margin-left:0cm;  line-height:115%;  mso-pagination:widow-orphan;  font-size:11.0pt;  font-family:"Calibri","sans-serif";  mso-ascii-font-family:Calibri;  mso-ascii-theme-font:minor-latin;  mso-fareast-font-family:"Times New Roman";  mso-fareast-theme-font:minor-fareast;  mso-hansi-font-family:Calibri;  mso-hansi-theme-font:minor-latin;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;p class="MsoNoSpacing"&gt;&lt;b&gt;&lt;span style="color: rgb(127, 0, 85);"&gt;package&lt;/span&gt;&lt;/b&gt; test.client;&lt;/p&gt;  &lt;p class="MsoNoSpacing"&gt;&lt;b&gt;&lt;span style="color: rgb(127, 0, 85);"&gt;import&lt;/span&gt;&lt;/b&gt; com.google.gwt.junit.client.GWTTestCase;&lt;span style="color: teal;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNoSpacing"&gt;&lt;b&gt;&lt;span style="color: rgb(127, 0, 85);"&gt;import&lt;/span&gt;&lt;/b&gt; com.google.gwt.user.client.ui.FlexTable;&lt;span style="color: teal;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNoSpacing"&gt;&lt;span style="color: teal;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNoSpacing"&gt;&lt;b&gt;&lt;span style="color: rgb(127, 0, 85);"&gt;public&lt;/span&gt;&lt;/b&gt; &lt;b&gt;&lt;span style="color: rgb(127, 0, 85);"&gt;class&lt;/span&gt;&lt;/b&gt; FlexTableTest &lt;b&gt;&lt;span style="color: rgb(127, 0, 85);"&gt;extends&lt;/span&gt;&lt;/b&gt; GWTTestCase {&lt;span style="color: teal;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNoSpacing" style="margin-left: 36pt;"&gt;&lt;b&gt;&lt;span style="color: rgb(127, 0, 85);"&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style="color: teal;"&gt; &lt;/span&gt;&lt;b&gt;&lt;span style="color: rgb(127, 0, 85);"&gt;void&lt;/span&gt;&lt;/b&gt;&lt;span style="color: teal;"&gt; testFlexTable() {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNoSpacing" style="margin-left: 36pt;"&gt;&lt;span style="color: teal;"&gt;&lt;span style=""&gt;                &lt;/span&gt;FlexTable &lt;u&gt;flexTable&lt;/u&gt; = &lt;/span&gt;&lt;b&gt;&lt;span style="color: rgb(127, 0, 85);"&gt;new&lt;/span&gt;&lt;/b&gt;&lt;span style="color: teal;"&gt; FlexTable();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNoSpacing" style="margin-left: 36pt;"&gt;&lt;span style="color: teal;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNoSpacing" style="margin-left: 36pt;"&gt;&lt;span style="color: teal;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNoSpacing" style="margin-left: 36pt;"&gt;&lt;span style="color: rgb(100, 100, 100);"&gt;@Override&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNoSpacing" style="margin-left: 36pt;"&gt;&lt;b&gt;&lt;span style="color: rgb(127, 0, 85);"&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style="color: teal;"&gt; String getModuleName() {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNoSpacing" style="margin-left: 36pt; text-indent: 36pt;"&gt;&lt;b&gt;&lt;span style="color: rgb(127, 0, 85);"&gt;return&lt;/span&gt;&lt;/b&gt;&lt;span style="color: teal;"&gt; &lt;/span&gt;&lt;span style="color: rgb(42, 0, 255);"&gt;"test.FlexTableTester"&lt;/span&gt;&lt;span style="color: teal;"&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNoSpacing" style="margin-left: 36pt;"&gt;&lt;span style="color: teal;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNoSpacing"&gt;&lt;span style="color: teal;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;So - I created a completely new Project package from scratch and then found it passed just fine.&lt;br /&gt;&lt;br /&gt;So - what was going on?  Well it turns it was to do with my "myProject.gwt.xml" file.  It seems that when you run the GWT tests using GWTTestCase, the code is compiled and run on a virtual browser - that may be different from the actual browser you're using to run the application in for manual testing or acceptance tests.  Obvious, in retrospect!&lt;br /&gt;&lt;br /&gt;Now, in my project, I had decided that since I was only running the application (and Selenium acceptance tests) in Internet Explorer browsers, I could save GWT compile time by only compiling one permutation of the GWT options - that for Internet Explorer.&lt;br /&gt;&lt;br /&gt;To do this, I had introduced the following line of code into my "myProject.gwt.xml" file:&lt;br /&gt;&lt;br /&gt;      &amp;lt;set-property name="user.agent" value="ie6"/&amp;gt;&lt;br /&gt;&lt;br /&gt;This code tells GWT to only compile one permutation - for Internet Explorer.  However, it seems that the "virtual browser" used by GWTTestCase is not InternetExplorer (or at least not fully compatible with ie6 mode). &lt;br /&gt;&lt;br /&gt;Having this property set to a particular browser (IE6) led to the problems I was having with my tests.&lt;br /&gt;&lt;br /&gt;All I had to do was r&lt;span style="font-weight: bold;"&gt;emove the &amp;lt;set-poroperty name="user.agent" value="ie6"/&amp;gt; tag &lt;/span&gt;and the tests worked perfectly.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6086730485636404739-2611425035632813597?l=drglennn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://drglennn.blogspot.com/feeds/2611425035632813597/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6086730485636404739&amp;postID=2611425035632813597' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/2611425035632813597'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/2611425035632813597'/><link rel='alternate' type='text/html' href='http://drglennn.blogspot.com/2010/01/problems-with-unit-testing-using.html' title='Problems with Unit Testing using GWTTestCase and GWT FlexTable()'/><author><name>Glennn</name><uri>http://www.blogger.com/profile/11073435827711258234</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6086730485636404739.post-5885228893230259836</id><published>2010-01-24T16:34:00.000-08:00</published><updated>2010-01-24T17:20:21.958-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GWT'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Testing'/><category scheme='http://www.blogger.com/atom/ns#' term='Selenium'/><title type='text'>Selenium Testing GWT - upgrading to GWT 2.0 and Selenium 2.0a1</title><content type='html'>Recently, I'd written some acceptance tests for a Google Web Toolkit (GWT) based Web Application using SeleniumRC v1.0.1.&lt;br /&gt;&lt;br /&gt;I was using GWT 1.7.1 and the tests were all working nicely.  I had a Tree in the WebApp and was using GWT TreeItem elements for the nodes in this tree. I was also using GWT drag and drop (&lt;a href="http://code.google.com/p/gwt-dnd/"&gt;http://code.google.com/p/gwt-dnd/&lt;/a&gt;) to help with selecting and dragging TreeItems.&lt;br /&gt;&lt;br /&gt;Over the last week I decided to upgrade the version of GWT from 1.7.1 to 2.0.  As a result a bunch of Selenium functionality started failing.  This included:&lt;br /&gt;&lt;ul&gt;&lt;li&gt; Selenium.click() method ceased to properly select a GWT TreeItem. A manual click  will make the TreeItem go blue (ie. look selected and have  "gwt-TreeItem-selected" class attribute in the DOM), but the selenium  test doesn't.&lt;/li&gt;&lt;li&gt;Selenium.type("//*[@contentEditable='true']", newText) method ceased to properly enter text into an editable IFrame element.&lt;/li&gt;&lt;li&gt;Multiple Selection (via Drag and Drop GWT) failed to show visibly what was selected.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;After trying a bunch of things, I came to the conclusion that there is significant Selenium functionality that worked correctly when testing GWT 1.7.1 web-apps that no longer works with GWT 2.0.&lt;br /&gt;&lt;br /&gt;A simple example was the following code (which I asked about on &lt;a href="http://stackoverflow.com/questions/2084233/selenium-testing-of-gwt-2-0"&gt;StackOverflow&lt;/a&gt;) which tests the online GWT web-page demo for TreeItems and should click() on a treeItem.  However, it doesn't produce the same functionality as a manual mouse-click:&lt;br /&gt;&lt;pre class="prettyprint"&gt;&lt;code&gt;&lt;span class="kwd"&gt;package&lt;/span&gt;&lt;span class="pln"&gt; test&lt;/span&gt;&lt;span class="pun"&gt;;&lt;/span&gt;&lt;span class="pln"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="kwd"&gt;import&lt;/span&gt;&lt;span class="pln"&gt; org&lt;/span&gt;&lt;span class="pun"&gt;.&lt;/span&gt;&lt;span class="pln"&gt;junit&lt;/span&gt;&lt;span class="pun"&gt;.&lt;/span&gt;&lt;span class="typ"&gt;Before&lt;/span&gt;&lt;span class="pun"&gt;;&lt;/span&gt;&lt;span class="pln"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="kwd"&gt;import&lt;/span&gt;&lt;span class="pln"&gt; org&lt;/span&gt;&lt;span class="pun"&gt;.&lt;/span&gt;&lt;span class="pln"&gt;junit&lt;/span&gt;&lt;span class="pun"&gt;.&lt;/span&gt;&lt;span class="typ"&gt;Test&lt;/span&gt;&lt;span class="pun"&gt;;&lt;/span&gt;&lt;span class="pln"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="kwd"&gt;import&lt;/span&gt;&lt;span class="pln"&gt; com&lt;/span&gt;&lt;span class="pun"&gt;.&lt;/span&gt;&lt;span class="pln"&gt;thoughtworks&lt;/span&gt;&lt;span class="pun"&gt;.&lt;/span&gt;&lt;span class="pln"&gt;selenium&lt;/span&gt;&lt;span class="pun"&gt;.&lt;/span&gt;&lt;span class="typ"&gt;DefaultSelenium&lt;/span&gt;&lt;span class="pun"&gt;;&lt;/span&gt;&lt;span class="pln"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="kwd"&gt;import&lt;/span&gt;&lt;span class="pln"&gt; com&lt;/span&gt;&lt;span class="pun"&gt;.&lt;/span&gt;&lt;span class="pln"&gt;thoughtworks&lt;/span&gt;&lt;span class="pun"&gt;.&lt;/span&gt;&lt;span class="pln"&gt;selenium&lt;/span&gt;&lt;span class="pun"&gt;.&lt;/span&gt;&lt;span class="typ"&gt;Selenium&lt;/span&gt;&lt;span class="pun"&gt;;&lt;/span&gt;&lt;span class="pln"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="kwd"&gt;public&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="kwd"&gt;class&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="typ"&gt;TestTreeClick&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="pun"&gt;{&lt;/span&gt;&lt;span class="pln"&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span class="kwd"&gt;static&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="typ"&gt;Selenium&lt;/span&gt;&lt;span class="pln"&gt; selenium &lt;/span&gt;&lt;span class="pun"&gt;=&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="kwd"&gt;null&lt;/span&gt;&lt;span class="pun"&gt;;&lt;/span&gt;&lt;span class="pln"&gt;&lt;br /&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span class="lit"&gt;@Before&lt;/span&gt;&lt;span class="pln"&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span class="kwd"&gt;public&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="kwd"&gt;void&lt;/span&gt;&lt;span class="pln"&gt; setUp&lt;/span&gt;&lt;span class="pun"&gt;()&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="kwd"&gt;throws&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="typ"&gt;Exception&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="pun"&gt;{&lt;/span&gt;&lt;span class="pln"&gt;&lt;br /&gt;        &lt;/span&gt;&lt;span class="kwd"&gt;if&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="pun"&gt;(&lt;/span&gt;&lt;span class="pln"&gt;selenium &lt;/span&gt;&lt;span class="pun"&gt;==&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="kwd"&gt;null&lt;/span&gt;&lt;span class="pun"&gt;)&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="pun"&gt;{&lt;/span&gt;&lt;span class="pln"&gt;&lt;br /&gt;            selenium &lt;/span&gt;&lt;span class="pun"&gt;=&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="kwd"&gt;new&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="typ"&gt;DefaultSelenium&lt;/span&gt;&lt;span class="pun"&gt;(&lt;/span&gt;&lt;span class="str"&gt;"localhost"&lt;/span&gt;&lt;span class="pun"&gt;,&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="lit"&gt;4444&lt;/span&gt;&lt;span class="pun"&gt;,&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="str"&gt;"*iexplore"&lt;/span&gt;&lt;span class="pun"&gt;,&lt;/span&gt;&lt;span class="pln"&gt;&lt;br /&gt;                    &lt;/span&gt;&lt;span class="str"&gt;"http://gwt.google.com/samples/Showcase/Showcase.html#CwTree"&lt;/span&gt;&lt;span class="pun"&gt;);&lt;/span&gt;&lt;span class="pln"&gt;&lt;br /&gt;            selenium&lt;/span&gt;&lt;span class="pun"&gt;.&lt;/span&gt;&lt;span class="pln"&gt;start&lt;/span&gt;&lt;span class="pun"&gt;();&lt;/span&gt;&lt;span class="pln"&gt;&lt;br /&gt;        &lt;/span&gt;&lt;span class="pun"&gt;}&lt;/span&gt;&lt;span class="pln"&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span class="pun"&gt;}&lt;/span&gt;&lt;span class="pln"&gt;&lt;br /&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span class="lit"&gt;@Test&lt;/span&gt;&lt;span class="pln"&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span class="kwd"&gt;public&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="kwd"&gt;void&lt;/span&gt;&lt;span class="pln"&gt; testingClicking&lt;/span&gt;&lt;span class="pun"&gt;()&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="pun"&gt;{&lt;/span&gt;&lt;span class="pln"&gt;&lt;br /&gt;        selenium&lt;/span&gt;&lt;span class="pun"&gt;.&lt;/span&gt;&lt;span class="pln"&gt;open&lt;/span&gt;&lt;span class="pun"&gt;(&lt;/span&gt;&lt;span class="str"&gt;"http://gwt.google.com/samples/Showcase/Showcase.html#CwTree"&lt;/span&gt;&lt;span class="pun"&gt;);&lt;/span&gt;&lt;span class="pln"&gt;&lt;br /&gt;        selenium&lt;/span&gt;&lt;span class="pun"&gt;.&lt;/span&gt;&lt;span class="pln"&gt;click&lt;/span&gt;&lt;span class="pun"&gt;(&lt;/span&gt;&lt;span class="str"&gt;"gwt-debug-cwTree-staticTree-root-child0-content"&lt;/span&gt;&lt;span class="pun"&gt;);&lt;/span&gt;&lt;span class="pln"&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span class="pun"&gt;}&lt;/span&gt;&lt;span class="pln"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="pun"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span class="pln"&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt; To try and alleviate this problem, I upgraded my selenium .jar file to the latest WebDriver backed Selenium (selenium-2.0a.1.jar) found at &lt;a href="http://code.google.com/p/selenium/downloads/list"&gt;http://code.google.com/p/selenium/downloads/list&lt;/a&gt;.  However, simply upgrading the .jar file and leaving the code the same doesn't actually use the WebDriver-backed Selenium compoments.  To do this, I needed to modify the start-up code to be:&lt;br /&gt;&lt;br /&gt;&lt;pre class="prettyprint"&gt;&lt;code&gt;&lt;span class="kwd"&gt;import&lt;/span&gt;&lt;span class="pln"&gt; org&lt;/span&gt;&lt;span class="pun"&gt;.&lt;/span&gt;&lt;span class="pln"&gt;openqa&lt;/span&gt;&lt;span class="pun"&gt;.&lt;/span&gt;&lt;span class="pln"&gt;selenium&lt;/span&gt;&lt;span class="pun"&gt;.&lt;/span&gt;&lt;span class="typ"&gt;WebDriver&lt;/span&gt;&lt;span class="pun"&gt;;&lt;/span&gt;&lt;span class="pln"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="kwd"&gt;import&lt;/span&gt;&lt;span class="pln"&gt; org&lt;/span&gt;&lt;span class="pun"&gt;.&lt;/span&gt;&lt;span class="pln"&gt;openqa&lt;/span&gt;&lt;span class="pun"&gt;.&lt;/span&gt;&lt;span class="pln"&gt;selenium&lt;/span&gt;&lt;span class="pun"&gt;.&lt;/span&gt;&lt;span class="typ"&gt;WebDriverBackedSelenium&lt;/span&gt;&lt;span class="pun"&gt;;&lt;/span&gt;&lt;span class="pln"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="kwd"&gt;import&lt;/span&gt;&lt;span class="pln"&gt; org&lt;/span&gt;&lt;span class="pun"&gt;.&lt;/span&gt;&lt;span class="pln"&gt;openqa&lt;/span&gt;&lt;span class="pun"&gt;.&lt;/span&gt;&lt;span class="pln"&gt;selenium&lt;/span&gt;&lt;span class="pun"&gt;.&lt;/span&gt;&lt;span class="pln"&gt;ie&lt;/span&gt;&lt;span class="pun"&gt;.&lt;/span&gt;&lt;span class="typ"&gt;InternetExplorerDriver&lt;/span&gt;&lt;span class="pun"&gt;;&lt;/span&gt;&lt;span class="pln"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="kwd"&gt;import&lt;/span&gt;&lt;span class="pln"&gt; com&lt;/span&gt;&lt;span class="pun"&gt;.&lt;/span&gt;&lt;span class="pln"&gt;thoughtworks&lt;/span&gt;&lt;span class="pun"&gt;.&lt;/span&gt;&lt;span class="pln"&gt;selenium&lt;/span&gt;&lt;span class="pun"&gt;.&lt;/span&gt;&lt;span class="typ"&gt;Selenium&lt;/span&gt;&lt;span class="pun"&gt;;&lt;/span&gt;&lt;span class="pln"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="kwd"&gt;public&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="kwd"&gt;class&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="typ"&gt;TestTreeClick&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="pun"&gt;{&lt;/span&gt;&lt;span class="pln"&gt;&lt;br /&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span class="kwd"&gt;public&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="kwd"&gt;static&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="kwd"&gt;void&lt;/span&gt;&lt;span class="pln"&gt; main&lt;/span&gt;&lt;span class="pun"&gt;(&lt;/span&gt;&lt;span class="typ"&gt;String&lt;/span&gt;&lt;span class="pun"&gt;[]&lt;/span&gt;&lt;span class="pln"&gt; args&lt;/span&gt;&lt;span class="pun"&gt;)&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="pun"&gt;{&lt;/span&gt;&lt;span class="pln"&gt;&lt;br /&gt;        &lt;/span&gt;&lt;span class="typ"&gt;WebDriver&lt;/span&gt;&lt;span class="pln"&gt; driver &lt;/span&gt;&lt;span class="pun"&gt;=&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="kwd"&gt;new&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="typ"&gt;InternetExplorerDriver&lt;/span&gt;&lt;span class="pun"&gt;();&lt;/span&gt;&lt;span class="pln"&gt;&lt;br /&gt;        &lt;/span&gt;&lt;span class="typ"&gt;Selenium&lt;/span&gt;&lt;span class="pln"&gt; selenium &lt;/span&gt;&lt;span class="pun"&gt;=&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="kwd"&gt;new&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="typ"&gt;WebDriverBackedSelenium&lt;/span&gt;&lt;span class="pun"&gt;(&lt;/span&gt;&lt;span class="pln"&gt;driver&lt;/span&gt;&lt;span class="pun"&gt;,&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="str"&gt;"http://gwt.google.com/samples/Showcase/Showcase.html#CwTree"&lt;/span&gt;&lt;span class="pun"&gt;);&lt;/span&gt;&lt;span class="pln"&gt;&lt;br /&gt;        selenium&lt;/span&gt;&lt;span class="pun"&gt;.&lt;/span&gt;&lt;span class="pln"&gt;open&lt;/span&gt;&lt;span class="pun"&gt;(&lt;/span&gt;&lt;span class="str"&gt;"http://gwt.google.com/samples/Showcase/Showcase.html#CwTree"&lt;/span&gt;&lt;span class="pun"&gt;);&lt;/span&gt;&lt;span class="pln"&gt;&lt;br /&gt;        selenium&lt;/span&gt;&lt;span class="pun"&gt;.&lt;/span&gt;&lt;span class="pln"&gt;click&lt;/span&gt;&lt;span class="pun"&gt;(&lt;/span&gt;&lt;span class="str"&gt;"gwt-debug-cwTree-staticTree-root-child0-content"&lt;/span&gt;&lt;span class="pun"&gt;);&lt;/span&gt;&lt;span class="pln"&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span class="pun"&gt;}&lt;/span&gt;&lt;span class="pln"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="pun"&gt;}&lt;/span&gt;&lt;span class="pln"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;I found that the new Web-Driver backed Selenium &lt;span style="font-style: italic;"&gt;does &lt;/span&gt;fix a number of the problems I'd found (or provides alternative ways to achieve functionality) - but not easily in a single step.  However, it was good to find that for the click() example above, the new code works correctly with GWT 2.0, where as the old code does not.&lt;br /&gt;&lt;br /&gt;However, at the moment (Jan 2010) this doesn't provide a really simple solution to my testing problems.  Currently Web-Driver backed Selenium (Selenium 2.0a.1) does NOT provide a full set of testing functionality as found in earlier versions of standard Selenium.  Some selenium methods that work in earlier versions have slightly different commands to make them work in the new version.  Of the limitations/issues I've had, the key one is that Web-Driver backed Selenium &lt;span style="font-style: italic;"&gt;does not currently provide support for right-click (context menu), and Ctrl-Click functionality&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;In addition there are a number of minor changes to make things work.  For instance, typing into an editable iFrame didn't seem to work using our old code:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Selenium.type("//*[@contentEditable='true']", newText)&lt;/li&gt;&lt;/ul&gt;Instead, we now have to use:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;selenium.typeKeys(elementId, newText);&lt;/li&gt;&lt;/ul&gt;In summary, if I were to stop using the Web-Driver backed Selenium, the available test functionality is more complete, but unfortunately key bits I wish to test just don't work with GWT 2.0 code.  I don't want to go back to GWT 1.7, so for the time being I'm developing my application without the ability to test Right-Clicks and having to re-write bits of the test code to work properly. &lt;br /&gt;&lt;br /&gt;It isn't a huge deal, as I should have almost all of my right-click functionality in other menus, anyway - and hopefully the main testing comes from Unit tests and Integration tests.  Nevertheless, just wanted to record these experiences here in case they help others understand what's going on when they upgrade - and what the impacts might be on Selenium tests.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6086730485636404739-5885228893230259836?l=drglennn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://drglennn.blogspot.com/feeds/5885228893230259836/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6086730485636404739&amp;postID=5885228893230259836' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/5885228893230259836'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/5885228893230259836'/><link rel='alternate' type='text/html' href='http://drglennn.blogspot.com/2010/01/selenium-testing-gwt-upgrading-to-gwt.html' title='Selenium Testing GWT - upgrading to GWT 2.0 and Selenium 2.0a1'/><author><name>Glennn</name><uri>http://www.blogger.com/profile/11073435827711258234</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6086730485636404739.post-1340943941172986973</id><published>2009-10-07T04:28:00.001-07:00</published><updated>2009-10-07T04:41:27.056-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GWT'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Selenium'/><title type='text'>Selenium Testing page with iframe/GWT RichTextArea</title><content type='html'>Recently we've been using Selenium to do integration/acceptance testing of a new web-application.&lt;br /&gt;&lt;br /&gt;The web-application uses Google Web Toolkit (GWT) for the view layer. One of the key components is a GWT RichTextArea for user input. GWT RichTextAreas are implemented in Javascript using an iframe with designMode=On, to allow user input.&lt;br /&gt;&lt;br /&gt;This works fine, however when we came to testing we couldn't seem to get Selenium to input text into the RichTextArea (iframe) component.&lt;br /&gt;&lt;br /&gt;A number of websites (for example &lt;a href="http://www.hietavirta.net/blog/item/2008/08/gwt-15-tree-and-richtextarea-testing-with-selenium"&gt;http://www.hietavirta.net/blog/item/2008/08/gwt-15-tree-and-richtextarea-testing-with-selenium&lt;/a&gt;) suggested something like "&lt;em&gt;select the right frame with Selenium's selectFrame, type text to //html/body and finally select the top frame again."&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;/em&gt;&lt;br /&gt;However, this didn't work for us. We tried a combination of options for selecting the frame and then trying to select the body (or other elements) within the iframe, but all to no avail.&lt;br /&gt;&lt;br /&gt;In the end, we didn't need to select the iframe/richtextarea separately first (and, indeed, this selecting didn't seem to work, even though the GWT "ensureDebugId" did correctly attach the id to the iframe element).&lt;br /&gt;&lt;br /&gt;The final solution to get selenium to type into the RichTextArea was to include in our tests the code:&lt;br /&gt;&lt;br /&gt;selenium.type("//*[@contentEditable='true'","This text is to be typed");&lt;br /&gt;&lt;br /&gt;The first argument of the selenium.type command is a locator that finds the correct iframe (RichTextArea) element, based on the fact that GWT creates this element with a parameter indicating the content is editable. The second command is the text you want typed in your test.&lt;br /&gt;&lt;br /&gt;Seems so simple here, but getting that to work took hours! We tried a bunch of much more "obvious" options to locate that element (including a bunch that other bloggers said worked), but in our case this was the only thing that we could find that did the job!!&lt;br /&gt;&lt;br /&gt;So... now ya know what worked for us, too!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6086730485636404739-1340943941172986973?l=drglennn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://drglennn.blogspot.com/feeds/1340943941172986973/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6086730485636404739&amp;postID=1340943941172986973' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/1340943941172986973'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/1340943941172986973'/><link rel='alternate' type='text/html' href='http://drglennn.blogspot.com/2009/10/selenium-testing-page-with-iframegwt.html' title='Selenium Testing page with iframe/GWT RichTextArea'/><author><name>Glennn</name><uri>http://www.blogger.com/profile/11073435827711258234</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6086730485636404739.post-2311178531173601341</id><published>2009-05-19T22:59:00.000-07:00</published><updated>2009-05-20T00:12:29.369-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='Tomcat'/><category scheme='http://www.blogger.com/atom/ns#' term='Hibernate'/><title type='text'>"java.sql.SQLException: Communication link failure" when using Hibernate, Tomcat and MySQL with Spring</title><content type='html'>I have recently obtained an error after leaving my Hibernate/Tomcat/MySQL web-application running overnight (&gt;8 hours) with the following root-cause :&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Root Cause: java.sql.SQLException: Communication link failure: java.net.SocketException, underlying cause: Software caused connection abort: recv failed&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Situation:&lt;/strong&gt; When first deployed the application works fine. However, when the application is left running for a long time (eg &gt; 8 hours) without any interactions, the connection to the MySQL database is lost and the web-app throws an exception. The full stacktrace of that exception is below, for those interested. I am using &lt;em&gt;Tomcat 6.0.18&lt;/em&gt; and &lt;em&gt;MySQL 5.0.27-community-nt&lt;/em&gt;.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Aside:&lt;/em&gt; It is perhaps also worth noting that another computer with the same code-base does NOT throw this error - even though the MySQL time-out settings are the same. The main difference appears to be that the other computer is running &lt;em&gt;Tomcat 6.0.14&lt;/em&gt; and &lt;em&gt;MySQL 5.0.18-nt&lt;/em&gt; so it is possible that these versions don't require the fix below - but I haven't confirmed that it isn't some other minor difference.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Background:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;This is a fairly common problem, but a range of solutions presented elsewhere on the internet didn't fix my problem - and they aren't documented together anywhere I could find - so I'm recording some of these here, along with the one that finally worked for me.&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;How to test:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The first thing to note is that this is caused by MySQL closing down connections that are idle for a period of time. One fix is to just drastically increase the "Interactive timeout" and "Wait timeout" in the &lt;em&gt;my.ini&lt;/em&gt; file that is read on startup in MySQL. Don't forget to restart MySQL each time you change these (and to stop Tomcat before restarting MySQL). A good way to test if this timeout is really your problem is to change these to a short value (eg 40) (that is, 40 seconds) and wait to see if the error occurs in a minute or so. That way you don't have to wait overnight to test whether changes fix your problem.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Proposed Solutions:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;NB: Only one of these worked (or was deemed "acceptable") for my case - and that one is the last one, but I record them all here as I couldn't find one location with all these summarized.&lt;br /&gt;&lt;br /&gt;1. One solution is to just increase the MySQL Timeout settings as described in the "testing" section above. However, while this fixed one application I was working on, in one (different) case I found that the error was occurring overnight even if I set this to a very large value (eg 604800 sec). In any case, just increasing this value isn't a great solution as you don't want the error to occur ever - so just stalling it for a week isn't great!&lt;br /&gt;&lt;br /&gt;2. Another solution that I didn't like, but should mention, is to put a try/catch around the Java code that accesses the database. This isn't really a hibernate solution, but I thought I'd mention it. See the suggestions at the following URL if you want to try this. It's inelegant if you're using Hibernate, but might be good if you are doing your connections manually.&lt;br /&gt;&lt;a href="http://forums.mysql.com/read.php?39,55337,139123#msg-139123"&gt;http://forums.mysql.com/read.php?39,55337,139123#msg-139123&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;3. Another suggestion that I found on the web that didn't work - but might for similar problems - is to put the following into your hibernate config file:&lt;br /&gt;&lt;br /&gt;&amp;lt;property name="connection.autoReconnect"&amp;gt;true&amp;lt;/property&amp;gt;&lt;br /&gt;&amp;lt;property name="connection.autoReconnectForPools"&amp;gt;true&amp;lt;/property&amp;gt;&lt;br /&gt;&amp;lt;property name="connection.is-connection-validation-required"&amp;gt;true&amp;lt;/property&amp;gt;&lt;br /&gt;&lt;br /&gt;4. A related suggestion is to add &lt;em&gt;autoReconnect=true&lt;/em&gt; to jdbc URL. I did try this and it didn't work for me, but it might be worth considering.&lt;br /&gt;&lt;br /&gt;5. Another suggestion was to set the C3P0 connection-pooling properties as follows:&lt;br /&gt;&amp;lt;session-configuration&gt;&lt;br /&gt;&amp;lt;property name=“hibernate.c3p0.acquire_increment"&amp;gt;3&amp;lt;/property&amp;gt;&lt;br /&gt;&amp;lt;property name=“hibernate.c3p0.idle_test_period"&amp;gt;14400&amp;lt;/property&amp;gt;&lt;br /&gt;&amp;lt;property name=“hibernate.c3p0.timeout"&amp;gt;25200&amp;lt;/property&amp;gt;&lt;br /&gt;&amp;lt;property name=“hibernate.c3p0.max_size"&amp;gt;15&amp;lt;/property&amp;gt;&lt;br /&gt;&amp;lt;property name=“hibernate.c3p0.min_size"&amp;gt;3&amp;lt;/property&amp;gt;&lt;br /&gt;&amp;lt;property name=“hibernate.c3p0.max_statements"&amp;gt;0&amp;lt;/property&amp;gt;&lt;br /&gt;&amp;lt;property name=“hibernate.c3p0.preferredTestQuery"&amp;gt;select 1&amp;lt;/property&amp;gt;&lt;br /&gt;&amp;lt;/session-configuration&amp;gt;&lt;br /&gt;&lt;br /&gt;See &lt;a href="https://www.hibernate.org/214.html"&gt;https://www.hibernate.org/214.html&lt;/a&gt; for more details on C3PO config. This would set C3PO pooling values in the configuration - in particular setting the &lt;em&gt;idle_test_period&lt;/em&gt; and &lt;em&gt;timeout&lt;/em&gt; properties to be less than the values set for &lt;em&gt;MySQL&lt;/em&gt; &lt;em&gt;timeout&lt;/em&gt; (see 1 - I had the MySQL timeout set to 691200, so it was much longer). In fact, even before experiencing this problem I did actually already have these values set and yet the error still occurred! Still, this may be necessary /fix the problem for some people and I am still using these settings, above.&lt;br /&gt;&lt;br /&gt;Aside: A similar set of properties for dbcp is given at &lt;a href="https://forum.hibernate.org/viewtopic.php?f=1&amp;amp;t=933088&amp;amp;view=previous"&gt;https://forum.hibernate.org/viewtopic.php?f=1&amp;amp;t=933088&amp;amp;view=previous&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;6. &lt;strong&gt;Solution (Actually worked for me):&lt;/strong&gt; The final change that actually worked was to modify the Spring data-source to be:&lt;br /&gt;&lt;br /&gt;&amp;lt;bean id="dataSource"&lt;br /&gt;class="com.mchange.v2.c3p0.ComboPooledDataSource" abstract="false"&lt;br /&gt;lazy-init="default" autowire="default" dependency-check="default"&lt;br /&gt;destroy-method="close"&amp;gt;&lt;br /&gt;&amp;lt;property name="driverClass"&amp;gt; &amp;lt;value&amp;gt;com.mysql.jdbc.Driver&amp;lt;/value&amp;gt; &amp;lt;/property&amp;gt;&lt;br /&gt;&amp;lt;property name="jdbcUrl"&amp;gt;&amp;lt;value&amp;gt;jdbc:mysql://localhost/myApp&amp;lt;/value&amp;gt;&amp;lt;/property&amp;gt;&lt;br /&gt;&amp;lt;property name="user"&amp;gt; &amp;lt;value&amp;gt;myUser&amp;lt;/value&amp;gt;&amp;lt;/property&amp;gt;&lt;br /&gt;&amp;lt;property name="password"&amp;gt;&amp;lt;value&amp;gt;myPassword&amp;lt;/value&amp;gt;&amp;lt;/property&amp;gt;&lt;br /&gt;&amp;lt;property name="autoCommitOnClose"&amp;gt; &amp;lt;value&amp;gt;true&amp;lt;/value&amp;gt;&amp;lt;/property&amp;gt;&lt;br /&gt;&amp;lt;property name="idleConnectionTestPeriod"&amp;gt;&amp;lt;value&amp;gt;15&amp;lt;/value&amp;gt; &amp;lt;/property&amp;gt;&lt;br /&gt;&amp;lt;property name="maxIdleTime"&amp;gt; &amp;lt;value&amp;gt;15&amp;lt;/value&amp;gt; &amp;lt;/property&amp;gt;&lt;br /&gt;&amp;lt;/bean&amp;gt;&lt;br /&gt;&lt;br /&gt;The key properties here are to set the &lt;em&gt;idleConnectionTestPeriod&lt;/em&gt; and &lt;em&gt;maxIdleTime&lt;/em&gt; to values that are less than the mySQL timeout values mentioned in (1) above. Setting these two new properties for the datasource in &lt;em&gt;applicationContext-jdbc.xml&lt;/em&gt; file in my Spring config settings fixed the problem.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;More StackTrace Info for Error:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.TransactionException: JDBC begin failed:&lt;br /&gt;org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:408)&lt;br /&gt;org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:350)&lt;br /&gt;javax.servlet.http.HttpServlet.service(HttpServlet.java:690)&lt;br /&gt;javax.servlet.http.HttpServlet.service(HttpServlet.java:803)&lt;br /&gt;org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:174)&lt;br /&gt;org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)&lt;br /&gt;jcifs.http.CustomNtlmFilter.doFilter(CustomNtlmFilter.java:111)&lt;br /&gt;&lt;br /&gt;root cause:&lt;br /&gt;&lt;br /&gt;java.sql.SQLException: Communication link failure: java.net.SocketException, underlying cause: Software caused connection abort: recv failed** BEGIN NESTED EXCEPTION ** java.net.SocketExceptionMESSAGE: Software caused connection abort: recv failedSTACKTRACE:java.net.SocketException: Software caused connection abort: recv failed at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(Unknown Source) at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1391) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:1538) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1929) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1167) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1278) at com.mysql.jdbc.MysqlIO.sqlQuery(MysqlIO.java:1224) at com.mysql.jdbc.Connection.execSQL(Connection.java:2248) at com.mysql.jdbc.Connection.execSQL(Connection.java:2208) at com.mysql.jdbc.Connection.execSQL(Connection.java:2189) at com.mysql.jdbc.Connection.setAutoCommit(Connection.java:546) at com.mchange.v2.c3p0.impl.NewProxyConnection.setAutoCommit(NewProxyConnection.java:756) at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:63) at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326) at org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:496) at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:322) at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:255) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:102) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6086730485636404739-2311178531173601341?l=drglennn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://drglennn.blogspot.com/feeds/2311178531173601341/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6086730485636404739&amp;postID=2311178531173601341' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/2311178531173601341'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/2311178531173601341'/><link rel='alternate' type='text/html' href='http://drglennn.blogspot.com/2009/05/javasqlsqlexception-communication-link.html' title='&quot;java.sql.SQLException: Communication link failure&quot; when using Hibernate, Tomcat and MySQL with Spring'/><author><name>Glennn</name><uri>http://www.blogger.com/profile/11073435827711258234</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6086730485636404739.post-5343842088315423194</id><published>2009-04-22T20:22:00.000-07:00</published><updated>2009-04-22T20:42:38.167-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='MyEclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='Tomcat'/><title type='text'>java.lang.UnsupportedClassVersionError: Bad version number in .class file</title><content type='html'>I was recently deploying a webApp in Eclipse (MyEclipse) using Tomcat when suddenly I got a UnsupportedClassVersionError:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;java.lang.UnsupportedClassVersionError: Bad version number in .class file&lt;br /&gt;at java.lang.ClassLoader.defineClass1(Native Method)&lt;br /&gt;at java.lang.ClassLoader.defineClass(Unknown Source)&lt;br /&gt;at java.security.SecureClassLoader.defineClass(Unknown Source)&lt;br /&gt;at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1817)&lt;br /&gt;at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872)&lt;br /&gt;at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1325)&lt;br /&gt;at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)&lt;br /&gt;at org.apache.catalina.startup.WebAnnotationSet.loadClassAnnotation(WebAnnotationSet.java:145)&lt;br /&gt;at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:73)&lt;br /&gt;at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:56)&lt;br /&gt;at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:297)&lt;br /&gt;at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1064)&lt;br /&gt;at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:261)&lt;br /&gt;at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)&lt;br /&gt;at org.apache.catalina.core.StandardContext.start(StandardContext.java:4236)&lt;br /&gt;at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)&lt;br /&gt;at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)&lt;br /&gt;at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)&lt;br /&gt;at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)&lt;br /&gt;at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)&lt;br /&gt;at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)&lt;br /&gt;at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)&lt;br /&gt;at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)&lt;br /&gt;at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)&lt;br /&gt;at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)&lt;br /&gt;at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)&lt;br /&gt;at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)&lt;br /&gt;at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)&lt;br /&gt;at org.apache.catalina.core.StandardService.start(StandardService.java:516)&lt;br /&gt;at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)&lt;br /&gt;at org.apache.catalina.startup.Catalina.start(Catalina.java:566)&lt;br /&gt;at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)&lt;br /&gt;at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)&lt;br /&gt;at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)&lt;br /&gt;at java.lang.reflect.Method.invoke(Unknown Source)&lt;br /&gt;at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)&lt;br /&gt;at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;So my initial thought was "ok, a class is not loaded, but which one???". &lt;br /&gt;&lt;br /&gt;Well - it turns out that this information would probably have led me down the wrong path anyway... and you don't need it (so don't get frustrated with whoever created that error message!). &lt;br /&gt;&lt;br /&gt;The problem occurs, generally, when you compile a .java file with one version of JDK and then run the (compiled) .class with a different version of the Java Virtual Machine.&lt;br /&gt;&lt;br /&gt;So... how was I doing this?  Well - the .class file is being run within Tomcat and the .java file is being compiled by the preferred java compiler set in myEclipse.   Ideally, these two versions would be the same - however they can be quite different.  This won't be a problem AS LONG AS the Tomcat Java version (ie the Java running the .class files) is not an older version than the Java version used to compile the .class file from .java.  It turns out that I had accidently set the Tomcat Java version to be an older one than the JAVA version being used to compile the code.&lt;br /&gt;&lt;br /&gt;In MyEclipse:&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Tomcat Java Version&lt;/strong&gt; is set by:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;MyEclipse Tomcat[*] -&gt; Configure -&gt; Jdk -&gt; Tomcat JDK Name&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;MyEclipse Compiler Java Version&lt;/strong&gt; is set by:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Project-&gt; Properties -&gt; Java Compiler -&gt; Compiler Compliance Level&lt;/li&gt;&lt;li&gt;Window -&gt; Preferences -&gt; Java -&gt; Installed JREs -&gt; Selected JRE&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;So, all I had to do to fix this was to set both the Tomcat JDK Name and Selected JRE to &lt;em&gt;jre1.6.0_05&lt;/em&gt; and compiler compliance to 1.6 and I'd fixed the problem.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[*] or whichever Tomcat you are using...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6086730485636404739-5343842088315423194?l=drglennn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://drglennn.blogspot.com/feeds/5343842088315423194/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6086730485636404739&amp;postID=5343842088315423194' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/5343842088315423194'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/5343842088315423194'/><link rel='alternate' type='text/html' href='http://drglennn.blogspot.com/2009/04/javalangunsupportedclassversionerror.html' title='java.lang.UnsupportedClassVersionError: Bad version number in .class file'/><author><name>Glennn</name><uri>http://www.blogger.com/profile/11073435827711258234</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6086730485636404739.post-7887744524718242926</id><published>2009-02-17T01:14:00.000-08:00</published><updated>2009-02-24T02:26:22.046-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Bugs'/><title type='text'>YouTube - JavaScript Turned off or an old version of Adobe Flash Player - Bug</title><content type='html'>Earlier today I was sent a link for a YouTube video, however when I went to the link I received the error message:&lt;br /&gt;&lt;br /&gt;"Hello, you either have JavaScript turned off or an old version of Adobe's Flash Player. &lt;a onmousedown="urchinTracker('/Events/VideoWatch/GetFlash');" href="http://www.adobe.com/go/getflashplayer/"&gt;Get the latest Flash player&lt;/a&gt;. "&lt;br /&gt;&lt;br /&gt;I have the latest Flash player (and, indeed, did follow the link and upgrade it just to make sure). However, this kept occurring for a number of YouTube videoes I then tried to watch as a test.&lt;br /&gt;&lt;br /&gt;A bit of investigation indicated a huge range of suggestions for how to fix this - everything from people claiming it is a bug with YouTube and "YouTube Engineers are working on it" through to those advising turning off various bits of your Internet Explorer security settings (such as any "Add blockers" etc) and deleting temporary internet files and cookies.&lt;br /&gt;&lt;br /&gt;Given that these fixes didn't work for me - and I don't want to leave my browser in an unsafe state with popups etc, anyway - I changed all these settings back to their usual state.&lt;br /&gt;&lt;br /&gt;SOLUTION (Well, almost!):&lt;br /&gt;&lt;br /&gt;I did, however, come up with a way to watch the video.&lt;br /&gt;&lt;br /&gt;Now, to be honest, I haven't actually fixed the problem - when I go to the original URL I get the same error message still - but, on the positive side, I can watch the YouTube video (which, after all was the point). To do this, you just need to modify the URL you are using slightly.&lt;br /&gt;&lt;br /&gt;In this particular case (as embarrassing as this may be - I didn't choose this video), my friend wanted me to view the link:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.youtube.com/watch?v=AbAX9A8Cq0k"&gt;http://www.youtube.com/watch?v=AbAX9A8Cq0k&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This didn't (and still doesn't at the moment of writing this) work for me. However, if you modify the link to:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;remove the words "watch?"&lt;/li&gt;&lt;li&gt;replace "=" with "/"&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;I obtain a new URL that does work:&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.youtube.com/v/AbAX9A8Cq0k"&gt;http://www.youtube.com/v/AbAX9A8Cq0k&lt;/a&gt;&lt;/p&gt;&lt;p&gt;So, the good news is this worked. The bad news is that had I known what the link was for I wouldn't have wasted the time :-) Ok - so maybe it isn't that bad?!? &lt;/p&gt;&lt;p&gt;Anyway, music taste aside, the good news is that this works on all the YouTube files I've tried so far. They're all giving me this same error message but, if I really wanted to, I could watch them by changing the URL manually...&lt;/p&gt;&lt;p&gt;So... it isn't a long term fix - but maybe this is a good start for others if the problem is with something at YouTube's end, or if you're just in a real hurry to watch that link you've been sent and don't wanna spend days re-installing Adobe products and Virus scanners!!!&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6086730485636404739-7887744524718242926?l=drglennn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://drglennn.blogspot.com/feeds/7887744524718242926/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6086730485636404739&amp;postID=7887744524718242926' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/7887744524718242926'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/7887744524718242926'/><link rel='alternate' type='text/html' href='http://drglennn.blogspot.com/2009/02/utube-javascript-turmed-off-or-old.html' title='YouTube - JavaScript Turned off or an old version of Adobe Flash Player - Bug'/><author><name>Glennn</name><uri>http://www.blogger.com/profile/11073435827711258234</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6086730485636404739.post-586678637866563893</id><published>2008-10-25T06:21:00.000-07:00</published><updated>2008-10-25T06:23:04.864-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='Hibernate Annotations'/><category scheme='http://www.blogger.com/atom/ns#' term='Hibernate'/><title type='text'>Booleans in Hibernate</title><content type='html'>As the following helpful article (&lt;a href="http://www.databasesandlife.com/hibernate-boolean-fields-mysql-50/"&gt;http://www.databasesandlife.com/hibernate-boolean-fields-mysql-50/&lt;/a&gt;) points out:&lt;br /&gt;&lt;br /&gt;"There's a problem persisting boolean fields using Hibernate 3.2.2 to MySQL 5.0, if you allow Hibernate to generate your schema and you leave Hibernate to generate the schema in the default way".  The problem is, by default, it generates a MqSQL field of type "bit(1)" - which causes Hibernate to throw:&lt;br /&gt;&lt;br /&gt;could not insert: [com.company.MyObject] org.hibernate.exception.DataException: could not insert: [com.company.MyObject] at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:77) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) .... Caused by: java.sql.SQLException: Data too long for column 'my_field' at row 1 at ....&lt;br /&gt;&lt;br /&gt;When I try to save. &lt;br /&gt;&lt;br /&gt;That's causing my tests to fail… so what to do?&lt;br /&gt;&lt;br /&gt;Well the article I mention above suggests mapping the field using&lt;br /&gt;&lt;br /&gt;&amp;lt;column sql-type="BOOLEAN" /&amp;gt;,&lt;br /&gt;&lt;br /&gt;which does work. &lt;br /&gt;&lt;br /&gt;However, I'm using annotations, so my preferred mapping for booleans is:&lt;br /&gt;&lt;br /&gt;        @Column(columnDefinition = "tinyint", nullable = false)        &lt;br /&gt;        private boolean exampleBooleanValue;&lt;br /&gt;&lt;br /&gt;An alternative is to use:     &lt;br /&gt;  &lt;br /&gt;       @Column        &lt;br /&gt;       private Boolean exampleBooleanValue;&lt;br /&gt;&lt;br /&gt;But I prefer to work with primitives rather than boxed primitives wherever possible.&lt;br /&gt;Anyway, the first solution above works wonderfully.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6086730485636404739-586678637866563893?l=drglennn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://drglennn.blogspot.com/feeds/586678637866563893/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6086730485636404739&amp;postID=586678637866563893' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/586678637866563893'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/586678637866563893'/><link rel='alternate' type='text/html' href='http://drglennn.blogspot.com/2008/10/booleans-in-hibernate.html' title='Booleans in Hibernate'/><author><name>Glennn</name><uri>http://www.blogger.com/profile/11073435827711258234</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6086730485636404739.post-1865587499699158883</id><published>2008-10-25T06:11:00.000-07:00</published><updated>2008-10-25T06:20:03.932-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Log4J'/><title type='text'>Log4J Warnings</title><content type='html'>Annoyingly, when I run a junit test that is testing my Hibernate DAO objects, I get the following warnings:&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;&lt;em&gt;log4j:WARN No appenders could be found for logger (jpt.dao.impl.test.GenericDaoImplTest). log4j:WARN Please initialize the log4j system properly.&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This shouldn't be surprising, it's saying that Log4j hasn't been initialized properly. Why not? Well, It can't find my log4j.properties file. That's because hibernate needs it to be in the class path. So, I need to put log4j.properties into the classpath.&lt;br /&gt;&lt;br /&gt;Well that's fine, and doing so does fix the problem - I just put log4j.properties into my src folder (or, in this case, specifically my test-src folder).&lt;br /&gt;&lt;br /&gt;However, the problem is that I already have log4j.properties in the WebRoot/WEB-INF folder. When running my web-app (not the tests, but the web app itself), hibernate knows to look for it there because web.xml has:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;context-param&amp;gt;&lt;br /&gt;&amp;lt;param-name&amp;gt;log4jConfigLocation&amp;lt;/PARAM-NAME&amp;gt;&lt;br /&gt;&amp;lt;param-value&amp;gt;/WEB-INF/log4j.properties&amp;lt;/PARAM-VALUE&amp;gt;&lt;br /&gt;&amp;lt;/CONTEXT-PARAM&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;What's more, that's exactly where I want my log4j.properties to be. Sure, I could change this to point somewhere else, but I don't want to do that. I want log4j.properties to be located in this directory for my web-app and configured just so.&lt;br /&gt;&lt;br /&gt;So… the question is, how do I get Junit to initialize using this log4j.properties, rather than looking into src (on the classpath) and finding it missing. Well, I haven't been able to do it yet. I can manually configure log4j in my test class - but that's after the warnings are already shown. The only way I've been able to avoid those warnings is by placing log4j.properties into the classpath.&lt;br /&gt;So, in the end, I've now got two versions of log4j.properties. One is in test-src and defines the logging levels etc for the debug running. One is in WebRoot/WEB-INF and defines logging levels for the webapp.&lt;br /&gt;&lt;br /&gt;This is fine - and some might even say the best of both worlds - because I can have different default logging for my tests and my web-app. However, I still don't really like it. It could be confusing having two files named log4j.properites in the one project. What if I want to have only one!&lt;br /&gt;&lt;br /&gt;Surely it shouldn't be THAT hard to configure my Junit test runs (that extend AbstractTransactionalDataSourceSprignContextTests) so that they search for the log4j.properties in the web-inf directory rather than on the classpath?!?!?!? Any ideas? (By the way, trying to add web-inf to the classpath doesn't work, as I'm using MyEclipse and it doesn't allow this!)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6086730485636404739-1865587499699158883?l=drglennn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://drglennn.blogspot.com/feeds/1865587499699158883/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6086730485636404739&amp;postID=1865587499699158883' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/1865587499699158883'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/1865587499699158883'/><link rel='alternate' type='text/html' href='http://drglennn.blogspot.com/2008/10/log4j-warnings.html' title='Log4J Warnings'/><author><name>Glennn</name><uri>http://www.blogger.com/profile/11073435827711258234</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6086730485636404739.post-5474853391122829260</id><published>2008-10-25T06:06:00.000-07:00</published><updated>2008-10-25T06:07:50.483-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Hibernate'/><title type='text'>Hibernate "PreInsertEvent.getSource()" NoSuchMethodError.</title><content type='html'>I recently obtained the following error:&lt;br /&gt;&lt;br /&gt;java.lang.NoSuchMethodError: org.hibernate.event.PreInsertEvent.getSource()Lorg/hibernate/engine/SessionImplementor;&lt;br /&gt;&lt;br /&gt;This occurred when attempting to run a test on one of my Hibernate DAO entities.&lt;br /&gt;&lt;br /&gt;The problem started when I updated some (but not all) of my hibernate .jar libraries, to enable the use of spring-test.jar to provide access to the helper org.springframework.test.AbstractTransactionalDataSourceSpringContextTests methods.&lt;br /&gt;&lt;br /&gt;It turns out (&lt;a href="http://opensource.atlassian.com/projects/hibernate/browse/HV-67"&gt;http://opensource.atlassian.com/projects/hibernate/browse/HV-67&lt;/a&gt;) that the problem was:&lt;br /&gt;&lt;br /&gt;Method getSource from an older version of the Hibernate Core is referenced.&lt;br /&gt;&lt;br /&gt;It is stated within the compatibility matrix that Hibernate Validator 3.1.0.CR1 is compatible only with Hibernate Core 3.3.x version(s).Exception in thread "main" java.lang.NoSuchMethodError: org.hibernate.event.PreInsertEvent.getSource()Lorg/hibernate/engine/SessionImplementor;&lt;br /&gt;&lt;br /&gt;That is, I was using the latest Hibernate Core (3.3.x), but didn't have the most up to date Hibernate Validator.  I downloaded a new hibernate-validator.jar and everything worked again.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6086730485636404739-5474853391122829260?l=drglennn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://drglennn.blogspot.com/feeds/5474853391122829260/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6086730485636404739&amp;postID=5474853391122829260' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/5474853391122829260'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/5474853391122829260'/><link rel='alternate' type='text/html' href='http://drglennn.blogspot.com/2008/10/hibernate-preinserteventgetsource.html' title='Hibernate &quot;PreInsertEvent.getSource()&quot; NoSuchMethodError.'/><author><name>Glennn</name><uri>http://www.blogger.com/profile/11073435827711258234</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6086730485636404739.post-4904337471436656777</id><published>2008-10-25T06:03:00.001-07:00</published><updated>2008-10-25T06:10:37.140-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Hibernate Annotations'/><category scheme='http://www.blogger.com/atom/ns#' term='JUnit'/><title type='text'>Problems with @Test annotations with AbstractTransactionalDataSourceSpringContextTests.</title><content type='html'>I've recently been writing tests, most of which use the Junit @Test (&lt;a href="http://junit.org/apidocs/org/junit/Test.html"&gt;http://junit.org/apidocs/org/junit/Test.html&lt;/a&gt;) annotations to identify the methods for testing as junit tests. This works really well, and also allows me to use other great annotations like @Before.&lt;br /&gt;&lt;br /&gt;However I decided I needed to do some integration testing of my DAOs with the database. So, to do this, I took advantage of Spring's AbstractTransactionalDataSourceSpringContextTests class (&lt;a href="http://static.springframework.org/spring/docs/2.0.x/api/index.html?org/springframework/test/AbstractTransactionalDataSourceSpringContextTests.html"&gt;http://static.springframework.org/spring/docs/2.0.x/api/index.html?org/springframework/test/AbstractTransactionalDataSourceSpringContextTests.html&lt;/a&gt;).&lt;br /&gt;&lt;br /&gt;This is great, however, I noticed that all of my test annotations for classes extended AbstractTransactionalDataSourceSpringContextTests were being ignored. This means that tests that were named "testExample" would run, but those named "doTestExample" would not - even if annotated. More to the point, something called "testExample" would run as a test even if not annotated.&lt;br /&gt;&lt;br /&gt;The reason soon became clear. AbstractTransactionalDataSourceSpringContextTests extends the Junit.Framework.TestCase class. Now JUnit4 and JUnit3 tests really should not be mixed and they don't go together. So, because I'm extending TestCase (although I don't really want to), I need to go back to old fashioned Junit Tests, without test annotations. This is commented, briefly in:&lt;br /&gt;&lt;a href="http://www.jetbrains.net/jira/browse/IDEA-16466"&gt;http://www.jetbrains.net/jira/browse/IDEA-16466&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6086730485636404739-4904337471436656777?l=drglennn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://drglennn.blogspot.com/feeds/4904337471436656777/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6086730485636404739&amp;postID=4904337471436656777' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/4904337471436656777'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/4904337471436656777'/><link rel='alternate' type='text/html' href='http://drglennn.blogspot.com/2008/10/problems-with-test-annotations-with.html' title='Problems with @Test annotations with AbstractTransactionalDataSourceSpringContextTests.'/><author><name>Glennn</name><uri>http://www.blogger.com/profile/11073435827711258234</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6086730485636404739.post-1968020227814114779</id><published>2008-09-16T19:42:00.000-07:00</published><updated>2008-09-16T20:49:44.459-07:00</updated><title type='text'>MySQL Database Recovery</title><content type='html'>I recently had a key application server die (hardware).  One of the key applications running on this machine was a web-application that used a &lt;em&gt;MySql&lt;/em&gt; database.  We did have some specific &lt;em&gt;MySql&lt;/em&gt; backup files, but the most recent backup of the data was a complete server backup of all files.&lt;br /&gt;&lt;br /&gt;This meant that I had to work out how to restore a &lt;em&gt;MySql &lt;/em&gt;database from the files stored in the &lt;em&gt;data&lt;/em&gt; folder (under &lt;em&gt;MySQL Server5.0/data/)&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;The files I had were:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;ib_logfile0&lt;/em&gt;&lt;br /&gt;&lt;em&gt;ib_logfile1&lt;/em&gt;&lt;br /&gt;&lt;em&gt;ibdata1&lt;/em&gt;&lt;br /&gt;and a folder, &lt;em&gt;my_application&lt;/em&gt;, which contained a whole bunch of &lt;em&gt;.frm&lt;/em&gt; files describing the table structures.&lt;br /&gt;&lt;br /&gt;To restore &lt;em&gt;MySql&lt;/em&gt; I started by copying these three files and one folder into a newly installed &lt;em&gt;MySql&lt;/em&gt; folder on a replacement server.  However, on starting &lt;em&gt;mySql&lt;/em&gt; as a service, I got:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Could not start the MySQL service on Local Computer.&lt;/em&gt;&lt;br /&gt;&lt;em&gt;Error 1067: The process terminated unexpectedly.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;I then checked out more information about this error in the file named &lt;em&gt;machineName.err&lt;/em&gt; in the &lt;em&gt;MySql/data &lt;/em&gt;folder.&lt;br /&gt;&lt;br /&gt;This showed that:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;InnoDB: Error: log file .\ib_logfile0 is of different size 0 25165824 bytes&lt;/em&gt;&lt;br /&gt;&lt;em&gt;InnoDB: than specified in the .cnf file 0 1782 57920 bytes.&lt;/em&gt;&lt;br /&gt;&lt;em&gt;080917 12:30:17 [ERROR] Default storage engine (InnoDB) is not available&lt;/em&gt;&lt;br /&gt;&lt;em&gt;080917 12:30:17 [ERROR] Aborting.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;In this case, I went to &lt;em&gt;my.ini&lt;/em&gt; file and changed:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;innodb_log_file_size=170M&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;to&lt;br /&gt;&lt;br /&gt;&lt;em&gt;innodb_log_file_size=25165824&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;I was then able to start the &lt;em&gt;MySql &lt;/em&gt;Server and create a normal backup for later retrieval on other servers.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6086730485636404739-1968020227814114779?l=drglennn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://drglennn.blogspot.com/feeds/1968020227814114779/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6086730485636404739&amp;postID=1968020227814114779' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/1968020227814114779'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/1968020227814114779'/><link rel='alternate' type='text/html' href='http://drglennn.blogspot.com/2008/09/mysql-database-recovery.html' title='MySQL Database Recovery'/><author><name>Glennn</name><uri>http://www.blogger.com/profile/11073435827711258234</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6086730485636404739.post-4120400684668317367</id><published>2008-09-14T22:35:00.001-07:00</published><updated>2008-09-14T22:47:07.281-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Tomcat'/><title type='text'>Tomcat - Error starting.</title><content type='html'>I recently have been installing Tomcat 6 on a new server.&lt;br /&gt;&lt;br /&gt;After installing a fresh &lt;em&gt;JRE&lt;/em&gt; and then &lt;em&gt;apache-tomcat-6.0.18.exe &lt;/em&gt;I got the error:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Windows could not start the Apache Tomcat on Local Computer.  For more information, review the System Event Log. If this is a non-Microsoft service, contact the service vendor, and refer to service-specific error code 0.&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;/em&gt;&lt;br /&gt;To fix this I copied the file &lt;em&gt;msvcr71.dll &lt;/em&gt;from my Java/bin directory into the Apache-Tomcat/bin directory.&lt;br /&gt;&lt;br /&gt;It worked... though why it didn't work "out of the box" without such "black magic" I really don't know!!!!.  I spent ages trying a range  of different Tomcat installations, JAVA versions and classpath settings.&lt;br /&gt;&lt;br /&gt;Aaaargh!  Those were precious hours of my life I'm never going to get back...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6086730485636404739-4120400684668317367?l=drglennn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://drglennn.blogspot.com/feeds/4120400684668317367/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6086730485636404739&amp;postID=4120400684668317367' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/4120400684668317367'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/4120400684668317367'/><link rel='alternate' type='text/html' href='http://drglennn.blogspot.com/2008/09/tomcat-error-starting.html' title='Tomcat - Error starting.'/><author><name>Glennn</name><uri>http://www.blogger.com/profile/11073435827711258234</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6086730485636404739.post-3881417446058132246</id><published>2008-09-10T18:40:00.000-07:00</published><updated>2008-09-10T18:53:35.048-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Hibernate Annotations'/><category scheme='http://www.blogger.com/atom/ns#' term='Log4J'/><category scheme='http://www.blogger.com/atom/ns#' term='Hibernate'/><title type='text'>Upgrading Hibernate Annotations from V3.2 to V3.4.0</title><content type='html'>I recently &lt;a href="http://drglennn.blogspot.com/2008/09/transient-annotation-and-generics-in.html"&gt;blooged about&lt;/a&gt; a &lt;a href="http://drglennn.blogspot.com/2008/09/transient-annotation-and-generics-in.html"&gt;Hibernate Annotations bug&lt;/a&gt; that had been fixed in &lt;em&gt;Hibernate Annotations 3.4.0&lt;/em&gt;, but not in &lt;em&gt;3.2&lt;/em&gt;.&lt;br /&gt;&lt;br /&gt;While upgrading fixed this problem, I did have some problems with changing to &lt;em&gt;Hibernate Annotations 3.4&lt;/em&gt;.&lt;br /&gt;&lt;br /&gt;I tried downloading &lt;em&gt;hibernate-annotations-3.4.0.GA.tar.gz&lt;/em&gt; and just swapping over the &lt;em&gt;hibernate-annotations.jar&lt;/em&gt; file in my project. Seemed like a simple thing to do, however, using the new &lt;em&gt;hibernate-annotations.jar&lt;/em&gt; file caused a new error:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Caused by: java.lang.NoClassDefFoundError: org/hibernate/annotations/common/reflection/ReflectionManager&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;This problem is discussed at &lt;a href="http://forum.hibernate.org/viewtopic.php?p=2363366"&gt;this post&lt;/a&gt;. It turns out that, in upgrading, I need also to include &lt;em&gt;hibernate-commons-annotations.jar.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Then I got &lt;a href="http://forum.hibernate.org/viewtopic.php?p=2394754"&gt;another problem &lt;/a&gt;that is due to the lack of the &lt;em&gt;slf4j-api.jar:&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;Caused by: java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;After that, I decided I'd better trust the README.txt file that comes with &lt;em&gt;hibernate-annotations-3.4.0&lt;/em&gt; and pulled across a bunch of (I think) required libraries:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;dom4j.jar&lt;br /&gt;ejb3-persistence.jar&lt;br /&gt;hibernate-core.jar&lt;br /&gt;slf4j-api.jar&lt;br /&gt;slf4j-log4j12.jar&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;which fixed one problem... but led to another new error:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Caused by: java.lang.NoSuchFieldError: TRACE&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;The problem here &lt;a href="http://www.blogjava.net/rain1102/articles/193843.html"&gt;seems to be&lt;/a&gt; that I need &lt;em&gt;log4j.jar&lt;/em&gt; to be of version 1.2.12 or higher. (I've got 1.2.11 - missed it by that much!)&lt;br /&gt;&lt;br /&gt;Having upgraded to &lt;em&gt;log4j-1.2.15&lt;/em&gt; that fixed that problem - but, a new one was waiting for me:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Caused by: java.lang.NoClassDefFoundError: org/apache/commons/collections/map/LRUMapat org.hibernate.util.SimpleMRUCache.init(SimpleMRUCache.java:71)&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;I realized (following a bit of reading I probably should have done right at the start!) that I needed to upgrade not just the &lt;em&gt;hibernate-annotations&lt;/em&gt;, but also the hibernate core packages themselves to be compatible with the new annotations.&lt;br /&gt;&lt;br /&gt;I downloaded the &lt;em&gt;hibernate-distribution-3.3.0.SP1-dist.tar.gz&lt;/em&gt; file (something I probably should have done right from the start).&lt;br /&gt;&lt;br /&gt;With &lt;em&gt;Hibernate&lt;/em&gt; and &lt;em&gt;Hibernate Annotations&lt;/em&gt; both updated, everything worked just fine.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The Moral of the Story:&lt;/strong&gt; Check the dependencies when you upgrade one part of a system and make sure you read the documentation!&lt;br /&gt;&lt;br /&gt;Now... I won't make &lt;em&gt;that&lt;/em&gt; mistake again (not a guarantee!)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6086730485636404739-3881417446058132246?l=drglennn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://drglennn.blogspot.com/feeds/3881417446058132246/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6086730485636404739&amp;postID=3881417446058132246' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/3881417446058132246'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/3881417446058132246'/><link rel='alternate' type='text/html' href='http://drglennn.blogspot.com/2008/09/upgrading-hibernate-annotations-from.html' title='Upgrading Hibernate Annotations from V3.2 to V3.4.0'/><author><name>Glennn</name><uri>http://www.blogger.com/profile/11073435827711258234</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6086730485636404739.post-1617271647684457224</id><published>2008-09-10T15:49:00.000-07:00</published><updated>2008-09-10T18:55:01.956-07:00</updated><title type='text'>@Transient Annotation and Generics in Hibernate Superclasses</title><content type='html'>I'm working with Hibernate Annotations, and have a transient field in one of my entity superclasses that is mapped as @MappedSuperclass. That is:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;@MappedSuperclass&lt;br /&gt;public abstract class MyEntity&amp;lt;T extends MyEntity&amp;lt;T&amp;gt;&amp;gt; implements Serializable {&lt;br /&gt;@Transient&lt;br /&gt;protected Class&amp;lt;T&amp;gt; domainClass = getDomainClass();&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;/em&gt;&lt;br /&gt;This is throwing the following error:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;org.hibernate.AnnotationException: Property my.entity.MyClass.domainClass has an unbound type and no explicit target entity. Resolve this Generic usage issue or set an explicit target attribute (eg @OneToMany(target=) or use an explicit @Type&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;/em&gt;&lt;br /&gt;I found the following Hibernate bug report that seems to refer to the same problem, and indicated it is a bug in Hibernate:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://opensource.atlassian.com/projects/hibernate/browse/ANN-698?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel"&gt;http://opensource.atlassian.com/projects/hibernate/browse/ANN-698?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This bug was recently fixed. Seeing as I've been using Hibernate 3.3, I decided to upgrade to Hibernate Annotations 3.4 to fix this.&lt;br /&gt;&lt;br /&gt;It worked! Just thought I'd mention this as a fix to that problem, in case others have it.&lt;br /&gt;&lt;br /&gt;PS: Sounds easy, huh ?- but I did have &lt;a href="http://drglennn.blogspot.com/2008/09/upgrading-hibernate-annotations-from.html"&gt;some issues &lt;/a&gt;with changing to Hibernate Annotations 3.4 which you can read about &lt;a href="http://drglennn.blogspot.com/2008/09/upgrading-hibernate-annotations-from.html"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6086730485636404739-1617271647684457224?l=drglennn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://drglennn.blogspot.com/feeds/1617271647684457224/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6086730485636404739&amp;postID=1617271647684457224' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/1617271647684457224'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/1617271647684457224'/><link rel='alternate' type='text/html' href='http://drglennn.blogspot.com/2008/09/transient-annotation-and-generics-in.html' title='@Transient Annotation and Generics in Hibernate Superclasses'/><author><name>Glennn</name><uri>http://www.blogger.com/profile/11073435827711258234</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6086730485636404739.post-4900573597890705232</id><published>2008-09-09T22:34:00.000-07:00</published><updated>2008-09-09T22:49:55.982-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Hibernate Annotations'/><category scheme='http://www.blogger.com/atom/ns#' term='Hibernate'/><title type='text'>@Entity annotations</title><content type='html'>I've just been scratching my head, attempting to figure out why some of my Java classes, marked with the &lt;em&gt;@Entity&lt;/em&gt; annotation, weren't being generated (by Hibernate) as tables in my database.&lt;br /&gt;&lt;br /&gt;They were correctly included in my &lt;em&gt;hibernate.cfg.xml&lt;/em&gt; file with mappings:&lt;br /&gt;&lt;br /&gt;&amp;lt;mapping class="mypackage.entity.myclass" /&amp;gt;&lt;br /&gt;&lt;br /&gt;However, while most of my classes were being correctly generated, some were not.&lt;br /&gt;&lt;br /&gt;It turns out that in the classes which were failing, I'd accidently imported  &lt;em&gt;&lt;a href="http://www.hibernate.org/hib_docs/annotations/api/org/hibernate/annotations/Entity.html"&gt;org.hibernate.annotations.Entity&lt;/a&gt;&lt;/em&gt; rather than the correct class (&lt;em&gt;javax.persistence.Entity)&lt;/em&gt;  &lt;br /&gt;&lt;br /&gt;I guess this is a pretty easy trap to fall into - especially if you're using nice editor features (like the myEclipse "&lt;em&gt;organize imports&lt;/em&gt;" plugin) and not paying sufficient attention (I did it once in a template and then copied this to a bunch of other locations!).  Once done it can be kinda hard to see what isn't right ..  Of course, the documentation is clear when it &lt;a href="http://www.redhat.com/docs/manuals/jboss/jboss-eap-4.3/doc/hibernate/Annotations_Reference_Guide/Hibernate_Annotation_Extensions-Entity.html"&gt;states&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;"&lt;a href="http://www.redhat.com/docs/manuals/jboss/jboss-eap-4.3/doc/hibernate/Annotations_Reference_Guide/Hibernate_Annotation_Extensions-Entity.html"&gt;Note:&lt;/a&gt; &lt;em&gt;@javax.persistence.Entity is still mandatory, @org.hibernate.annotations.Entity is not a replacement.&lt;/em&gt; "&lt;br /&gt;&lt;br /&gt;Oooops...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6086730485636404739-4900573597890705232?l=drglennn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://drglennn.blogspot.com/feeds/4900573597890705232/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6086730485636404739&amp;postID=4900573597890705232' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/4900573597890705232'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/4900573597890705232'/><link rel='alternate' type='text/html' href='http://drglennn.blogspot.com/2008/09/entity-annotations.html' title='@Entity annotations'/><author><name>Glennn</name><uri>http://www.blogger.com/profile/11073435827711258234</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6086730485636404739.post-3624531978004634324</id><published>2008-09-08T20:10:00.000-07:00</published><updated>2008-09-09T16:20:20.772-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Hibernate Annotations'/><category scheme='http://www.blogger.com/atom/ns#' term='Hibernate'/><title type='text'>Hibernate and SQL keyword Column Names</title><content type='html'>I have recently experienced some problems with Hibernate and the generation of SQL Tables. I am using Hibernate Annotations, and some of my entities have annotations that look something like:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;@Column(nullable = false)&lt;br /&gt;String myProperty;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;@Column&lt;br /&gt;@Temporal(TemporalType.TIMESTAMP)&lt;br /&gt;@GeneratedValue(strategy = GenerationType.AUTO)&lt;br /&gt;Date timestamp;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;@Column&lt;br /&gt;boolean insert;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;@Column&lt;br /&gt;boolean update;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;@Column&lt;br /&gt;boolean delete;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;The problem is that Hibernate is throwing the following errors:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;DEBUG [org.hibernate.tool.hbm2ddl.SchemaUpdate] - &amp;lt;create table MyTable (id bigint not null auto_increment, modifyingUsername varchar(255) not null, timestamp datetime, insert bit, update bit, delete bit, primary key (id))&amp;gt;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] - &amp;lt;Unsuccessful: create table TextMetaDataHistory (id bigint not null auto_increment, modifyingUsername varchar(255) not null, timestamp datetime, insert bit, update bit, delete bit,primary key (id))&amp;gt;&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] - &amp;lt;Syntax error or access violation message from server: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'insert bit, update bit, delete bit' at line 1"&amp;gt;&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;Upon further investigation, it seems the problem is with the SQL that Hibernate is generating. Unfortunately some of my Java variable names (such as "timestamp", "insert", "update" and "delete") are themselves SQL keywords.&lt;br /&gt;&lt;br /&gt;The Debug information above shows that the SQL being generated is not correct SQL syntax. In particular, if you type in MySQL:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;create table MyTable (id bigint not null auto_increment, modifyingUsername varchar(255) not null, timestamp datetime, insert bit, update bit, delete bit, primary key (id))&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;you'll get an error.&lt;br /&gt;&lt;br /&gt;If you manually edit this so it, instead, reads:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;create table MyTable (id bigint not null auto_increment, modifyingUsername varchar(255) not null, `timestamp` datetime, `insert` bit, `update` bit, `delete` bit, primary key (id))&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;the SQL will run beautifully. All I've done here is insert quotes (the "`" quote, which is found on a standard keyboard above Tab, and using Shift on this key produces "~").&lt;br /&gt;&lt;br /&gt;All I need to do now is work out how to get Hibernate to generate SQL with this included!!!&lt;br /&gt;More news soon... (I hope!)&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Update:&lt;/strong&gt;  Ok, so I decided, in the end, to fix this just by manually changing my Hibernate annotations to give an explicit name for each "questionable" column that includes the quotes.  Thus the modified annotations are now:&lt;br /&gt;&lt;em&gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;@Column(name="`timestamp`")&lt;/em&gt;&lt;br /&gt;&lt;em&gt;@Temporal(TemporalType.TIMESTAMP) &lt;/em&gt;&lt;br /&gt;&lt;em&gt;@GeneratedValue(strategy = GenerationType.AUTO) &lt;/em&gt;&lt;br /&gt;&lt;em&gt;Date timestamp; &lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;@Column(name="`insert`")&lt;/em&gt;&lt;br /&gt;&lt;em&gt;boolean insert; &lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;@Column(name="`update`")&lt;/em&gt;&lt;br /&gt;&lt;em&gt;boolean update; &lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;@Column(name="`delete`")&lt;/em&gt;&lt;br /&gt;&lt;em&gt;boolean delete;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;NB:  &lt;/strong&gt;The "`" quote I'm using is the one above &lt;tab&gt; on a US keyboard, sharing the key with "~".  Other quotation marks didn't work for me.&lt;br /&gt;&lt;br /&gt;This now works - but it does seem unusual that I have to do this.  I'm surprised Hibernate doesn't do this automatically for all Column names to avoid such "keyword" problems.  Having said that, some "newbie" Hibernate users who have experienced similar problems, have suggested modifying Hibernate to do this, and the response from more experienced Hibernate programmers in at least one case was "&lt;em&gt;Read the manual - stop wasting time&lt;/em&gt;" or something to that effect.  Makes me wonder if I'm missing something in proposing this solution? &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;If you know of a better way to fix this problem, please post a comment on this blog!&lt;/strong&gt;  In the meantime, using the @Column(name="`whatever`") annotation is fixing my immediate problem, and doesn't seem to have any bad side effects, so I'll just stick with it!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;PS: By the way, to get Hibernate to log the SQL it was using, I set:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;log4j.logger.org.hibernate=debug&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;in the log4j.properties file I'm using..&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6086730485636404739-3624531978004634324?l=drglennn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://drglennn.blogspot.com/feeds/3624531978004634324/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6086730485636404739&amp;postID=3624531978004634324' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/3624531978004634324'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/3624531978004634324'/><link rel='alternate' type='text/html' href='http://drglennn.blogspot.com/2008/09/hibernate-and-sql-keyword-column-names.html' title='Hibernate and SQL keyword Column Names'/><author><name>Glennn</name><uri>http://www.blogger.com/profile/11073435827711258234</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6086730485636404739.post-2446246310114254667</id><published>2008-09-08T17:52:00.000-07:00</published><updated>2008-09-08T18:39:40.112-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MyEclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='Hibernate'/><title type='text'>Incorrect Version of ehcache</title><content type='html'>Within a web application I'm currently working on, I've just added the Hibernate entity mappings into the &lt;em&gt;hibernate.cfg.xml&lt;/em&gt; file.  These look something like:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&amp;lt;mapping class="project.entity.MyClass" /&amp;gt;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;and follow a cache configuration line that says:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&amp;lt;property name="cache.use_second_level_cache"&amp;gt;true&amp;lt;/property&amp;gt;&lt;br /&gt;&amp;lt;property name="hibernate.cache.provider_class"&amp;gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;net.sf.ehcache.hibernate.SingletonEhCacheProvider&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&amp;lt;/property&amp;gt;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;However, when I launch Tomcat, I get the following errors:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;context&gt;&lt;br /&gt;org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/bean-defs-6-session.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: net.sf.ehcache.CacheManager.getEhcache(Ljava/lang/String;)Lnet/sf/ehcache/Ehcache;&lt;br /&gt;Caused by:&lt;br /&gt;java.lang.NoSuchMethodError: net.sf.ehcache.CacheManager.getEhcache(Ljava/lang/String;)Lnet/sf/ehcache/Ehcache;&lt;br /&gt;at net.sf.ehcache.hibernate.SingletonEhCacheProvider.buildCache(SingletonEhCacheProvider.java:89)&lt;br /&gt;at ...&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;/em&gt;&lt;br /&gt;It turns out that the application is using an old version of &lt;em&gt;ehcache.jar&lt;/em&gt;.  Further investigation revealed that the reason for this is that the MyEclipse "&lt;em&gt;Hibernate 3.1 Core Libraries&lt;/em&gt;" includes a copy of "&lt;em&gt;ehcache-1.1.jar&lt;/em&gt;".  Even though I had "&lt;em&gt;ehcache-1.3.0.jar&lt;/em&gt;" included as a project library (and even changed its order above the &lt;em&gt;Hibernate Core Libraries&lt;/em&gt; in the "Order and Export" tab), the application was still defaulting to the &lt;em&gt;ehcache-1.1.jar&lt;/em&gt; version.&lt;br /&gt;&lt;br /&gt;To fix this, I removed the &lt;em&gt;Hibernate 3.1 Core Libraries&lt;/em&gt; from the project libraries.  (Subsequently you can add it back in, if you want, as it will now be below the &lt;em&gt;ehcache-1.3.0.jar &lt;/em&gt;so the correct version of &lt;em&gt;ehcache&lt;/em&gt; will now be used, if you need other bits from the &lt;em&gt;Hibernate 3.1 Core libraries&lt;/em&gt;).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6086730485636404739-2446246310114254667?l=drglennn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://drglennn.blogspot.com/feeds/2446246310114254667/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6086730485636404739&amp;postID=2446246310114254667' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/2446246310114254667'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/2446246310114254667'/><link rel='alternate' type='text/html' href='http://drglennn.blogspot.com/2008/09/incorrect-version-of-ehcache.html' title='Incorrect Version of ehcache'/><author><name>Glennn</name><uri>http://www.blogger.com/profile/11073435827711258234</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6086730485636404739.post-5339175435128463175</id><published>2008-09-07T21:50:00.000-07:00</published><updated>2008-09-08T17:52:20.380-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Spring'/><category scheme='http://www.blogger.com/atom/ns#' term='Hibernate'/><title type='text'>Defining DAO Objects</title><content type='html'>A little while back in an &lt;a href="http://drglennn.blogspot.com/2008/08/problems-with-webapproot-system.html"&gt;earlier blog post&lt;/a&gt; I mentioned a web application I've been developing which uses Hibernate Annotations and Spring MVC.&lt;br /&gt;&lt;br /&gt;As mentioned then, the framework I'm using is based on one described in &lt;a href="http://www.developer.com/java/ent/article.php/3577101"&gt;this tutorial.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In the section of this tutorial that discusses defining the DAOs (Database Access Objects) it suggests creating your DAOs using code that looks like:&lt;br /&gt;&lt;br /&gt;&amp;lt;bean id="daoTmpl"&amp;gt;&lt;br /&gt;&amp;lt;property name="sessionFactory"&amp;gt;&lt;br /&gt;&amp;lt;ref bean="sessionFactory"/&amp;gt;&lt;br /&gt;&amp;lt;/property&amp;gt;&lt;br /&gt;&amp;lt;/bean&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;bean id="myObjectDao" class="org.annotationmvc.dao.MyObjectDaoTmpl" parent="daoTmpl" /&amp;gt;&lt;br /&gt;&lt;br /&gt;A similar pattern is repeated in a number of other locations on the internet, suggesting using a daoTmpl bean so you don't have to include the sessionFactory object individually in each one of your DAOs.&lt;br /&gt;&lt;br /&gt;This is great advice, but in every case you get an error something like:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'daoTmpl' defined in ServletContext resource [/WEB-INF/bean-defs-5-dao.xml]: Instantiation of bean failed; nested exception is java.lang.IllegalStateException: No bean class specified on bean definition&lt;br /&gt;Caused by:&lt;br /&gt;java.lang.IllegalStateException: No bean class specified on bean definition&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;The problem is that you can only define a bean without a class if you declare it as abstract. To do this, change the bean definition to:&lt;br /&gt;&lt;br /&gt;&amp;lt;bean id="daoTmpl" &lt;strong&gt;abstract="true"&lt;/strong&gt; &amp;gt;&lt;br /&gt;&amp;lt;property name="sessionFactory"&amp;gt;&lt;br /&gt;&amp;lt;ref bean="sessionFactory"/&amp;gt;&lt;br /&gt;&amp;lt;/property&amp;gt;&lt;br /&gt;&amp;lt;/bean&amp;gt;&lt;br /&gt;&lt;br /&gt;and it will work as expected.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6086730485636404739-5339175435128463175?l=drglennn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://drglennn.blogspot.com/feeds/5339175435128463175/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6086730485636404739&amp;postID=5339175435128463175' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/5339175435128463175'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/5339175435128463175'/><link rel='alternate' type='text/html' href='http://drglennn.blogspot.com/2008/09/defining-dao-objects.html' title='Defining DAO Objects'/><author><name>Glennn</name><uri>http://www.blogger.com/profile/11073435827711258234</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6086730485636404739.post-5737900500830630050</id><published>2008-08-26T17:40:00.000-07:00</published><updated>2008-08-26T20:42:35.587-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Hibernate'/><category scheme='http://www.blogger.com/atom/ns#' term='ORM'/><title type='text'>Hibernate Inheritance Mapping Strategies</title><content type='html'>If you've played with Hibernate for a while, one thing you'll really appreciate is how it helps you avoid the &lt;a href="http://www.jboss.com/pdf/HibernateBrochure-Jun2005.pdf"&gt;"object/relational mapping" paradigm mismatch.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Now, this is great, because it frees you up to focus on getting your object hierarchy / object models right, without (too much) focus on the underlying persistence layer.  However, this doesn't come completely for free.&lt;br /&gt;&lt;br /&gt;Inheritence is one area where the mistmatch between object-oriented and relational world becomes particularly visible.  What this means is that you have to undertake some thought when it comes to mapping classes to tables, in the case where the classes exhibit inheritence. &lt;br /&gt;&lt;br /&gt;A number of &lt;a href="http://www.hibernate.org/hib_docs/reference/en/html/inheritance.html"&gt;references&lt;/a&gt; (for instances, I read about this in Chapter 3 of the excellent book "&lt;a href="http://www.hibernate.org/hib_docs/reference/en/html/inheritance.html"&gt;Hibernate In Action")&lt;/a&gt; talk about the "&lt;em&gt;three&lt;/em&gt; different approaches to representing an inheritance hierarchy", as classified in a paper "Mapping Ojects to Relational Databases" by Scott Ambler in 2002.  These are:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Table per concrete Class ("&lt;a href="file:///C:/Documents%20and%20Settings/moyg/My%20Documents/Downloads/hibernate-annotations-3.2.1.GA/doc/reference/en/html_single/index.html"&gt;Table per class&lt;/a&gt;") - One table is used for each (non-abstract) class.&lt;/li&gt;&lt;li&gt;Table per class hierarchy ("&lt;a href="file:///C:/Documents%20and%20Settings/moyg/My%20Documents/Downloads/hibernate-annotations-3.2.1.GA/doc/reference/en/html_single/index.html"&gt;Single table per class hierarchy&lt;/a&gt;") - One table is used to map an entire class hierarchy.&lt;/li&gt;&lt;li&gt;Table per subclass ("&lt;a href="file:///C:/Documents%20and%20Settings/moyg/My%20Documents/Downloads/hibernate-annotations-3.2.1.GA/doc/reference/en/html_single/index.html"&gt;Joined subclasses&lt;/a&gt;")- One table is used for every subclass (including abstract classes and interfaces).  These only contain columns for the non-inherited properties.&lt;/li&gt;&lt;/ul&gt;Each of these is mapped (using Hibernate annotations) using the @Inheritance annotations.  That is, @Inheritance(strategy=InheritanceType.TABLE_PER_CLASS), @Inheritance(strategy=InheritanceType.SINGLE_TABLE) and @Inheritance(strategy=InheritanceType.JOINED) respectively.&lt;br /&gt;&lt;br /&gt;However, recently I found about another way of handling inheritance in my object model being mapped to the persistence layer.  It is useful for the case where you have a superclass that does not need to have any corresponding tables in the underlying database, and does not need to be queryable.  In this case, a superclass can be annotated with the @&lt;a href="https://java.sun.com/javaee/5/docs/api/javax/persistence/MappedSuperclass.html"&gt;MappedSuperclass &lt;/a&gt;annotation.&lt;br /&gt;&lt;br /&gt;I thought I should mention this, as most of the information about the three strategies for inheritance doesn't seem to mention this as a "fourth" option - probably because in this case the superclass is not actually an entity.&lt;br /&gt;&lt;br /&gt;In fact, I had a bit of difficulty understanding the difference between @MappedSuperclass and the @Inheritance(strategy=InheritanceType.TABLE_PER_CLASS) strategy.  They are, in fact, very similar. &lt;br /&gt;&lt;br /&gt;@&lt;a href="https://java.sun.com/javaee/5/docs/api/javax/persistence/MappedSuperclass.html"&gt;MappedSuperclass &lt;/a&gt;reference states:&lt;br /&gt;&lt;br /&gt;"A mapped superclass designates a class whose mapping information is applied to the entities that inherit from it.  A mapped superclass has no separate table defined for it."&lt;br /&gt;&lt;br /&gt;So, the MappedSuperclass annotation is similar to "table per class" inheritance, but (the difference is) it does not allow querying, persisting or relationships to the superclass.  Table per class does allow these (but, if I understand correctly, is fairly inefficient at these compared to the other two inheritance strategies.)&lt;br /&gt;&lt;br /&gt;Thus:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Mapped superclasses can't be targets of entity relationships&lt;/li&gt;&lt;li&gt;They can be either abstract or concrete.  (Some references suggest that a mapped superclass normally should be an abstract class).  &lt;/li&gt;&lt;li&gt;A mapped superclass is not an Entity&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;More information on these can be found at &lt;a href="http://en.wikibooks.org/wiki/Java_Persistence/Inheritance#Mapped_Superclasses"&gt;http://en.wikibooks.org/wiki/Java_Persistence/Inheritance#Mapped_Superclasses&lt;/a&gt;&lt;/p&gt;&lt;p&gt;The advantage of using MappedSperclass annotation for me, at this time, is that it seems the simplest approach if I don't want the superclass to be queried or relationships going directly to it.  For the top level of my hierarchy this seems to be a good way to go.  &lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6086730485636404739-5737900500830630050?l=drglennn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://drglennn.blogspot.com/feeds/5737900500830630050/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6086730485636404739&amp;postID=5737900500830630050' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/5737900500830630050'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/5737900500830630050'/><link rel='alternate' type='text/html' href='http://drglennn.blogspot.com/2008/08/hibernate-inheritance-mapping.html' title='Hibernate Inheritance Mapping Strategies'/><author><name>Glennn</name><uri>http://www.blogger.com/profile/11073435827711258234</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6086730485636404739.post-5611769484835181319</id><published>2008-08-19T19:47:00.000-07:00</published><updated>2008-08-19T20:01:18.617-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MyEclipse'/><title type='text'>Changing Web Context-root in MyEclipse</title><content type='html'>As you would expect, when you create a web application in myEclipse, by default the web context-root is the name of your web application.&lt;br /&gt;(The web context-root defines the URL you'll use to access your web-app).&lt;br /&gt;&lt;br /&gt;To change the Web Context-root, right-click on the project and select properties. Then find the MyEclipse-&gt;Web tag. Now you can change this property!&lt;br /&gt;&lt;br /&gt;You'll then need to re-deploy!&lt;br /&gt;&lt;br /&gt;Easy, I know - but it took me a while to find, so why not record it here for posterity...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6086730485636404739-5611769484835181319?l=drglennn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://drglennn.blogspot.com/feeds/5611769484835181319/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6086730485636404739&amp;postID=5611769484835181319' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/5611769484835181319'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/5611769484835181319'/><link rel='alternate' type='text/html' href='http://drglennn.blogspot.com/2008/08/chaning-web-context-root-in-myeclipse.html' title='Changing Web Context-root in MyEclipse'/><author><name>Glennn</name><uri>http://www.blogger.com/profile/11073435827711258234</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6086730485636404739.post-6663776080735803183</id><published>2008-08-19T17:12:00.000-07:00</published><updated>2008-08-19T18:17:40.796-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Log4J'/><category scheme='http://www.blogger.com/atom/ns#' term='Tomcat'/><title type='text'>Problems with the webapp.root system property when using Tomcat &amp; Log4J.</title><content type='html'>&lt;strong&gt;java.lang.IllegalStateException: Web app root system property already set to different value:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;I've been developing a web application that uses Log4J for logging. Recently I started a new web app, using essentially the same framework.&lt;br /&gt;(By the way, the framework - which uses Hibernate Annotations and Spring MVC - is based on the one descrbed in &lt;a href="http://www.developer.com/java/ent/article.php/3577101"&gt;this tutorial&lt;/a&gt;)&lt;br /&gt;&lt;br /&gt;Anyway, in creating this new web app and starting Tomcat, I immediately encountered the following error:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.util.Log4jConfigListener&lt;br /&gt;java.lang.IllegalStateException: Web app root system property already set to different value: 'webapp.root' = [MyPath\EclipseProjects\.metadata\.plugins\com.genuitec.eclipse.easie.tomcat.myeclipse\tomcat\webapps\app1Name\] instead of [MyPath\EclipseProjects\.metadata\.plugins\com.genuitec.eclipse.easie.tomcat.myeclipse\tomcat\webapps\app2Name\] - Choose unique values for the 'webAppRootKey' context-param in your web.xml files!&lt;br /&gt;at org.springframework.web.util.WebUtils.setWebAppRootSystemProperty(WebUtils.java:132)&lt;br /&gt;at org.springframework.web.util.Log4jWebConfigurer.initLogging(Log4jWebConfigurer.java:117)&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;/em&gt;&lt;br /&gt;Ok - so why is this??? Well, I'm glad you asked...&lt;br /&gt;&lt;br /&gt;First things first, I should note that the &lt;a href="http://opensource.objectsbydesign.com/spring-1.1.4/org/springframework/web/util/Log4jWebConfigurer.html"&gt;L4JWebConfigurer class &lt;/a&gt;is:&lt;br /&gt;&lt;br /&gt;"&lt;em&gt;A convenience class that performs custom Log4J initialization for web environments, support 2 init parameters..."&lt;/em&gt; that are set as context-param in web.xml.&lt;br /&gt;&lt;br /&gt;See: &lt;a href="http://opensource.objectsbydesign.com/spring-1.1.4/org/springframework/web/util/Log4jWebConfigurer.html"&gt;http://opensource.objectsbydesign.com/spring-1.1.4/org/springframework/web/util/Log4jWebConfigurer.html&lt;/a&gt;&lt;br /&gt;and&lt;br /&gt;&lt;a href="http://static.springframework.org/spring/docs/1.2.x/api/org/springframework/web/util/Log4jWebConfigurer.html"&gt;http://static.springframework.org/spring/docs/1.2.x/api/org/springframework/web/util/Log4jWebConfigurer.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;However, this convenience class comes with a &lt;a href="http://static.springframework.org/spring/docs/1.2.x/api/org/springframework/web/util/Log4jWebConfigurer.html"&gt;warning&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;"WARNING: Some containers (like Tomcat) do not keep system properties separate per web app. You have to use unique "webAppRootKey" context-params per web app then, to avoid clashes. Other containers like Resin do isolate each web app's system properties: Here you can use the default key (i.e. no "webAppRootKey" context-param at all) without worrying. "&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;So... given I'm using Tomcat, what does this mean?&lt;br /&gt;&lt;br /&gt;It turns out that the &lt;em&gt;webAppRootKey &lt;/em&gt;is a Spring context parameter. It exposes the web application's root directory as a system property. So, it is the value of the webAppRootKey that provides the name for the system property to use. That's fine if you've just got one webapp in Tomcat. Spring will just choose a default value for this (&lt;em&gt;app.root&lt;/em&gt;) and off you go. However, as the warning above notes, Tomcat does not keep system properties separate per webApp. This means that when we get to the second application, the same system property (app.root) is being set to a new value (our second application's root directory, rather than the first!)&lt;br /&gt;&lt;br /&gt;The reason this is occurring at all is that Log4JConfigListener is trying to set the webAppRootKey in both cases. This allows log4J to place log and config files in directories relative to the application root directory, rather than in a fixed path.&lt;br /&gt;&lt;br /&gt;Anyway, the real question is how to fix this. One option would be to remove the Log4JConfigListener, or re-configure Log4J so that this doesn't happen - that is by setting &lt;em&gt;'&lt;a href="http://static.springframework.org/spring/docs/1.2.x/api/org/springframework/web/util/Log4jWebConfigurer.html"&gt;log4JExposeWebAppRoot&lt;/a&gt;'&lt;/em&gt; to false. (This is a servlet context parameter that eliminates the use of log file locations relative to the web application's root directory.)&lt;br /&gt;&lt;br /&gt;However, in my case, I decided the easiest thing was just to use a non-default name for the webAppRootKey for each of my applications.&lt;br /&gt;&lt;br /&gt;That is, I fixed this by placing the following context-parameter into each of the web application's web.xml files:&lt;br /&gt;&lt;br /&gt;&amp;lt;context-param&amp;gt;&lt;br /&gt;&amp;lt;param-name&amp;gt;webAppRootKey&amp;lt;/param-name&amp;gt;&lt;br /&gt;&amp;lt;param-value&amp;gt;uniqueAppRootNamee&amp;lt;/param-value&amp;gt;&lt;br /&gt;&amp;lt;/context-param&amp;gt;&lt;br /&gt;&lt;br /&gt;This fixed the problem, and everything's working again... Hoorah!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6086730485636404739-6663776080735803183?l=drglennn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://drglennn.blogspot.com/feeds/6663776080735803183/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6086730485636404739&amp;postID=6663776080735803183' title='14 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/6663776080735803183'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/6663776080735803183'/><link rel='alternate' type='text/html' href='http://drglennn.blogspot.com/2008/08/problems-with-webapproot-system.html' title='Problems with the webapp.root system property when using Tomcat &amp; Log4J.'/><author><name>Glennn</name><uri>http://www.blogger.com/profile/11073435827711258234</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>14</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6086730485636404739.post-7317097738149758078</id><published>2008-08-17T00:33:00.000-07:00</published><updated>2008-08-17T16:24:24.737-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='AVG'/><title type='text'>AVG Free Edition - .bin file is missing</title><content type='html'>If you're using AVG Anti-Virus 8 (Free edition), you may have just got a message saying that the update failed and a .bin file is missing.&lt;br /&gt;&lt;br /&gt;It turns out this is because the update that is trying to occur is, errr, missing. Don't worry, though, it's not your fault. It's a problem with AVG. There are lots of people finding that problem today (16th/17th August 2008), and lots of people wasting time re-installing AVG with no improvement. My advice is wait a 24 hours and see if AVG fix it.&lt;br /&gt;&lt;br /&gt;If you're in a real hurry, I can tell you which of the updates is missing and you can then do the other updates manually. To do this:&lt;br /&gt;(1) Start AVG&lt;br /&gt;(2) Click on Update Now.&lt;br /&gt;(3) When the updates are shown in the popup window, click on the link to tell you more.&lt;br /&gt;&lt;a href="http://free.avg.com/ww.download-update-appf8"&gt;http://free.avg.com/ww.download-update-appf8&lt;/a&gt;&lt;br /&gt;(4) Save the updates to your computer to do a manual update later. The one you want to avoid is (currently) the last one:&lt;br /&gt;&lt;a href="http://downloadfree.avg.com/update/u7iavi1616oo.bin" target="_blank" rel="nofollow"&gt;http://downloadfree.avg.com/update/u7iavi1616oo.bin&lt;/a&gt; - but it isn't there!!!.&lt;br /&gt;(5) use "Tools-&gt;Update From Directory" and browse to the other updates to do them manually.&lt;br /&gt;&lt;br /&gt;Of course... you could just wait for AVG to fix this. Can't be long now, surely :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6086730485636404739-7317097738149758078?l=drglennn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://drglennn.blogspot.com/feeds/7317097738149758078/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6086730485636404739&amp;postID=7317097738149758078' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/7317097738149758078'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/7317097738149758078'/><link rel='alternate' type='text/html' href='http://drglennn.blogspot.com/2008/08/avg-free-edition-bin-file-is-missing.html' title='AVG Free Edition - .bin file is missing'/><author><name>Glennn</name><uri>http://www.blogger.com/profile/11073435827711258234</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6086730485636404739.post-1444496063694547363</id><published>2008-08-11T05:16:00.000-07:00</published><updated>2008-08-19T20:00:26.008-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='MyEclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='Tomcat'/><title type='text'>UnsupportedClassVersionError</title><content type='html'>&lt;p&gt;I just got the following error when trying to start Tomcat for an Eclipse project:&lt;/p&gt;&lt;p&gt;java.lang.UnsupportedClassVersionError: Bad version number in .class file &lt;/p&gt;It turns out my Tomcat installation seemed to be using an older version of Java to run. To fix this I went into Eclipse Windows-&gt;Preferences-&gt;Java and made sure that both the "Installed JRE" and "Compiler" tags had the same Java version (Java 6).&lt;br /&gt;&lt;br /&gt;I also checked that in the Project preferences under "MyEclipse-&gt;Application Servers-&gt;Tomcat-&gt;MyEclipseTomcat-&gt;JDK" that I had the correct JDK selected (6.0.03, in my case).&lt;br /&gt;&lt;br /&gt;I also deleted the Java 5 JDK (even though it wasn't selected) and (for good measure) deleted all my .class files... but this was probably a bit of overkill.&lt;br /&gt;&lt;br /&gt;Following a complete rebuild it all worked again... Phew!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6086730485636404739-1444496063694547363?l=drglennn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://drglennn.blogspot.com/feeds/1444496063694547363/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6086730485636404739&amp;postID=1444496063694547363' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/1444496063694547363'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/1444496063694547363'/><link rel='alternate' type='text/html' href='http://drglennn.blogspot.com/2008/08/unsupportedclassversionerror.html' title='UnsupportedClassVersionError'/><author><name>Glennn</name><uri>http://www.blogger.com/profile/11073435827711258234</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6086730485636404739.post-2190757851684287507</id><published>2008-07-15T22:34:00.001-07:00</published><updated>2008-07-31T23:18:07.801-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VBA'/><category scheme='http://www.blogger.com/atom/ns#' term='VBScript'/><category scheme='http://www.blogger.com/atom/ns#' term='Outlook'/><title type='text'>VBScript and Custom Forms in Outlook</title><content type='html'>&lt;strong&gt;1. Background:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I've recently been given a task to develop some custom task forms in Microsoft Outlook. These forms needed to have some additional fields (specialized text entries with information on the "last action taken", "outstanding actions" and "comments" in addition to standard task fields and categories. More challengingly, they also needed to have some other behaviours such as "automatically emailing people of changes" when they're updated.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;If you've ever worked with Microsoft Outlook, you'll know that doing this from scratch isn't as easy as you otherwise might expect. It sounded like the obvious thing to build on Outlook "Tasks" to just enable this extra functionality, but it turns out Outlook can be very restrictive when you get to something it isn't used to doing.&lt;br /&gt;&lt;br /&gt;I've done a reasonable amount of VBA coding in Excel and Powerpoint before, and was expecting this to be relatively similar (and straightforward). As it turns out, there were a number of new things to learn before getting this new custom form to work.&lt;br /&gt;&lt;br /&gt;This post outlines some of the things I had to work out in order to get this particular script to work. Not all of these "lessons" are profound - some were very quick to find solutions to. Others posed a more significant problem.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;2. Outlook Forms - Basics &lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;(or how to start if you've never worked with Outlook forms before)&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The actual starting process of creating a new form for entering task information is actually very easy. Just go to Tools-&gt;Forms-&gt;Design A Form and choose a "base form" from the "Standard Forms Library". In my case, "Task". This will give you a standard-looking "Task" form that you can start modifying in a fairly typical way. However, let me at least note some aspects that surprised me at first:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;You can't actually modify the first Tab (Task) tab on the form. It is fixed. You can't add new buttons or features.&lt;/li&gt;&lt;li&gt;It is probably not very profitable to try to "get around" this limitation by hiding this first tab (which you can do) and putting all of these features onto a user-modifyable tab. The main "tasks" tab is &lt;em&gt;actually&lt;/em&gt; different from the user-definable ones, and if you do attempt to put all of the tasks features on your own user-tab, you will find you've lost some pretty important abilities (like having a "calendar" pop-up allowing users to choose dates/times for these fields.) The overall look and feel also looks different and not as "professional". The issue with Calendar etc can be overcome, but it is going to take some effort!&lt;/li&gt;&lt;li&gt;Don't get confused by the difference between an outlook Form created in this manner and the Forms you get in the Visual Basic Editor (Tools-&gt;Macros-&gt;Visual Basic Editor). If you create a Form in the Visual Basic Editor it is a nice, plain, blank form with no specific limitations, but it isn't going to be very useful for most Outlook things you want to do - like generating an Outlook Task, Email or Calendar entry.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Noting this distinction between going into Visual Basic Editor, and the process for creating the form, let us pause for a moment to discuss VBA and Outlook (especially for those people, who like me, might assume it will be similar to Excel, Word or Powerpoint in the Office suite)&lt;/p&gt;&lt;p&gt;&lt;strong&gt;3. Aside - Visual Basic For Applications and Outlook &lt;/strong&gt;&lt;strong&gt;(If you're used to Excel/Word/Powerpoint):&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;When you are using Outlook, you might notice that (like other Office applications) there is the usual Tools-&gt;Macros-&gt;Visual Basic Editor menu options. You might expect that, like with other Office applications you will be able to record VBA macros and then modify them to work with Outlook. However, you'll note that Outlook does NOT have a Macro recorder. &lt;/p&gt;&lt;p&gt;You have to write your macros from scratch. This is because (see &lt;a href="http://support.microsoft.com/kb/q146636/"&gt;http://support.microsoft.com/kb/q146636/&lt;/a&gt;) "Outloook does not support a full object model, such as those in Word or Microsoft Excel", so not everything you may want to do may be possible in VBA within Outlook. &lt;/p&gt;&lt;p&gt;The key to using VBA with outlook is understanding this Outlook Object model, which defines what objects, properties, methods and events are available.&lt;/p&gt;&lt;p&gt;Outlook Object Model: &lt;a href="http://msdn.microsoft.com/en-us/library/aa221870(office.11).aspx"&gt;http://msdn.microsoft.com/en-us/library/aa221870(office.11).aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;4. Outlook Scripting - VBA and VBScript:&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Having discussed VBA briefly, above, let's now return to the task at hand - namely creating a custom task form. In this particular case, we'll find that VBA Macros actually have very limited utility, in any case.&lt;/p&gt;&lt;p&gt;To quote &lt;a href="http://www.outlookcode.com/article.aspx?ID=40"&gt;http://www.outlookcode.com/article.aspx?ID=40&lt;/a&gt;: &lt;/p&gt;&lt;p&gt;"Visual Basic for Applications (VBA) is actually only one of the two programming languages available for writing code in Outlook. The other is VBScript. VBScript is used by Microsoft outlook custom forms."&lt;/p&gt;&lt;p&gt;So, if we're going to have our custom task form work for us, we're going to be working in the special Outlook forms (not a VBA form), with VBScript (not VBA) doing the scripting work behind it. &lt;/p&gt;&lt;p&gt;Luckily, however, VBScript is very similar to VBA as a language, and isn't very hard at all to pick up (even if you aren't familiar with VBA). The following references may help, however:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;VBScript Language Reference: &lt;a href="http://msdn.microsoft.com/en-us/library/d1wf56tt.aspx"&gt;http://msdn.microsoft.com/en-us/library/d1wf56tt.aspx&lt;/a&gt;&lt;/li&gt;&lt;li&gt;VBA Features NOT in VBScript: &lt;a href="http://msdn.microsoft.com/en-us/library/30593abb.aspx"&gt;http://msdn.microsoft.com/en-us/library/30593abb.aspx&lt;/a&gt;&lt;/li&gt;&lt;li&gt;VBScript in a nutshell: &lt;a href="http://www.intranetjournal.com/articles/200009/vb10.html"&gt;http://www.intranetjournal.com/articles/200009/vb10.html&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;5. Developing the custom task form&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;In (2), above, we discussed how to open the standard outlook task form and some limitations on modifying these. Useful things you'll need when creating the custom form include:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Control Toolbox - A list of controls (like "listbox", "radiobutton", "textbox") you may like to put on your form.&lt;/li&gt;&lt;li&gt;Field Chooser - A list of "fields" (such as "notes", "owner", "Bcc", "Complete", "Actual Work" etc) that individual items have and you may like to display.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;These two items can both be obtained by right-clicking on the form and checking the "Control Toolbox" or "Field Chooser" item, respectively, in the menu.&lt;/p&gt;&lt;p&gt;Most basic functionality is very simple to obtain. For instance to create a new text field that is linked to a user-defined field either drag that field onto the form-palete, or drag the control you wish to use onto the form-palete. If you have dragged a particular control (eg a "textbox" or "label") onto the form, and then decide later you wish to link it to a particular field (say "owner" to display the outlook owner of the item), right-click on the control and select "properties". On the "Value" tab, choose the field (in this case, "owner") you wish to link to. For basic properties, everything happens pretty-much automatically.&lt;/p&gt;&lt;p&gt;You can use the "Properties" and "Advanced Properties" options on any control to set its look and feel or modify this "data binding".&lt;/p&gt;&lt;p&gt;For simple forms, that's probably all you need to know. Plenty of information is also available at:&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.outlookcode.com/article.aspx?ID=35"&gt;http://www.outlookcode.com/article.aspx?ID=35&lt;/a&gt;&lt;/p&gt;&lt;p&gt;However, in my case there was some more advanced behaviour required. This included a list-box allowing multiple people who were "responsible" for a task to be selected and then behaviour with a series of radio buttons that would email those responsible when the new task was created. The default values of these radio buttons needed to modify based on whether it was a "new task" or an update on an old task - and whether the task had actually been modified since being open, in the latter case. This required use of vbScript.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;6. Adding VbScript behind Outlook Forms:&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Starting with the simple things first, to get to the VBScript, just go to the Form-&gt;View Code option on the menu. You'll get a basic script editor.&lt;/p&gt;&lt;p&gt;Here's some important, but basic, standard-named methods in vbScript to get you started:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Create a method "Function Item_Open()" that will run when a new item is opened. Use this to perform a range of initialization steps.&lt;/li&gt;&lt;li&gt;Create a method "Function Item_Close()" that will run immediately before closing an item (task). In my case, this function could be used to send an email to those who were made "reseponsible" in the task if the appropriate options were chosen.&lt;/li&gt;&lt;li&gt;Create a method "Function Item_Write()" that will be called prior to saving.&lt;/li&gt;&lt;li&gt;Create a method "Sub Item_CustomPropertyChange(ByVal Name)". This method will be called whenever &lt;em&gt;any&lt;/em&gt; custom property (one of your custom fields, mentioned above) is changed by the user of the form. You need to test the "Name" attribute to handle a particular item being changed.&lt;/li&gt;&lt;li&gt;Create a method "Sub Item_PropertyChange(ByVal Name)". This method will be called whenever a standard (non-custom) property is changed.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Further, here are some of the most common method calls from the VBScript object model that I used:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Item.UserProperties("myUserFieldProperty") - is a function that returns the value of a particular user property/field on the form. Can also be used to set that property.&lt;/li&gt;&lt;li&gt;Set controlPage = Item.GetInspector.ModifiedFormPages("myPageOnForm") - is a function that returns an object that represents your custom page (tab) on the form.&lt;/li&gt;&lt;li&gt;Set myControl = controlPage.Controls("myControlName") - is a function that uses a page of your form (obtained as above) and gets an object that represents a particular control on the form. You can then usee this control to obtain information about it. For instance, if it is a label use "myControl.Caption" to get its current caption.&lt;/li&gt;&lt;li&gt;Use the vbScript "Split" function to break a comma separated string (for instance, obtained from a control that represents a multiple selection of items) into an array that can be looked through. &lt;/li&gt;&lt;li&gt;Use the vbScript "For Each ... Next" method to loop through each item in the array that is created.&lt;/li&gt;&lt;li&gt;Use Application.getNameSpace("MAPI").CurrentUser to get the current username of the person logged in.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;7. Some Problems I encountered:&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;All of this looks relatively simple (and, indeed, is). However, I did encounter a number of specific problems in coding up my solution to this problem that took a while to sort out and are probably worth discussing briefly.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;(A) How to put a carriage return into MsgBox in VBScript:&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;I was wondering how you put a carriage return into a MsgBox in VBScript. It turns out one way is to do the following:&lt;/p&gt;MsgBox "This is Line 1. " &amp;amp; vbNewLine &amp;amp; "This is Line 2." &amp;amp; vbNewLine &amp;amp; "etc..."&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;(B) Creating an email in VBScript:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;REF: &lt;a href="http://www.tek-tips.com/viewthread.cfm?qid=1374311&amp;amp;page=1"&gt;http://www.tek-tips.com/viewthread.cfm?qid=1374311&amp;amp;page=1&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;One thing you may wish to do is create an email using VBScript. There are a number of places on the internet that suggest something like the following code:&lt;br /&gt;&lt;br /&gt;Set MyApp = CreateObject("Outlook.Application")&lt;br /&gt;Set MyItem = MyApp.CreateItem(0) 'olMailItem&lt;br /&gt;With MyItem&lt;br /&gt;.To = &lt;a href="mailto:a@b.c"&gt;a@b.c&lt;/a&gt;&lt;br /&gt;.Subject = "Subject"&lt;br /&gt;.ReadReceiptRequested = False&lt;br /&gt;.HTMLBody = "Message&lt;br /&gt;End With&lt;br /&gt;MyItem.Display&lt;br /&gt;&lt;br /&gt;However, I was finding that the line "set olApp=CreateObject("Outlook.Application") was throwing an error. &lt;br /&gt;&lt;br /&gt;To fix this, I used set "objMail = Application.CreateItem(olMailItem)" without the need to create the olApp object.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;(C) Calling VBA methods from VBScript:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;I had a problem of wanting to store some of the data (such as a list of usernames the form would display) locally for each user.  I didn't want to use a database, but just store these somewhere in the "Outlook Session" of the user.  I was able to do this by placing a VBA function that returned an array into the "Outlook Session" module of the user and calling this function directly from the form's VBScript.  To do this, I use:&lt;br /&gt;&lt;br /&gt;On Error Resume Next&lt;br /&gt;    Set olApp = CreateObject("Outlook.Application")&lt;br /&gt;    userInformation = olApp.methodCallOnSessionObject()&lt;br /&gt;    If (Err.Number &lt;&gt; 0) Then&lt;br /&gt;        ' the method wasn't found in VBA on the users session&lt;br /&gt;        userInformation = defaultVbScriptMethodCallToFillDefaultData()&lt;br /&gt;    End If&lt;br /&gt;On Error Goto 0&lt;br /&gt;&lt;br /&gt;It is worth noting here that olApp.methodCallOnSessionObject() is required to call the VBA method.  For me it did NOT work to use "Application.methodCallOnSessionObject()" though this was recommended elsewhere on the internet.&lt;br /&gt;&lt;br /&gt;It is also worth noting that you may get "Type Mismatch" errors when trying to pass array data between VBA and VBScript.  Outlook VBA uses a different variation of the array data type than that supported by VBScript, and therefore a "Type mismatch" error will occur if you attempt to "Type" your VBA output.  In the example above, for instance, I receive an error if I attempt to "Dim" the variable "userInformation". &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;(D) How to get a bound, multi-select Listbox to work?&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;I mentioned, above, how easy it is to bind a control (say a label on your form) to a field (say, a custom-defined user comments field) and have the control and the bound value stay nicely in synch. &lt;br /&gt;&lt;br /&gt;The only exception to this for me was in getting a Listbox to work.  It was all very easy when I only had a single-select list-box.  However, as soon as I wanted to allow the user to select multiple values in the listbox, I had problems.  The most obvious way to create a multi-select listbox is to go into the "AdvancedProperties" of the Listbox and set the "multiple select" attribute to "1-Multi".  However, while this did correctly show multiple selections on the form, this seemed to "break" the link to the underlying field on the form when saved.  I couldn't get it to work by linking to a standard user-defined field.&lt;br /&gt;&lt;br /&gt;My fix:  In the end, the only way I was able to make this work and still have the selection show on the form when re-opened was to use a "Keywords" field.  Most of the fields I was using were "Text" fields.  If you create a user-defined field, say "responsibleUser" and make it a keywords field type, you're on your way to success with a listBox.  Then just bind the listbox control to the "responsibleUser" and make it "multi" and it will automatically show a set of checkboxes for multiple selection that are nicely bound to the appropriate field as a comma-separated list.&lt;br /&gt;&lt;br /&gt;There is, however, one problem with this approach.  You're now likely to get "Type Mismatch" errors.&lt;br /&gt;To quote from &lt;a href="http://support.microsoft.com/kb/q201099/"&gt;http://support.microsoft.com/kb/q201099/&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;"It is not possible to directly modify the contents of a user-defined &lt;em&gt;keyword&lt;/em&gt; field using VBScript. Outlook uses a different variation of array data type than that supported by VBScript, and therefore a "Type mismatch" error message will appear if you try to display the text of the field in a message box, assign the field to an array variable, or perform any string-related function on it.  The simplest way to work around this limitation is by accessing the text via a control or by using a standard keywords field."&lt;br /&gt;&lt;br /&gt;Not too hard to do... once you know :-)  To see how you can get access to the control to do this, see my "useful vbscript functions" section above!&lt;br /&gt;&lt;br /&gt;One final thing, before I leave listboxes.  I spent ages trying to work out how to set the selected values on a listbox.  I just couldn't find the property or way of doing this anywhere... Finally the lightbulb lit...  It's easy - just set the bound value (of the field the listbox is bound to) properly. ie : Item.UserProperties("Responsibility") = myResponsibilityString.  Really obvious in retrospect, but seeing as it stumped me for hours, I'll just mention it here for next time!&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;(E) Issues with "one-off" forms:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Another problem that stumped me for a while (at least, until I started reading about "one-off" forms) was that every time I saved my (now quite complex) forms, they would show up as having the wrong "MessageClass".&lt;br /&gt;&lt;br /&gt;Now, a diversion here is probably useful.  Every item in Outlook has a MessageClass.  The base MessageClass values are things like IPM.Task (for tasks) or IPM.Post (for mail), IPM.Appointment (for calendar entries) etc.  When you start extending these base forms, you'll get items with message classes such as "IPM.Task.mySpecialTaskType".  When you double-click on these it'll know exactly what form to use to display the information.&lt;br /&gt;&lt;br /&gt;However, I was finding that my MessageClass, rather than being IPM.Task.mySpecialTaskType was always showing up as IPM.Task.  This was causing me some problems.&lt;br /&gt;&lt;br /&gt;It turns out that this is a feature!  Basically, there are two different types of (in this case) tasks possible.  What I'd created was what's known as a "one-off" form.  For information, look at:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://support.microsoft.com/?kbid=290657"&gt;http://support.microsoft.com/?kbid=290657&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://outlookcode.com/article.aspx?id=34"&gt;http://outlookcode.com/article.aspx?id=34&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;To quote: "If code on a received message or a saved item doesn't run, it probably means that the form is 'one-offed.' This is a condition in which the form definition is saved with the item. Such an item has lost the connection with its published form. Other symptoms for one-off form items are an increase in the size of the item, loss of the custom icon for the item, and reversion of the MessageClass value to the default for that type of item."&lt;br /&gt;&lt;br /&gt;It turns out that one of the most common ways of creating a one-off form is if you change the form-design in code.  In my case, this meant populating the list-box at run-time with a list of users (as discussed above).  This automatically caused the form to become a "one-off" form and caused some problems for this. &lt;br /&gt;&lt;br /&gt;In my case, the simplest way around the symptoms I was getting from this being a one-off form was to reset the MessageClass to the correct value for my form.  That is, set "Item.MessageClass = IPM.Task.mySpecialTaskType".  It isn't perfect (as the increased task-file size issue remains, even after doing this as the form definition remains with the object, but now unattached - however, Outlook documentation suggests there's no good way to fix this without recreating a new task from scratch - and recommends the MessageClass attribute as a valid way to get around the symptoms of the one-off form).&lt;br /&gt;&lt;br /&gt;Another way of changing the messageclass of a form is discussed below:&lt;br /&gt;&lt;a href="http://support.microsoft.com/default.aspx?scid=kb;[ln];q201089"&gt;http://support.microsoft.com/default.aspx?scid=kb;[ln];q201089&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;(F) "This function cannot be performed because the message has been changed"&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Another problem that became increasingly frustrating was that, in some instances after editing (or creating) a task, if you try and save that task an "This function cannot be performed because the message has been changed" error would occur.   Alternatively, if instead of saving in VBScript, I saved the task manually, it would throw an error stating ""The item could not be saved because it has been changed by another user or in another window."&lt;br /&gt;&lt;br /&gt;Both of these errors were "intermittent" in that they go away if one clicks off the task and then back onto it.  This error is caused by the form being changed onOpen, and seems only to occur when the task that is being opened does not have focus prior to the actual double-click event that opens it.  Presumably the vbscript that modifies the form is for some reason being interpreted as being undertaken by a different user.&lt;br /&gt;&lt;br /&gt;To date, I haven't been able to "fix" this problem.  However, the problem can be found as soon as the form opens.  As such, I have an "OnError" code in the "OnOpen" method that runs whenever this error occurs.  In my current code, if this error occurs it just shuts down the new task form.  This, gives focus to the appropriate task, meaning that the next time someone opens it, the form will display properly and everything works.  To the user, it just looks like the form isn't opening when they double-click.  However, in the background it is starting to open, finding a problem and closing itself as a result.   This is a pretty ugly solution, I know, but it does seem to work in the absence of more information.  A post about this problem (experienced by others as well) is available at:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.outlookcode.com/threads.aspx?forumid=3&amp;amp;messageid=25975"&gt;http://www.outlookcode.com/threads.aspx?forumid=3&amp;amp;messageid=25975&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;8. Conclusions:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Overall, this just summarizes some of my experiences in developing custom forms in Outlook.  Apart from some problems that took the bulk of my time to fix, it was actually quite easy to do, even with no prior knowledge of Outlook or VBScript.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6086730485636404739-2190757851684287507?l=drglennn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://drglennn.blogspot.com/feeds/2190757851684287507/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6086730485636404739&amp;postID=2190757851684287507' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/2190757851684287507'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/2190757851684287507'/><link rel='alternate' type='text/html' href='http://drglennn.blogspot.com/2008/07/vbscript-and-custom-forms-in-outlook.html' title='VBScript and Custom Forms in Outlook'/><author><name>Glennn</name><uri>http://www.blogger.com/profile/11073435827711258234</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6086730485636404739.post-4956375263334437482</id><published>2008-07-14T22:41:00.000-07:00</published><updated>2008-07-16T15:56:17.141-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Hibernate'/><title type='text'>Hibernate Query Language</title><content type='html'>&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;I've recently become interested in the &lt;a href="http://www.hibernate.org/hib_docs/reference/en/html/queryhql.html"&gt;Hibernate Query Language &lt;/a&gt;(HQL) and some of its capabilities. This post summarizes some of my initial experiences for my future reference.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Background:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Until recently, my Data Access Objects (DAOs) would pretty much just use the most basic HQL queries to load an object from my database by its ID:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Query q = session.createQuery("from Clazz c where c.id = 1");&lt;/em&gt;&lt;br /&gt;&lt;em&gt;List result = q.list();&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;or alternatively, load a complete list of all database objects for a particular table:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;List result = session.createQuery("from Clazz").list(); &lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;If I needed to retrieve a list of objects using a more complex criteria, I could always load the full list, as above, and then return the appropriate objects programmatically, but this is terribly inefficient.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In the past I have used SQL queries (rather than HQL) to more efficiently retrieve just the data I was after. Eg:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;session.createSQLQuery("select {c.*} from Clazz {c} where NAME like 'searchName'","c",Clazz.class);&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;For simple mappings this works fine and uses plain old SQL. However, once you begin to use the more powerful abilities of Hibernate (such as mapping &lt;a href="http://en.wikipedia.org/wiki/Polymorphic_association"&gt;Polymorphic associations&lt;/a&gt;), the SQL you need to write becomes more and more difficult and convoluted.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;That's when it's finally time to bite the bullet and find out that HQL is actually surprisingly easy to use and very powerful.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;HQL Statements - structure:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The structure of a general HQL statement takes the form:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;[select ...] from ... [where ...] [group by ... [having ...]] [order by...]&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Seeing as the only required clause is &lt;em&gt;from,&lt;/em&gt; the simplest HQL query (to retrieve a list of all the items in the table mapped by the class clazz) is:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;from clazz&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;To build on this to create much more complex queries (even when you have &lt;a href="http://en.wikipedia.org/wiki/Polymorphic_association"&gt;Polymorphic associations&lt;/a&gt;) is very easy. To describe the queries I've been working with lately, I'm only going to use a very small subset of HQL query options, namely:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;em&gt;select clazz - &lt;/em&gt;tells Hibernate to restrict the objects it returns to the specific class you are interested in.&lt;/li&gt;&lt;li&gt;&lt;em&gt;select distinct clazz - &lt;/em&gt;tells Hibernate to remove duplicates in the list returned.&lt;/li&gt;&lt;li&gt;&lt;em&gt;join&lt;/em&gt; - performs an inner join.'&lt;/li&gt;&lt;li&gt;&lt;em&gt;left join fetch -&lt;/em&gt; performs a left outer join (for eager fetching).&lt;/li&gt;&lt;/ul&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;Suppose we have a class, &lt;em&gt;ParameterValue&lt;/em&gt;. There are two different types of &lt;em&gt;ParameterValues&lt;/em&gt;, which are subclasses of &lt;em&gt;ParameterValue&lt;/em&gt;. Namely "&lt;em&gt;ElementParameterValue&lt;/em&gt;" and "&lt;em&gt;UnitParameterValue&lt;/em&gt;". We use the Hibernate "Table per class hierarchy" mapping strategy to map this to a single table in our database.&lt;br /&gt;&lt;br /&gt;All &lt;em&gt;ParameterValues&lt;/em&gt; have a &lt;em&gt;Unit&lt;/em&gt; class reference (so each &lt;em&gt;ParameterValue&lt;/em&gt; belongs to one and only one &lt;em&gt;Unit&lt;/em&gt;). In addition, a &lt;em&gt;ParameterValue&lt;/em&gt; has a &lt;em&gt;SaveTag&lt;/em&gt; reference (so each &lt;em&gt;ParameterValue&lt;/em&gt; also has a unique &lt;em&gt;SaveTag&lt;/em&gt;).&lt;br /&gt;&lt;br /&gt;In my example, I needed to find a list of &lt;em&gt;SaveTags &lt;/em&gt;for a given &lt;em&gt;Unit&lt;/em&gt;. That is, the question was "for a particular &lt;em&gt;Unit&lt;/em&gt; what SaveTags were represented amongst its &lt;em&gt;ParameterValues?"&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;/em&gt;&lt;br /&gt;The simple HQL that achieves this is:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;select distinct saveTag from ParameterValue pv join pv.unit u join pv.saveTag saveTag where u.id = :unitId&lt;/em&gt;&lt;br /&gt;&lt;p&gt;The &lt;em&gt;select distinct saveTag&lt;/em&gt; tells HQL that the result you want sent back is a List of SaveTag objects with no single SaveTag object represented more than once in the list&lt;savetag&gt;.&lt;/p&gt;&lt;p&gt;The &lt;em&gt;joins&lt;/em&gt; perform inner joins with the required &lt;em&gt;Unit&lt;/em&gt;  data and the &lt;em&gt;SaveTag &lt;/em&gt;data, allowing us to reference (in the where clause) or retrieve these objects by name, respectively. &lt;/p&gt;&lt;p&gt;The &lt;em&gt;where&lt;/em&gt; clause defines the search criterion. &lt;/p&gt;&lt;p&gt;All pretty easy stuff - nothing too profound - but I've been playing around with a range of other HQL queries, and they're all as easy as this - even for quite complex datasets, and polymorphic mappings. &lt;/p&gt;&lt;p&gt;The take-home message: Have a look at HQL and don't assume that just sticking with SQL (even if you know it well) is going to be easier.&lt;/p&gt;[NB: This post is a placeholder - I might put some more information about useful HQL queries in future].&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6086730485636404739-4956375263334437482?l=drglennn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://drglennn.blogspot.com/feeds/4956375263334437482/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6086730485636404739&amp;postID=4956375263334437482' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/4956375263334437482'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/4956375263334437482'/><link rel='alternate' type='text/html' href='http://drglennn.blogspot.com/2008/07/hibernate-query-language.html' title='Hibernate Query Language'/><author><name>Glennn</name><uri>http://www.blogger.com/profile/11073435827711258234</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6086730485636404739.post-957429909825651107</id><published>2008-07-09T18:08:00.000-07:00</published><updated>2008-07-15T00:29:50.866-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Hibernate'/><title type='text'>Hibernate - Mapping booleans using annotations.</title><content type='html'>&lt;strong&gt;Summary:&lt;/strong&gt;&lt;br /&gt;Using Hibernate annotations to map a Java boolean in MySQL.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The Problem:&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;I've recently experienced some problems with mapping boolean values in a Hibernate entity to mySQL. The problem arose because the "boolean" type in mySQL is not actually a boolean. It's a tinyint.&lt;br /&gt;&lt;br /&gt;MySQL does support the SQL Standard BOOLEAN or BOOL keywords, but treats these as synonyms for TINYINT(1). A value of zero is considered false. Non-zero values are considered true.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The solution:&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;Luckily, this isn't a problem for Hibernate, once you know what you're doing. Indeed, if Hibernate is creating your database, all you need to do is annotate your booleans with correct annotations, namely:&lt;br /&gt;&lt;br /&gt;@Column(columnDefinition = "tinyint", nullable = false)&lt;br /&gt;boolean myTrueOrFalseValue;&lt;br /&gt;&lt;br /&gt;or, if you need to allow potentially null columns:&lt;br /&gt;&lt;br /&gt;@Column(columnDefinition = "tinyint")&lt;br /&gt;Boolean myTrueOrFalseValue;&lt;br /&gt;&lt;br /&gt;Both of these will work, however the first one does not allow null values.&lt;br /&gt;&lt;br /&gt;WARNING: This means that if you have been trying a number of different attempts to map "myTrueOrFalseValue" you'll probably already have a column in your mySql table and it will be full of null values. You'll need to delete this column manually (and allow hibernate to regenerate), or use some other manual method to ensure there are no null values in the column. If you do have null values in your database, these annotations will cause a "&lt;br /&gt;org.hibernate.PropertyAccessException: could not set a field value by reflection setter of..." error on startup.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6086730485636404739-957429909825651107?l=drglennn.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://drglennn.blogspot.com/feeds/957429909825651107/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6086730485636404739&amp;postID=957429909825651107' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/957429909825651107'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6086730485636404739/posts/default/957429909825651107'/><link rel='alternate' type='text/html' href='http://drglennn.blogspot.com/2008/07/hibernate-mapping-booleans-using.html' title='Hibernate - Mapping booleans using annotations.'/><author><name>Glennn</name><uri>http://www.blogger.com/profile/11073435827711258234</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
