I’ve been focusing a lot lately on how to install P8 with CPIT. Mostly because this is easier, faster, and usually more convenient, but it has inconveniences as well. Installing all components separatly has a few benefits and I thought it was time to write how to do that:
- Install different versions of the components
- Install Fix Packs during install
- Use different technologies
- Split components on different servers
- Use pre-installed components (LDAP, DB, …)
- Optimize install size by deleting binaries after each install
- And for curious people, understand better what’s going on 🙂
This will be a long post, but I’ll try to split this step by step and explain precisely what is going on. At the end of this post, I will give the full script you can run to install a full platform. Unlike the CPIT installer, I’ve tried to keep everything in one script to ease distribution, installation and customization. That’s why you will see a lot of HERE-doc commands to create files on-the-go. At this moment I’m using only one dependency, which is a file from the CPIT installer: cpt-actions.jar. This is the java tool allowing us to create the default domain and object store. This is quite basic to implement using the Java API so I hope to write soon how to rewrite this tool so we can get rid of all dependency on CPIT.
Here is how to upgrade P8 FileNet Platform 5.2.1 to 5.2.1 FP5 silently. This upgrades both the server and the client.
You need FileNet 5.2.1 to upgrade to 5.2.1 FP 5. Here is a way to install FileNet 5.2.1.
You can execute this in the same directory you copied 220.127.116.11-P8CPE-LINUX-FP005.tar.gz and 18.104.22.168-P8CPE-CLIENT-LINUX-FP005.tar.gz.
Here is the new and up-to-date version of the Install FileNet P8 series, replacing the old one (5.2). What is mainly new, compare to CPIT 5.2:
- Tivoli Directory Server 6.3 FP24
- GSKit 22.214.171.124
- FileNet Content Platform Engine 5.2.1
- WebSphere Application Server 8.5.5
- IBM Content Navigator 2.0.3
- Installation Manager 1.6.2
- There are now two WAS nodes, one for FileNet and one for ICN
- IBM DB2 9.7 Fix Pack 8/li>
Last version was Install FileNet P8. This post is intended to help you to use the CPIT installer to install a fully functional FileNet P8 on a single server. We will see what you need to run and how to proceed. As nice as it sounds, errors are frequent so we will try to isolate all errors and see how to fix them.
This is weird, but most of the errors from the CPIT 5.1 are still present in the version 5.2.1… The only one actually fixed is the creation of the setDB2port which is not needed anymore.
Here is a quick summary of how to upgrade to FileNet 5.2.1. As usual, before starting, snapshot/backup your server. Here are the main steps for a single server platform installed with the CPIT installer and where the application server has not been upgraded. If it has been or you platform is different, check the knowledge center but procedure should be mostly the same and you can use this to help you.
When programming with P8, one recurrent task is counting how many results a query has.
There are a few options to do this, none of them being
count(*) and I’ll explain why. The purpose of this post is to expose them and compare their execution time and limitations with benchmarks. We will also see how to optimize each of them separately. Hopefully, after reading this post, you will be able to choose which one best fits your needs. Before introducing all options IBM made available to us, a little introduction important to understand this post and its benchmarks.
When counting, it may be strange, but it is a lot better to expect something. Or if you can’t, at least have a limit over which the result doesn’t really matter, you are happy enough knowing it is more than this limit. Actually in most case that’s enough. For UI you would say over something, to forbid an operation you usually have a limit over which you will forbid it anyway, and so on. Of course, if you want the exact number of item, it can be done but it will be a lot slower.
Benchmarks will be counting the number of documents in a 5/4/10 folder hierarchy, meaning 5 level of sub-folders, each level with 4 sub-folders and 10 documents. This is about 55,000 documents in 5,500 folders. And we don’t always want to count exactly, in the benchmarks we will ask if there is more than 5, 10, 15,50 … until 40,000 documents. Because sometimes knowing than there is more than 50 documents is enough to forbid an operation.
Now let’s introduce the few options we have to count.
After a CPIT installation, you will still have to create an Object Store in order to have a fully functional platform. Luckily, when using the CPIT installer, IBM already provides the database and datasources for one more Object Store, They also pre-set the database connection in the Administrative Console for Content Engine (ACCE). So the procedure is really easy, we only have to create the Object Store using the pre-set database connection.
Here are the procedure in pictures:
I was reading a few posts on ecmplace today and I saw that some persons are struggling with starting and stopping the FileNet platform after they got their CPIT installation done. So here are two scripts to start and stop all components. They start in order (and stop in reverse order) the following components:
- The DBMS DB2
- The LDAP Tivoli Directory Server (admin server then instance)
- The Application Server WebSphere Application Server (hosting the Platform Engine and possibly IBM Content Navigator or any client application)
To start the platform (I include the iptables config but if you saved it once for all you don’t need those lines):
iptables -I INPUT 4 -i eth0 -p tcp --dport 9080 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -I INPUT 4 -i eth0 -p tcp --dport 9043 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -I INPUT 4 -i eth0 -p tcp --dport 2809 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -I INPUT 4 -i eth0 -p tcp --dport 9100 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -I INPUT 4 -i eth0 -p tcp --dport 9403 -m state --state NEW,ESTABLISHED -j ACCEPT
su - dsrdbm01 -c db2start
# TDS admin server
/opt/ibm/ldap/V6.3/sbin/idsdiradm -I dsrdbm01
# TDS instance
/opt/ibm/ldap/V6.3/sbin/ibmslapd -n -I dsrdbm01
To stop the platform:
/opt/ibm/WebSphere/AppServer/bin/stopServer.sh server1 -username P8Admin -password PASSWORD
# TDS instance
/opt/ibm/ldap/V6.3/sbin/ibmslapd -I dsrdbm01 -k
# TDS admin server
/opt/ibm/ldap/V6.3/sbin/idsdiradm -I dsrdbm01 -k
su - dsrdbm01 -c db2stop
Hopefully it will help someone.
If like me, you are a really clumsy person, you may delete the entire Object Store on a stupid mistake. Don’t laugh, it happened to me. I was working with the FEM and I clicked without reading twice :). From the FileNet knowledge center, this is supposed to be an irreversible action. The truth is it’s not, thanks god because i could have been in real trouble! So if you don’t have snapshot of the platform before, or your backup is hard to restore, or you will loose to much data since the last backup, here is another solution.
This is a really nice trick to recover a deleted object store really easily. It can save you a lot of troubles too. It is really well explained in the link, but here is the procedure summarized.
Actually the deletion of an object store is an update like every other updates, therefore it can be undone by updating the FNGCD table of the GCD database, which store the last 100 updates. You just have to set he last_epoch_id of the line with the id 0, to the the value of the update before the deletion.
I have to thank so much my colleague for finding and then sharing this trick with me!
To write true unit test, and make sure your FileNet developments do not rely on FileNet for unit test, one solution is using PowerMock, because it allows to mock the static methods from FileNet, that we are using a lot since there are quite usual in the FileNet Java API, for example all the fetInstance and getInstance of the Factory objects, when creating Batches and so on.
How to set up PowerMock for your project
If you are not using any project management software to manage your dependencies like Maven, you’ll have to download the PowerMockito dependencies on the PowerMock website.
PowerMockito can work with both Mockito and EasyMock, you can use which one you are familiar with. If you are not familiar with any of them, I would recommend Mockito. I prefer the Mockito syntax, I think it makes test easier to understand and maintain. You only have to take the zip for what you want to do, in our case the powermock-mockito-junit zip.
Then add all zip to your classpath and you are good to go.
Unit test has to keep its unit, even with FileNet
In Unit Test, there is Unit, and people tends to forget that when writing tests with FileNet. That means your test should not rely on anything else than itself, especially not FileNet. Because then what happens? Your tests fail because the platform is down, the test user credentials changed or a network error occurred, and after a while you’ stop noticing the error, thinking “that’s the platform again, but the method’s fine”, or worst, you end up disabling test on your build, because they are becoming a liability more than a help.
Well, this is not how unit test work, I guess you already know that but still. A unit test has to be perfectly reliable, that’s means if your method produce the right outcome, the test should always pass, no matter what, if the test fail, there is something wrong with the method, and you MUST take a look at what’s wrong, not ignore the failure. If you write true unit test, this should be true and you can enable test in the build, and trust failures as real defects.
I’ll write in another post how to set up PowerMock, and some examples so this one does not become to long.
How to make FileNet development not rely on FileNet