<?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>ITworks &#187; java</title>
	<atom:link href="http://itworks.hu/tag/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://itworks.hu</link>
	<description>Random musings in IT</description>
	<lastBuildDate>Mon, 09 Jan 2012 08:01:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Testing mojo generated code in Maven</title>
		<link>http://itworks.hu/2011/11/15/testing-mojo-generated-code-in-maven/</link>
		<comments>http://itworks.hu/2011/11/15/testing-mojo-generated-code-in-maven/#comments</comments>
		<pubDate>Tue, 15 Nov 2011 17:38:46 +0000</pubDate>
		<dc:creator>csak</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://m.itworks.hu/2011/11/15/testing-mojo-generated-code-in-maven/</guid>
		<description><![CDATA[Lately I was assigned a task which involved something that a unit test seemed to be able to solve, but later it turned out to be way more complex than that. Almost a third of our codebase consists of POJOs &#8230; <a href="http://itworks.hu/2011/11/15/testing-mojo-generated-code-in-maven/">Read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Lately I was assigned a task which involved something that a unit test seemed to be able to solve, but later it turned out to be way more complex than that. </p>
<p>Almost a third of our codebase consists of POJOs generated from Xsd descriptors scattered around in our projects. The generation is performed during build, using a Maven plugin that performs the parsing and generation tasks.</p>
<p>These generated classes are no more than simple value objects descending from a common root object, that contains some well-known methods like toString (), that all methods should share. Unfortunately this particular toString does not know about it&#8217;s descendants&#8217; inner structure, so it relies heavily on reflection to perform it&#8217;s task. This springs the idea of generating the classes with their own toString methods, so the resulting code is more efficient. </p>
<p>To do this to be backwards compatible, I would have to generate all known xsds, invoke their old and generated toString implementation and compare the results. Also I&#8217;d have to fill these objects with values, so I&#8217;d have data to compare.</p>
<p>So much for the task, but what&#8217;s the fuss about? Well I want the testing kept inside Maven, so should the generated or  inherited code change, we can see it in the build process. </p>
<p>There seem to exist a vast number of ways to be used for mojo testing, starting from the blunt get a mojo instance, fill it with values, and run execute (), to running a separate Maven instance and use the generated test results. Given that in this particular case I&#8217;d to start the compiler and then the surefire I (eventually ) went for the later approach. </p>
<p>The plugin testing harness is an example of the earlier approach, while it seems from the usage example the former. Avoid if you have to invoke more, than just your own mojo. It only reads the pom.xml you provide, but doesn&#8217;t set up the required Maven environment like builders, project, …etc. It doesn&#8217;t do the setup of the default values of your mojo (not that it could resolve the non-existing values for that) So all you end up with is using a helper method for setting up your mojos and executing them from your testcase. I went as far as generating and compiling my classes, but when it came to the point of actually testing them with a surefire mojo I gave up on it, as setting that up would really have been impossible. </p>
<p>I then realized that from testing point of view it is in fact an integration test, not a &#8220;mere&#8221; unit test, as the testing involves interaction with third party plugins (compiler and surefire) as well. So I converted the package from the plugin testing harness&#8217;s structure to the maven-invoker plugin&#8217;s recommended structure.  It was nothing more than moving a few directories around, but I could simply throw the complicated mojo invocation out and use a well defined and simple pom instead.  This plugin creates a local repository for itself that contains your project&#8217;s dependencies and the artifact to be tested. It&#8217;s advised to create a settings.xml that points to your local repository, to limit the unnecessary fetching from your repositories.  </p>
<p>So far, so good. You should keep in mind however, the invoker plugin has some disadvantages. It&#8217;s way slower than the harness. It doesn&#8217;t aggregate the test results, so all you can see on a failed build, that there were errors in a particular run. Also, since it runs the test in a separate Java environment, you cannot debug your test code, which in my case is quite complex. </p>
<p>So you either create a separate test module and refer to it from the test pom, and create a unit test to test your code with known data, or just be brave write well thought out code and do it properly using log messages to trace your work, just like the good old times. After all repeated failure builds character.  <img src='http://itworks.hu/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>I actually created a small and a full test environment, testing the particularities of the test separately. To debug the test code you&#8217;ve got to import the generated Maven project in your IDE and start the test execution with the local repository and the generated settings.xml. </p>
<p>What were the results? I achieved a speedup of about 90% for completely empty classes, about 70% for classes with data, when the output buffer is limited, and around 30% for classes recursively and completely filled in a depth of four iterations. Overall I could say it&#8217;s a 50% improvement on the original method, with a proven backwards compatibility. Considering that this is invoked at least 6 million times a day it might bring a favorable impact on the performance of our systems. </p>
<p>In the process I found 3 errors in the current code, that proved that the output of method&#8217;s not used to heavily in the live system. Since the logging it produces is mandatory for regulatory compliance it might just be a good idea to roll it out in the near future. </p>
]]></content:encoded>
			<wfw:commentRss>http://itworks.hu/2011/11/15/testing-mojo-generated-code-in-maven/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why are there so few female software developers in Hungary?</title>
		<link>http://itworks.hu/2011/03/16/why-are-there-so-few-female-software-developers-in-hungary/</link>
		<comments>http://itworks.hu/2011/03/16/why-are-there-so-few-female-software-developers-in-hungary/#comments</comments>
		<pubDate>Tue, 15 Mar 2011 22:30:12 +0000</pubDate>
		<dc:creator>csak</dc:creator>
				<category><![CDATA[Thoughts]]></category>
		<category><![CDATA[developer]]></category>
		<category><![CDATA[education]]></category>
		<category><![CDATA[female]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[thoughts]]></category>
		<category><![CDATA[University]]></category>

		<guid isPermaLink="false">http://itworks.hu/?p=182</guid>
		<description><![CDATA[Recently I was musing about this topic and was trying to find reasons for this phenomenon. When I was running my company I interviewed several developers for open positions, and interestingly there was an unspeakable imbalance in the gender ratio. &#8230; <a href="http://itworks.hu/2011/03/16/why-are-there-so-few-female-software-developers-in-hungary/">Read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Recently I was musing about this topic and was trying to find reasons for this phenomenon.</p>
<p>When I was running my company I interviewed several developers for open positions, and interestingly there was an unspeakable imbalance in the gender ratio. Namely I can only recall two ladies I interviewed, out of about a hundred subjects.</p>
<p>I&#8217;m trying to look into the root cause for this matter.</p>
<p><span id="more-182"></span></p>
<p><strong><em>Gender differences ?</em><br />
</strong></p>
<p>This is the answer that comes up easiest, but this is also the most controversial of all. I can almost hear the pro-women league boo. This however has an aspect that should not be overlooked or swept aside too easily.</p>
<p>I do believe that  there are no differences whatsoever in the brain capacities of the genders, also I firmly believe that women are equally capable of reasoning and thinking as men. However I think that,  probably due to upbringing or whatnot, women are generally better at tedious and repetitive tasks, while men are generally better at innovative jobs. Wait a second here, one would argue, doesn&#8217;t enterprise development consists mainly of tedious and repetitive tasks? Yes, I should say, that most enterprise development takes place in a framework, that uses the same pattern over and over again. So women should by all means be better at it then men. They would make less errors and would be better finding them!</p>
<p>So do I think  the reason is for having so few of them?</p>
<p><del>Women don&#8217; like taking risks</del> BS. there is no risk of becoming a high-paid SW developer,</p>
<p><del>Women are not interested in careers</del> BS. they are, as much as men,</p>
<p><del>Women won&#8217;t sacrifice their families</del> BS. this would mean there were loads of female juniors changing careers,</p>
<p>but wait, lets go back in time a bit, to</p>
<p><strong>Higher education<br />
</strong></p>
<p>Anyone knowing me, knows how much I loathe the higher education in Hungary. I believe it&#8217;s a relic and should be dealt with the respect it deserves (ie. none) So lets walk through the steps a kid decides gets her/his first graduate job.</p>
<ul>
<li>The kid does the entrance exams, passes and gets admitted.</li>
<li>He/she takes classes and does the exams,</li>
<li>The student chooses a topic for the thesis, prepares, and submits it.</li>
<li>The student passes the finals, and graduates.</li>
<li>He/she attends some recruitment fairs, talks to several HR people, submits loads of CVs, and attends several interviews, to get the first job.</li>
</ul>
<p>What could go wrong? It&#8217;s just studies, you decide you want to be in IT and attend a school for it.</p>
<p><strong>Choosing the career</strong></p>
<p>Let&#8217;s look at it in detail. How do you choose IT? When a boy plays about with the computer, he&#8217;s considered a wiz by the family, &#8220;He installed this and that on the computer, and removed viruses, and built his own, look at it with all the flashing LEDs and glow-in-the-dark stickers! He&#8217;s going to be a computer guy!&#8221; And so be it. The parents push the kid toward the career. As for a girl? This is not the kind of thing she should do. Is there anything remotely related to computer science in that above? It&#8217;s only an expensive LEGO, except girls get Barbies (and Apples, as those are more fashionable for a girl <img src='http://itworks.hu/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> )</p>
<p><strong>Preparing for the admission tests</strong></p>
<p>If a girl is interested in CS, and wants to know more about it how could she proceed? You must pass your finals and the admission tests for the faculty. This always means, you must do Maths, and maybe even Physics on a higher level. These subjects are not considered to be &#8220;girl&#8221; subjects, and this is suggested to everyone through a lifetime. Even if she were talented and interested she would be discouraged at a point by family, friends, or the teachers themselves.</p>
<p>Will you actually use these subjects in the field? Definitely NO. Do you have any use of studying them? Unfortunately yes. These subjects are the only way as of now to acquire the basics of logical and methodological thinking.</p>
<p><strong>Studying through university/college</strong></p>
<p>When you&#8217;re in you just have to sit through several boring lectures, pass some boring exams high on caffeine and that&#8217;s it. Well as for sitting through the classes she&#8217;d have to face the same ordeal that she faced before getting there. I know of a lecturer, who told his students plainly, that no matter what he will NOT allow any girls to graduate, as they are not fit for being an engineer! (some still passed though on one of his better days)</p>
<p>I won&#8217;t complain about the current state of education, and the impracticality of the curriculum here, that should take it&#8217;s own post later on. But it all adds up to the discouraging atmosphere.</p>
<p><strong>Thesis</strong></p>
<p>Choosing a topic is easy, isn&#8217;t it? You get a list of topics you are in no respect prepared to wrestle, and in better cases you get a sponsor and and outside consultant to go with, in worse cases you get a topic and an ignorant inside consultant. (If you bring your own topic, than you are either a high-flier, who actually knows something, or a conceited wannabe, who will fail miserably.) Take someone who&#8217;s been told/suggested so many times, that she&#8217;s not for this career, and you&#8217;ll get someone who hesitates. And by the time she makes her mind up all the good subjects are gone. She can take the leftovers, with a disgruntled consultant.</p>
<p>Still the thesis is prepared and submitted. It has to be original, and imaginative. (Gosh, we are talking about preparing for a job that is not much more than patterns glued together with simple instructions!) Good thing they don&#8217;t mess around much on judging the thesis.</p>
<p><strong>Recruitment</strong></p>
<p>Now the last (?) hurdle. All she has to do is convince</p>
<ul>
<li>a recruiter, who probably has no idea how a computer works, or what the expectations are at the designation,</li>
<li>HR, who are the counterparts of the recruiter,</li>
<li>the technical team leader,</li>
</ul>
<p>at any position she applies for, that despite she knows nothing (this is rooted in the rotten education system and is not her fault), she&#8217;s the ideal candidate for the job. She has to fight all their prejudice to even get a job, where she could actually get to learn the ropes. But wait, there are still lots of boys queuing up for the same position. So they either end up in administration, project management or (like the only female member of our study group) working behind a counter at a computer parts shop. If they insist on taking a technical job, the odds are high it won&#8217;t be at a respected company but at a web-app sweatshop, with no good prospects, as she won&#8217;t get a chance of learning the best practices.</p>
<p><strong>Conclusion</strong></p>
<p>There is no way to change this from one day to another. There is a need to change the general attitude towards women in technical positions. Even if it the change starts it will take many generations to level up.</p>
<p>On the positive side I&#8217;ve lately seen several examples of contractors providing ladies as developers, and trust me they are no worse than the guys they sent. They all suck.</p>
<p><strong>Side note</strong></p>
<p>OK. Once you got up to this, I have to admit a few things</p>
<ul>
<li>I&#8217;m prepping for an interview tomorrow, so I&#8217;m trying to get my English writing and thematic vocabulary in shape,</li>
<li>I&#8217;m currently working with some aged whiz-kids who get on my nerves at times, who could easily be replaced by hard-working people, or simply working would even be an improvement.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://itworks.hu/2011/03/16/why-are-there-so-few-female-software-developers-in-hungary/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Regexp fun</title>
		<link>http://itworks.hu/2009/11/25/regexp-fun/</link>
		<comments>http://itworks.hu/2009/11/25/regexp-fun/#comments</comments>
		<pubDate>Wed, 25 Nov 2009 21:57:31 +0000</pubDate>
		<dc:creator>csak</dc:creator>
				<category><![CDATA[fun]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[regexp]]></category>
		<category><![CDATA[test]]></category>

		<guid isPermaLink="false">http://itworks.hu/?p=95</guid>
		<description><![CDATA[Reading the post about useful regular expressions,  remembered what my favourite solution is to one of  the questions of the test we give to junior Java developers. The task is to write a method that takes a string as a &#8230; <a href="http://itworks.hu/2009/11/25/regexp-fun/">Read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Reading the post about<a href="http://www.mkyong.com/regular-expressions/10-java-regular-expression-examples-you-should-know/"> useful regular expressions</a>,  remembered what my favourite solution is to one of  the questions of the test we give to junior Java developers.</p>
<p>The task is to write a method that takes a string as a parameter and returns the acronym of the string in uppercase made up of the first letters of the words in the string. The acronym must ignore the words &#8220;the&#8221;, &#8220;of&#8221; and &#8220;and&#8221;.</p>
<p>The usual solutions are either to sequentially step through the string (Yuck!) or split it up or use a StringTokenizer class. The people usually overlook the fact, that the input strings can be padded with whitespace, or contain multiple spaces, and they usually ignore, that the keywords that are to be omitted might be found on the begining of a valid word. Thus my test &#8221; United   States of Andorra&#8221; string breaks most of the methods.  The ones who have time to write the answer down, usually forget to return the value from the method, or to change it to uppercase and sometimes even ignore that it should be a method to start with! This is my favourite question, as it can really show how the applicant can handle stressful situations.</p>
<p>I was tired after several interviews one day and tried to come up with the  shortest possible solution. Naturally it contains regular expressions.</p>
<p>My solution looked  something like this (OK I just reproduced it for the sake of the article, using nano and javac, so it might have overlooked flaws in it):</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Acronym <span style="color: #009900;">&#123;</span> 
&nbsp;
<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #003399;">String</span> toAcronym<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> str<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">return</span> str.<span style="color: #006633;">toUpperCase</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.
                        <span style="color: #006633;">replaceAll</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;(THE|OF|AND)(<span style="color: #000099; font-weight: bold;">\\</span>W+|$)&quot;</span>,<span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span>.
                        <span style="color: #006633;">replaceAll</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;(<span style="color: #000099; font-weight: bold;">\\</span>w)<span style="color: #000099; font-weight: bold;">\\</span>w*<span style="color: #000099; font-weight: bold;">\\</span>W*&quot;</span>,<span style="color: #0000ff;">&quot;$1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> args<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>args.<span style="color: #006633;">length</span><span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>toAcronym<span style="color: #009900;">&#40;</span>args<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://itworks.hu/2009/11/25/regexp-fun/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using JAX-WS without code generation</title>
		<link>http://itworks.hu/2008/08/05/using-jax-ws-without-code-generation/</link>
		<comments>http://itworks.hu/2008/08/05/using-jax-ws-without-code-generation/#comments</comments>
		<pubDate>Tue, 05 Aug 2008 21:58:41 +0000</pubDate>
		<dc:creator>csak</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[axis2]]></category>
		<category><![CDATA[Geronimo]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[JAX-WS]]></category>
		<category><![CDATA[web-service]]></category>
		<category><![CDATA[WebSphere]]></category>

		<guid isPermaLink="false">http://itworks.hu/?p=24</guid>
		<description><![CDATA[Something gave me the weird idea to try the new features of JAX-WS on a current project. The main idea was, to get rid of the code generators that must be ran whenever some minor change is done in the &#8230; <a href="http://itworks.hu/2008/08/05/using-jax-ws-without-code-generation/">Read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Something gave me the weird idea to try the new features of JAX-WS on a current project. The main idea was, to get rid of the code generators that must be ran whenever some minor change is done in the web service.</p>
<p>So instead of designing the WSDL along with the matching schema definition for the connector classes, I decided to start of by designing the interfaces and the connector classes, then just create the implementation with the corresponding annotations on the server side, that will be deployed automatically. The WSDL is generated from the annotations and the connector classes, there is no need to write them manually.</p>
<p><span id="more-24"></span>Take the following example. The web service has a simple method to query a list of items, that can throw a simple exception when the database is unreachable.</p>
<pre>import java.util.List;

import dummy.ws.type.Item;

public interface ItemService {
    public List&lt;Item&gt; getItemList() throws ItemException;
}</pre>
<p>with the implementation example like:</p>
<pre>import java.util.List;

import dummy.ws.type.Item;

import javax.jws.WebMethod;
import javax.jws.WebService;

@WebService(serviceName = "ItemService", targetNamespace = "http://dummy/ws", portName = "ItemPortType")
public class ItemServiceImpl implements ItemService {
    @WebMethod
    public List&lt;Item&gt; getItemList() throws ItemException {
        // <strong>TODO</strong> implementation comes here
    }
}</pre>
<p>can be invoked with the following simple code</p>
<pre>...
    Service service = Service.create(new URL(URLBASE
                     + "/ItemService?wsdl"), new QName(
                     "http://dummy/ws", "ItemService"));
    ItemService itemService = service.getPort(new QName(
                             "http://dummy/ws", "itemPortType"),
                             ItemService.class);
    List&lt;Item&gt; itemList = itemService.getItemList();
...</pre>
<p>There are several problems with this, even though it would be great to have it working right away. It could actually work, if there were no Collections involved on the return value. So creating a simple wrapper class for the return value like:</p>
<pre>package dummy.ws.types;</pre>
<pre>import java.util.List;

public class ItemList {</pre>
<pre>        private List&lt;Item&gt; content;
        public ItemList() {
        }</pre>
<pre>        public ItemList(List&lt;Item&gt; content) {
               this.content = content;
       }</pre>
<pre>        public List&lt;Item&gt; getContent() {
                return content;
        }

        public void setContent(List&lt;Item&gt; content) {
                this.content = content;
        }
}</pre>
<p>along with the modification of the interface and of course the implementation to use the newly created class should break the ice.</p>
<p>There is another shortcoming to this method yet. The thrown exception must contain a constructor with (String, Object) parameters, and an Object getFaultInfo method. Took me quite a time to figure it out, as there is a huge gap in the documentation when you try this. Once you&#8217;ve done that you are ready to deploy.</p>
<p>In the project we are using WebSphere Application Server Community Edition, which is an Apache Geronimo based quite stable and fast server. The WAS CE uses Axis2 for web service implementation. The rich client we implemented used the latest Axis2 libs.</p>
<p>The whole thing worked well until the middle of the project, when all of a sudden, without any major change that we could trace, the client suddenly started throwing JAXB exceptions (classname nor any of its super class is known to this context). This could only be cured by creating the jaxb.index in the ws.types package with all the connector classnames listed in it, along with an ObjectFactory that has a XXX createXXX () method for each ws.type class. Intrestingly however this class, while mandatory is never touched by the code, the class is not even loaded!</p>
<p>On the whole this approach provided a really quick and a bit dirty way of using the web services in a single project. However I would not dare to use it on a bigger scale. I still consider starting from the WSDL and the schema, then generating the interfaces and the connector classes from them the best approach.</p>
]]></content:encoded>
			<wfw:commentRss>http://itworks.hu/2008/08/05/using-jax-ws-without-code-generation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Parable of the Object Oriented Programmer and Breakfast</title>
		<link>http://itworks.hu/2007/06/15/the-parable-of-the-object-oriented-programmer-and-breakfast/</link>
		<comments>http://itworks.hu/2007/06/15/the-parable-of-the-object-oriented-programmer-and-breakfast/#comments</comments>
		<pubDate>Fri, 15 Jun 2007 11:00:12 +0000</pubDate>
		<dc:creator>csak</dc:creator>
				<category><![CDATA[fun]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://itworks.hu/?p=16</guid>
		<description><![CDATA[This is the English version of a tale I&#8217;ve recently found in my archive mailbox from 2001. Looking at ongoing projects, I think it still has a point. Once upon a time, in a kingdom not far from here, a &#8230; <a href="http://itworks.hu/2007/06/15/the-parable-of-the-object-oriented-programmer-and-breakfast/">Read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This is the English version of a tale I&#8217;ve recently found in my archive mailbox from 2001. Looking at ongoing projects, I think it still has a point.</p>
<blockquote><p>Once upon a time, in a kingdom not far from here, a king summoned two of his advisors for a test. He showed them both a shiny metal box with two slots in the top, a control knob, and a lever. &#8220;<em>What do you think this is?</em>&#8221;<br />
<span id="more-16"></span></p>
<p>One advisor, an engineer, answered first. &#8220;<em>It is a toaster,</em>&#8221; he said. The king asked, &#8220;<em>How would you design an embedded computer for it?</em>&#8221; The engineer replied, &#8220;<em>Using a four-bit microcontroller, I would write a simple program that reads the darkness knob and quantizes its position to one of 16 shades of darkness, from snow white to coal black. The program would use that darkness level as the index to a 16-element table of initial timer values. Then it would turn on the heating elements and start the timer with the initial value selected from the table. At the end of the time delay, it would turn off the heat and pop up the toast. Come back next week, and I&#8217;ll show you a working prototype.</em>&#8221;</p>
<p>The second advisor, a Java developer, highly skilled in object oriented design, immediately recognized the danger of such short-sighted thinking. He said, &#8220;<em>Toasters don&#8217;t just turn bread into toast, they are also used to warm frozen waffles. What you see before you is really a breakfast food cooker. As the subjects of your kingdom become more sophisticated, they will demand more capabilities. They will need a breakfast food cooker that can also cook sausage, fry bacon, and make scrambled eggs. A toaster that only makes toast will soon be obsolete. If we don&#8217;t look to the future, we will have to completely redesign the toaster in just a few years.</em>&#8221;</p>
<p>&#8220;<em>With this in mind, we can formulate a more intelligent solution to the problem. First, create a class of breakfast foods. Specialize this class into subclasses: grains, pork, and poultry. The specialization process should be repeated with grains divided into toast, muffins, pancakes, and waffles; pork divided into sausage, links, and bacon; and poultry divided into scrambled eggs, hard-boiled eggs, poached eggs, fried eggs, and various omelet classes.</em>&#8221;</p>
<p>&#8220;<em>The ham and cheese omelet class is worth special attention because it must inherit characteristics from the pork, dairy, and poultry classes. Thus, we see that the problem cannot be properly solved without multiple inheritance. At run time, the program must create the proper object and send a message to the object that says, &#8220;<code>Cook yourself.</code>&#8221; The semantics of this message depend, of course, on the kind of object, so they have a different meaning to a piece of toast than to scrambled eggs.</em>&#8221;</p>
<p>&#8220;<em>Reviewing the process so far, we see that the analysis phase has revealed that the primary requirement is to cook any kind of breakfast food. In the design phase, we have discovered some derived requirements. Specifically, we need an object-oriented language with multiple inheritance. Of course, users don&#8217;t want the eggs to get cold while the bacon is frying, so concurrent processing is required, too.</em>&#8221;</p>
<p>&#8220;<em>We must not forget the user interface. The lever that lowers the food lacks versatility, and the darkness knob is confusing. Users won&#8217;t buy the product unless it has a user-friendly, graphical interface. When the breakfast cooker is plugged in, users should see a cowboy boot on the screen. Users click on it, and the message &#8220;<code>Booting Application Breakfast v1.2</code>&#8221; appears on the screen. (Breakfast v1.2 should be out by the time the product gets to the market.) Users can pull down a menu and click on the foods they want to cook.</em>&#8221;</p>
<p>&#8220;<em>Having made the wise decision of specifying the software first in the design phase, all that remains is to pick an adequate hardware platform for the implementation phase. An Intel Pentium 1.86GHz with 1.2GB of memory, a 220GB hard disk, and a TFT monitor should be sufficient. Selecting a multitasking, object oriented language that supports multiple inheritance and has a built-in GUI, means writing the program will be a snap. (Imagine the difficulty we would have had if we had foolishly allowed a hardware-first design strategy to lock us into a four-bit microcontroller!).</em>&#8221;</p>
<p>The king had the computer scientist thrown in the moat, and they all lived happily ever after.</p></blockquote>
<p>NB. The story mentions a Java developer and thus provides a valuable insight: Java coders are lazy and provide specs they don&#8217;t have to develop when possible. This is why the multiple inheritance was suggested, instead of AOP.<br />
Actually the story is way older than Java, and in those times developers actually knew languages and didn&#8217;t try to design everything so it can be solved in their language of choice. <img src='http://itworks.hu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://itworks.hu/2007/06/15/the-parable-of-the-object-oriented-programmer-and-breakfast/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Developing J2ME application on Linux</title>
		<link>http://itworks.hu/2007/06/08/developing-j2me-application-on-linux/</link>
		<comments>http://itworks.hu/2007/06/08/developing-j2me-application-on-linux/#comments</comments>
		<pubDate>Thu, 07 Jun 2007 23:27:49 +0000</pubDate>
		<dc:creator>csak</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[J2ME]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[SWT]]></category>

		<guid isPermaLink="false">http://itworks.hu/?p=15</guid>
		<description><![CDATA[We are starting up prototyping on a new project I&#8217;ve mentioned in this article. Our aim is to provide a proof-of-concept implementation of a simple off-line application running on the PDA&#8217;s we have. The PDA&#8217;s of today are quite well &#8230; <a href="http://itworks.hu/2007/06/08/developing-j2me-application-on-linux/">Read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>We are starting up prototyping on a new project I&#8217;ve mentioned in <a href="http://itworks.hu/?p=8">this article</a>. Our aim is to provide a proof-of-concept implementation of a simple off-line application running on the PDA&#8217;s we have.<br />
<span id="more-15"></span><br />
The PDA&#8217;s of today are quite well equipped, they come with ample processor power and enough RAM for running medium sized applications. We&#8217;re supplied with some rugged Symbol PDAs, running Windows CE 2003 (I might be wrong there, as I haven&#8217;t laid my hand on one for longer than 5 minutes)<br />
Just to make things clear, I never done any J2ME development and I&#8217;m not very familiar with the concept of configurations or profiles either.<br />
Going through the Net and checking the scene I&#8217;ve found that there are only few options for J2ME development other than vi. The most favored recommendation seemed to be the <a href="http://www.netbeans.org/kb/articles/mobility.html">Netbeans Mobility Pack</a>, but I said I&#8217;m not touching that with a six foot pig-teaser pole. For the first run I&#8217;ve opted for using EclipseME instead.<br />
EclipseME 1.6.8 is a pretty simple solution, and can use <a href="http://java.sun.com/products/sjwtoolkit/">Sun&#8217;s Java Wireless toolkit 2.5.1</a> seamlessly under Linux.<br />
In a couple of minutes I was able to bang together a simple HelloWorld midlet, being pleased with myself. This was going better than I thought, so I went on with extending the application. I banged together a simple form display using SAX based xml parser and the lcdui controls. After I had my first form with a couple of controls displayed I went out to the Net to see which embedded language I could use to store and evaluate the logic parsed from the XML. I went to see the usual suspects, <a href="http://jakarta.apache.org/bsf/">BSF</a>, <a href="http://http://groovy.codehaus.org/">Groovy</a>, <a href="http://www.jython.org/">Jython</a>, <a href="http://www.mozilla.org/rhino/">JavaScript</a> and my favorite <a href="http://www.beanshell.org/">BeanShell</a>. There were traces on the forums that some people have already struggled with this out there, this didn&#8217;t make me feel more secure, but at least I knew I was not alone. After hours of reading it turned out that BSH has the smallest footprint of this all (cca. 145Kb) but whatever I do the language will use reflection to access the host objects. This was hardly a surprise, but the surprise came when I realized MIDP and CLDC do <strong>NOT</strong> support reflection. This was the time when I realized that I was using the wrong environment all along.<br />
No problem! &#8211; I thought &#8211; I just switch over to <a href="http://jcp.org/en/jsr/detail?id=218">CDC</a> and <a href="http://jcp.org/en/jsr/detail?id=219">Foundation</a> or <a href="http://jcp.org/en/jsr/detail?id=217">Personal Basis </a> Profile and I&#8217;m all set!<br />
This was when my hair started graying, I went through the Internet to find a single CDC implementation that can run on Linux, but no luck. Sun, Nokia, Motorola, Sony just to name a few, even though all strongly support Linux don&#8217;t provide any development environment for any OS other than Windows. This basically means that once you want to develop for any PDA in J2ME you are resorted to use a Windows based machine.<br />
There seems to be a touch of light on the end of the tunnel though, IBM does provide a solution even if it&#8217;s quite dated, that is Linux compatible. See the <a href="http://www-306.ibm.com/software/wireless/wctme_fam/index.html">Websphere Studio Device Developer</a> site to get a trial version. I thought Eclipse 2.0 is something I&#8217;ll never see in my life, but this is something I give a hearty welcome to! For our current project this is a reasonable alternative to use, but buying this for any other project seems unreasonable. As far as I can see this product is already discontinued, so I don&#8217;t expect to have it around for much longer.</p>
]]></content:encoded>
			<wfw:commentRss>http://itworks.hu/2007/06/08/developing-j2me-application-on-linux/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Quick and dirty way to create DB2 update scripts</title>
		<link>http://itworks.hu/2007/05/29/quick-and-dirty-way-to-create-db2-update-scripts/</link>
		<comments>http://itworks.hu/2007/05/29/quick-and-dirty-way-to-create-db2-update-scripts/#comments</comments>
		<pubDate>Tue, 29 May 2007 20:52:32 +0000</pubDate>
		<dc:creator>csak</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[DB2]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://itworks.hu/?p=14</guid>
		<description><![CDATA[In on of our major projects we store some of our business logic data as database metadata, but provide GUI interface for updates. Since clicking through the project&#8217;s GUI is much easier, than creating and verifying scripts for each tiny &#8230; <a href="http://itworks.hu/2007/05/29/quick-and-dirty-way-to-create-db2-update-scripts/">Read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In on of our major projects we store some of our business logic data as database metadata, but provide GUI interface for updates. Since clicking through the project&#8217;s GUI is much easier, than creating and verifying scripts for each tiny modification, our developers got lazy and we had to find a way to create SQL scripts to bring releases up to date. This basically means, we had to create a script generator that compares the data in source and destination databases and creates SQL INSERT, UPDATE and DELETE statements that can be used to modify the destination to source.<br />
<span id="more-14"></span><br />
For the script we didn&#8217;t need to be very precise, as the generated statements are always validated manually to avoid problems. This means that there was no need to care about table constraints, but the table content comparison is enough. Still there were situations where some fields were to be ignored, and situations where the tables had composite keys.</p>
<p>As usual this was not a task that was planed in the project in advance, so we had to hack together a code that didn&#8217;t require too much programming. This is usually the case when one takes two strong coffees and switches to script writing mode.</p>
<p>The databases in question are DB2 8.x patched up to a version equivalent to DB2 9.x, the environment the script must run in was GNU Linux, Cygwin and possibly even AIX, I had about 4 hours to write the original version.</p>
<p>On the end I whipped up something like <a href="http://itworks.hu/wp-content/uploads/2007/05/functions.sh" title="Script source">this</a>.</p>
<p>After this script was done I just had to add the table specific invocations to another script and voila it was able to create the scripts we needed to create the deploy scripts.</p>
<p>The simplest case of invoking the function, when the tables are to be compared with all their fields.<br />
<code><br />
compare_content $SRC_DB_ALIAS $SRC_DB_USER $SRC_DB_PASSWORD $DST_DB_ALIAS $DST_DB_USER $DST_DB_PASSWORD 'MY_SCHEMA' 'MY_TABLE' 'ID';</code></p>
<p>But the script is also good for cases, where you would like to ignore some fields for the comparison would like to conditionally compare the dbs (MY_FILTER IS NOT NULL), use composite alternate key (MY_ALTERNATE_KEY1,MY_ALTERNATE_KEY2,MY_ALTERNATE_KEY3) for identifying a row and want to use a synthetic key as primary key (NEXT VALUE FOR MY_COMPLEX_TABLE_ID_SEQUENCE) on inserts.<br />
<code><br />
compare_content $SRC_DB_ALIAS $SRC_DB_USER $SRC_DB_PASSWORD $DST_DB_ALIAS $DST_DB_USER $DST_DB_PASSWORD<br />
'MY_SCHEMA' 'MY_COMPLEX_TABLE' 'MY_ALTERNATE_KEY1,MY_ALTERNATE_KEY2,MY_ALTERNATE_KEY3' 'MY_FILTER IS NOT NULL' 'ID' 'NEXT VALUE FOR MY_COMPLEX_TABLE_ID_SEQUENCE';</code><br />
For this the script will automatically create the required statements, where the updates will omit the field ID, the inserts will insert the next value for the sequence in ID, but all comparison will be performed among values that have the same alternate key.</p>
<p>I&#8217;m sure this is a script that has a lot to improve, but still this is a good example to show the power of script languages when it comes to hacking together a utility that saves plenty of time, and would be a real pain to create using conventional programming techniques.</p>
<p>If you replace the db2 commands with the equivalents of your favorite DBMS&#8217;s command line tool you might see that this can be easily adapted to your needs as well.</p>
<p>NB. There are some other aspects in the original script I didn&#8217;t include. Namely it&#8217;s able to compare the database structures of the DB&#8217;s using the meta data tables of DB2. Since these modifications are quite rare in our project and it&#8217;s hard to compare data for some cases, that part of the script is not finished.</p>
]]></content:encoded>
			<wfw:commentRss>http://itworks.hu/2007/05/29/quick-and-dirty-way-to-create-db2-update-scripts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How not to use Java key stores</title>
		<link>http://itworks.hu/2007/05/23/how-not-to-use-java-key-stores/</link>
		<comments>http://itworks.hu/2007/05/23/how-not-to-use-java-key-stores/#comments</comments>
		<pubDate>Wed, 23 May 2007 12:23:03 +0000</pubDate>
		<dc:creator>csak</dc:creator>
				<category><![CDATA[fun]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://itworks.hu/?p=13</guid>
		<description><![CDATA[I spent half a day today trying to see why a the web start application created and deployed using a simple build script didn&#8217;t work after I&#8217;ve created a new certificate as our previous was about to expire. First I &#8230; <a href="http://itworks.hu/2007/05/23/how-not-to-use-java-key-stores/">Read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I spent half a day today trying to see why a the web start application created and deployed using a simple build script didn&#8217;t work after I&#8217;ve created a new certificate as our previous was about to expire.</p>
<p>First I suspected it was because I signed the application using SUN JDK 1.6, and it might have some compatibility issues (as if) then I suspected it was the IBM JDK 1.5&#8242;s ikeytool I used to create the key (NB. I&#8217;m lazy to learn the keytool paramers, so I prefer to use a GUI for creating keys)</p>
<p>It turned out I was presuming the keys use UTF internally, like most Java applications should, so when entering the locality I used &#8220;Vác&#8221; with accented characters. Neither ikeytool, neither keytool warned me about this. Once creating a new key without the accent the application started working straight away.</p>
<p>Since &#8220;Budapest&#8221; doesn&#8217;t have any special characters, I never noticed this, but I think it deserves to be mentioned, so others won&#8217;t run into this problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://itworks.hu/2007/05/23/how-not-to-use-java-key-stores/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Off-line SWT application</title>
		<link>http://itworks.hu/2007/05/10/off-line-swt-application/</link>
		<comments>http://itworks.hu/2007/05/10/off-line-swt-application/#comments</comments>
		<pubDate>Wed, 09 May 2007 23:02:05 +0000</pubDate>
		<dc:creator>csak</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[DB2]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[MQ]]></category>
		<category><![CDATA[RCP]]></category>
		<category><![CDATA[SWT]]></category>

		<guid isPermaLink="false">http://itworks.hu/?p=8</guid>
		<description><![CDATA[One of our current Customers have a very interesting requirement for an upcoming project. The nature of the project requires mobile clients and frequent (or even instant) database updates, but there is no guarantee to have constant connectivity. We more &#8230; <a href="http://itworks.hu/2007/05/10/off-line-swt-application/">Read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>One of our current Customers have a very interesting requirement for an upcoming project. The nature of the project requires mobile clients and frequent (or even instant) database updates, but there is no guarantee to have constant connectivity. We more or less have full control on the choice of tools to use for this application, but since our developer resources are limited, it would be great if we could use the architecture from a previous project. We&#8217;ve been working with András on this for quite a while and it seems we found a pretty interesting way to do this.<br />
<span id="more-8"></span><br />
The current architecture looks like this:<br />
<img src="http://itworks.hu/wp-content/uploads/2007/05/current-layout.png" alt="Current layout" align="left" /><br />
The RCP client connects to the application server using Axis based web services that uses our framework to call the business logic which accesses the database through Hibernate.</p>
<p>As the application currently uses web services to access the framework containing the business logic and this is already separated in the application it&#8217;s relatively straightforward to modify this dispatcher to access the business logic.</p>
<p><img src="http://itworks.hu/wp-content/uploads/2007/05/new-layout.png" alt="Planned layout" align="right" /><br />
When online the modified application works just like the one above, and during the online period the application will synchronize its database with the server using DB2 Everyplace.</p>
<p>When the application is off-line the actions will perform the actions on the locally synchronized database, and send MQ messages of these actions through the local MQ Everyplace. Thus the application will see the local database as it&#8217;s own and perform the actions on it&#8217;s local database. The requirements allow for this, as the data is distributed among the users, (it&#8217;s more of a data collector, than business application) and there is only a very little chance of simultaneous updates.</p>
<p>When the client goes on-line again first the MQ messages will be sent to the server, the client will then wait for all the sent messages to be consumed by a message bean on the application server. After the messages are consumed the local database can be synchronized with the server so the data modified by other clients will be reflected on the client.</p>
<p>We&#8217;ve also considered using the features of the Lotus Expeditor platform, which works similarly, but decided against it. Our two main concerns were, that firstly we have limited resources and learning a new platform is time consuming, especially for such a new framework, the other was that Lotus Expeditor&#8217;s works offline like the original Lotus Notes platform (this is our assumption, based on a very short research) has the preconception, that noone is allowed to use the same database at the same time. If someone does the records are marked as save conflicts that must be reconciled manually.</p>
<p>Our way would permit the business logic to handle these updates gracefully, by either simply applying the updates on the given record in sequence, or refusing the update using either a version- or timestamp, or in workflow like cases statuses.</p>
<p>I&#8217;m sure this is not the only, and very likely not the best way to do this, but it&#8217;s most certainly the one that would require the smallest effort.</p>
<p>The images suck, I know, but I&#8217;m not in a drawing mood right now. <img src='http://itworks.hu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://itworks.hu/2007/05/10/off-line-swt-application/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Continous integration issues with Ant(hill)</title>
		<link>http://itworks.hu/2007/05/02/continous-integration-issues-with-anthill/</link>
		<comments>http://itworks.hu/2007/05/02/continous-integration-issues-with-anthill/#comments</comments>
		<pubDate>Wed, 02 May 2007 21:11:29 +0000</pubDate>
		<dc:creator>csak</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[continous-integration]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://itworks.hu/?p=6</guid>
		<description><![CDATA[Anthill is a small, easy to configure automatic build and publish environment. I don&#8217;t want to discuss the deployment and configuration of the tool itself, I&#8217;d rather highlight the main issues that we had on using Anthill to automatically build &#8230; <a href="http://itworks.hu/2007/05/02/continous-integration-issues-with-anthill/">Read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.anthillpro.com/html/products/anthillos/default.html">Anthill</a> is a small, easy to configure automatic build and publish environment.<br />
I don&#8217;t want to discuss the deployment and configuration of the tool itself, I&#8217;d rather highlight the main issues that we had on using Anthill to automatically build and deploy our ongoing projects.<br />
<span id="more-6"></span></p>
<p><strong>Hard to identify InvocationTarget exceptions</strong><br />
Our build environment was a Tomcat 6.0.x running on Sun JDK 1.6 on Debian Linux on x86, while the test and production environments are Websphere Application Servers 6.0.12 running the default IBM JDK 1.4.2 on AIX on Power5. Upon deploying to the test server we used the images created on the build environment using the Anthill&#8217;s <em>build as version</em> functions. Since the target source and target levels are Java 1.4, these options were specified in the javac ant task, so the code produced can run on the target environments.<br />
This setup worked perfectly for months on our projects, but after a while strange exceptions started popping up on the test server. Compiling and deploying the application using the same options as the ones set in Anthill on our local Websphere servers got rid of the problems, while the one deployed on the AIX running the WAS we got the exceptions. Since there didn&#8217;t seem to be any difference between the builds we didn&#8217;t suspect Anthill for quite a time, and thought it was some strange JDK problem on AIX.<br />
The simple code:<br />
<code>new BigDecimal(1);</code><br />
worked perfectly on our Tomcat, on our local WAS but threw an exception on the test server&#8217;s WAS. Changing the code to<br />
<code>new BigDecimal("1");</code><br />
worked perfectly on all environments.<br />
A collegue worked out the reason after a few days of searching. He noticed, that these issues occur, when we use methods, that have been extended in Java 1.5. For example the code above would map to BigDecimal(int i) while it will map to BigDecimal(double d). We realized, that however the generated code will be created to be ran under Java 1.4, it will be compiled for the actual runtime of the ant ran from the Anthill. Since the JRE in WAS doesn&#8217;t contain the signatures for the given method, this will throw the InvocationTargetException, which looks strange at that point of the code.<br />
After identifying the problem, solving it was quite easy after checking out the official <a href="http://ant.apache.org/manual/CoreTasks/javac.html">documentation</a>, changing the javac block to look something like:<br />
<code><javac srcdir="${src}"><br />
destdir="${build}"<br />
fork="yes"<br />
executable="${java.home}/../bin/javac"<br />
/&gt;</javac></code><br />
and passing the option <code>-Djava.home=/my/jdk/home/dir</code> will enable to build the project both under Anthill and Eclipse.</p>
<p><strong>Publishing under WAS</strong><br />
Our current project is to be deployed on WebSphere, and we wanted to use Anthill to deploy automatically on WAS. This is a real pain in the backside, since if you take FOSS servlet containers and application servers (Tomcat, Jetty, Jboss, Geronimo), they are pretty friendly when it comes to deploying an application on. You just copy the WAR/EAR in a directory and it is deployed automatically. On WAS hovewer this is not half as simple.<br />
WAS has a very specific way of accessing the administration interface ws_ant. It first seems like a very simple shell script running ant scripts, but try as you might you&#8217;ll never be able to invoke it from inside your normal ant. Rumor has it, that IBM modified the ant for some weird reason. After several failed attempts, we used the most trivial and ugly way to invoke the tasks.<br />
Based on the forums and even IBM&#8217;s InfoCenter it seems that invoking the ws_ant with the exec task with the required arguments. I have to mention two points here, one is that there seems to be no way to handle the return value of the exec. The other is that it&#8217;s quite annoying, that all arguments of the exec must be specified using separate args.</p>
]]></content:encoded>
			<wfw:commentRss>http://itworks.hu/2007/05/02/continous-integration-issues-with-anthill/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

