Skip Spot Bugs stack traces when features require ASM8_EXPERIMENTAL - java

I'm using spotbugs-maven-plugin 4.0.0 (+ spotbugs 4.0.2 dependency).
The problem is that it cannot recognize Java 14 records.
Every time when it finds a record or a class that uses that record, it prints a long stacktrace.
[INFO] >>> spotbugs-maven-plugin:4.0.0:check (default) > :spotbugs # core >>>
[INFO]
[INFO] --- spotbugs-maven-plugin:4.0.0:spotbugs (spotbugs) # core ---
[INFO] Fork Value is true
[java] The following errors occurred during analysis:
[java] Unable to get XClass for com/something/MyRecord
[java] java.lang.UnsupportedOperationException: This feature requires ASM8_EXPERIMENTAL
[java] At org.objectweb.asm.ClassVisitor.visitRecordComponentExperimental(ClassVisitor.java:304)
[java] At org.objectweb.asm.ClassReader.readRecordComponent(ClassReader.java:929)
[java] At org.objectweb.asm.ClassReader.accept(ClassReader.java:704)
[java] At edu.umd.cs.findbugs.asm.FBClassReader.accept(FBClassReader.java:44)
[java] At org.objectweb.asm.ClassReader.accept(ClassReader.java:401)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassParserUsingASM.parse(ClassParserUsingASM.java:552)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassParserUsingASM.parse(ClassParserUsingASM.java:736)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:79)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:38)
[java] At edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getClassAnalysis(AnalysisCache.java:261)
[java] At edu.umd.cs.findbugs.ba.XFactory.getXClass(XFactory.java:685)
[java] At edu.umd.cs.findbugs.ba.AnalysisContext.setAppClassList(AnalysisContext.java:975)
[java] At edu.umd.cs.findbugs.FindBugs2.setAppClassList(FindBugs2.java:909)
[java] At edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:252)
[java] At edu.umd.cs.findbugs.FindBugs.runMain(FindBugs.java:395)
[java] At edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1231)
[java] Couldn't get class info for com/something/MyRecord
[java] java.lang.UnsupportedOperationException: This feature requires ASM8_EXPERIMENTAL
[java] At org.objectweb.asm.ClassVisitor.visitRecordComponentExperimental(ClassVisitor.java:304)
[java] At org.objectweb.asm.ClassReader.readRecordComponent(ClassReader.java:929)
[java] At org.objectweb.asm.ClassReader.accept(ClassReader.java:704)
[java] At edu.umd.cs.findbugs.asm.FBClassReader.accept(FBClassReader.java:44)
[java] At org.objectweb.asm.ClassReader.accept(ClassReader.java:401)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassParserUsingASM.parse(ClassParserUsingASM.java:552)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassParserUsingASM.parse(ClassParserUsingASM.java:736)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:79)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:38)
[java] At edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getClassAnalysis(AnalysisCache.java:261)
[java] At edu.umd.cs.findbugs.ba.XFactory.getXClass(XFactory.java:685)
[java] At edu.umd.cs.findbugs.ba.AnalysisContext.setAppClassList(AnalysisContext.java:975)
[java] At edu.umd.cs.findbugs.FindBugs2.setAppClassList(FindBugs2.java:909)
[java] At edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:252)
[java] At edu.umd.cs.findbugs.FindBugs.runMain(FindBugs.java:395)
[java] At edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1231)
[java] Exception analyzing com.something.MyClassThatUsesMyRecord using detector edu.umd.cs.findbugs.detect.CalledMethods
[java] java.lang.UnsupportedOperationException: This feature requires ASM8_EXPERIMENTAL
[java] At org.objectweb.asm.ClassVisitor.visitRecordComponentExperimental(ClassVisitor.java:304)
[java] At org.objectweb.asm.ClassReader.readRecordComponent(ClassReader.java:929)
[java] At org.objectweb.asm.ClassReader.accept(ClassReader.java:704)
[java] At edu.umd.cs.findbugs.asm.FBClassReader.accept(FBClassReader.java:44)
[java] At org.objectweb.asm.ClassReader.accept(ClassReader.java:401)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassParserUsingASM.parse(ClassParserUsingASM.java:552)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassParserUsingASM.parse(ClassParserUsingASM.java:736)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:79)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:38)
[java] At edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getClassAnalysis(AnalysisCache.java:261)
[java] At edu.umd.cs.findbugs.ba.XFactory.getXClass(XFactory.java:685)
[java] At edu.umd.cs.findbugs.ba.AnalysisContext.setAppClassList(AnalysisContext.java:975)
[java] At edu.umd.cs.findbugs.FindBugs2.setAppClassList(FindBugs2.java:909)
[java] At edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:252)
[java] At edu.umd.cs.findbugs.FindBugs.runMain(FindBugs.java:395)
[java] At edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1231)
...
[INFO] Done SpotBugs Analysis....
How can I get rid of these detailed exceptions?

