Uploaded image for project: 'JBoss Modules'
  1. JBoss Modules
  2. MODULES-136

When JBoss Modules are used as a library causes FactoryConfigurationError

XMLWordPrintable

      Issue was original about use of jboss modules in Eclipse via m2e-apt/jboss logging but is also causing problems for forge and arquillian.

      Original:
      JBDS 5.5.0.CR1 embeds m2e-apt, which automatically enables Eclipse JDT Annotation Processor Toolkit.
      When importing the server module from http://github.com/jbossas/jboss-as.git (also happens for other modules), Eclipse starts crashing (see JBIDE-12087) with errors like :

      javax.xml.parsers.FactoryConfigurationError: Provider __redirected.__DocumentBuilderFactory not found
      	at javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:127)
      	at org.eclipse.jdt.apt.core.internal.util.FactoryPathUtil.decodeFactoryPath(FactoryPathUtil.java:222)
      	at org.eclipse.jdt.apt.core.internal.util.FactoryPathUtil.readFactoryPathFile(FactoryPathUtil.java:115)
      	at org.eclipse.jdt.apt.core.internal.util.FactoryPathUtil.calculatePath(FactoryPathUtil.java:342)
      	at org.eclipse.jdt.apt.core.internal.util.FactoryPathUtil.getFactoryPath(FactoryPathUtil.java:429)
      	at org.eclipse.jdt.apt.core.internal.AnnotationProcessorFactoryLoader.getJava6FactoriesAndAttributesForProject(AnnotationProcessorFactoryLoader.java:420)
      	at org.eclipse.jdt.internal.apt.pluggable.core.dispatch.IdeAnnotationProcessorManager.processAnnotations(IdeAnnotationProcessorManager.java:130)
      	at org.eclipse.jdt.internal.compiler.Compiler.processAnnotations(Compiler.java:813)
      	at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:432)
      	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:364)
      	at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.compile(BatchImageBuilder.java:178)
      	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:301)
      	at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.build(BatchImageBuilder.java:60)
      	at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildAll(JavaBuilder.java:254)
      	at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:173)
      	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
      	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
      	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
      	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
      	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
      	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
      	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
      	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
      	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
      	at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
      	at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
      	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
      Caused by: java.lang.ClassNotFoundException: __redirected/__DocumentBuilderFactory
      	at java.lang.Class.forName0(Native Method)
      	at java.lang.Class.forName(Class.java:264)
      	at javax.xml.parsers.FactoryFinder.getProviderClass(FactoryFinder.java:119)
      	at javax.xml.parsers.FactoryFinder.newInstance(FactoryFinder.java:144)
      	at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:185)
      	at javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:121)
      

      It turns out the Eclipse System Properties have been changed to use javax.xml.parsers.SAXParserFactory=_redirected/_DocumentBuilderFactory

      I tracked the code responsible with messing with the properties :

      Thread [Worker-24] (Suspended (breakpoint at line 779 in System))	
      System.setProperty(String, String) line: 779	
      __SAXParserFactory.<clinit>() line: 68	
      __JAXPRedirected.initAll() line: 80	
      Module$1.run() line: 126	
      Module$1.run() line: 113	
      AccessController.doPrivileged(PrivilegedAction<T>) line: not available [native method]	
      Module.<clinit>() line: 113	
      Class<T>.forName0(String, boolean, ClassLoader) line: not available [native method]	
      Class<T>.forName(String) line: 186	<====== org.jboss.modules.Module
      JCodeModel.ref(String) line: 363	
      MessageBundleImplementor(ImplementationClassModel).createBundleMethod(MessageMethod, JMethod, JMethod, JVar) line: 150	
      MessageBundleImplementor.generateModel() line: 86	
      MessageBundleImplementor(ClassModel).create(JavaFileObject) line: 104	
      ImplementationClassGenerator.processTypeElement(TypeElement, TypeElement, MessageInterface) line: 63	
      LoggingToolsProcessor.process(Set<TypeElement>, RoundEnvironment) line: 155	
      RoundDispatcher.handleProcessor(ProcessorInfo) line: 139	
      RoundDispatcher.round() line: 121	
      IdeAnnotationProcessorManager(BaseAnnotationProcessorManager).processAnnotations(CompilationUnitDeclaration[], ReferenceBinding[], boolean) line: 159	
      IdeAnnotationProcessorManager.processAnnotations(CompilationUnitDeclaration[], ReferenceBinding[], boolean) line: 134	
      Compiler.processAnnotations() line: 813	
      Compiler.compile(ICompilationUnit[]) line: 432	
      BatchImageBuilder(AbstractImageBuilder).compile(SourceFile[], SourceFile[], boolean) line: 364	
      BatchImageBuilder.compile(SourceFile[], SourceFile[], boolean) line: 178	
      BatchImageBuilder(AbstractImageBuilder).compile(SourceFile[]) line: 301	
      BatchImageBuilder.build() line: 60	
      JavaBuilder.buildAll() line: 254	
      JavaBuilder.build(int, Map, IProgressMonitor) line: 173	
      BuildManager$2.run() line: 728	
      SafeRunner.run(ISafeRunnable) line: 42	
      BuildManager.basicBuild(int, IncrementalProjectBuilder, Map<String,String>, MultiStatus, IProgressMonitor) line: 199	
      BuildManager.basicBuild(IBuildConfiguration, int, IBuildContext, ICommand[], MultiStatus, IProgressMonitor) line: 239	
      BuildManager$1.run() line: 292	
      SafeRunner.run(ISafeRunnable) line: 42	
      BuildManager.basicBuild(IBuildConfiguration, int, IBuildContext, MultiStatus, IProgressMonitor) line: 295	
      BuildManager.basicBuildLoop(IBuildConfiguration[], IBuildConfiguration[], int, MultiStatus, IProgressMonitor) line: 351	
      BuildManager.build(IBuildConfiguration[], IBuildConfiguration[], int, IProgressMonitor) line: 374	
      AutoBuildJob.doBuild(IProgressMonitor) line: 143	
      AutoBuildJob.run(IProgressMonitor) line: 241	
      Worker.run() line: 54	
      

      That stacktrace represents the processing of https://github.com/jbossas/jboss-as/blob/master/server/src/main/java/org/jboss/as/server/ServerMessages.java#L507

      So basically, whenever a Logger has a dependency to the org.jboss.modules.Module class, stuff starts hitting the fan.

      Ideally we should process the classes in an isolated way, so that doesn't break IDE embdeding.

      Currently, JBoss AS source code can only be used in JBDS if m2e-apt is disabled (Preferences > Maven > Annotation Processing).

            dlloyd@redhat.com David Lloyd
            fbricon@redhat.com Fred Bricon
            Votes:
            3 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: