<p>for a server based j2ee application, I need to retrieve the number of pages from word documents.. any ideas what works?</p>

If the documents are modern Word 2007 format you can use direct XML-based manipulation, through
OOXML
. This is by far the better long term solution, though I realize it may not be realistic for an entire organization to change overnight.
If they are older Word formats, you're probably stuck with server-side Word/Excel/Powerpoint/Outlook programmable object models, although
you're not supposed to do that on the server
..