Though the plugin's latest release read the support through JDK-15, the ASM support for preview features require 8.0+ version while the library is still on 7.3.1.
That said, the changes to their deployable branch should fix this. Specifically the difference in:
- <asm.version>7.3.1</asm.version>
+ <asm.version>8.0.1</asm.version>
So just wait for the next version while requesting them to release soon. :)

Related

ClassCastException for class implementing class from another jar

I'm getting the below exception when attempting to run the class org.apache.tools.ant.launch.Launcher which comes as part of the ant launcher jar :
testTask: [java] Working directory ignored when same JVM is used.
[java] Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre1.8.0_141\lib\tools.jar
[java] java.lang.ClassCastException: org.apache.tools.ant.Main cannot be cast to org.apache.tools.ant.launch.AntMain
[java] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:256)
[java] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[java] at java.lang.reflect.Method.invoke(Unknown Source)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:217)
[java] at java.lang.Thread.run(Unknown Source)
This is the ant target I'm running:
<target name="testTask">
<java classname="org.apache.tools.ant.launch.Launcher" failonerror="true" jvm="C:/jdk1.8.0_141-x64/bin/java" dir=".">
<classpath>
<pathelement location="ant-launcher-1.7.0.jar"/>
<pathelement location="ant-1.7.0.jar"/>
</classpath>
</java>
</target>
and if you look inside ant-1.7.0.jar inside the classpath, you will find that org.apache.tools.ant.Main in fact implements org.apache.tools.ant.launch.AntMain:
and inside ant-launcher-1.7.0.jar, org.apache.tools.ant.launch.AntMain exists exactly under the package we're looking for:
Also I made sure that org.apache.tools.ant.Main overrides the method startAnt(String[] paramArrayOfString, Properties paramProperties, ClassLoader paramClassLoader) and takes the same arguments.
The line causing this exception is:
mainClass = Class.forName("org.apache.tools.ant.Main");
AntMain main = (AntMain)mainClass.newInstance();
worth noting that if I create the exact same class as org.apache.tools.ant.Main but rename it and place it on its own (outside of any .jar package), and run the above snippet but using the name of the new class it works perfectly fine.
Why is java insisting that org.apache.tools.ant.Main cannot be cast to org.apache.tools.ant.launch.AntMain ?

JavaFX + java 7 and Maven-2.2.1 Downloading Error

