Menu ▾ ▴

#1419 PMD-Plugin does not work if run with IBM JDK 1.7.0

Eclipse-Plugin
closed
None
Eclipse
3-Major
Bug
4.0.7.v20150522-1709
2015-10-04
2015-10-03
Ralf
No

PMD-Plugin: 4.0.7.v20150522-1709
Eclipse Luna SR2
IBM JDK 1.7.0

Eclipse is run with the IBM-JDK. When clicking OK on the project properties page for PMD the following exception is thrown:

java.lang.RuntimeException: Could not instantiate serializer com.sun.org.apache.xml.internal.serialize.XMLSerializer: java.lang.ClassNotFoundException: com.sun.org.apache.xml.internal.serialize.XMLSerializer
at org.exolab.castor.xml.BaseXercesJDK5Serializer.<init>(BaseXercesJDK5Serializer.java:59)
at org.exolab.castor.xml.XercesJDK5XMLSerializerFactory.getSerializer(XercesJDK5XMLSerializerFactory.java:34)
at org.exolab.castor.xml.util.XMLParserUtils.getSerializer(XMLParserUtils.java:259)
at org.castor.xml.AbstractInternalContext.getSerializer(AbstractInternalContext.java:370)
at org.exolab.castor.xml.Marshaller.configureSerializer(Marshaller.java:477)
at org.exolab.castor.xml.Marshaller.setWriter(Marshaller.java:423)
at net.sourceforge.pmd.eclipse.runtime.properties.impl.ProjectPropertiesManagerImpl.writeProjectProperties(ProjectPropertiesManagerImpl.java:280)
....</init>

The problem is that the IBM JDK does not ship the class com.sun.org.apache.xml.internal.serialize.XMLSerializer (note the leading "com.sun"), but the class org.apache.xml.internal.serialize.XMLSerializer (without leading "com.sun").

I fixed that locally by adding

marshaller.setProperty("org.exolab.castor.xml.serializer.factory","org.exolab.castor.xml.XercesXMLSerializerFactory");

to the following two methods:

net.sourceforge.pmd.eclipse.core.rulesets.impl.RuleSetsManagerImpl.writeToXml(RuleSets, OutputStream)
net.sourceforge.pmd.eclipse.runtime.properties.impl.ProjectPropertiesManagerImpl.writeProjectProperties(IProject, ProjectPropertiesTO)

I have no Oracle JDK to test, but I guess that this would break the plugin there.

Discussion

  • Andreas Dangel

    Andreas Dangel - 2015-10-03
    • status: open --> closed
    • assigned_to: Andreas Dangel
    • Module: PMD --> Eclipse
    • Milestone: New Tickets --> Eclipse-Plugin
     
  • Andreas Dangel

    Andreas Dangel - 2015-10-03

    This will be fixed with the next version.
    You can test the new version by installing the latest plugin version from
    https://sourceforge.net/projects/pmd/files/pmd-eclipse/update-site-latest/

    I removed castor completely and use just JAXB.

     
  • Ralf

    Ralf - 2015-10-04

    Fix confirmed. Thank you.

    I build from source, as I also needed the fix described in #1415.

     

Log in to post a comment.