[ 
https://issues.apache.org/jira/browse/BVAL-84?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12924977#action_12924977
 ] 

Albert Lee commented on BVAL-84:
--------------------------------

When I did was following the instructions checking out the bval.trunk branch 
then use "mvn clean install" to build the project.

C:\temp>mkdir bval.trunk
C:\temp>cd bval.trunk
C:\temp\bval.trunk>svn co http://svn.apache.org/repos/asf/incubator/bval/trunk
A    trunk\NOTICE
......
A    trunk\bval-guice\pom.xml
 U   trunk
Checked out revision 1027567.

C:\temp\bval.trunk>cd trunk
C:\temp\bval.trunk\trunk>set path="c:\Program Files\maven-2.2.1\bin";%PATH%
C:\temp\bval.trunk\trunk>mvn clean install
[INFO] Scanning for projects...
[INFO] Reactor build order:
[INFO]   Apache Bean Validation :: bval-parent (Parent POM)
[INFO]   Apache Bean Validation :: bval-core
[INFO]   Apache Bean Validation :: bval-xstream (optional)
[INFO]   Apache Bean Validation :: bval-jsr303
[INFO]   Apache Bean Validation :: org.apache.bval.bundle
[INFO]   Apache Bean Validation :: bval-json (optional)
[INFO]   Apache Bean Validation :: bval-guice (optional)
[INFO]   Apache Bean Validation :: bval-tck (TCK Runner)
[INFO] ------------------------------------------------------------
[INFO] Building Apache Bean Validation :: bval-parent (Parent POM)
[INFO]    task-segment: [clean, install]
[INFO] ------------------------------------------------------------

.........

[INFO] ------------------------------------------------------------------------
[INFO] Building Apache Bean Validation :: bval-xstream (optional)
[INFO]    task-segment: [clean, install]
[INFO] ------------------------------------------------------------------------
[INFO] [clean:clean {execution: default-clean}]
[INFO] [enforcer:enforce {execution: default}]
[INFO] [buildnumber:create {execution: default}]
[INFO] [remote-resources:process {execution: process-remote-resources}]
[INFO] [remote-resources:process {execution: default}]
[INFO] [resources:resources {execution: default-resources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory 
C:\temp\bval.trunk\trunk\bval-xstream\src\main\resources
[INFO] Copying 4 resources
[INFO] Copying 4 resources
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Compiling 23 source files to 
C:\temp\bval.trunk\trunk\bval-xstream\target\classes
[INFO] [resources:testResources {execution: default-testResources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] Copying 4 resources
[INFO] Copying 4 resources
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] Compiling 8 source files to 
C:\temp\bval.trunk\trunk\bval-xstream\target\test-classes
[INFO] [surefire:test {execution: default-test}]
[INFO] Surefire report directory: 
C:\temp\bval.trunk\trunk\bval-xstream\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running org.apache.bval.xml.XMLMetaBeanManagerTest
Failed to instantiate SLF4J LoggerFactory
Reported exception:
java.lang.NoClassDefFoundError: org.slf4j.impl.StaticLoggerBinder
        at org.slf4j.LoggerFactory.bind(LoggerFactory.java:121)
        at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:111)
        at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:268)
        at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:241)
        at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:254)
        at org.apache.bval.MetaBeanBuilder.<clinit>(MetaBeanBuilder.java:32)
        at java.lang.J9VMInternals.initializeImpl(Native Method)
        at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
        at java.lang.J9VMInternals.initialize(J9VMInternals.java:167)
        at 
org.apache.bval.xml.XMLMetaBeanManager.<init>(XMLMetaBeanManager.java:42)
        at 
org.apache.bval.xml.XMLMetaBeanManagerTest.<init>(XMLMetaBeanManagerTest.java:35)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:44)

