[Jigsaw] Getting "Bad service configuration file" error with annotation processor

Alex Buckley alex.buckley at oracle.com
Mon Feb 8 19:30:09 UTC 2016

The NoClassDefFoundError for javax.tools.DiagnosticListener makes me 
suspect that the project's code is in the unnamed module (a.k.a. on the 
classpath) and that no other module has read the java.compiler module 
which exports the javax.tools package. Hence, java.compiler is not in 
the module graph.

java.compiler also exports the javax.annotation.processing package, so 
this would explain the inability to instantiate the service provider 
class -- the service interface type 
javax.annotation.processing.Processor is not visible.

To ensure the java.compiler module is in the module graph, specify 
-addmods java.compiler on the command line.


On 2/8/2016 9:07 AM, Jonathan Gibbons wrote:
> Gunnar,
> cross-posting to jigsaw-dev.
> Can you describe more about the setup of this example?  Is the processor
> in a module with a module declaration with a provides clause for the
> processor, or is it a "pre-Jigsaw"/"JDK8-style" processor with a service
> configuration file in a jar file's META-INF directory?
> If it's "old-style" you should be able to use -processorpath, as before.
> -- Jon
> On 02/08/2016 08:16 AM, Gunnar Morling wrote:
>> Hi,
>> I'm looking into building one of the Hibernate projects, Hibernate
>> Validator, using the Jigsaw-enabled early access build 104.
>> The build uses an annotation processor, which causes the following error:
>>      "Bad service configuration file, or exception thrown while
>> constructing Processor object: javax.annotation.processing.Processor:
>> Provider org.jboss.logging.processor.apt.LoggingToolsProcessor could
>> not be instantiated"
>> The the processor is added via the "-processormodulepath" option.
>> Unfortunately, javac doesn't provide any further context information
>> other than this short error.
>> I tried adding "-verbose" to the javac invocation, but that didn't
>> give me any further information. I also tried to invoke the processor
>> programmatically using the JSR 199 compiler API, but that resulted in
>> a NoClassDefFoundError: javax/tools/DiagnosticListener.
>> The processor works as expected with the non-Jigsaw build 104.
>> Does anyone have an idea of what I could do to to reveal what's the
>> problem here?
>> Thanks,
>> --Gunnar

More information about the compiler-dev mailing list