Strange processing problem... solution must be cool:)
Hi,
I've been having a problem with the libraries that are used within
annotation processors. APs are easily compiled but when it comes
to annotation processing I get a NoClassDefFoundError caused by the AnnotationProcessor for any annotation that is used (i.e. if I execute the getAnnotation(javax.ws.WebService.class) method).
As I have debugging on I can see that the search path for classes is correct (there is a javaee.jar). The strange thing is that if I process my own annotations (i.e. @MyOwnWebService) which are in the same directory as the APF and AP everything works fine...
My apt ant task is as followin:
<apt fork="true"
verbose="true"
debug="on"
srcdir="${src.dir}"
destdir="${build.dir}"
factory="my.package.WebServiceAPF"
factorypathref="factory.path"
preprocessdir="${src.dir}">
<classpath refid="classpath.apt"/>
</apt>
The error (for a class that is not an annotation) is as following:
[apt] Problem encountered during annotation processing;
[apt] see stacktrace belowfor more information.
[apt] java.lang.NoClassDefFoundError: freemarker/template/Template
[apt]at wstest.annotations.WebServiceAP.process(Unknown Source)
[apt]at com.sun.mirror.apt.AnnotationProcessors$CompositeAnnotationProcessor.process(AnnotationProcessors.java:60)
[apt]at com.sun.tools.apt.comp.Apt.main(Apt.java:454)
[apt]at com.sun.tools.apt.main.JavaCompiler.compile(JavaCompiler.java:448)
[apt]at com.sun.tools.apt.main.Main.compile(Main.java:1075)
[apt]at com.sun.tools.apt.main.Main.compile(Main.java:938)
[apt]at com.sun.tools.apt.Main.processing(Main.java:95)
[apt]at com.sun.tools.apt.Main.process(Main.java:43)
[apt]at com.sun.tools.apt.Main.main(Main.java:34)
Later (why later?) we can see that:
[apt] [loading C:\MyProject\lib\freemarker.jar(freemarker/template/DefaultObjectWrapper.class)]
[apt] [loading C:\MyProject\lib\freemarker.jar(freemarker/template/Configuration.class)]
[apt] [loading C:\MyProject\lib\freemarker.jar(freemarker/template/Template.class)]
The classpath.apt is as following (all the necessary jars are in there):
<path id="classpath.apt">
<fileset dir="C:\MyProject\lib\" includes="*.jar"/>
</path>
Thank you in advance for any suggestions...
Kind regards,
Maciej Machulak

