Monday, January 18, 2010

Spring DM & Hibernate on RAP: The classloading hell

In the meantime I set up a RAP application with a hibernate backend that will be integrated through spring DM. Since the hibernate libraries are not bundle-ified I went throught the overall known classloading hell. I had trouble with the Spring LocalContainerEntityManagerFactoryBean, that did not find my persistence unit, although I found some different posts suggesting that it should work. I changed

persistenceXmlLocation to classpath:META-INF/persistence.xml

so it looks in my bundle and there it is. With the default setting "classpath*:META-INF..." it simply seemed to find the file, but couldn't find my persistence units. 

Has anyone made the same experiences ?

I'm looking forward to work with the osgi-ified spring services in the app now.

Wednesday, January 13, 2010

Strange behaviour of while on linux

Last night I had I strange fight with java on linux. I tried to unzip a zip archive with with something like

zipEntry = zipStream.getNextEntry();
   // unzip
} // end while

This worked like a charm on windows but on linux the vm left the while loop, although, proveable, zipEntry was not null.

I changed the loop to

while ( (zipEntry=zipStream.getNextEntry()) != null)

and now it works on linux too. I feel completely confused about this behaviour. Maybe I should open a bug, as I can reproduce it with a large zip stream. In the meantime I learned a lot about encoding troubles with zip archives, and that the ant zip task doesn't use but it's own implementation that doesnt encode filenames with UTF-8 on windows like does.

Saturday, January 9, 2010

SSH on Android

Recently I downloaded ConnectBot on my android phone. I now can login to my online server from everywhere I have a mobile network connection. Just for the sake that I have to restart jetty for some strange reasons once again.

Friday, January 1, 2010

My first real RAP application

Over the christmas holidays I found some time to build my first real app with RAP. It took my two days to set up a little webshop, that is bound to our buchmanager backend (its a now commercial app for the german book producer market). As our customers have all relevant information about their products already in our database, I always thought it would be nice to integrate a webshop based on this information. I was completely surprised in how little time I could build this application (took me two days coding, another hard day spent on deploying the app). You can have a look at it on (sorry but it's in german only for now) You can select from different categories and do a text search (has a hibernate search/lucene backend). I didn't spent much time on themeing and reused a theme from the examples with my own logo in it. Once again I was completely surprised how fast I could develop a nice ajax frontend, the backend only needed some extensions to store the orders you can make in the shop. Things I am not so happy with are that I have to run two instances of eclipse most of the time, as our "usual" eclipse RCP client needs a different target platform. I wonder if eclipse could build against multiple target platforms in the same workspace one time. I really had a hard time deploying the application. We have an embedded jetty already present in our backend, so I wanted to build a war file I could simply put on our embedded jetty. But tooling is poor there and the ConigfIniCreator that comes with the example deployment scenario left out org.eclipse.equinox.servletbridge.extensionbundle from the list of bundles to start. The BridgeServlet then gave me a simple 404, digging in the code told me that it couldn't reach its delegate servlet, but gave me no idea about what's missing. Luckily I had an example build of a Hello World app that worked before and there I found the missing entry. To all the RAP engineers, tooling can be improved. I spent a whole day to fix this. But now I have a nice new feature in our book management application. Just waiting for hibernate search 3.2 which promises to make the index dynamically configurable (now its hard coded in annotations). RAP is way cool if you know have to do RCP code, that's my overall conclusion.

Jupyter Kernel for Java9