↓ Skip to main content

Programming

Spring PropertyPlaceholderConfigurer with Velocity

·171 words·1 min
Part of the configuration magic is (one of several) Spring post-processors, that allows load the property file or files and refer to the values in these files inside XML configuration files. The rationale behind these is that property files are much easier to edit that possibly huge XML config file and using property values prevents repeating same value over and over again. With this approach, the following configuration: [sourcecode language='xml']

Oracle SQLDeveloper and mystery of the missing host

·193 words·1 min
If you work with Oracle database, a very good tool you should not ignore is the Oracle SQL Developer. It gives you much more power when it comes to manipulating data or managing database. I use most of the time MyEclipseIDE plugins, but when I need e.g. export data, the SQLDeveloper is way to go. Today I tried it for first time on the Mac. I started to configure and database connection and was completely confused by the error message "Port must contain numerical value". Here was the dialog box:

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... ```

Joel's gems

·97 words·1 min
One of the most readable, original blogers out there, writing on software development practice and techniques - Joel Spolsky - published an excellent 3 part Talk at Yale: Part1, Part2 and Part3. You will find out: - what two computer science courses were most useful in his university studies (one that was not really a comp-sci and one he decided to drop) - why is it tough to be an in-house programmer - why is the quality of many in-house systems so bad - what is this "quality thing" anyway - why is specification futile

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.