↓ Skip to main content

Java

Spring Framework - the biggest missing piece

·561 words·3 mins
I am having the pleasure working with Spring 2.x since about October last year. It is my return back to Spring, after first encounter in 2005 (counting only larger projects). Same as in previous project, it has been so much fun :-). So much fun in fact, that I was spending my evening playing with code and reading up what is new in 2.5, rather that blogging ;-) I am still amazed about how nice is the whole thing designed and how many ways it can be used. It's flexibility is simply breathtaking. The price for the flexibility is complexity - sometimes it is not obvious what of many options should be chosen and what are all these options anyway :-).

Spring 2 MVC and ResourceBundleViewResolver problem

·129 words·1 min
This one took some time to figure out - it is one of those problems that are obvious after you know the solution but hard to see beforehand. I had the ResourceBundleViewResolver configured with Tiles 2, like this: [code language='xml'] [/code] and the view.properties was: [code language='xml'] parent-view.(class)=org.springframework.web.servlet.view.JstlView parent-view.(abstract)=true about.url=/WEB-INF/jsp/about.jsp form.url=/WEB-INF/jsp/form.jsp list.url=/WEB-INF/jsp/list.jsp [/code] It kept givin exception saying that /WEB-INF/jsp/list.jsp does not exist. Which it did. I tried couple of things, no result.

Using iBatis with Abator

·457 words·3 mins
I am back to Java and on mission of re-discovering Spring coolness - and in awe how much was added since 1.2 to current 2.5.1. Thanks, SpringSource and hundreds of contributors. Data layer of the current project is based on iBatis and Spring DAO. We have decided to try out the Abator tool from Apache (part of the iBatis suite) to generate initial version of data mapping (as we inherited the database schema). Only necessary part is abator.jar (there are no other dependencies).

JRuby - keeping your database.yml really DRY

·180 words·1 min
I am experimenting in JRuby and use database in virtual machine (VMWare Fusion). This is great because you can have multiple versions of multiple databases ready without polluting the notebook. One downsize though is that IP address of the database will change between the VM restarts. First important setting in Fusion is to use the 'NAT' option rather than 'Bridged'. With NAT, you database host IP address will not follow the network. It was quite annoying to change it from 192.168.X to 192.168.Y everytime I reconnected at home from work or vice versa.

JRuby trunk - issues with JDBC connectivity

·344 words·2 mins
Following the book on JRuby I am discovering small differences when trying the examples. After installing activerecord-jdbc gem which is available in version 0.5, the shoplet application fails with Rails 2.0, as soon as you click on the 'About your application environment' link. => Booting Mongrel (use 'script/server webrick' to force WEBrick) => Rails application starting on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server ** Starting Mongrel listening at 0.0.0.0:3000 ** Starting Rails with development environment... ** Rails loaded. ** Loading any Rails specific GemPlugins ** Signals ready. TERM => stop. USR2 => restart. INT => stop (no restart). ** Rails signals registered. HUP => reload (without restart). It might not work well. ** Mongrel 1.1.2 available at 0.0.0.0:3000 ** Use CTRL-C to stop. Processing InfoController#properties (for 127.0.0.1 at 2007-12-23 23:13:25) [GET] Session ID: BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNo%0ASGFzaHsABjoKQHVzZWR7AA%3D%3D--9791be23205677745e457b5bf62c50eba6e3813f Parameters: {"controller"=>"rails/info", "action"=>"properties"} Exception in thread "Ruby Thread11043409" java.lang.NoSuchMethodError: org.jruby.runtime.builtin.IRubyObject.setInstanceVariable(Ljava/lang/String;Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/runtime/builtin/IRubyObject; at JdbcAdapterInternalService.set_connection(JdbcAdapterInternalService.java:122) at JdbcAdapterInternalServiceInvoker$set_connection_FS1.call(Unknown Source) at org.jruby.runtime.callback.FastInvocationCallback.execute(FastInvocationCallback.java:55) at org.jruby.internal.runtime.methods.SimpleCallbackMethod.call(SimpleCallbackMethod.java:70) at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:158) at org.jruby.runtime.CallSite$ArgumentBoxingCallSite.call(CallSite.java:103) at org.jruby.evaluator.ASTInterpreter.fCallNode(ASTInterpreter.java:1092) at org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:345) at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:626) at org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:293) at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:147) at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:158) at org.jruby.runtime.CallSite$ArgumentBoxingCallSite.call(CallSite.java:76) at org.jruby.evaluator.ASTInterpreter.vcallNode(ASTInterpreter.java:1734) at org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:474) at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:626) at org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:293) at org.jruby.evaluator.ASTInterpreter.rescueNode(ASTInterpreter.java:1499) at org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:442) at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168) I found out that there is newer version of activerecord-jdbc, which is also renamed to activerecord-jdbc-adapter. It is important to uninstall the old gem as well as install the new one, otherwise the application will not work.

