Quantcast

[JIRA] (JENKINS-15344) Publishing Findbugs analysis report on a multi-module maven project results in ClassCastException

classic Classic list List threaded Threaded
24 messages Options
12
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-15344) Publishing Findbugs analysis report on a multi-module maven project results in ClassCastException

JIRA noreply@jenkins-ci.org
Issue Type: Bug Bug
Affects Versions: current
Assignee: Ulli Hafner
Attachments: jenkins.txt
Components: findbugs
Created: 28/Sep/12 10:08 AM
Description:

When using the Jenkins Findbugs plugin on a multi-module Maven plugin, the build fails with the root cause exception:
java.lang.ClassCastException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory
(cf. attachment for full stack-trace).

Note: the Findbugs Maven plugin is not able to generate an aggregated report for multi-module Maven, so maybe this is the origin of the problem ?

Project: Jenkins
Priority: Major Major
Reporter: Thomas Zlika
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-15344) Publishing Findbugs analysis report on a multi-module maven project results in ClassCastException

JIRA noreply@jenkins-ci.org
Ulli Hafner commented on Bug JENKINS-15344

Can you please add some details about your environment? Is this a slave build? Which JDK, findbugs, Jenkins, etc. is installed?

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-15344) Publishing Findbugs analysis report on a multi-module maven project results in ClassCastException

JIRA noreply@jenkins-ci.org
In reply to this post by JIRA noreply@jenkins-ci.org
Change By: Thomas Zlika (28/Sep/12 11:32 AM)
Environment: The problem occurs at least on the following tested environments:
- Jenkins 1.483 & 1.437 on both Windows and Linux
- Multi-module Maven 3 project using Maven Findbugs plugin 2.5.2
- JDK 1.7
- It is not a slave build
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-15344) Publishing Findbugs analysis report on a multi-module maven project results in ClassCastException

JIRA noreply@jenkins-ci.org
In reply to this post by JIRA noreply@jenkins-ci.org

I've updated the environment section of the issue. Tell me if you need other details.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-15344) Publishing Findbugs analysis report on a multi-module maven project results in ClassCastException

JIRA noreply@jenkins-ci.org
In reply to this post by JIRA noreply@jenkins-ci.org
Ulli Hafner commented on Bug JENKINS-15344

Please add the plug-in versions of findbugs and analysis-core. And how do you start Jenkins? java -jar or Tomcat?

Note: does this error occur when Jenkins runs using a JDK 6?

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-15344) Publishing Findbugs analysis report on a multi-module maven project results in ClassCastException

JIRA noreply@jenkins-ci.org
In reply to this post by JIRA noreply@jenkins-ci.org

analysis-core : 1.47
findbugs : 4.44
Starting Jenkins in standalone mode (java -jar) or deployed in a Tomcat server leads to the same problem.
I've not tried with a JDK6 yet.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-15344) Publishing Findbugs analysis report on a multi-module maven project results in ClassCastException

JIRA noreply@jenkins-ci.org
In reply to this post by JIRA noreply@jenkins-ci.org

Just made a test with JRE6 : same problem.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-15344) Publishing Findbugs analysis report on a multi-module maven project results in ClassCastException

JIRA noreply@jenkins-ci.org
In reply to this post by JIRA noreply@jenkins-ci.org
Change By: Thomas Zlika (28/Sep/12 3:35 PM)
Environment: The problem occurs at least on the following tested environments:
- Jenkins 1.483 & 1.437 on both Windows and Linux
-
 analysis-core plugin 1.47 and findbugs plugin 4.44
-
 Multi-module Maven 3 project using Maven Findbugs plugin 2.5.2
- JDK 1.7
 or JRE1.6
-
 Jenkins launched in standalone mode (java -jar jenkins.war) or deployed in a Tomcat server
-
 It is not a slave build
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-15344) Publishing Findbugs analysis report on a multi-module maven project results in ClassCastException

JIRA noreply@jenkins-ci.org
In reply to this post by JIRA noreply@jenkins-ci.org

According to the stack trace, it seems to be a class loading problem with dom4j.
Using mvn dependency:tree, we can see that dom4j is used twice with 2 slightly different versions:

  • dom4j:dom4j:jar:1.6.1:compile is a transitive dependency of org.jvnet.hudson.plugins.findbugs:library:jar:2.0.1-SNAPSHOT
  • org.jvnet.hudson.dom4j:dom4j:jar:1.6.1-hudson-3:provided is a transitive dependency of org.jenkins-ci.main:jenkins-core:jar:1.409:provided

In FindBugsParser.readXml(), where the bug occurs, you change the context class loader. And I can see in the stack trace that an async task is launched in a ThreadPoolExecutor, so the thread in the executor is certainly not using the class loader you tried to impose in FindBugsParser.readXml(), isn't it ?
Maybe a quick-and-dirty workaround would be to explicitly exclude dom4j:dom4j:jar:1.6.1 when configuring the findbugs dependency ?

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-15344) Publishing Findbugs analysis report on a multi-module maven project results in ClassCastException

JIRA noreply@jenkins-ci.org
In reply to this post by JIRA noreply@jenkins-ci.org
Change By: SCM/JIRA link daemon (05/Oct/12 8:58 AM)
Status: Open Resolved
Resolution: Fixed
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-15344) Publishing Findbugs analysis report on a multi-module maven project results in ClassCastException

JIRA noreply@jenkins-ci.org
In reply to this post by JIRA noreply@jenkins-ci.org

