Skip to content

java.lang.AbstractMethodError: org.apache.commons.logging.LogFactory.setAttribute(..) [SPR-17302] #21835

Closed

Description

@spring-projects-issues

gregh3269 opened SPR-17302 and commented

Hello,

Upgrading to v5.1.0 now gives me an error on startup :

 

java.lang.AbstractMethodError: org.apache.commons.logging.LogFactory.setAttribute(Ljava/lang/String;Ljava/lang/Object;)V
at org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:638)

.....

 

Seems something to do with the spring-jcl jar,  I checked the jars before/after the upgrade and they are identical (other than the version changes).

 

I use the bridge logging to commons-logging.  If I exclude the spring-jcl jar the app starts up OK.  v5.0.8 was OK.

 

Here are my dependancies

<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
<!-- Actual Logging Implementation log4j 2 --->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.11.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.11.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-web</artifactId>
<version>2.11.1</version>
</dependency>
<!-- Logging redirects --->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jcl</artifactId>
<version>2.11.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.11.1</version>
</dependency>
<!-- Log4j 1.x API Bridge -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-1.2-api</artifactId>
<version>2.11.1</version>
</dependency>
<!-- slf4j Logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>

Cheers Greg

 


Affects: 5.1 GA

Issue Links:

Referenced from: commits d6dfde3

Activity

  1. spring-projects-issues commented on Sep 25, 2018

    @spring-projects-issues
    CollaboratorAuthor

    Juergen Hoeller commented

    We're aiming to be compatible with standard commons-logging there, so we'll have a look at adding such a setAttribute method (although we're not going to do anything with it).

    That said, you seem to have overlapping Commons Logging implementations on your classpath. spring-jcl, commons-logging and log4j-jcl are all Commons Logging bridges implementing the very same API. You could drop two of them and things should still run; we recommend just using spring-jcl, of course :-)

  2. spring-projects-issues commented on Sep 26, 2018

    @spring-projects-issues
    CollaboratorAuthor

    gregh3269 commented

    I had not realised there was a spring version of jcl, hence the log4j-jcl.  btw, I use log4j 2 as a base, my app uses commons-logging and bridge into log4j 2, then bridge all the other log stuff/versions into Log4j 2. 

     

    ..When I last reviewed all the logging stuff, I thought I understood what was going on, but now it looks like log soup!

     

    Cheers Greg

     

  3. spring-projects-issues commented on Sep 26, 2018

    @spring-projects-issues
    CollaboratorAuthor

    Juergen Hoeller commented

    I've narrowed this AbstractMethodError down to scenarios where standard Commons Logging parses a commons-logging.properties file. The plain presence of commons-logging.jar does not trigger this.

    In any case, the recommended solution is to only have one Commons Logging bridge on the classpath. spring-jcl is a complete replacement there, with no other JCL artifacts needed on the classpath next to it.

  4. spring-projects-issues commented on Sep 29, 2018

    @spring-projects-issues
    CollaboratorAuthor

    Juergen Hoeller commented

    Addressed through implementing the Commons Logging attribute methods in LogFactoryService now, in case we're running against an overlapping commons-logging.jar with a commons-logging.properties file around.

  5. added
    type: bug
    in: core
    on Jan 11, 2019
  6. added this to the 5.1.1 milestone on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: coretype: bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions