2

I have a problem when i build nutch1.14 project (on RHEL6, java 1.8) I have defined the env options for Maven & Java

But when i execute mvn -X install i have this error

    [INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 26.502 s
[INFO] Finished at: 2018-01-16T09:35:05+01:00
[INFO] Final Memory: 47M/656M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project nutch: Compilation failure: Compilation failure: 
[ERROR] /opt/NUTCH/nutch-1.14/src/java/org/apache/nutch/fetcher/FetcherThread.java:[511,17] incompatible types: java.lang.String cannot be converted to org.slf4j.Marker
[ERROR] /opt/NUTCH/nutch-1.14/src/java/org/apache/nutch/fetcher/FetcherThread.java:[522,17] incompatible types: java.lang.String cannot be converted to org.slf4j.Marker
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project nutch: Compilation failure
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure
    at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:858)
    at org.apache.maven.plugin.compiler.CompilerMojo.execute (CompilerMojo.java:129)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
[ERROR] 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Any ideas ? thanks I have already tried delete folder /root/.m2/repository but not affect this error.

And this is the code error in FetecherThread.java

if (origHost.equals(newHost)) {
            LOG.debug(
                " - ignoring redirect {} from {} to {} because internal links are ignored", redirType, urlString, newUrl);
            return null;
eis
  • 51,991
  • 13
  • 150
  • 199
Quent
  • 73
  • 10
  • Tell me what is full package name of class LOG. – Vy Do Jan 16 '18 at 09:05
  • I strongly suggest that you scan the Maven error output to see, if there is a more detailed error message. Typically there will be an explanation of what failed in the compilation process, like e.g: `...MatchFunctions.java:[31,10] ';' expected` – gil.fernandes Jan 16 '18 at 09:06
  • This outpout already shows the only error when mvn -X install [ERROR] /opt/NUTCH/nutch-1.14/src/java/org/apache/nutch/fetcher/FetcherThread.java:[511,17] incompatible types: java.lang.String cannot be converted to org.slf4j.Marker [ERROR] /opt/NUTCH/nutch-1.14/src/java/org/apache/nutch/fetcher/FetcherThread.java:[522,17] incompatible types: java.lang.String cannot be converted to org.slf4j.Marker [ERROR] -> [Help 1] – Quent Jan 16 '18 at 09:13
  • Have you also tried to run with `mvn -e clean install` ? This should give extended output. – gil.fernandes Jan 16 '18 at 09:14
  • @QuentQuent Have you checked?: https://stackoverflow.com/questions/41880719/java-lang-string-cannot-be-converted-to-org-slf4j-marker – gil.fernandes Jan 16 '18 at 09:16

2 Answers2

0

Because the argument in this line is wrong

LOG.debug(" - ignoring redirect {} from {} to {} because internal links are ignored", redirType, urlString, newUrl);

See Javadoc of Logging framework for correct usage.

Vy Do
  • 46,709
  • 59
  • 215
  • 313
  • I am not saying this is incorrect, but how do you know this is wrong? Perhaps it would be good to explain that. – gil.fernandes Jan 16 '18 at 09:03
  • Yes it's this line in FetcherThread.java, but i don't know what argument it's wrong and why ? – Quent Jan 16 '18 at 09:17
  • @DoNhuVy: I think you are right. But the explanation is actually provided here: https://stackoverflow.com/questions/41880719/java-lang-string-cannot-be-converted-to-org-slf4j-marker . If the user reduces the number of parameters in the LOG call, then it should work. – gil.fernandes Jan 16 '18 at 09:19
0

I think that there when you use SL4J with 3 string parameters the API thinks that you want to use method:

info(Marker marker, String format, Object arg1, Object arg2)

instead of:

info(String format, Object... arguments)

This is the reason for the compilation error.

There are multiple ways to fix this:

Example 1: use String.format:

LOG.debug(String.format(" - ignoring redirect %s from %s to %s because internal links are ignored", redirType, urlString, newUrl));
gil.fernandes
  • 12,978
  • 5
  • 63
  • 76