Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
spring-projects-issues opened this issue Sep 25, 2018 · 4 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Sep 25, 2018

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

@spring-projects-issues
Copy link
Collaborator Author

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 :-)

@spring-projects-issues
Copy link
Collaborator Author

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

 

@spring-projects-issues
Copy link
Collaborator Author

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.

@spring-projects-issues
Copy link
Collaborator Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants