Expand my Community achievements bar.

SOLVED

Junit 5 Issue while reading XML

Avatar

Level 2

Hi ,

 

I am trying to write a junit for a path based servlet using junit5. The servlet basically reads an input stream (XML format) and then processes that further.

I am trying to load XML from class path src/test/resources :

 

private final AemContext context = new AemContext();

 

@BeforeEach

public void setUp() throws Exception {

context.load().fileVaultXml("relative path to XML", "/content/dam/UticaQuoteProposal/samplexml");

}

 

Exception :

 

java.lang.IllegalStateException: Unable to enable secure processing.

 

Cause : 

org.xml.sax.SAXNotRecognizedException: Feature 'http://javax.xml.XMLConstants/feature/secure-processing' is not recognized.

 

In the parent POM I am using dependency:

 

<dependency>

<groupId>io.wcm</groupId>

<artifactId>io.wcm.testing.aem-mock.junit5</artifactId>

<version>4.1.0</version>

<scope>test</scope>

</dependency>

 

In the core bundle pom added :

 

<dependency>

<groupId>xerces</groupId>

<artifactId>xercesImpl</artifactId>

<version>2.12.2</version>

<scope>test</scope>

</dependency>

 

Kindly, let me know what might be the root cause for this issue.

 

Thanks

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Seems like the issue is with dependency version compatibility with the JDK version.

 

https://github.com/adobe/aem-project-archetype/issues/920

 

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Seems like the issue is with dependency version compatibility with the JDK version.

 

https://github.com/adobe/aem-project-archetype/issues/920