Code changed in jenkins
User: Ulli Hafner
Path:
library/.classpath
library/.project
library/.settings/org.eclipse.core.resources.prefs
library/.settings/org.eclipse.m2e.core.prefs
library/pom.xml
http://jenkins-ci.org/commit/findbugs-plugin/20fcf8f9fc4191842f63f2f3c27b1eb737fca247
Log:
[FIXED JENKINS-15344]: Upgrade to findbugs 2.0.1 and exclude DOM4J
library which is already part of core.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-15344) Publishing Findbugs analysis report on a multi-module maven project results in ClassCastException

JIRA noreply@jenkins-ci.org
In reply to this post by JIRA noreply@jenkins-ci.org

I tested the lattest version of Jenkins (1.484) with all the latest versions of the plugins (including analysis core 1.48 and findbugs 4.45) and unfortunately I still have the same error stack trace...

Change By: Thomas Zlika (05/Oct/12 2:13 PM)
Resolution: Fixed
Status: Resolved Reopened
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-15344) Publishing Findbugs analysis report on a multi-module maven project results in ClassCastException

JIRA noreply@jenkins-ci.org
In reply to this post by JIRA noreply@jenkins-ci.org
Ulli Hafner commented on Bug JENKINS-15344

Ok, I see. I just applied your quick fix with the hope that it will work on your machine...

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-15344) Publishing Findbugs analysis report on a multi-module maven project results in ClassCastException

JIRA noreply@jenkins-ci.org
In reply to this post by JIRA noreply@jenkins-ci.org

That was just a (bad) idea... I saw that the PMD plugin also comes with its own version of dom4j, but even if I delete it from the list of installed plugin the error still happens.
Where you able to reproduce this problem on your machine or not ? I may try to build a small example so that you can reproduce the problem on your machine.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-15344) Publishing Findbugs analysis report on a multi-module maven project results in ClassCastException

JIRA noreply@jenkins-ci.org
In reply to this post by JIRA noreply@jenkins-ci.org
Ulli Hafner commented on Bug JENKINS-15344

That would help. I can't reproduce that problem on my machine up to now...

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-15344) Publishing Findbugs analysis report on a multi-module maven project results in ClassCastException

JIRA noreply@jenkins-ci.org
In reply to this post by JIRA noreply@jenkins-ci.org

This very simple project (1 mock java class and 1 mock test class) can reproduce the problem.
In fact the problem is not related to multi-module maven projects as I thought, because I can reproduce it with this mono-module project.
The problem seems to be somehow related to the tests, because it disappears if I remove the test class.

Change By: Thomas Zlika (09/Oct/12 9:51 AM)
Attachment: test.zip
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-15344) Publishing Findbugs analysis report on a multi-module maven project results in ClassCastException

JIRA noreply@jenkins-ci.org
In reply to this post by JIRA noreply@jenkins-ci.org
Ulli Hafner commented on Bug JENKINS-15344

I can't reproduce this with your example. Is there a findbugs warning in your project? When I run it I get:

[INFO] 
[INFO] --- findbugs-maven-plugin:2.5.2:findbugs (default-cli) @ aggregator ---
[INFO] Fork Value is true
[INFO] Done FindBugs Analysis....
mojoSucceeded org.codehaus.mojo:findbugs-maven-plugin:2.5.2(default-cli)
[FINDBUGS] Finding all files that match the pattern findbugsXml.xml
[FINDBUGS] Parsing 1 files in /Users/hafner/Development/jenkins/jobs/JENKINS-15344/workspace/target
[FINDBUGS] Successfully parsed file /Users/hafner/Development/jenkins/jobs/JENKINS-15344/workspace/target/findbugsXml.xml of module aggregator with 0 warnings.
projectSucceeded net.test:aggregator:0.1-SNAPSHOT
sessionEnded

There is no warning found. I'm using the goals "clean package findbugs:findbugs". What did you use?

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-15344) Publishing Findbugs analysis report on a multi-module maven project results in ClassCastException

JIRA noreply@jenkins-ci.org
In reply to this post by JIRA noreply@jenkins-ci.org

I use mvn clean site

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-15344) ClassCastException when reports are created with maven-site-plugin

JIRA noreply@jenkins-ci.org
In reply to this post by JIRA noreply@jenkins-ci.org
Change By: Ulli Hafner (13/Oct/12 10:44 AM)
Summary: Publishing Findbugs analysis report on a multi-module maven project results in  ClassCastException  when reports are created with maven-site-plugin
Priority: Major Minor
Description: When  using  enabling  the Jenkins Findbugs plugin on a  multi-module  Maven  job that uses the maven-site-  plugin ,  to generate  the  reports then the  build fails with the root cause exception:
java.lang.ClassCastException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory
(cf. attachment for full stack-trace).

Note: the Findbugs Maven plugin is not able to generate an aggregated report for multi-module Maven, so maybe this is the origin of the problem ?
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-15344) ClassCastException when reports are created with maven-site-plugin

JIRA noreply@jenkins-ci.org
In reply to this post by JIRA noreply@jenkins-ci.org
Ulli Hafner commented on Bug JENKINS-15344

Thanks Thomas! Now I can reproduce the problem. Seems that maven-site-plugin is the cause for the exception. I need to investigate how I can update my plug-in to work with the results of this maven plugin.

Until that is fixed, please use the goal 'findbugs:findbugs' to create the FindBugs results. Maybe it would also work if you downgrade to 3.0 maven-site-plugin, see JENKINS-14737.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12
Loading...