Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

[AEM Gems Webinar] Accelerating Experience Manager as a Cloud Service development with Rapid Development Environments
SOLVED

Junit test fails with SAXNotRecognizedException while loading json

Avatar

Level 4

We created project using latest archetype (cloud runtime).

Junit test fails in the part when json is loading,

ctx.load().json("/com/myproject/core/models/impl/MycmpntImplTest.json", "/content");

 

Same test works when I move it and run from inside weekend project or when I use weekend test libs (pom defintions) in our project.

 

Exception follows :

 

java.lang.IllegalStateException: Unable to enable secure processing.
at org.apache.sling.contentparser.xml.jcr.internal.JCRXMLContentParser.<init>(JCRXMLContentParser.java:61)
at org.apache.sling.testing.mock.sling.loader.ContentLoader.<init>(ContentLoader.java:149)
at org.apache.sling.testing.mock.sling.context.SlingContextImpl.load(SlingContextImpl.java:376)
at org.apache.sling.testing.mock.sling.context.SlingContextImpl.load(SlingContextImpl.java:366)
at com.myproject.core.models.impl.MycmpntImplTest.setUp(MycmpntImplTest.java:76)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
.

.

.at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)
Caused by: org.xml.sax.SAXNotRecognizedException: Feature 'http://javax.xml.XMLConstants/feature/secure-processing' is not recognized.
at org.apache.xerces.parsers.AbstractSAXParser.setFeature(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl.setFeatures(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl.<init>(Unknown Source)
at org.apache.xerces.jaxp.SAXParserFactoryImpl.newSAXParserImpl(Unknown Source)
at org.apache.xerces.jaxp.SAXParserFactoryImpl.setFeature(Unknown Source)
at org.apache.sling.contentparser.xml.jcr.internal.JCRXMLContentParser.<init>(JCRXMLContentParser.java:57)

1 Accepted Solution

Avatar

Correct answer by
Level 4

Adding following to Core resolved it (thanks to Adobe support)

 

<dependency> <groupId>xerces</groupId> <artifactId>xercesImpl</artifactId> <version>2.12.2</version> <scope>test</scope> </dependency>

View solution in original post

4 Replies

Avatar

Employee Advisor

What Java version are you using? mvn -version should display it.

Avatar

Correct answer by
Level 4

Adding following to Core resolved it (thanks to Adobe support)

 

<dependency> <groupId>xerces</groupId> <artifactId>xercesImpl</artifactId> <version>2.12.2</version> <scope>test</scope> </dependency>