You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Henrik Eriksson <he...@gmail.com> on 2013/02/02 09:24:56 UTC

Re: Maven compiler fails non-randomly

This issue is still haunting me. The same project could be running on one
machine but run fine on another. Wiped repos, diffrent JDKs, OSs etc. It
fails "randomly" since there are no apparant situation left I can think of
why it should fail. But when it fails it always fails at the same place,
same file, same line when telling javac to be verbose. But only when
building in the same reactor order. Swapping places of modules might work,
and if one use -rf :module to continue the build it compiles. It's so damn
annoying. The whole project build have been building flawlessly without any
problmes. The difference now is that I've added annotation processing.


2013/1/11 Henrik Eriksson <he...@gmail.com>

> Well seems like its not solved. This time I cant trace it to usage of suns
> classes, and the condition is reverse now, building the whole project
> doesn't render in an error but building a part of the reactor with -rf
> renders the below error which builds when building the whole project. Seems
> like the whole build is unstable somehow. Notably is that all this is
> building today.
>
>
> [loading
> ZipFileIndexFileObject[C:\bea12\jdk1.7.0_04_x86\lib\ct.sym(META-INF/sym/rt.jar/java/util/Comparator.class)]]
> An exception has occurred in the compiler (1.7.0_04). Please file a bug at
> the Java Developer Connection (http://java.sun.com/webapps/bugreport)
>  after checking
>  the Bug Parade for duplicates. Include your program and the following
> diagnostic in your report.  Thank you.
> java.lang.IllegalAccessError: tried to access class
> com.sun.tools.javac.code.Kinds$1 from class com.sun.tools.javac.code.Kinds
>         at com.sun.tools.javac.code.Kinds.kindName(Kinds.java:146)
>         at com.sun.tools.javac.comp.Attr.checkMethod(Attr.java:2794)
>         at com.sun.tools.javac.comp.Attr.checkId(Attr.java:2570)
>         at com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:2354)
>         at
> com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1677)
>         at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:431)
>         at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:418)
>         at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:449)
>         at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1514)
>         at
> com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1321)
>         at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:431)
>         at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:418)
>         at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:460)
>         at com.sun.tools.javac.comp.Attr.visitExec(Attr.java:1287)
>         at
> com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1167)
>         at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:431)
>         at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:418)
>         at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:480)
>         at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:496)
>         at com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:911)
>         at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:781)
>         at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:431)
>         at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:418)
>         at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:480)
>         at com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:829)
>         at
> com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:669)
>         at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:431)
>         at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:418)
>         at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:480)
>         at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:3241)
>         at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:3164)
>         at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:3100)
>         at com.sun.tools.javac.comp.Attr.attrib(Attr.java:3074)
>         at
> com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1184)
>         at
> com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:870)
>         at
> com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:829)
>         at com.sun.tools.javac.main.Main.compile(Main.java:439)
>         at
> com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:132)
>         at
> org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:126)
>         at
> org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:170)
>         at
> org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:684)
>         at
> org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:118)
>         at
> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
>         at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
>         at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
>         at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
>         at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
>         at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
>         at
> org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
>         at
> org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
>         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
>         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
>         at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
>         at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
>         at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:601)
>         at
> org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
>         at
> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
>         at
> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
>         at
> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
> [INFO] -------------------------------------------------------------
> [ERROR] COMPILATION ERROR :
> [INFO] -------------------------------------------------------------
> [ERROR] An unknown compilation problem occurred
> [INFO] 1 error
>
> Im going to try switching to another jdk today to see if the same error is
> there.
>
>
> 2013/1/10 Henrik Eriksson <he...@gmail.com>
>
>> No multithread build.
>> Windows 7x64
>> changed to alwaysNew
>> changed to 3.0
>>
>> I isolated it to there's a class using sun.misc.BASE64Decoder() and this
>> reference is failing the build. The other problems are a result of the same
>> issue with properitary usage, but easy to remove. I moved the specific code
>> to a test and it fails when it tries to compile the test. If I compile the
>> module explicit it compiles nicely or restart the reactor build with -rf it
>> builds. I removed the properiatary class and replaced it with apaches. But
>> I still want the propertiary to run with the build in the test since there
>> are alot of things depending on that function and I want the tests to tell
>> me if there's any situation where it fails. The good thing is that now I
>> can clean the code from these mistakes :)
>>
>>
>> 2013/1/10 Olivier Lamy <ol...@apache.org>
>>
>>> with multi thread build -T x ?
>>>
>>> which os ?
>>>
>>> Can you try with changing value of
>>>
>>> http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#compilerReuseStrategy
>>>
>>> to alwaysNew ?
>>>
>>> Do you have same issues using compiler plugin 3.0 ?
>>>
>>>
>>>
>>> 2013/1/10 Henrik Eriksson <he...@gmail.com>:
>>> > Hi all!
>>> > I'm getting a wierd error which I don't understand yet. This is the
>>> > following stacktrace I get from javac:
>>> > [INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @
>>> > warfile-war ---
>>> > [INFO] Compiling 15 source files to C:\XXXX\target\classes
>>> > [INFO] -------------------------------------------------------------
>>> > [ERROR] COMPILATION ERROR :
>>> > [INFO] -------------------------------------------------------------
>>> > [ERROR] Failure executing javac, but could not parse the error:
>>> > An exception has occurred in the compiler (1.7.0_04). Please file a
>>> bug at
>>> > the Java Developer Connection (http://java.sun.com/webapps/bugreport)
>>> >  after checking
>>> >  the Bug Parade for duplicates. Include your program and the following
>>> > diagnostic in your report.  Thank you.
>>> > java.lang.LinkageError: loader constraint violation: loader (instance
>>> of
>>> > sun/misc/Launcher$AppClassLoader) previously initiated loading for a
>>> > different type wit
>>> > h name "com/sun/tools/javac/code/Symbol"
>>> >         at java.lang.ClassLoader.defineClass1(Native Method)
>>> >         at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
>>> >         at
>>> > java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
>>> >         at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
>>> >         at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
>>> >         at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
>>> >         at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
>>> >         at java.security.AccessController.doPrivileged(Native Method)
>>> >         at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
>>> >         at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
>>> >         at
>>> sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
>>> >         at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
>>> >         at com.sun.tools.javac.code.Kinds.kindName(Kinds.java:146)
>>> >         at com.sun.tools.javac.comp.Attr.checkMethod(Attr.java:2794)
>>> >         at com.sun.tools.javac.comp.Attr.checkId(Attr.java:2570)
>>> >         at com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:2354)
>>> >         at
>>> > com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1677)
>>> >         at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:431)
>>> >         at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:418)
>>> >         at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:449)
>>> >         at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1514)
>>> >         at
>>> >
>>> com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1321)
>>> >         at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:431)
>>> >         at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:418)
>>> >         at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:460)
>>> >         at com.sun.tools.javac.comp.Attr.visitExec(Attr.java:1287)
>>> >         at
>>> >
>>> com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1167)
>>> >         at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:431)
>>> >         at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:418)
>>> >         at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:480)
>>> >         at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:496)
>>> >         at com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:911)
>>> >         at
>>> com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:781)
>>> >         at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:431)
>>> >         at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:418)
>>> >         at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:480)
>>> >         at com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:829)
>>> >         at
>>> > com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:669)
>>> >         at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:431)
>>> >         at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:418)
>>> >         at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:480)
>>> >         at
>>> com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:3241)
>>> >         at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:3164)
>>> >         at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:3100)
>>> >         at com.sun.tools.javac.comp.Attr.attrib(Attr.java:3074)
>>> >         at
>>> > com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1184)
>>> >         at
>>> > com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:870)
>>> >         at
>>> > com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:829)
>>> >         at com.sun.tools.javac.main.Main.compile(Main.java:439)
>>> >         at com.sun.tools.javac.main.Main.compile(Main.java:353)
>>> >         at com.sun.tools.javac.main.Main.compile(Main.java:342)
>>> >         at com.sun.tools.javac.main.Main.compile(Main.java:333)
>>> >         at com.sun.tools.javac.Main.compile(Main.java:94)
>>> >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> >         at
>>> >
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>> >         at
>>> >
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>> >         at java.lang.reflect.Method.invoke(Method.java:601)
>>> >         at
>>> >
>>> org.codehaus.plexus.compiler.javac.JavacCompiler.compileInProcess0(JavacCompiler.java:551)
>>> >         at
>>> >
>>> org.codehaus.plexus.compiler.javac.JavacCompiler.compileInProcess(JavacCompiler.java:526)
>>> >         at
>>> >
>>> org.codehaus.plexus.compiler.javac.JavacCompiler.compile(JavacCompiler.java:167)
>>> >         at
>>> >
>>> org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:678)
>>> >         at
>>> > org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:128)
>>> >         at
>>> >
>>> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
>>> >         at
>>> >
>>> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
>>> >         at
>>> >
>>> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
>>> >         at
>>> >
>>> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
>>> >         at
>>> >
>>> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
>>> >         at
>>> >
>>> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
>>> >         at
>>> >
>>> org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
>>> >         at
>>> >
>>> org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
>>> >         at
>>> org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
>>> >         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
>>> >         at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
>>> >         at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
>>> >         at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
>>> >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> >         at
>>> >
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>> >         at
>>> >
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>> >         at java.lang.reflect.Method.invoke(Method.java:601)
>>> >         at
>>> >
>>> org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
>>> >         at
>>> >
>>> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
>>> >         at
>>> >
>>> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
>>> >         at
>>> >
>>> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
>>> >
>>> > [INFO] 1 error
>>> >
>>> > The behaviour is that if I compile this starting a multimodule build I
>>> get
>>> > this error, but building the module explicit it doesn't fail. There's
>>> > another error with an illegalAccessException from javac which sometimes
>>> > occours with maven-processor-plugin and sometimes with
>>> > maven-compiler-plugin. Compiling the module explicit works in that case
>>> > aswell. These erros always occours when I try to build the project but
>>> not
>>> > the individual module.
>>> > Here's the effective pom for the modules and that step:
>>> >     <plugins>
>>> >       <plugin>
>>> >         <artifactId>maven-compiler-plugin</artifactId>
>>> >         <version>2.5.1</version>
>>> >         <executions>
>>> >           <execution>
>>> >             <id>default-testCompile</id>
>>> >             <phase>test-compile</phase>
>>> >             <goals>
>>> >               <goal>testCompile</goal>
>>> >             </goals>
>>> >             <configuration>
>>> >               <source>1.7</source>
>>> >               <target>1.7</target>
>>> >             </configuration>
>>> >           </execution>
>>> >           <execution>
>>> >             <id>default-compile</id>
>>> >             <phase>compile</phase>
>>> >             <goals>
>>> >               <goal>compile</goal>
>>> >             </goals>
>>> >             <configuration>
>>> >               <source>1.7</source>
>>> >               <target>1.7</target>
>>> >             </configuration>
>>> >           </execution>
>>> >           <execution>
>>> >             <id>default-compiler</id>
>>> >             <configuration>
>>> >               <compilerArgument>-proc:none</compilerArgument>
>>> >               <source>1.7</source>
>>> >               <target>1.7</target>
>>> >             </configuration>
>>> >           </execution>
>>> >         </executions>
>>> >         <configuration>
>>> >           <source>1.7</source>
>>> >           <target>1.7</target>
>>> >         </configuration>
>>> >       </plugin>
>>> >       <plugin>
>>> >         <groupId>org.bsc.maven</groupId>
>>> >         <artifactId>maven-processor-plugin</artifactId>
>>> >         <version>2.1.0</version>
>>> >         <executions>
>>> >           <execution>
>>> >             <id>process</id>
>>> >             <phase>process-sources</phase>
>>> >             <goals>
>>> >               <goal>process</goal>
>>> >             </goals>
>>> >           </execution>
>>> >         </executions>
>>> >         <dependencies>
>>> >           <dependency>
>>> >             <groupId>org.hibernate</groupId>
>>> >
>>> > <artifactId>hibernate-validator-annotation-processor</artifactId>
>>> >             <version>4.3.0.Final</version>
>>> >             <scope>compile</scope>
>>> >           </dependency>
>>> >         </dependencies>
>>> >       </plugin>
>>> > Any ideas?
>>> > TIA
>>> > /Henrik
>>>
>>>
>>>
>>> --
>>> Olivier Lamy
>>> Talend: http://coders.talend.com
>>> http://twitter.com/olamy | http://linkedin.com/in/olamy
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>
>

