Saturday, February 16, 2008

Jackrabbit 1.4 and Problems with Failed Document Uploads

For those who prefer to live and bleed on the cutting edge of things, you must have already started experimenting with Jackrabbit 1.4 that came out in Janurary, 2008.

Well then most of you must have alse encountered a problem with uploading documents that worked perfectly with previous versions but fails. The upload succeeds, but unless the repository is manually restarted, attempts to access the newly uploaded document throws an exception with the following stack trace :

javax.jcr.RepositoryException: Internal error while retrieving value of /SecondTest/nb/field/*Value3*: name can't be null: name can't be null at org.apache.jackrabbit.core.PropertyImpl.getValue(PropertyImpl.java:470) at org.apache.jackrabbit.core.PropertyImpl.getStream(PropertyImpl.java:479) at com.sun.portal.cms.mirage.service.custom.impl.ContentServiceImpl.getFieldValue(ContentServiceImpl.java:677) at com.sun.portal.cms.mirage.service.custom.impl.ContentServiceImpl.getContentFromNode(ContentServiceImpl.java:393) at com.sun.portal.cms.mirage.service.custom.impl.ContentServiceImpl.getContentByNameAndType(ContentServiceImpl.java:351) at com.sun.portal.cms.mirage.service.custom.impl.ContentServiceImpl.getContentsByType(ContentServiceImpl.java:434) at com.sun.portal.cms.portlet.ccd.beans.ContentCreationBean.changeContentType(ContentCreationBean.java:220)
Caused by: java.lang.NullPointerException: name can't be null
at java.io.FilePermission.init(FilePermission.java:171)
at java.io.FilePermission.(FilePermission.java:264)
at java.lang.SecurityManager.checkRead(SecurityManager.java:871)
at java.io.FileInputStream.(FileInputStream.java:100)
at org.apache.jackrabbit.core.value.BLOBInTempFile.getStream(BLOBInTempFile.java:145) at org.apache.jackrabbit.core.value.InternalValue.toJCRValue(InternalValue.java:366) at org.apache.jackrabbit.core.PropertyImpl.getValue(PropertyImpl.java:466)
      ... 97 more
java.lang.NullPointerException: name can't be null

Well thanks to the following my problem is at least temporarily solved:
http://www.mail-archive.com/users@jackrabbit.apache.org/msg06191.html

A better understanding of the problem is called for so that I can address it more appropriately in the future.
But for now setting the system property org.jackrabbit.useDataStore to false fixes it immediately.


Sunday, February 10, 2008

Networking Issues with Ubuntu

A very strange problem has me totally flummoxed for the past week.

I have a Linksys Wireless router connecting my computers wirelessly to the internet through Rogers cable. Very recently my Ubuntu 7.10 laptop simply stopped being able to surf the net.

It could successfully connect to machines on the LAN, so I knew my wireless components were all working. It had a valid internal IP address...so I ran the usual tests - pinging, tracerouting etc. Pinging www.google.com timed out. Tracepath interestingly reached only part of the way - timing out after that.

Windows laptops, other machines on the wired network continued to work fine.

Following posts on the net:
  • I removed IPV6 from the laptop
  • Downgraded to Ubuntu 6
  • Updated my router to do MAC address cloning

...All to no avail. For some reason this computer would just not see anything outside the LAN.

Eventually the only way I could get the laptop to connect to the outside world was by setting it to connect through a proxy! So at least I have a temporary work around. But definitely its not a satisfactory one, least of all because I still do not know why this happened in the first place!!

Incidentally I used the RabbIT proxy server, a pure Java based one for this and its done a good job so far. You need a fairly adept implementation to enable things like AJAX based sites to work through your proxy and still keep things simple...

Wink for Flash Tutorials

There are a huge number of video presentation tools available on the commercial market, but once you consider something as easy to use and feature complete as Wink - you might be tempted to go the free software route. With the ability to:
  • Do live screen captures (as movies)
  • Edit the captures frame by frame
  • Add interactive scripting
  • Add voice-overs
  • Generate the final output as easily distributable Flash movies
  • And do all of above through a simple, easy-to-use GUI
Wink really meets most of the requirements for people looking to create video tutorials for their applications, or interactive video based demonstrations etc. The best part is that with a high quality, free tool like this people will find innovative ways to put video to work for them.

Incidentally Satish, the creator and maintainor of the tool, seems to have other software credits to his name as well, all hosted at debugmode.com

Apple Bonjour Pitfalls on Multicore Machines

Many in the software development community rejoiced when Apple announced they were open sourcing Bonjour. I am not ashamed to say I was one of them since I have used the technology in my own projects and have been amazed by the relative ease of use of the technology as compared to something like Jini. However, a problem we ran into recently highlighted some of the unforeseen hiccups technology can run into -

My Bonjour based auto-discovery code written using the new Java libraries was working very reliably in test environments for some time. In fact, we could test it even on VMWare. However, we ran into trouble when some of the non-virtual test machines started displaying erratic auto-discovery behaviour - specifically, discoverable components would not be discovered, or if discovered would soon be spontaneously lost, etc.

Much testing and debugging followed before we narrowed down our problem to the fact that it happened only on multicore machines - Dell Latitude D620s in fact. On Dell Latitude D810s, or any other single core CPU, the applications behaved as expected .

Then we found that the BrowserApp that comes with the 1.0.3+ SDK samples, has similar erratic behaviour on the same machines - and in fact consistently refused to detect nodes on the network. And then most interestingly, we found that the dns-sd.exe program (written in C) based on the same low level libraries that the Java libraries depend on, works perfectly, irrespective of the CPU!!

This seemed to indicate that the Java code we had written modeled on Apple's sample code had inherited some problems from it. Eventually with some re-reading of their documentation and a better understanding of the event based API that Apple provides, we managed to rewrite our Java application so that it too worked as expected.

However, the whole experience suggests that chip manufacturers may be pushing software development to a whole new era of implicit multi-threading with a host of associated issues, that many software developers are just not ready for.

Echo2 and GWT

I've had a fairly good experience with Echo2 so far and relatively less so with GWT - but I thought I'd just record my biggest gripe with GWT so far.

As I noted in my previous blog - Google effectively creates their own JVM in the browser. This results in non-trivial differences for a developer:
  • You have to remember that the code you write has to be compliant with the 1.4 Java spec. This means that although you may write perfectly compiling code using your Eclipse IDE (set to 1.4+ compiler compatibility - after all we're all on Java5 now if not Java6) the GWT compiler will throw errors if you use any of the Java5+ language features
  • Even within Java 1.4 limits, fairly innocuous things like System.arraycopy() are not supported.
  • You lose the ability to use something as useful as Java's built-in logging feature - Eclipse based debugging is all very fine, but we all know that debugging is only useful for the last mile. Logging is the the meat and potatoes of most trouble shooting for most developers and GWT does not give us a good way to do that yet.
These are problems as of now. Google keeps getting better, so I hope to see a lot of this gone pretty soon. But, splitting the spec by calling the libraries Java compatible while having so many issues, reminds me too much of Microsoft's bastardization of Java a few years back. This is a new VM which breaks the Java promise of write once and run anywhere in many ways and that should be made clear right at the outset...

Incidentally none of these are issues for Echo2. Since all the code you develop (aside of course from any custom scripting) is run on the server side - you can use all Java features without any issues.