Package sun.text.normalizer does not exist


(Royce King) #1

When I run the identical build.gradle file on my mac and the build works great. I moved the build to a RedHat box with the same JDK and now I am getting a lot of warnings like the following “warning: unmappable character for encoding UTF8”, and errors like “package sun.text.normalizer does not exist”. Then it blows up saying the following:

Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 2 errors 41 warnings

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ‘:taxhawk2012:compileJava’. > Compilation failed; see the compiler error output for details.

  • Try: Run with --info or --debug option to get more log output.

  • Exception is: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ‘:taxhawk2012:compileJava’.

at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:68)

at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)

at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:34)

at org.gradle.api.internal.changedetection.CacheLockHandlingTaskExecuter$1.run(CacheLockHandlingTaskExecuter.java:34)

at org.gradle.cache.internal.DefaultCacheAccess$2.create(DefaultCacheAccess.java:200)

at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:172)

at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:198)

at org.gradle.cache.internal.DefaultPersistentDirectoryStore.longRunningOperation(DefaultPersistentDirectoryStore.java:137)

at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.longRunningOperation(DefaultTaskArtifactStateCacheAccess.java:83)

at org.gradle.api.internal.changedetection.CacheLockHandlingTaskExecuter.execute(CacheLockHandlingTaskExecuter.java:32)

at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:55)

at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57)

at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:41)

at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)

at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:52)

at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:42)

at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:247)

at org.gradle.execution.DefaultTaskGraphExecuter.executeTask(DefaultTaskGraphExecuter.java:192)

at org.gradle.execution.DefaultTaskGraphExecuter.doExecute(DefaultTaskGraphExecuter.java:177)

at org.gradle.execution.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:83)

at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:36)

at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)

at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)

at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)

at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter$1.run(TaskCacheLockHandlingBuildExecuter.java:31)

at org.gradle.cache.internal.DefaultCacheAccess$1.create(DefaultCacheAccess.java:111)

at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:126)

at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:109)

at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:129)

at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.java:79)

at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter.execute(TaskCacheLockHandlingBuildExecuter.java:29)

at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)

at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)

at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)

at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)

at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)

at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54)

at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:155)

at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:110)

at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:78)

at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:38)

at org.gradle.launcher.exec.InProcessGradleLauncherActionExecuter.execute(InProcessGradleLauncherActionExecuter.java:39)

at org.gradle.launcher.exec.InProcessGradleLauncherActionExecuter.execute(InProcessGradleLauncherActionExecuter.java:25)

at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)

at org.gradle.launcher.cli.ActionAdapter.execute(ActionAdapter.java:30)

at org.gradle.launcher.cli.ActionAdapter.execute(ActionAdapter.java:22)

at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:200)

at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:173)

at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)

at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:138)

at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)

at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)

at org.gradle.launcher.Main.doAction(Main.java:48)

at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)

at org.gradle.launcher.Main.main(Main.java:39)

at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)

at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)

at org.gradle.launcher.GradleMain.main(GradleMain.java:26) Caused by: org.gradle.api.internal.tasks.compile.CompilationFailedException: Compilation failed; see the compiler error output for details.

at org.gradle.api.internal.tasks.compile.jdk6.Jdk6JavaCompiler.execute(Jdk6JavaCompiler.java:42)

at org.gradle.api.internal.tasks.compile.jdk6.Jdk6JavaCompiler.execute(Jdk6JavaCompiler.java:33)

at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.delegateAndHandleErrors(NormalizingJavaCompiler.java:95)

at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:48)

at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:34)

at org.gradle.api.internal.tasks.compile.DelegatingJavaCompiler.execute(DelegatingJavaCompiler.java:29)

at org.gradle.api.internal.tasks.compile.DelegatingJavaCompiler.execute(DelegatingJavaCompiler.java:20)

at org.gradle.api.internal.tasks.compile.IncrementalJavaCompilerSupport.execute(IncrementalJavaCompilerSupport.java:33)

at org.gradle.api.internal.tasks.compile.IncrementalJavaCompilerSupport.execute(IncrementalJavaCompilerSupport.java:23)

at org.gradle.api.tasks.compile.Compile.compile(Compile.java:60)

at org.gradle.api.internal.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:196)

at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:102)

at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:99)

at org.gradle.api.tasks.compile.Compile_Decorated.invokeMethod(Unknown Source)

at org.gradle.util.ReflectionUtil.invoke(ReflectionUtil.groovy:23)

at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$4.execute(AnnotationProcessingTaskFactory.java:150)

at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$4.execute(AnnotationProcessingTaskFactory.java:145)

at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:472)

at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:461)

at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:60)

… 57 more

Any Ideas?


(Peter Niederwieser) #2