Look further into LoggerFactory.bind()

  private static final void bind()  {
    try   {
      StaticLoggerBinder.getSingleton();
      INITIALIZATION_STATE = 3;
      emitSubstituteLoggerWarning();
    } catch (NoClassDefFoundError ncde) {
      String msg = ncde.getMessage();
      if ((msg != null) && (msg.indexOf("org/slf4j/impl/StaticLoggerBinder") != 
-1)) {
        INITIALIZATION_STATE = 4;
        Util.report("Failed to load class 
\"org.slf4j.impl.StaticLoggerBinder\".");

        Util.report("Defaulting to no-operation (NOP) logger implementation");
        Util.report("See http://www.slf4j.org/codes.html#StaticLoggerBinder for 
further details.");
      }
      else {    <<<<< it is going into this path.
        failedBinding(ncde);
        throw ncde;
      }
.......
  static void failedBinding(Throwable t) {
    INITIALIZATION_STATE = 2;
    Util.report("Failed to instantiate SLF4J LoggerFactory", t);
  }

One thing I noticed is that on NoClassDefFoundError, 

      if ((msg != null) && (msg.indexOf("org/slf4j/impl/StaticLoggerBinder") != 
-1)) {

It is checking "org/slf4j/impl/StaticLoggerBinder" but the message contains 
"org.slf4j.impl.StaticLoggerBinder", hence it goes into the "else" leg, which 
posted

Failed to instantiate SLF4J LoggerFactory

and the exception in failedBinding(Throwable t)

I cleaned up the slf4j in my local repository and make sure I am downloading 
the correct level from the remote repository and try again. The same error 
occurs.

Looked into the newly created local repository and found the project is using 2 
levels of slf4j code base, 1.5.1 and 1.6.1.

Look into 1.5.1 level and it has a complete different implementation which 
showed that it is checking for "org/slf4j/impl/StaticLoggerBinder":

  static
  {
    try
    {
      loggerFactory = StaticLoggerBinder.SINGLETON.getLoggerFactory();
    } catch (NoClassDefFoundError ncde) {
      String msg = ncde.getMessage();
      if ((msg != null) && (msg.indexOf("org/slf4j/impl/StaticLoggerBinder") != 
-1)) {
        Util.reportFailure("Failed to load class 
\"org.slf4j.impl.StaticLoggerBinder\".");
        Util.reportFailure("See 
http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.");
      }

      throw ncde;
    }
    catch (Exception e) {
      Util.reportFailure("Failed to instantiate logger [" + 
StaticLoggerBinder.SINGLETON.getLoggerFactoryClassStr() + "]", e);
    }

Looks like there is a mixed use of 1.5.1 and 1.6.1 level of slf4j code. If the 
1.5.1 level is use, you will pass but use of 1.6.1 level will flagged as an 
error.

Albert Lee.

> CNFEX org.slf4j.impl.StaticLoggerBinder building xstream and guice
> ------------------------------------------------------------------
>
>                 Key: BVAL-84
>                 URL: https://issues.apache.org/jira/browse/BVAL-84
>             Project: BeanValidation
>          Issue Type: Bug
>          Components: build
>    Affects Versions: 0.2-incubating
>            Reporter: Albert Lee
>            Priority: Minor
>         Attachments: BVAL-84.patch
>
>
> Clean downloaded from trunk and hit the following exception in xstream and 
> guice modules from "mvn install" 
> java.lang.NoClassDefFoundError: org.slf4j.impl.StaticLoggerBinder
>         at org.slf4j.LoggerFactory.bind(LoggerFactory.java:121)
>         at 
> org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:111)
>         at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:268)
>         at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:241)
>         at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:254)
>         at org.apache.bval.MetaBeanBuilder.<clinit>(MetaBeanBuilder.java:32)
>         at java.lang.J9VMInternals.initializeImpl(Native Method)
>         at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
>         at java.lang.J9VMInternals.initialize(J9VMInternals.java:167)
>         at 
> org.apache.bval.xml.XMLMetaBeanManager.<init>(XMLMetaBeanManager.java:42)
>         at 
> org.apache.bval.xml.XMLMetaBeanManagerTest.<init>(XMLMetaBeanManagerTest.java:35)
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
> Method)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to