package org.apache.xml.serialize does not exist error | Community
Skip to main content
Keerthi0555
Level 5
August 2, 2023
Solved

package org.apache.xml.serialize does not exist error

  • August 2, 2023
  • 3 replies
  • 2929 views

Trying to convert json to xml and trying to indent the xml So used below library but 

package org.apache.xml.serialize does not exist getting this error though I added dependency in pom

    <dependency>
    <groupId>xerces</groupId>
    <artifactId>xercesImpl</artifactId>
    <version>2.12.2</version>
</dependency>
Any suggestions to solve this error.
Thanks in advance.
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Sudheer_Sundalam

@keerthi0555 ,

You might be getting this error because "xercesImpl" jar/library is not available OOTB in AEM bundles.

In that case, you need to embed this dependency as part of your core module as external dependency.

<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<!-- <Embed-Dependency> artifactId1, artifactId2;inline=true </Embed-Dependency> -->
<Embed-Dependency>xercesImpl</Embed-Dependency>

Note: You may have to embed other dependencies which are needed for "xercesImpl" as well.

Try this out.

3 replies

Shiv_Prakash_Patel
Community Advisor
Community Advisor
August 2, 2023
Shiv Prakash
Sid_Gour
Level 3
August 2, 2023

Hi @keerthi0555 ,

Can you tell me which Java utilities you are using for converting the JSON to XML?

It is always good to check the maven dependencies in AEM using depfinder and then use that in your POM as dependency, if you don't find that OSGi bundle in AEM then you can go for external dependency.

 

Thanks,

 

Sudheer_Sundalam
Community Advisor
Sudheer_SundalamCommunity AdvisorAccepted solution
Community Advisor
August 2, 2023

@keerthi0555 ,

You might be getting this error because "xercesImpl" jar/library is not available OOTB in AEM bundles.

In that case, you need to embed this dependency as part of your core module as external dependency.

<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<!-- <Embed-Dependency> artifactId1, artifactId2;inline=true </Embed-Dependency> -->
<Embed-Dependency>xercesImpl</Embed-Dependency>

Note: You may have to embed other dependencies which are needed for "xercesImpl" as well.

Try this out.