Xerces and Classloaders

18 02 2009

It can be hard to work out what happens with Xerces and classloaders. Its a common cause of ClassCastExceptions. Often cause by the the java class loading one class from some parent classloader and then the ParserFactories loading from the context classloader, the result is a ClassCastException even though the classes are the same.

There are some tricks that can help -Djaxp.debug=1  will get xerces to print out messages telling where the classes were loaded from, which will give you some idea if things are going correctly.

In the case of K2, because we manage the classloaders, Unit test harnesses will load the unit test classes inside the base classloader, whereas the context classloader may be the component classloader that is current when the parsers are invoked.

I think there are 2 ways in which this could be addressed. We could create an isolated classloader that is used for running test, so that classes in the test are loaded into a component classloader.

Or we could allow developers to specifiy if a jar is ignore by the compnent managers for the purposes of running tests.

The former is more correct, the latter is easier, no decision at the moment, but I need to try both approaches.





JCR SQL Queries

5 02 2009

Care needs to be taken

SELECT *  FROM nt:base  WHERE jcr:path LIKE '/userenv/%'

works, but

SELECT *  FROM nt:base  WHERE jcr:path LIKE '/userenv%'

does not.





K2 Search

2 02 2009

Search is all inside Jackrabbit inside K2, there is no search service and no managing segments. It supports all standard documents that you might encounter, and the lag between update and search is generally < 100ms. This is not really any surprise  since the Query mechanism inside Jackrabbit depends on search. This means we can do relational queries using the search engine without hitting the DB at all…. just a bit more scalable.





K2 Memory Usage

2 02 2009

33MB Perm Space, 11MB Heap after startup, thats with most of the functionallity to support the UX project.

See attached from yourkit of the startup,

picture-3-300x288