Thank you all, I have finally managed to find the root of the problem.
Nick's warning about the possibility of a different Log4J version as a
transitive dependency got me thinking and I tried disabling the
dependencies, one at a time, to see what would happen. The errors
disappeared after disabling a custom 3rd party library that I have
installed to my local repository manually and after inspecting its contents
it turned out that there is an older Log4J version packed inside the JAR
along with the rest of the library.

Thank you once more for all your quick responses,
Dušan



2014-04-30 14:44 GMT+02:00 Nick Stolwijk <[email protected]>:

> And for another thought: maybe of your other dependencies include the
> org.apache.log4j.Logger class but with a different version.
>
> Check with maven copy dependencies and a grep over the contents of all
> the jar files.
>
> Here is how I do it:
>
> 02:40:48 {master} ~/sandbox/bowling-nickstolwijk$ mvn
> dependency:copy-dependencies
> [INFO] Scanning for projects...
> [INFO]
> [INFO] Using the builder
>
> org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder
> with a thread count of 1
> [INFO]
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Building bowling-nickstolwijk 1.0-SNAPSHOT
> [INFO]
> ------------------------------------------------------------------------
> [INFO]
> [INFO] --- maven-dependency-plugin:2.8:copy-dependencies (default-cli)
> @ bowling-nickstolwijk ---
> [INFO] hamcrest-core-1.3.jar already exists in destination.
> [INFO] junit-4.11.jar already exists in destination.
> [INFO] hamcrest-library-1.3.jar already exists in destination.
> [INFO] mockito-core-1.9.5.jar already exists in destination.
> [INFO] objenesis-1.0.jar already exists in destination.
> [INFO]
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: 1.143 s
> [INFO] Finished at: 2014-04-30T14:41:08+01:00
> [INFO] Final Memory: 9M/153M
> [INFO]
> ------------------------------------------------------------------------
> 02:41:08 {master} ~/sandbox/bowling-nickstolwijk$ cd target/dependency/
> 02:41:16 {master} ~/sandbox/bowling-nickstolwijk/target/dependency$
> findjar.sh . Logger
> Starting search for JAR files from directory .
> Looking for the class Logger
>
> This might take a while...
>
> org/mockito/internal/debugging/VerboseMockInvocationLogger.class
> org/mockito/internal/debugging/VerboseMockInvocationLogger.java
> org/mockito/internal/util/ConsoleMockitoLogger.class
> org/mockito/internal/util/ConsoleMockitoLogger.java
> org/mockito/internal/util/MockitoLogger.class
> org/mockito/internal/util/MockitoLogger.java
> org/mockito/internal/util/SimpleMockitoLogger.class
> org/mockito/internal/util/SimpleMockitoLogger.java
> ./mockito-core-1.9.5.jar
> 02:41:20 {master} ~/sandbox/bowling-nickstolwijk/target/dependency$
> cat ~/bin/findjar.sh
> #!/bin/sh
> #
> # findjar.sh by Samuli Kaski
> #
>
> VERBOSE=no
>
> if [ $# -ne 2 ]; then
>         echo "Usage: findjar.sh <path> <classname>";
>         exit;
> fi
>
> STARTPATH=$1
> CLASS=$2
>
> echo "Starting search for JAR files from directory $STARTPATH"
> echo "Looking for the class $CLASS"
> echo ""
> echo "This might take a while..."
> echo ""
>
> for jar in `find $STARTPATH -name '*.jar'`;
> do
>  BASENAME=`basename $jar`
>
>  jar -tf $jar | grep $CLASS
>
>  if [ $? -eq 0 ]; then
>
>    echo "$jar"
>  fi
> done
>
> Hth,
> Nick Stolwijk
>
> ~~~ Try to leave this world a little better than you found it and,
> when your turn comes to die, you can die happy in feeling that at any
> rate you have not wasted your time but have done your best ~~~
>
> Lord Baden-Powell
>
>
> On Wed, Apr 30, 2014 at 2:29 PM, Nick Stolwijk <[email protected]>
> wrote:
> > Could you check your checksum on the log4j jar file? Maybe there is
> > some corruption in your repository.
> >
> > 02:28:40 ~/.m2/repository/log4j/log4j/1.2.17$ ls -altr log4j-1.2.17.jar
> > -rw-r--r-- 1 nick nick 489884 Jan  8 13:31 log4j-1.2.17.jar
> > 02:28:45 ~/.m2/repository/log4j/log4j/1.2.17$ sha1sum log4j-1.2.17.jar
> > 5af35056b4d257e4b64b9e8069c0746e8b08629f  log4j-1.2.17.jar
> > 02:28:47 ~/.m2/repository/log4j/log4j/1.2.17$ cat log4j-1.2.17.jar.sha1
> > 5af35056b4d257e4b64b9e8069c0746e8b08629f
> >
> > Hth,
> >
> > Nick Stolwijk
> >
> > ~~~ Try to leave this world a little better than you found it and,
> > when your turn comes to die, you can die happy in feeling that at any
> > rate you have not wasted your time but have done your best ~~~
> >
> > Lord Baden-Powell
> >
> >
> > On Wed, Apr 30, 2014 at 2:00 PM, Dušan Rychnovský
> > <[email protected]> wrote:
> >> Thank you both for your help. Unfortunatelly, neither seems to be the
> case.
> >>
> >>  * dependency:tree confirmed that version 1.2.17 is beeing used indeed
> >> (log4j:log4j:jar:1.2.17:compile),
> >>  * I have verified that the import statement is correct (import
> >> org.apache.log4j.Logger;).
> >>
> >> Dušan
> >>
> >>
> >>
> >> 2014-04-30 13:55 GMT+02:00 Stuart McCulloch <[email protected]>:
> >>
> >>> Also check your java imports, just in case you’ve imported a different
> >>> Logger by mistake (such as java.util.logging.Logger)
> >>>
> >>> On 30 Apr 2014, at 12:48, Nick Stolwijk <[email protected]>
> wrote:
> >>>
> >>> > You can use the dependency:tree[1] goal to view a tree of your
> >>> > dependencies to see if the correct version of Log4J is being included
> >>> > in the compiler classpath.
> >>> >
> >>> > [1]
> >>>
> https://maven.apache.org/plugins/maven-dependency-plugin/tree-mojo.html
> >>> >
> >>> > Hth,
> >>> >
> >>> > Nick Stolwijk
> >>> >
> >>> > ~~~ Try to leave this world a little better than you found it and,
> >>> > when your turn comes to die, you can die happy in feeling that at any
> >>> > rate you have not wasted your time but have done your best ~~~
> >>> >
> >>> > Lord Baden-Powell
> >>> >
> >>> >
> >>> > On Wed, Apr 30, 2014 at 1:41 PM, Dušan Rychnovský
> >>> > <[email protected]> wrote:
> >>> >> Hi everyone,
> >>> >>
> >>> >> I have the following dependency in my project's POM:
> >>> >>
> >>> >> ...
> >>> >> <dependency>
> >>> >>    <groupId>log4j</groupId>
> >>> >>    <artifactId>log4j</artifactId>
> >>> >>    <version>1.2.17</version>
> >>> >> </dependency>
> >>> >> ...
> >>> >>
> >>> >> The artifact is downloaded to my local repository, but, during the
> >>> compile
> >>> >> phase, the following error is emitted and the build process is
> aborted:
> >>> >>
> >>> >> [ERROR] Failed to execute goal
> >>> >> org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile
> >>> >> (default-compile) on project dbtoixattrdt: Compilation failure:
> >>> Compilation
> >>> >> failure:
> >>> >> [ERROR]
> >>> >>
> >>>
> d:\prace\dbtoixattrdt\DBToIXATTRDT-TRUNK\src\main\java\dbtoixattrdt\TraceLogAspect.java:[19,8]
> >>> >> error: cannot find symbol
> >>> >> [ERROR] symbol:   method trace(String)
> >>> >> [ERROR] location: variable logger of type Logger
> >>> >>
> >>> >> This error message does not make much sense, as the trace method
> should
> >>> be
> >>> >> available on the Logger class in Log4J version 1.2.17.
> >>> >>
> >>> >> What can be wrong?
> >>> >>
> >>> >> Thanks in advance,
> >>> >> Dušan
> >>> >
> >>> > ---------------------------------------------------------------------
> >>> > To unsubscribe, e-mail: [email protected]
> >>> > For additional commands, e-mail: [email protected]
> >>> >
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: [email protected]
> >>> For additional commands, e-mail: [email protected]
> >>>
> >>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to