Where exactly do you get the “unmappable characters” warning? My guess is that you use MacRoman as your source file encoding. Then you have to configure ‘tasks.withType(Compile) { options.encoding = “MacRoman” }’ to make the Linux build happy. That’s because ‘options.encoding’ defaults to the Java platform’s default file encoding, which on Linux is UTF-8.

The Gradle error message says “Compilation failed; see the compiler error output for details.” One such error is “package sun.text.normalizer does not exist”. Not sure what it means. Maybe you are using a JRE instead of a JDK to execute Gradle, or maybe the class only exists in tools.jar, which is bundled by default on MacOs, but not on other OSes.

Have you double-checked that the output of ‘gradle -v’ is the same on both machines (except where it can’t be)?


(Royce King) #3

I get like 42 of the UTF8 warnings right after it does a “compileJava” on one of my projects. I get the warning on multiple files. Where would I add the

tasks.withType(Compile) { options.encoding = "MacRoman" }

? In the project?

On my mac: gradle -v

------------------------------------------------------------ Gradle 1.1 ------------------------------------------------------------

Gradle build time: Tuesday, July 31, 2012 1:24:32 PM UTC Groovy: 1.8.6 Ant: Apache Ant™ version 1.8.4 compiled on May 22 2012 Ivy: 2.2.0 JVM: 1.6.0_35 (Apple Inc. 20.10-b01-428) OS: Mac OS X 10.8.2 x86_64

On RedHat: gradle -v

------------------------------------------------------------ Gradle 1.1 ------------------------------------------------------------

Gradle build time: Tuesday, July 31, 2012 1:24:32 PM UTC Groovy: 1.8.6 Ant: Apache Ant™ version 1.8.4 compiled on May 22 2012 Ivy: 2.2.0 JVM: 1.6.0_35 (Sun Microsystems Inc. 20.10-b01) OS: Linux 2.6.18-274.el5 amd64


(Peter Niederwieser) #4

Where would I add the …

In the build script, at the outermost level.

Regarding the “package sun.text.normalizer does not exist”, I recommend to google for the problem. My Google search didn’t turn up something concrete; maybe you have more luck.


(Peter Niederwieser) #5

Don’t you get more information than “package sun.text.normalizer does not exist”, like the class that it’s trying to import?


(Royce King) #6

/foo/bar/Md502CrMef.java:14: package sun.text.normalizer does not exist import sun.text.normalizer.ReplaceableString;

/foo/bar/WebUtil.java:269: warning: unmappable character for encoding UTF8

case ‘’: sb.append(“€”); break;

/foo/bar/PDFFileRAMField.java:23: package com.sun.xml.internal.messaging.saaj.util does not exist import com.sun.xml.internal.messaging.saaj.util.ByteInputStream;

Tried the

tasks.withType(Compile) { options.encoding = "MacRoman" }

Same result.


(Peter Niederwieser) #7

Same result.

The warning still says “UTF8”, so apparently the setting didn’t take effect. One thing you can try is to invoke Gradle with ‘-Dfile.encoding=MacRoman’.

All in all, the problems sound more like environment differences/problems than Gradle problems. Since I can’t inspect your environment, it’s hard for me to make suggestions. See this link for an explanation of a similar “package does not exist” error when compiling with Maven: http://mail-archives.apache.org/mod_mbox/maven-users/200805.mbox/<483A97BF.3080207@chello.at> Maybe these classes can be used with an Apple JDK, but not with an Oracle JDK.

Let us know if you find anything.


(Royce King) #8

I think that is the case. I had to add a classpath for the rt.jar. I don’t understand why that isn’t already included. After adding it to the claspath it built, and tested fine. Here is my code:

repositories {
     flatDir { dirs "/usr/lib/jvm/java-openjdk/jre/lib" }
 mavenCentral()
 }
  project(':taxhawk2012') {
   dependencies {
                compile ':rt'
}
        }

I am still getting the UTF8 warnings. But I am ok with the warnings because it is still testing out correctly.


(Peter Niederwieser) #9

Seems like:

  • Oracle’s ‘javac’ doesn’t grant access to some of the internal classes in ‘rt.jar’ which aren’t meant to be used by user code.

  • This can be circumvented by explicitly adding ‘rt.jar’ to the compile class path.

To add a single file to a configuration, you can do ‘dependencies.compile files(‘path/to/file’)’ (instead of the ‘flatDir’ approach).


(estaub2) #10

The ‘javac -XDignore.symbol.file’ switch should fix this - but I’m a gradle newb, and don’t see how to feed this to gradle’s JavaCompile. My best guess is:

tasks.withType(Compile) { >

options.compilerArgs << “-XDignore.symbol.file” > }

This is from a similar (non-gradle) StackOverflow post.


(Peter Niederwieser) #11

As far as I can tell, ‘-XDignore.symbol.file’ isn’t supported by the Java compiler API. For the time being, you can work around this with ‘options.useAnt = true’ (and then pass ‘-XDignore.symbol.file’ to ‘options.compilerArgs’).