Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

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

Avatar

Level 6

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.
1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@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.

View solution in original post

3 Replies

Avatar

Level 3

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,

 

Avatar

Correct answer by
Community Advisor

@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.