Friday, January 15, 2010

How to upgrade YUI libraries in Orbeon

Orbeon uses YUI as a javascript framework/library for XForm components. As of this writing it bundles YUI 2.6 with some bug fixes, YUI is now out with 2.8 as RC and 3.0 beta.

There are a few critical bugs in YUI 2.6 that was preventing us to implement couple of components which prompted to look into upgrading YUI within Orbeon. Its not exactly a rocket science, but the process could have been better if Orbeon supported (had thought about easier ways of) upgrading YUI.

Here are the steps

  1. Download the latest source code from Orbeon git-hub
  2. Replace src\resources-packaged\ops\yui with the latest version of YUI
  3. Find XFormsFeatures.java this file has hard coded YUI library names!! To the very least look for all the *beta* js files and make sure either they exist in the new YUI version or replace the filenames (in java file or .js file itself) so they are found and loaded during run time
  4. Orbeon build does come with an additional subdirectory under yui called examples. Seems like they are bundling couple of examples (resize and treeview). You will need to move these from new version of YUI/examples directory.
  5. Rebuild and deploy orbeon (ant orbeon-war or ant orbeon-dist-war)!!
Note you can find your javascript files under orbeon-resources-public.jar and orbeon-resources-private.jar in case you want to double check which files made it into Orbeon build.

    Wednesday, August 26, 2009

    Using Maven2 Cargo Plugin

    I was trying to get Maven2 Cargo plugin to work for my proof of concept on parent-child multi module maven project. Since most practical real world maven projects will be such combination of both parent-child and multi module.

    Following instructions on Cargo site works only if are executing your mvn cargo:* mojos from within the project directory that is cargo enabled (deployable). It does not work if you run it from parent project directory. I had tried running it from the parent project directory and the packaging type being "pom" ofcourse. You will get the following error

    Maven LifecycleException ... The plugin 'org.apache.maven.plugins:maven-cargo-plugin' does not exist...

    The error is really misleading because it tries to look for maven-cargo-plugin which is not what you included as a plugin groupId:artifactId:version for either pluginDepenency (in parent) or in your plugins section. You will really have to dig through a few posts before you can get some hints on how to fix it.

    Now the fix part. There are 2 ways to fix this problem

    1. Just cd into the project directory which needs to deploy the artifact to the app server and run mvn cargo:deploy
    2. If you are like me, and would like to run this thing from CI engine (hudson), you would need to attach cargo:deploy to one of the existing maven phases e.g. install.

    Thanks to concise and right on the money post for the clue.

    Saturday, December 6, 2008

    Just a quick note about how to debug and compile Pentaho PDI
    1. Get the source from svn e.g. to get the branch 3.1.0 use the following command
      svn co svn://source.pentaho.org/svnkettleroot/Kettle/branches/3.1.0 Kettle3.1.0
    2. Make sure you have ant, I have 1.7.x installed and in the path
    3. Load the project as an existing Java project in Eclipse, modify source at your will
    4. Look at the build.xml file at the top level directory where you checked out the source
      e.g. Kettle3.1.0
    5. Run the default target or if you changed source file in one of the sub packages such as core or ui etc., there are separate targets to build just those lib

    Friday, December 5, 2008

    Pentaho PDI - Running multiple SQL statements

    As you may already know, you can use Exec SQL step to execute multiple SQL statements either once during the entire transformation run or once per row.

    But...

    I was bitten by this issue and ended up wasting couple of hours trying to debug the cause. The reason... Error is really amgious, if you have multiple "syntactically correct" SQL statements separated by commas and try to execute it with default settings on the Connector/J and MySQL as DB you get
    "You have an error in your SQL statement, Check the syntax..." error.
    Checked my SQL statements several times and individually in SQL Query browser to make sure they were correct.

    There are a couple of things you should note
    1. In the debug log you will see an old log saying executing DDL statement when it actually can execute both DDL and DML statements. So you will need to ignore that log
    2. Not all the drivers/databases allow running multiple comma separated SQL statements due to SQL Injection attach. Check the driver/db to make sure it allows execution of multiple SQL statements separated by commas in one shot.

    For MySQL and Connector/J by default does not allow this, so to enable it you will have to add an option in your Database Connections dialog -> Options tab and add the parameter allowMultiQueries with the value of true.

    3. Also make sure that you surround ?'s in your SQL statements with single quotes if you are passing in string values. If you are like me, you tend to think of the statement as your typical prepared statement in JDBC and using JDBC api to set the values so you dont need to worry about wrapping strings with quotes.

    Hope that helps.

    Friday, March 21, 2008

    Using Ofbiz and Wicket - Part I

    This article is the first article and probably more to follow on how to use Wicket with Ofbiz.

    Both Wicket and Ofbiz are from ASF (Apache Software Foundation) but unfortunately not many ppl seem to have used them together.

    Primary reason for me to use them together was complexity and amount of configuration required to use existing Ofbiz frontend frameworks such as screen widget and learning additional technologies such as freemarker, beanshell etc. That lead me to look for a framework which would replace that and provide more - hence Apache Wicket.

    Apache Wicket falls into already crowded MVC UI Frameworks consisting of struts, seam amongst others. You can get an entire list from Wicket website :). Yes, it has AJAX support builtin in the framework and yes it has rich set of components both AJAX and otherwise as Wicket extensions and at WicketStuff.org with integration with popular Javascript AJAX libraries DOJO, YUI and JQuery and few others.

    Now that we have some background, lets see what you need to get started and use Wicket "inside" Apache Ofbiz.

    • Ofbiz comes with embedded Tomcat at the time of writing Ofbiz 4.0 came with Tomcat 5.5.23 and fortunately Wicket can be deployed in any standard web container
    • Download wicket binaries from Apache Wicket site, copy them over to your Ofbiz application lib directory where you have your application and other 3rd party jars. I chose to put it under hot-deploy/myapp/webapp/myapp/WEB-INF/lib
    • Add WicketFilter entry to your web.xml file (Note: Both WicketFilter and Ofbiz ContextFilter will be listening on /* requests - so initially there will be chaining of those filters, but for this first article I will ignore that) - Make sure to put WicketFilter entry before ContextFilter so WicketFilter gets called first
    • Write your first Hello World in Wicket by creating your WebApplication and WebPage classes - access the URL (http://localhost:8080/yourappcontext) and see it in action, where yourappcontext is whatever you configured it to be in your ofbiz-component.xml file
    In the following articles I will try to cover things like using Ofbiz Entity Engine, Service Engine from wicket and may be how to translate Ofbiz ecommerce application using entirely Wicket. On the way will try to quickly cover some cool UI components both SEO friendly and otherwise.

    How to resolve channel 1: open failed: administratively prohibited: open failed

    There are a few reasons why you could get

    channel 1: open failed: administratively prohibited: open failed

    But essentially it means the port you are trying to tunnel into on the remote machine cannot be opened

    To debug the issue
    • If you have access to the remote machine check /var/log/secure to get more information on error
    • You could try ssh tunnel in verbose mode with -v option
    • Try with a different port number on the remote host just to test - some ports are reserved
    To resolve the issue - Depending on what the error was from debugging you might have to
    • If the error in the secure log was cannot resolve host name - it means you need to restart your network service or interfaces - it could be due to dns server issues
    • restart sshd on the remote server - make sure port forwarding is enabled in your ssh config - there are plenty of resources on the net that will explain this

    Thursday, March 20, 2008

    How to package Wicket jars quickly

    Wicket is buildable only using maven. Using maven install is not bad if you have to just build Wicket once, but when you have to build it multiple times, its takes its toll :) - on my 2.4GHz, 4Gb RAM dell laptop it takes atleast 8-12 mins - thats painful.

    If you are not Maven guru and would like to get this done quickly - here is what I tried and it worked. I could not find any documentation that shows exactly these steps so...

    Depending on the wicket jar that you want to build - cd to that subdirectory under wicket and use

    mvn -Dmaven.test.skip=true compile jar:jar install:install

    or any combination of the options above which are self explanatory, but I will explain them anyway, just in case-
    compile - compile phase of maven which will compile all
    jar:jar - is the jar goal of package phase if you specify the package instead of jar:jar it will also try to generate javadocs which will take forever
    install:install - deploy phase goal

    Hope that helped - would save atleast 30-45 mins if you didnt know maven