Friday, November 16, 2007

jar hell

Those who work with multiple open source stack need to be pitied. With your different open source stacks coming bundled with different versions of same jar files (e.g. xerces.jar which is a common occurrence in so many stacks), unexpected problems can crop up which hard to debug by just looking at the exception trace.
I had one such problem and it was very difficult for me to find the solution(solution method I am referring to is of-course googling) and hence the post for others who get stuck on this one.
If you see following exceptions:
org.jboss.xb.binding.JBossXBRuntimeException: Failed to create a new SAX parser
and
SAXNotRecognizedException: Feature >>'http://apache.org/xml/features/xinclude' is not recognized.

Most probably you have multiple incompatible versions of xerces.jar in your classpath.

My particular problem was xerces-2.6.2.jar which was there as part of hibernate 3.2 dependency was conflicting with newer version required by jboss which is 2.7.1 (xercesImpl.jar) and is present in JBOSS_HOME/lib/endorsed dir.
Removing xerces-2.6.2 from classpath solved this probelm.

Hope this helps some other unfortunate programmer who gets stuck!

Wednesday, June 27, 2007

Where is Indian Amazon?

Where is the Indian version of Amazon.com? Why can't I buy any book/movie/CD/clothes/gifts/electronic gadgets/flowers/magazines etc from a single website? And don't suggest sites like rediff.com, indiatimes, indiaplaza etc. They don't even come close.

I think India has huge supply chain issues to overcome and a brick and mortar company has a better chance of doign it then a software company.

Imagine doing these day-to-day things from a single website owned by a brick and mortar company. A company who delivers right from milk, cereals, grocery, petrol, landline phone connection, wireless phone connection, broadband, financial products, clothes, electricity, software and list goes on and on. You name it and they do it. Imagine all these things being available from a single website. All that company has to do is get their act together and decide to become Indian version of Amazon. You might have guessed it, I am referring to Reliance. If they overcome trivial issues (like tiff between two brothers!) they can own this space (that's the only space I think that's not owned by them right now).

So wake up Reliance (ADAG and MDAG both), Indian net space is for yours to rule.

Tuesday, June 26, 2007

Having problems on your first WAP website?

So you put a lot of effort and created a WML based version of your website and have tested it thoroughly with all the great WAP tools and simulators. Now you take your tentative first step and try to access it using a WAP browser on your GPRS phone and you get "Invalid content type"!
Hmmmm. So what went wrong?
Two possibilities:
1) Content-Type set in HTTP response is actually incorrect. It should be:
Content-Type: text/vnd.wap.wml
Note: Above content-type is only for wml pages. Now-a-days many phone browsers support direct HTTP and html pages in which case content-type would be text/html

How to find what Content-Type is being received by the browser? Use a tool like Openwave phone simulator which also display complete dump of http protocol between client and server. It's available at Openwave Phone Simulator
Advantage over some of the other tools is that it can directly handle http and does not require a WAP gateway (simulator) to function.


2) But problem may not be that simple. Second thing to check is actual WML page generated. You would wonder how could that be a problem since I tested with my great XYZ wap phone simulator. But here's the rub, most WAP phone simulators are very lax in wml parsing. They allow you to get away with murder while real WAP browsers on phone and WAP gateways are very strict in content parsing. On top of that error you get on a phone browser would not be very illuminating. You might get "Invalid content type" for both incorrect setting of Content-Type header in HTTP response and also when for some syntax error in the wml page.
The best way to catch these type of errors is to validate your WML and that's very easy to do. Just head to W3C Validator and enter your web site's URL.

Hope this helps some newbies out there who are facing the same problem as I did.

Thanks Thyaga for starting me on!