I am building my project using Apache Maven-2.2.1.
Earlier I run maven steps it download maven repository successfully. Then I was using jdk1.6.0_10, my JAVA_HOME environment variable have same entry of jdk1.6.0_10.
Now I have updated my Java version from 6 to 7, building application in JavaFX using jdk1.7.0_09, so I have set my JAVAFX_HOME pointing jdk1.7.0_09, but JAVA_HOME still points to jdk1.6.0_10. This time maven is downloading successully, giving me following error on build -
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Internal error in the plugin manager executing goal 'com.sun.enterprise:osgiversion-maven-plugin:0.4.11:compute-osgi-version': Unable to load the mojo 'com.sun.enterprise:osgiversion-maven-plugin:0.4.11:compute-osgi-version' in the plugin 'com.sun.enterprise:osgiversion-maven-plugin'. A required class is missing: Lorg/apache/maven/shared/osgi/Maven2OsgiConverter;
org.apache.maven.shared.osgi.Maven2OsgiConverter
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Internal error in the plugin manager executing goal 'com.sun.enterprise:osgiversion-maven-plugin:0.4.11:compute-osgi-version': Unable to load the mojo 'com.sun.enterprise:osgiversion-maven-plugin:0.4.11:compute-osgi-version' in the plugin 'com.sun.enterprise:osgiversion-maven-plugin'. A required class is missing: Lorg/apache/maven/shared/osgi/Maven2OsgiConverter;
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:698)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.PluginManagerException: Unable to load the mojo 'com.sun.enterprise:osgiversion-maven-plugin:0.4.11:compute-osgi-version' in the plugin 'com.sun.enterprise:osgiversion-maven-plugin'. A required class is missing: Lorg/apache/maven/shared/osgi/Maven2OsgiConverter;
at org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(DefaultPluginManager.java:679)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:468)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
... 17 more
Caused by: java.lang.NoClassDefFoundError: Lorg/apache/maven/shared/osgi/Maven2OsgiConverter;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2291)
at java.lang.Class.getDeclaredField(Class.java:1880)
at hidden.org.codehaus.plexus.util.ReflectionUtils.getFieldByNameIncludingSuperclasses(ReflectionUtils.java:47)
at org.codehaus.plexus.component.composition.FieldComponentComposer.getFieldByName(FieldComponentComposer.java:212)
at org.codehaus.plexus.component.composition.FieldComponentComposer.findMatchingField(FieldComponentComposer.java:171)
at org.codehaus.plexus.component.composition.FieldComponentComposer.assembleComponent(FieldComponentComposer.java:62)
at org.codehaus.plexus.component.composition.DefaultComponentComposerManager.assembleComponent(DefaultComponentComposerManager.java:68)
at org.codehaus.plexus.DefaultPlexusContainer.composeComponent(DefaultPlexusContainer.java:1486)
at org.codehaus.plexus.personality.plexus.lifecycle.phase.CompositionPhase.execute(CompositionPhase.java:29)
at org.codehaus.plexus.lifecycle.AbstractLifecycleHandler.start(AbstractLifecycleHandler.java:101)
at org.codehaus.plexus.component.manager.AbstractComponentManager.startComponentLifecycle(AbstractComponentManager.java:105)
at org.codehaus.plexus.component.manager.AbstractComponentManager.createComponentInstance(AbstractComponentManager.java:95)
at org.codehaus.plexus.component.manager.PerLookupComponentManager.getComponent(PerLookupComponentManager.java:48)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:331)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:440)
at org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(DefaultPluginManager.java:652)
... 19 more
Caused by: java.lang.ClassNotFoundException: org.apache.maven.shared.osgi.Maven2OsgiConverter
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:195)
at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:255)
at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:274)
at org.codehaus.classworlds.RealmClassLoader.loadClass(RealmClassLoader.java:214)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
... 36 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 29 minutes 36 seconds
[INFO] Finished at: Fri Dec 21 13:07:49 IST 2012
[INFO] Final Memory: 13M/23M
[INFO] ------------------------------------------------------------------------
Is this an issue of Java or any changes have been done in Maven-2.2.1 version. I downloaded this version of maven and compared with old but no changes found. Can anyone sort out this issue?
I have tried to download Maven-3.0.3 (also tried Maven-2.2.1 but getting same above error) with JAVA_HOME to jdk1.7.0_09, I have clarify the usage of JAVAFX_HOME, it is not used for maven downloading. Still I am getting same issues, exception of downloading Maven-3.0.3 is -
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Internal error in the plugin manager executing goal 'com.sun.enterprise:osgiversion-maven-plugin:0.4.11:compute-osgi-version': Unable to load the mojo 'com.sun.enterprise:osgiversion-maven-plugin:0.4.11:compute-osgi-version' in the plugin 'com.sun.enterprise:osgiversion-maven-plugin'. A required class is missing: Lorg/apache/maven/shared/osgi/Maven2OsgiConverter;
org.apache.maven.shared.osgi.Maven2OsgiConverter
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Internal error in the plugin manager executing goal 'com.sun.enterprise:osgiversion-maven-plugin:0.4.11:compute-osgi-version': Unable to load the mojo 'com.sun.enterprise:osgiversion-maven-plugin:0.4.11:compute-osgi-version' in the plugin 'com.sun.enterprise:osgiversion-maven-plugin'. A required class is missing: Lorg/apache/maven/shared/osgi/Maven2OsgiConverter;
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:698)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
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.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.PluginManagerException: Unable to load the mojo 'com.sun.enterprise:osgiversion-maven-plugin:0.4.11:compute-osgi-version' in the plugin 'com.sun.enterprise:osgiversion-maven-plugin'. A required class is missing: Lorg/apache/maven/shared/osgi/Maven2OsgiConverter;
at org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(DefaultPluginManager.java:679)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:468)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
... 17 more
Caused by: java.lang.NoClassDefFoundError: Lorg/apache/maven/shared/osgi/Maven2OsgiConverter;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2308)
at java.lang.Class.getDeclaredField(Class.java:1897)
at hidden.org.codehaus.plexus.util.ReflectionUtils.getFieldByNameIncludingSuperclasses(ReflectionUtils.java:47)
at org.codehaus.plexus.component.composition.FieldComponentComposer.getFieldByName(FieldComponentComposer.java:212)
at org.codehaus.plexus.component.composition.FieldComponentComposer.findMatchingField(FieldComponentComposer.java:171)
at org.codehaus.plexus.component.composition.FieldComponentComposer.assembleComponent(FieldComponentComposer.java:62)
at org.codehaus.plexus.component.composition.DefaultComponentComposerManager.assembleComponent(DefaultComponentComposerManager.java:68)
at org.codehaus.plexus.DefaultPlexusContainer.composeComponent(DefaultPlexusContainer.java:1486)
at org.codehaus.plexus.personality.plexus.lifecycle.phase.CompositionPhase.execute(CompositionPhase.java:29)
at org.codehaus.plexus.lifecycle.AbstractLifecycleHandler.start(AbstractLifecycleHandler.java:101)
at org.codehaus.plexus.component.manager.AbstractComponentManager.startComponentLifecycle(AbstractComponentManager.java:105)
at org.codehaus.plexus.component.manager.AbstractComponentManager.createComponentInstance(AbstractComponentManager.java:95)
at org.codehaus.plexus.component.manager.PerLookupComponentManager.getComponent(PerLookupComponentManager.java:48)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:331)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:440)
at org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(DefaultPluginManager.java:652)
... 19 more
Caused by: java.lang.ClassNotFoundException: org.apache.maven.shared.osgi.Maven2OsgiConverter
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
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 org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:195)
at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:255)
at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:274)
at org.codehaus.classworlds.RealmClassLoader.loadClass(RealmClassLoader.java:214)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 36 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 19 minutes 30 seconds
[INFO] Finished at: Fri Dec 21 19:13:39 IST 2012
[INFO] Final Memory: 15M/63M
[INFO] ------------------------------------------------------------------------
How to fix those errors?
Thanks!

