Hello again,
I was looking this morning for some workaround... I can't solve it yet. When the application is loaded for second time on the application server, the class cast exception appears when list() method is called. It happens in Tomcat too.
Debugging the code, i've evaluated the expression (see first message for code details):
repositorySession.getObject(deploymentId, objectName) instanceof ProcessDefinitionImpl
Obviously, with the first application deploy, the result is true, consequently the cast succeeds. With the second deploy the expression results false, then the cast throw the mentioned exception.
I'll still looking for any solution... I hate this kind of rare errors which always have a simple solution!