"org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory" can only happen if you have conflicting dom4j jars in your classpath somewhere. So it's likely you have either multiple versions of this jar in your application, or one in your application and for example one in the server lib folder.
Kris