Re: Maven compiler fails non-randomly

Posted by Wayne Fay <wa...@gmail.com>.
> This issue is still haunting me. The same project could be running on one

If you check the 2 stacktraces you've included below, this is an error
being emitted by javac, not Maven. You just happen to see it via Maven
as that is your build tool.

It is a bit of a pain, but can you test compiling with javac from the
command line (passing in the dependencies etc via -cp)? I think you
will discover that is occurs just as it does when compiling with
Maven. I'd offer help with this if it was an open source project.

Once you verify this, follow the directions about the Bug Parade so
this can be fixed in the JDK itself. Maven simply calls out and uses
your system JDK/javac for compiling, so bugs in javac mean that errors
occur when compiling with Maven as well.

Wayne


> > ZipFileIndexFileObject[C:\bea12\jdk1.7.0_04_x86\lib\ct.sym(META-INF/sym/rt.jar/java/util/Comparator.class)]]
> > An exception has occurred in the compiler (1.7.0_04). Please file a bug
> > at
> > the Java Developer Connection (http://java.sun.com/webapps/bugreport)
> >  after checking
> >  the Bug Parade for duplicates. Include your program and the following
> > diagnostic in your report.  Thank you.
> > java.lang.IllegalAccessError: tried to access class
> > com.sun.tools.javac.code.Kinds$1 from class


> >>> > [ERROR] Failure executing javac, but could not parse the error:
> >>> > An exception has occurred in the compiler (1.7.0_04). Please file a
> >>> bug at
> >>> > the Java Developer Connection
> >>> > (http://java.sun.com/webapps/bugreport)
> >>> >  after checking
> >>> >  the Bug Parade for duplicates. Include your program and the
> >>> > following
> >>> > diagnostic in your report.  Thank you.
> >>> > java.lang.LinkageError: loader constraint violation: loader
> >>> > (instance
> >>> of
> >>> > sun/misc/Launcher$AppClassLoader) previously initiated loading for a
> >>> > different type wit
> >>> > h name "com/sun/tools/javac/code/Symbol"
> >>> >         at java.lang.ClassLoader.defineClass1(Native Method)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org