Adds

Thursday, June 4, 2015

Pesky TypeNotPresentExceptionProxy exception

java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy



While creating an apache cxf client from wsdl I encountered the above exception. It was not easy to figure out what was the problem from the stack trace alone.
After some research I leaned that this exception is caused by annotation with a value that references class that is not in class path.
What that means is that a generated code ( in my case interface) contained something that was not in the class path.
To find out which annotation is causing the problem open your interface class ( if you are having this problem when generating code in apache cxf ) and check all the annotations that have specific reference to class in them. Example would be:
@XmlSeeAlso({org.someorg.ObjectFactory.class,org.someorgOther.SomeClass.class})

Please notice that the reference above is to SomeClass.class and to ObjectFactory.class (so those would be the classes I would check). If your error is at compile time then that class needs to be added to the path. If that is runtime error  (compiled  correctly) then you are most likely not including that in your deployment (but since it compiled, it is in your build path).

I hope this helps someone  if it does please leave me comment!

1 comment: