Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
  • Community
  • Answers Developer Questions
  • Questions
  • Getting this exception java.lang.ClassCastException: org.apache.xerces.jaxp.DocumentBuilderFactoryImpl cannot be cast to javax.xml.parsers.DocumentBuilderFactory at javax.xml.parsers.DocumentBuilderFactory.newInstance(Unknown Source)

Getting this exception java.lang.ClassCastException: org.apache.xerces.jaxp.DocumentBuilderFactoryImpl cannot be cast to javax.xml.parsers.DocumentBuilderFactory at javax.xml.parsers.DocumentBuilderFactory.newInstance(Unknown Source)

SJ September 28, 2015

Hi,

I am getting this exception,

java.lang.ClassCastException: org.apache.xerces.jaxp.DocumentBuilderFactoryImpl cannot be cast to javax.xml.parsers.DocumentBuilderFactory at javax.xml.parsers.DocumentBuilderFactory.newInstance(Unknown Source)

 

This is my pom.xml,

 

<?xml version="1.0" encoding="UTF-8"?>

 

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>com.xxxx.collabtools.jira</groupId>

    <artifactId>bart-api</artifactId>

    <version>1.0-SNAPSHOT</version>

    <organization>

        <name>XXXXX</name>

        <url>http://www.xxxx.com</url>

    </organization>

    <name>bart-api</name>

    <description>This is the com.xxxx.collabtools.jira:bart-api plugin for Atlassian JIRA.</description>

    <packaging>atlassian-plugin</packaging>

    <dependencies>

        <dependency>

            <groupId>com.atlassian.jira</groupId>

            <artifactId>jira-api</artifactId>

            <version>${jira.version}</version>

            <scope>provided</scope>

        </dependency>

        <!-- Add dependency on jira-core if you want access to JIRA implementation classes as well as the sanctioned API. -->

        <!-- This is not normally recommended, but may be required eg when migrating a plugin originally developed against JIRA 4.x -->

        <!--

        <dependency>

            <groupId>com.atlassian.jira</groupId>

            <artifactId>jira-core</artifactId>

            <version>${jira.version}</version>

            <scope>provided</scope>

        </dependency>

        -->

        <dependency>

            <groupId>junit</groupId>

            <artifactId>junit</artifactId>

            <version>4.10</version>

            <scope>test</scope>

        </dependency>

<!--        <dependency>

                        <groupId>com.atlassian.jira</groupId>

                        <artifactId>jira-rest-java-client-core</artifactId>

                        <version>2.0.0-m19</version>

                </dependency>  -->

    <dependency>

            <groupId>com.googlecode.json-simple</groupId>

            <artifactId>json-simple</artifactId>

            <version>1.1.1</version>

        </dependency>

         <dependency>

          <groupId>org.apache.httpcomponents</groupId>

          <artifactId>httpclient</artifactId>

          <version>[4.2.3,)</version>

          <scope>compile</scope>

      </dependency>

      <dependency>

 <groupId>xml-apis</groupId>

 <artifactId>xml-apis</artifactId>

 <version>1.3.04</version>

        <scope>compile</scope>

 </dependency>

 <dependency>

 <groupId>xerces</groupId>

 <artifactId>xercesImpl</artifactId>

 <version>2.9.1</version>

 <scope>compile</scope>

 </dependency>

<!--        <dependency>

        <groupId>org.apache.httpcomponents</groupId>

        <artifactId>httpclient</artifactId>

        <version>[4.1.2,)</version>

        <scope>provided</scope>

    </dependency>  -->

 

 

        <!-- WIRED TEST RUNNER DEPENDENCIES -->

        <dependency>

            <groupId>com.atlassian.plugins</groupId>

            <artifactId>atlassian-plugins-osgi-testrunner</artifactId>

            <version>${plugin.testrunner.version}</version>

            <scope>test</scope>

        </dependency>

        <dependency>

            <groupId>javax.ws.rs</groupId>

            <artifactId>jsr311-api</artifactId>

            <version>1.1.1</version>

            <scope>provided</scope>

        </dependency>

        <dependency>

            <groupId>com.google.code.gson</groupId>

            <artifactId>gson</artifactId>

            <version>2.2.2-atlassian-1</version>

        </dependency>

        <!-- Uncomment to use TestKit in your project. Details at https://bitbucket.org/atlassian/jira-testkit -->

        <!-- You can read more about TestKit at https://developer.atlassian.com/display/JIRADEV/Plugin+Tutorial+-+Smarter+integration+testing+with+TestKit -->

        <!--

  <dependency>

   <groupId>com.atlassian.jira.tests</groupId>

   <artifactId>jira-testkit-client</artifactId>

   <version>${testkit.version}</version>

   <scope>test</scope>

  </dependency>

  -->

        <dependency>

            <groupId>javax.servlet</groupId>

            <artifactId>servlet-api</artifactId>

            <version>2.4</version>

            <scope>provided</scope>

        </dependency>

        <dependency>

            <groupId>javax.xml.bind</groupId>

            <artifactId>jaxb-api</artifactId>

            <version>2.1</version>

            <scope>provided</scope>

        </dependency>

        <dependency>

            <groupId>com.atlassian.plugins.rest</groupId>

            <artifactId>atlassian-rest-common</artifactId>

            <version>1.0.2</version>

            <scope>provided</scope>

        </dependency>

        <dependency>

            <groupId>com.atlassian.sal</groupId>

            <artifactId>sal-api</artifactId>

            <version>2.6.0</version>

            <scope>provided</scope>

        </dependency>

        <dependency>

            <groupId>org.apache.wink</groupId>

            <artifactId>wink-client</artifactId>

            <version>1.1.3-incubating</version>

            <scope>test</scope>

        </dependency>

        <dependency>

            <groupId>org.mockito</groupId>

            <artifactId>mockito-all</artifactId>

            <version>1.8.5</version>

            <scope>test</scope>

        </dependency>

    </dependencies>

    <build>

        <plugins>

            <plugin>

                <groupId>com.atlassian.maven.plugins</groupId>

                <artifactId>maven-jira-plugin</artifactId>

                <version>${amps.version}</version>

                <extensions>true</extensions>

                <configuration>

                    <productVersion>${jira.version}</productVersion>

                    <productDataVersion>${jira.version}</productDataVersion>

                    <!-- Uncomment to install TestKit backdoor in JIRA. -->

                    <!--

     <pluginArtifacts>

      <pluginArtifact>

       <groupId>com.atlassian.jira.tests</groupId>

       <artifactId>jira-testkit-plugin</artifactId>

       <version>${testkit.version}</version>

      </pluginArtifact>

     </pluginArtifacts>

     -->

                </configuration>

            </plugin>

            <plugin>

                <artifactId>maven-compiler-plugin</artifactId>

                <configuration>

                    <source>1.6</source>

                    <target>1.6</target>

                </configuration>

            </plugin>

            <plugin>

                <groupId>com.atlassian.maven.plugins</groupId>

                <artifactId>maven-amps-plugin</artifactId>

                <version>${amps.version}</version>

                <extensions>true</extensions>

            </plugin>

        </plugins>

    </build>

    <properties>

        <jira.version>5.1.8</jira.version>

        <amps.version>5.0.2</amps.version>

        <plugin.testrunner.version>1.1.1</plugin.testrunner.version>

        <!-- TestKit version 5.x for JIRA 5.x, 6.x for JIRA 6.x -->

        <testkit.version>5.2.26</testkit.version>

    </properties>

</project>

Please help me with the issue.

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Volodymyr Krupach
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 28, 2015

Hi Senthil,

I am not able to give you straight "fix the problem" answer but I will try to point directions:

  • try to reuse dependencies that are part of JIRA api. I know for sure that there is apache httplcient. For sure it's older version than httpcomponents you included but I guess it should not be a problem. Similar story with xml-apis and xerces: try to rely on what is already in place.

  • If you really want to bring these libraries, you can try excludes. Few people reported the same exceptions and looks like were able to overcome it: https://answers.atlassian.com/questions/27329453

 

TAGS
AUG Leaders

Atlassian Community Events