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

<channel>
	<title>Java Developers</title>
	<atom:link href="http://blog.une.edu.au/javadevelopers/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.une.edu.au/javadevelopers</link>
	<description>Blog for people developing in the Java language</description>
	<lastBuildDate>Tue, 20 Jul 2010 11:22:49 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Spring</title>
		<link>http://blog.une.edu.au/javadevelopers/2010/07/20/spring/</link>
		<comments>http://blog.une.edu.au/javadevelopers/2010/07/20/spring/#comments</comments>
		<pubDate>Tue, 20 Jul 2010 11:22:49 +0000</pubDate>
		<dc:creator>gstewar8</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.une.edu.au/javadevelopers/?p=38</guid>
		<description><![CDATA[After establishing our own library for using either HSQL or H2 databases for Unit testing I&#8217;ve found that Spring provides a really simple way to do this already. I&#8217;m not sure at what point they added it but it appears to be there now. This means you can not just H2 and HSQL but also [...]]]></description>
				<content:encoded><![CDATA[<p>After establishing our own library for using either HSQL or H2 databases for Unit testing I&#8217;ve found that Spring provides a really simple way to do this already. I&#8217;m not sure at what point they added it but it appears to be there now. </p>
<p>This means you can not just H2 and HSQL but also DERBY.<br />
The following is the entry you can use:</p>
<p><code></p>
<p></code></p>
<p>in your spring config files. So far I&#8217;ve found that IDEA picks this up and allows you to include the xsd details you need same as importing packages in a class.</p>
<p>In case it doesn&#8217;t you can try adding the following:</p>
<p><code><br />
       xmlns:jdbc="http://www.springframework.org/schema/jdbc"<br />
      xsi:schemaLocation="   http://www.springframework.org/schema/jdbc<br />
          http://www.springframework.org/schema/jdbc/spring-jdbc.xsd"<br />
</code></p>
<p>G</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.une.edu.au/javadevelopers/2010/07/20/spring/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Moving to Spring 3 &#8211; Spring Security</title>
		<link>http://blog.une.edu.au/javadevelopers/2010/07/20/moving-to-spring-3-spring-security/</link>
		<comments>http://blog.une.edu.au/javadevelopers/2010/07/20/moving-to-spring-3-spring-security/#comments</comments>
		<pubDate>Tue, 20 Jul 2010 10:16:47 +0000</pubDate>
		<dc:creator>gstewar8</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.une.edu.au/javadevelopers/?p=36</guid>
		<description><![CDATA[I&#8217;ve been radically re-arranging TLCAdmin which includes moving it up to Spring 3 and pulling in the une-security library changes that Matt D did (thanks Matt). One thing I&#8217;ve found while doing this and pulling out our current auth ( so it can be developed locally) was a small but potentially irritating change when using [...]]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve been radically re-arranging TLCAdmin which includes moving it up to Spring 3 and pulling in the une-security library changes that Matt D did (thanks Matt). One thing I&#8217;ve found while doing this and pulling out our current auth ( so it can be developed locally) was a small but potentially irritating change when using the security extension. </p>
<p>We have some shortcuts which available by using &lt;security: namespaces in the spring config. Two of them are &#8216;authentication-manager&#8217; and &#8216;authentication-provider&#8217;. It would appear that in Spring 2.x these two tags were both top level tags. In 3.x however the provider needs to be inside the manager. See this link http://deprecatedconsciousness.wordpress.com/2009/12/01/spring-security-3-schema-changes/ for a slightly longer description.</p>
<p>G</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.une.edu.au/javadevelopers/2010/07/20/moving-to-spring-3-spring-security/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Annotation-driven configuration and Auto-detection</title>
		<link>http://blog.une.edu.au/javadevelopers/2010/06/03/annotation-driven-configuration-and-auto-detection/</link>
		<comments>http://blog.une.edu.au/javadevelopers/2010/06/03/annotation-driven-configuration-and-auto-detection/#comments</comments>
		<pubDate>Wed, 02 Jun 2010 23:43:22 +0000</pubDate>
		<dc:creator>spower5</dc:creator>
				<category><![CDATA[Annotations]]></category>
		<category><![CDATA[Spring]]></category>

		<guid isPermaLink="false">http://blog.une.edu.au/javadevelopers/?p=29</guid>
		<description><![CDATA[For quiet some time now i have been working with annotation on the URS application. You may have see or used some common annotations already such the java based @Override annotation or the @Required spring annotation. In this post i&#8217;d like to highlight some of the annotation benefits i have come across and more importantly the annotation [...]]]></description>
				<content:encoded><![CDATA[<p>For quiet some time now i have been working with annotation on the URS application. You may have see or used some common annotations already such the java based @Override annotation or the @Required spring annotation. In this post i&#8217;d like to highlight some of the annotation benefits i have come across and more importantly the annotation benefits that suit the UNE applications we are all developing.</p>
<p>Annotation-driven configuration was introduced in spring 2.5.x. Annotations can mark fields, methods and classes that need dependancy injection. This reduces configuration and dependancy mapping in spring configuration.</p>
<p>@Component, @Repository, @Service, and @Controller are four comnmonly known spring annotation. @Repository, @Service, and @Controller serve as specializations of @Component (generic stereotype). I have been using @Contoller for sometime and have found very useful, especially when combined with the benefits for spring 3&#8242;s REST support (more on that in a later post). Below is a controller with the annotation @Controller.</p>
<p><code>@Controller<br />
public class TestController {<br />
&nbsp;&nbsp;// Fields, Methods etc<br />
&nbsp;&nbsp;@Autowired(required = true)<br />
&nbsp;&nbsp;public void setTestDao(TestDao testDao) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;this.testDao = testDao;<br />
&nbsp;&nbsp;}<br />
}</code></p>
<p>You can auto-detect @components by adding the following element in the spring-config.xml. The &lt;component-scan/&gt; element will auto-detect components for the base package of you application (filters can be applied for finer grained inclusion/exclusion of the package).</p>
<p><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;<br />
&lt;beans xmlns="http://www.springframework.org/schema/beans"<br />
&nbsp;&nbsp;xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"<br />
&nbsp;&nbsp;xmlns:context="http://www.springframework.org/schema/context"<br />
&nbsp;&nbsp;xsi:schemaLocation="http://www.springframework.org/schema/beans<br />
&nbsp;&nbsp;http://www.springframework.org/schema/beans/spring-beans-2.5.xsd<br />
&nbsp;&nbsp;http://www.springframework.org/schema/context<br />
&nbsp;&nbsp;http://www.springframework.org/schema/context/spring-context-2.5.xsd"&gt;</code></p>
<p><code>&nbsp;&nbsp;&lt;context:component-scan base-package="au.edu.une.example"/&gt;</code></p>
<p><code>&lt;/beans&gt;</code></p>
<p>This component-scan would automatically detect the controller class and register any corresponding BeanDefinitions with the ApplicationContext. Therefore there would be no need for the following in the spring configuration:</p>
<p><code>&lt;bean name="testController" class="au.edu.une.example.TestController"&gt;<br />
&nbsp;&nbsp;&lt;property name="testDao" value="testDao"/&gt;<br />
&lt;/bean&gt;</code></p>
<p>Another handy annotation i have been making heavy use of is @Autowired (in example above). Its great for configuring controller dependencies on dao&#8217;s and other classes, when using auto detection. I have found @Autowired handy when writing unit tests too.</p>
<p>So try out the Annotation-driven configuration benefits in your application.</p>
<p>See <a href="http://static.springsource.org/spring/docs/2.5.x/reference/beans.html#beans-annotation-config">Annotation-based configuration</a> for more details on this Annotation-driven configuration via spring.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.une.edu.au/javadevelopers/2010/06/03/annotation-driven-configuration-and-auto-detection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ThreadLocal, Spring and Tomcat 6.0.24</title>
		<link>http://blog.une.edu.au/javadevelopers/2010/03/08/threadlocal-spring-and-tomcat/</link>
		<comments>http://blog.une.edu.au/javadevelopers/2010/03/08/threadlocal-spring-and-tomcat/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 01:16:38 +0000</pubDate>
		<dc:creator>gstewar8</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.une.edu.au/javadevelopers/?p=27</guid>
		<description><![CDATA[Hey all As you upgrade to the apps to 6.0.24 for the coming web cluster you will probably find that any app that contains spring is throwing ThreadLocal errors when you shut Tomcat down, as below: SEVERE: A web application appears to have started a thread named [schedulerFactory_Worker-9] but has failed to stop it. This [...]]]></description>
				<content:encoded><![CDATA[<p>Hey all</p>
<p>As you upgrade to the apps to 6.0.24 for the coming web cluster you will probably find that any app that contains spring is throwing ThreadLocal errors when you shut Tomcat down, as below:</p>
<p>SEVERE: A web application appears to have started a thread named [schedulerFactory_Worker-9] but has failed to stop it. This is very likely to create a memory leak.<br />
Mar 8, 2010 12:07:36 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads<br />
SEVERE: A web application appears to have started a thread named [schedulerFactory_Worker-10] but has failed to stop it. This is very likely to create a memory leak.<br />
Mar 8, 2010 12:07:36 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads<br />
SEVERE: A web application appears to have started a thread named [schedulerFactory_Worker-2] but has failed to stop it. This is very likely to create a memory leak.</p>
<p>It would appear there has been a change in Tomcat between 6.0.20 and 6.0.24 where Tomcat is trying to detect possible memory leaks. Spring has this to say about it:</p>
<p>http://forum.springsource.org/showthread.php?t=84202</p>
<p>Essentially at the moment they believe this is an erroneous error and that Tomcat perhaps needs to fix this. As a result at the moment this is not an error you need to remove. We will have to live with it on the new web-cluster until one side or the other determines a resolution.</p>
<p>Gerwood</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.une.edu.au/javadevelopers/2010/03/08/threadlocal-spring-and-tomcat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java Certificats and Mac</title>
		<link>http://blog.une.edu.au/javadevelopers/2010/02/24/java-certificats-and-mac/</link>
		<comments>http://blog.une.edu.au/javadevelopers/2010/02/24/java-certificats-and-mac/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 22:22:36 +0000</pubDate>
		<dc:creator>gstewar8</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[cacerts]]></category>
		<category><![CDATA[certificates]]></category>
		<category><![CDATA[mac]]></category>

		<guid isPermaLink="false">http://blog.une.edu.au/javadevelopers/?p=25</guid>
		<description><![CDATA[For those of us using Macs we seem to relatively often run up against certificates (such as login-dev or olt-dev) not being in our cacerts certificate store even after we are sure that we&#8217;ve added them. A comment I found on another site (http://mediakey.dk/~cc/java-default-keystore-password-cacerts/) suggests why. It would appear that Apple updates (and I suspect [...]]]></description>
				<content:encoded><![CDATA[<p>For those of us using Macs we seem to relatively often run up against certificates (such as login-dev or olt-dev) not being in our cacerts certificate store even after we are sure that we&#8217;ve added them. </p>
<p>A comment I found on another site (http://mediakey.dk/~cc/java-default-keystore-password-cacerts/) suggests why.</p>
<p>It would appear that Apple updates (and I suspect simply replaces) the cacerts file during some of their software updates. This will infact completely reset your cacerts store.</p>
<p>Also note that the other article also notes that apple have changed the default password from &#8216;changeit&#8217; to &#8216;changeme&#8217;</p>
<p>Gerwood</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.une.edu.au/javadevelopers/2010/02/24/java-certificats-and-mac/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>H2 Database alternative to commit</title>
		<link>http://blog.une.edu.au/javadevelopers/2010/02/24/h2-database-alternative-to-commit/</link>
		<comments>http://blog.une.edu.au/javadevelopers/2010/02/24/h2-database-alternative-to-commit/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 22:19:20 +0000</pubDate>
		<dc:creator>gstewar8</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.une.edu.au/javadevelopers/?p=23</guid>
		<description><![CDATA[So the earlier post on H2 suggested adding commit to the sql statements to make the tests more reliable. After a little more research it would appear that there is another setting you may need to apply to H2 to make it run the way you need. By default H2 in memory databases will be [...]]]></description>
				<content:encoded><![CDATA[<p>So the earlier post on H2 suggested adding commit to the sql statements to make the tests more reliable. </p>
<p>After a little more research it would appear that there is another setting you may need to apply to H2 to make it run the way you need. By default H2 in memory databases will be wiped out if there are no more connections to them. This means that if you remove all connections to an in memory database and then create a new one it will be connecting to a brand new, empty, in memory database.</p>
<p>How to fix it?</p>
<p>You can add <code>;DB_CLOSE_DELAY=-1</code> to the end of the testDatabaseName field in you spring datasource bean.</p>
<p>This means that the in memory database will be contained for the life of the running JVM. You can alternatively set it to a number greater than 0 and the database will be maintained for that many seconds past the last connection. This may be an alternative if you want the database to be available for a limited period only.</p>
<p>Gerwood</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.une.edu.au/javadevelopers/2010/02/24/h2-database-alternative-to-commit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Error handling differences between Servlets and Filters</title>
		<link>http://blog.une.edu.au/javadevelopers/2010/01/29/error-handling-differences-between-servlets-and-filters/</link>
		<comments>http://blog.une.edu.au/javadevelopers/2010/01/29/error-handling-differences-between-servlets-and-filters/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 00:10:02 +0000</pubDate>
		<dc:creator>mdebus4</dc:creator>
				<category><![CDATA[Bug]]></category>
		<category><![CDATA[Exceptions]]></category>
		<category><![CDATA[Filter]]></category>
		<category><![CDATA[Servlet]]></category>
		<category><![CDATA[Tomcat]]></category>

		<guid isPermaLink="false">http://blog.une.edu.au/javadevelopers/?p=15</guid>
		<description><![CDATA[If an exception is thrown from within a servlet&#8217;s init() method, I would expect Tomcat to act on it by not allowing the context to load. This makes sense to me. But I have recently discovered that Tomcat allows exceptions to be thrown from within the initialisation phase of a servlet&#8216;s life-cycle without side-affects, while [...]]]></description>
				<content:encoded><![CDATA[<p>If an exception is thrown from within a servlet&#8217;s <code>init()</code> method, I would expect Tomcat to act on it by not allowing the context to load. This makes sense to me.</p>
<p>But I have recently discovered that Tomcat allows exceptions to be thrown from within the initialisation phase of a <em>servlet</em>&#8216;s life-cycle without side-affects, while exceptions thrown from within the initialisation phase of a <em>filter</em>&#8216;s life-cycle causes a Catalina <code>SEVERE</code> error resulting in the context not loading.</p>
<p>Hmmm&#8230;. Not sure why this is the case, but until someone can explain it to me I will treat it as a bug within Tomcat. We are using v5.5.25.</p>
<p>FYI, I came across this while trying to implement an application configuration servlet which loads on start-up setting various application properties based on environment variables et al. Due to the described &#8216;bug&#8217;, I have ended up using a filter for the job instead of a servlet as it behaves as I would expect. A better solution would be to use Spring, I know, but we are still having to maintain some complex legacy apps which are not worth spending the time converting to Spring.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.une.edu.au/javadevelopers/2010/01/29/error-handling-differences-between-servlets-and-filters/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>H2 db unit testing tip</title>
		<link>http://blog.une.edu.au/javadevelopers/2010/01/28/h2-db-unit-testing-tip/</link>
		<comments>http://blog.une.edu.au/javadevelopers/2010/01/28/h2-db-unit-testing-tip/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 01:23:53 +0000</pubDate>
		<dc:creator>gstewar8</dc:creator>
				<category><![CDATA[H2]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Unit Testing]]></category>

		<guid isPermaLink="false">http://blog.une.edu.au/javadevelopers/?p=12</guid>
		<description><![CDATA[I&#8217;ve found that occasionally the unit tests for the vle fail with database errors. Really odd once such as &#8220;Table XYZ not found&#8221;. This generally prompts for checking the test schema. The table is being created. So why does the test fail? It would appear the h2 is possibly a little more advanced than HSQL [...]]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve found that occasionally the unit tests for the vle fail with database errors. Really odd once such as &#8220;Table XYZ not found&#8221;. This generally prompts for checking the test schema. </p>
<p>The table is being created. So why does the test fail?</p>
<p>It would appear the h2 is possibly a little more advanced than HSQL by default. The reason I can&#8217;t see the table is that I haven&#8217;t committed it. </p>
<p>By adding &#8216;commit;&#8217; as the last statement to the db schema file the errors will be corrected and the tests should pass (assuming that was the only problem).</p>
<p>The reason for this: </p>
<p>In some places (especially when testing repositories or if junit runs tests in parallel) you might end up with several connections to the in memory database. This could happen when you as a repository for something and it fires a second query while retrieving data from a previous one.</p>
<p>The result is that the first connection where I created the tables can see them because they are a part of its working data. The second connection can&#8217;t as they haven&#8217;t been committed back to the proper database for everyone else yet.</p>
<p>Gerwood</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.une.edu.au/javadevelopers/2010/01/28/h2-db-unit-testing-tip/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Programmatically setting Log4j properties</title>
		<link>http://blog.une.edu.au/javadevelopers/2010/01/28/programmatically-setting-log4j-properties/</link>
		<comments>http://blog.une.edu.au/javadevelopers/2010/01/28/programmatically-setting-log4j-properties/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 22:59:20 +0000</pubDate>
		<dc:creator>mdebus4</dc:creator>
				<category><![CDATA[Log4j]]></category>

		<guid isPermaLink="false">http://blog.une.edu.au/javadevelopers/?p=5</guid>
		<description><![CDATA[Have you ever needed to set a Log4j property on the fly (as opposed to setting it in the log4j.properties file or the log4j XML configuration file)??? Well I needed to so I set about finding out how to. I was updating our Library&#8217;s electronic document repository system, eReserve, when I noticed that it was [...]]]></description>
				<content:encoded><![CDATA[<p>Have you ever needed to set a Log4j property on the fly (as opposed to setting it in the log4j.properties file or the log4j XML configuration file)??? Well I needed to so I set about finding out how to.</p>
<p>I was updating our Library&#8217;s electronic document repository system, eReserve, when I noticed that it was using a Log4j SMTPAppender for cases when documents where not found where expected (HTTP 404). The Appender was setup to send an email to the Library&#8217;s document manager in order to keep on top of dud links. However, it was not working because in a recent iteration eReserve was updated to use  a Maven build instead of an Ant build. This resulted in Ant tokens not being processed and hence the &#8216;To&#8217; property of the SMTPAppender not being set. So the email was going nowhere.</p>
<p>Now, for each environment we have a different &#8216;To&#8217; address to use because we don&#8217;t want the Library&#8217;s document manager to receive all of our emails generated during development and system testing. For this situation we make use of Tomcat environment variables. But we can&#8217;t set log4j.properties to get values from JNDI. So we have to set the &#8216;To&#8217; field programmatically (that is, at run time as part of the code). Here is the code I used:</p>
<p><code><br />
    // This will set the To option of the SMTPAppender instead of it being set in the Log4j properties file<br />
    // this allows this value to be determined programmatically, in this case from an environment variable<br />
    Logger logger = LogManager.getLogger("erez.email");<br />
    SMTPAppender appender =  (SMTPAppender)logger.getAppender("erezEmail");<br />
    appender.setTo((String)pageContext.findAttribute("erez_email"));<br />
    appender.activateOptions();<br />
</code></p>
<p>Note the <code>activateOptions()</code> method of the <code>SMTPAppender</code> object. This is like the &#8216;save&#8217; button on forms&#8230; was hard to find that this was needed.</p>
<p>The Log4j API can be found here (note the version): <a href="http://logging.apache.org/log4j/1.2/apidocs/index.html">http://logging.apache.org/log4j/1.2/apidocs/index.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.une.edu.au/javadevelopers/2010/01/28/programmatically-setting-log4j-properties/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hello world!</title>
		<link>http://blog.une.edu.au/javadevelopers/2010/01/28/hello-world/</link>
		<comments>http://blog.une.edu.au/javadevelopers/2010/01/28/hello-world/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 22:08:31 +0000</pubDate>
		<dc:creator>mdebus4</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Welcome to UNE&#8217;s blog for Java Developers! Feel free to post your findings for the rest of the community to read. if (you.doCare()) { rss.subscribe(); //DO IT! } else { return new Lame(); }]]></description>
				<content:encoded><![CDATA[<p>Welcome to UNE&#8217;s blog for Java Developers! Feel free to post your findings for the rest of the community to read.<br />
<code><br />
if (you.doCare()) {<br />
rss.subscribe(); //DO IT!<br />
} else {<br />
return new Lame();<br />
}<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.une.edu.au/javadevelopers/2010/01/28/hello-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