Installation of Mongrel gem on JRuby

·159 words·1 min
I bought the Ola Bini's eBook on JRuby and started to work through the examples. The installation of the Mongrel gem in JRuby (trunk revision 5341 fails with the following error code: ``` $ jruby -S gem install -y mongrel> INFO: `gem install -y` is now default and will be removed> INFO: use --ignore-dependencies to install only the gems you list> Building native extensions. This could take a while...> extconf.rb:1:in `require': no such file to load -- mkmf (LoadError)> ERROR: Error installing mongrel:> ERROR: Failed to build gem native extension.[/sourcecode]> This error is logged in JIRA with id JRUBY-1771Workaround (possibly applicable for other gems is to explicitly specify the plaform:> [sourcecode language='ruby']> $ jruby -S gem install -y mongrel --platform jruby> INFO: `gem install -y` is now default and will be removed> INFO: use --ignore-dependencies to install only the gems you list> Successfully installed mongrel-1.1.2> 1 gem installed> Installing ri documentation for mongrel-1.1.2...> Installing RDoc documentation for mongrel-1.1.2... ```

Great Spring blog

·86 words·1 min
in case you have not noticed - Interface21 aka SpringSource (great name change, btw) runs a blog with lots of hidden treasures inside. Recent article describes new addition to Spring portfolio which is territory within my "watched space": enterprise integration. See the blog entry for more. If you are in corporate space that is keen on "standards", the comparison of Spring vs EJB3 is very good article as well. Not that EJB would matter too much these days (IMHO) - but a nice read nevertheless.

An advice to a fellow developer - 1

·1333 words·7 mins
We are recently interviewing quite a lot in anticipation of the great things coming. It is sort of similar task as we did year and something ago, but I enjoy this round much better. This time, rather than "we have to assemble the project team ASAP", we have the luxury of longer term view and focus more on hiring the people that will be great match to the company culture, will be with us for longer period and will grow with the company.

Ragioni per fare il grande salto

·900 words·5 mins
During the vacation, we stopped in small bookstore in Verona which was selling computer software as well. At the entrance, there was a poster showing smiling Finder's face, Apple logo and announcing reasons why you would want to make the big jump - il grande salto - to Mac platform. That is to explain the title :-) Grande Salto is exactly what I did. Without too much preparation or notice. Since Tuesday evening I am happy owner of the beautiful piece of hardware (17 inch 2.4 GHz Core 2 Duo Macbook Pro with 250 GB HDD and 4 GB of RAM) that is greatly complemented by the amazing software collection (OS X 10.5, iLife 08, iWork 08 and many others) running on it. I spent Wednesday playing with it and between 'Wows' and 'Ahhs' managed to setup the core applications I need for work: several configurations of Eclipse (with and without MyEclipseIDE), Netbeans with Ruby, couple of gems and of course THE editor. Then transferred the sources, installed Ant, Spring, Tomcat and couple of opensource packages (e.g. Jakarta Commons). And on Thursday, I jumped right into the field, to the client continuing in development of my current Java project in the place where I left it on Monday with Fujitsu N5100 running XP-ProSP2. As a plan B, I had my old notebook also with me - but did not have to resort to using it.

Installing ATG on Fedora Core

·219 words·2 mins
Trying to install ATG on the Linux platform turned out to be not completely hickup-free. The default installer died with the following message: $ ./ATG2007.1.bin> Preparing to install...> Extracting the installation resources from the installer archive...> Configuring the installer for this system's environment...> awk: error while loading shared libraries: libdl.so.2: cannot open shared object file: No such file or directory> dirname: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory> /bin/ls: error while loading shared libraries: librt.so.1: cannot open shared object file: No such file or directory> basename: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory> dirname: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory> basename: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory[/sourcecode]> Fortunately, the fix was easy after I found out what went wrong: incorrect assumption about kernel version. To make it work, this "hack" helped:> [sourcecode language='css']> $ mv ATG2007.1.bin ATG2007.1.bin.orig> $ cat ATG2007.1.bin.orig | sed "s/export LD_ASSUME_KERNEL/#xport LD_ASSUME_KERNEL/" >ATG2007-1.bin None of this of course happens on Windows - oh, yes - the joys of not swimming with the crowd :-). You will encounter issues otherwise unknown - but also learn something in the process.