Dojo 1.7 Build: Out of Memory Errors

After upgrading to Dojo 1.7.3, our ant build that was working flawlessly for years on previous versions of Dojo is now completely non-operational due to out of memory errors:
[java] starting writing resources...
[java] java.lang.OutOfMemoryError: GC overhead limit exceeded
[java] at org.mozilla.javascript.Interpreter.getArgsArray(Interpreter.java:4623)
[java] at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3335)
[java] at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2484)
[java] at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
[java] at org.mozilla.javascript.NativeArray.iterativeMethod(NativeArray.java:1565)
[java] at org.mozilla.javascript.NativeArray.execIdCall(NativeArray.java:313)
[java] at org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:127)
[java] at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3335)
[java] at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2484)
[java] at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
[java] at org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2347)
[java] at org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:272)
[java] at org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:127)
[java] at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:76)
[java] at org.mozilla.javascript.gen.c1._c62(Unknown Source)
[java] at org.mozilla.javascript.gen.c1.call(Unknown Source)
[java] at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:97)
[java] at org.mozilla.javascript.gen.c1._c69(Unknown Source)
[java] at org.mozilla.javascript.gen.c1.call(Unknown Source)
[java] at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:97)
[java] at org.mozilla.javascript.gen.c1._c40(Unknown Source)
[java] at org.mozilla.javascript.gen.c1.call(Unknown Source)
[java] at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:97)
[java] at org.mozilla.javascript.gen.c1._c42(Unknown Source)
[java] at org.mozilla.javascript.gen.c1.call(Unknown Source)
[java] at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3335)
[java] at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2484)
[java] at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
[java] at org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2347)
[java] at org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:272)
[java] at org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:127)
[java] at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:76)
[java] js: exception from uncaught JavaScript throw: java.lang.OutOfMemoryError: GC overhead limit exceeded
I have extensively documented our troubles here.
In particular, where I note:
If I run my build straight from the CL as a Java command, with the '
--optimize shrinksafe" switch, it fails, but without it succeeds. (running it with internStrings alone seems to cause other errors).
Not sure what to make of this, since I believe that oprtimize defaults
to shrinksafe, but I have determined the following:
WORKS:
c:\temp\dojo-release-1.7.3rc1-src\util\buildscripts>java -Xms256m
-Xmx256m -cp ../shrinksafe/js.jar;../closureCompiler/compiler.jar;../shrinksafe/shrinksafe.jar
org.mozilla.javascript.tools.shell.Main ../../dojo/dojo.js
baseUrl=../../dojo load=build -p
C:\company\builds\head\build\generated\general\comComplete.profile.js
--action release --releaseDir C:\company\builds\head\build\generated\general\htdocs\company\javascript\1420
BROKEN (out of memory errors):
c:\temp\dojo-release-1.7.3rc1-src\util\buildscripts>java -Xms256m
-Xmx256m -cp ../shrinksafe/js.jar;../closureCompiler/compiler.jar;../shrinksafe/shrinksafe.jar
org.mozilla.javascript.tools.shell.Main ../../dojo/dojo.js
baseUrl=../../dojo load=build -p
C:\company\builds\head\build\generated\general\comComplete.profile.js
--action release --releaseDir C:\company\builds\head\build\generated\general\htdocs\company\javascript\1420
--optimize shrinksafe --internStrings true
Unfortunately, the following ant script target continues to fail with
memory errors:
BuildNum: ${buildNum}
<path id="js.path"> <pathelement location="${basedir}"/>
</path>
<pathconvert targetos="unix" property="js.path.unix" refid="js.path"
/> js.path.unix: ${js.path.unix}
<!-- clean unpack and output dirs --> <delete
dir="${outputDir}/htdocs/company/javascript/src/" />
<copy file="${externalDir}/dojo/companyComplete.profile.js"
tofile="${outputDir}/companyComplete.profile.js" filtering="yes"
overwrite="yes">
<java fork="true"
dir="${outputDir}/htdocs/company/javascript/src/util/buildscripts"
classname="org.mozilla.javascript.tools.shell.Main"
failonerror="true">
-->
--> --> -->
Update 1
I've also tried it with:
<jvmarg value="-Xms5120m"/>
<jvmarg value="-Xmx5120m"/>
And also using the maxmemory setting on the ant java task itself.
Finally found the problem, the releaseDir switch value had both windows and unix file separators in it. That used to work fine in Dojo < 1.6 and typically Java has no problem with it. For some reason, the Dojo 1.7 build system hits memory problems in that case.
The releaseDir, after resolving the ant tokens from the question, had a mix of both unix and windows file separators:
<arg value="releaseDir=${output.dir}/path/foo/bar" />
-> Became ->
releaseDir=blah\blah\blah/path/foo/bar
And that was enough to cause the build to lock up at 'writing resources' and then crash with 'out of heap space'. (This is something Java normally handles without issue).
The fix was simple enough:
<path id="dojo.output.tmp">
<pathelement location=" ${output.dir}/path/foo/bar "/>
</path>
<pathconvert targetos="unix" property="dojo.output.dir" refid="dojo.output.tmp" />
...
<arg value="releaseDir=${dojo.output.dir}" />

