I had a lot of trouble making this work even with the above instructions, so I'll tell you what worked for me.
You don't need anything in the web.xml file in this case. If you do you'll get a complaint about the malformed url. But your app will still work. It complains bitterly (ie says it won'[t load the app) if that entry is there. But it does load the app just fine.
I messed about with putting my factory into endorsed but it actually works fine sitting in the app. That is good, keeps deployment simpler.
[Message sent by forum member 'mrkimi' (mrkimi)]
http://forums.java.net/jive/thread.jspa?messageID=322544