Websphere, Domino and Java insights
When you are a LotusScript buff and make your first baby steps in Java and Domino, there are a few things quite different. Working on DominoWebDAV I learned a few lessons I'd like to share:
- Get yourself a copy of this. It is still the best transition from your sound knowledge of Lotus Script Domino Objects to Java Domino Objects
- Domino comes with an entitlement of a Websphere server, so this can be a good starting point. One caveat: Websphere likes to have EAR files for application deployments. When you start off with a simple servlet or JSP, it is most likely, that you just have a WAR file. When deploying a war file Websphere wants to know the application context (Tomcat on the other hand simply uses the WAR file name as context, easier but less flexible). When you enter "myapp" it won't work. You have to enter "/myapp/"
- When linking Websphere to Domino for authentication (a topic for another Thursday). Websphere by default activates J2EE security. This is a good thing for applications deployed in production, but a nightmare for a Java novice. So when you tick the security icon, untick the J2EE security icon below (in your development environment only of course)
- Before you get started with servlets, you might want to test your Java skills on an agent first. While the build in IDE is OK, editing Java in Eclipse is much more fun. To edit Java agents there, you can use the Domiclipse plugin.
- Not sure about Java itself? There is an excellent Java learning IDE called BlueJ. And there are the outstanding Head First books about Java, Servlets, EJB and Patterns.
- There are also plenty of places where you can get Java help and insights. My favourite places are Javaranch, Java Coffee Break and Jakarta.
- When looking at a specific problem to solve, check the Jakarta Commons before you start coding. There a lot of problems have been solved for you. For example there is a complete HTTP client, that handles authentication, cookies, html parsing or encryption for you.
- When you are done with a Domino object in Java, call its recycle() method. Otherwise you create a army of Zombie C objects that eat all your memory. Of course you need to be careful of the sequence. If you recycle a database object, you can't access the documents in there any more, even if you have a Java object pointing to one
- Have a look at session.resolve(url). This session method allows you to take a notes URL (notes://....) and resolve it directly to a database, view or document. That's a very nice shortcut thru the object hierarchy.