Playn error - org.lwjgl.LWJGLException: X Error

After much work around, now i am able to understand the playn environment. Every thing is ok now, but, when i enter:
mvn install (from the main directory)
(or)
mvn java/pom.xml test -Ptest-java
I am getting the following error. I updated the pom.xml (java directory) with this
<!-- unpack LWJGL when testing -->
<plugin>
<groupId>com.googlecode.mavennatives</groupId>
<artifactId>maven-nativedependencies-plugin</artifactId>
<version>0.0.6</version>
<executions>
<execution>
<id>unpacknatives</id>
<phase>test-compile</phase>
<goals><goal>copy</goal></goals>
</execution>
</executions>
</plugin>
Then also, same error, can any one guide me on this
main:
[java] failed to create drawable
[java] Exception in thread "main" java.lang.RuntimeException: org.lwjgl.LWJGLException: X Error - disp: 0xa0b7cc8 serial: 91 error: BadGC (invalid GC parameter) request_code: 60 minor_code: 0
[java] at playn.java.JavaGLContext.initGL(JavaGLContext.java:183)
[java] at playn.java.JavaGraphics.init(JavaGraphics.java:155)
[java] at playn.java.JavaPlatform.run(JavaPlatform.java:218)
[java] at playn.core.PlayN.run(PlayN.java:37)
[java] at main.java.ExampleJava.main(ExampleJava.java:13)
[java] Caused by: org.lwjgl.LWJGLException: X Error - disp: 0xa0b7cc8 serial: 91 error: BadGC (invalid GC parameter) request_code: 60 minor_code: 0
[java] at org.lwjgl.opengl.LinuxDisplay.globalErrorHandler(LinuxDisplay.java:316)
[java] at org.lwjgl.opengl.LinuxKeyboard.nSetDetectableKeyRepeat(Native Method)
[java] at org.lwjgl.opengl.LinuxKeyboard.setDetectableKeyRepeat(LinuxKeyboard.java:152)
[java] at org.lwjgl.opengl.LinuxKeyboard.destroy(LinuxKeyboard.java:163)
[java] at org.lwjgl.opengl.LinuxDisplay.destroyKeyboard(LinuxDisplay.java:1190)
[java] at org.lwjgl.input.Keyboard.destroy(Keyboard.java:349)
[java] at org.lwjgl.opengl.Display.destroyWindow(Display.java:349)
[java] at org.lwjgl.opengl.Display.access$400(Display.java:62)
[java] at org.lwjgl.opengl.Display$5.destroy(Display.java:860)
[java] at org.lwjgl.opengl.Display.create(Display.java:880)
[java] at org.lwjgl.opengl.Display.create(Display.java:782)
[java] at org.lwjgl.opengl.Display.create(Display.java:764)
[java] at playn.java.JavaGLContext.initGL(JavaGLContext.java:173)
[java] ... 4 more
[java] Java Result: 1
Fact: Linux 64-bit + LWJGL = Problems
If you are using a 64-bit Linux then try these one by one:
Upgrade to the newest version of LWJGL(2.8.4)
Install OpenJDK7 64-bit and have it as the default jvm
I believe there was a third fix but forgot what it was. I'll edit it in when I find it.
If you're using a 32-bit Linux then none of these will help.

