I wrote a save method with the following signature: saveMyObject(String, Integer, Integer), in both the service and DAO layers. When trying to execute the save method, I got the following error:
java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
It is because org.openmrs.aop.RequiredDataAdvice is trying to cast the second argument (in my case an Integer) as a String because the save method is assumed to be intended to have this alternate format. There is no try/catch around this call, and there is really no need for it if this kind of save or create method should be allowed. Ben provided me with the attached (patch) solution, even though I also changed my code to addMyObject() so I could avoid the advisor.