How can I have my ant task pass or fail based on the results of a jar it runs?

I'm running CrossCheck (browserless js unit testing) as part of an ant script. I'd like ant to report failure if the CrossCheck tests fail. Here's the relevant bit from the build.xml
<target name="test" depends="concat">
<java jar="src/test/lib/crosscheck.jar" fork="true">
<arg value="src/test/webapp/js/"/>
</java>
And an example of CrossCheck's failure messaging:
[java] Running tests in environment: Mozilla 1.7 (Firefox 1.0)
[java] org.mozilla.javascript.EcmaError: ReferenceError: "clusterNode" is not defined. (ResultXMLWrapperTest.js#22)
[java] at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3229)
[java] at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3219)
[java] at org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3292)
[java] at org.mozilla.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1636)
[java] at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1575)
[java] at org.mozilla.javascript.gen.c1._c1(ResultXMLWrapperTest.js:22)
[java] at org.mozilla.javascript.gen.c1.call(ResultXMLWrapperTest.js)
[java] at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:340)
[java] at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2758)
[java] at org.mozilla.javascript.gen.c1.call(ResultXMLWrapperTest.js)
[java] at net.thefrontside.crosscheck.framework.AbstractScopeFactory$1.run(AbstractScopeFactory.java:108)
[java] at org.mozilla.javascript.Context.call(Context.java:515)
[java] at org.mozilla.javascript.Context.call(Context.java:450)
[java] at net.thefrontside.crosscheck.framework.AbstractScopeFactory.initTestScope(AbstractScopeFactory.java:94)
[java] at net.thefrontside.crosscheck.framework.DefaultScopeFactory.getTestScope(DefaultScopeFactory.java:68)
[java] at net.thefrontside.crosscheck.framework.TestCase$1.run(TestCase.java:119)
[java] at org.mozilla.javascript.Context.call(Context.java:528)
[java] at org.mozilla.javascript.Context.call(Context.java:450)
[java] at net.thefrontside.crosscheck.framework.TestCase.run(TestCase.java:117)
[java] at net.thefrontside.crosscheck.framework.TestSuite.run(TestSuite.java:95)
[java] at net.thefrontside.crosscheck.framework.Crosscheck.runAll(Crosscheck.java:116)
[java] at net.thefrontside.crosscheck.framework.ConsoleRunner.run(ConsoleRunner.java:140)
[java] at net.thefrontside.crosscheck.framework.ConsoleRunner.main(ConsoleRunner.java:300)
[java] ReferenceError: "clusterNode" is not defined. (ResultXMLWrapperTest.js#22)
[java] Java Result: 1
Can ant get at the results of the CrossCheck test (perhaps Java Result: 1 gets passed back to ant?) and succeed or fail based on that?
Assuming that CrossCheck returns a non-zero return code on a error you could add the failonerror attribute to the java task:
<target name="test" depends="concat">
<java jar="src/test/lib/crosscheck.jar" fork="true" failonerror="true">
<arg value="src/test/webapp/js/"/>
</java>
See the documentation on the Ant java task.
You can use the 'failonerror' attribute of the 'java' task.
failonerror Stop the buildprocess if
the command exits with a returncode
other than 0. Default is "false" (see
note)
Check the Ant manual here.

Categories

Resources