accept(ContentType.XML) is giving org.glassfish.jersey.server.ContainerException: java.lang.NoClassDefFoundError: oracle/i18n/util/LocaleMapper] with root cause

822 views
Skip to first unread message

Sara

unread,
Feb 3, 2018, 12:28:32 AM2/3/18
to REST assured
Request header is .config(RestAssured.config().encoderConfig(new EncoderConfig().appendDefaultContentCharsetToContentTypeIfUndefined(false)))
.contentType(ContentType.XML)
.accept(ContentType.XML);

This works well with ContentType.JSON.

Full stackTrace of the exception is 991 ERROR o.a.c.c.C.[.[.[.[.c.a.c.JerseyConfig] - Servlet.service() for servlet [XXXXXXXXXXX.config.JerseyConfig] in context with path [] threw exception [org.glassfish.jersey.server.ContainerException: java.lang.NoClassDefFoundError: oracle/i18n/util/LocaleMapper] with root cause

java.lang.NoClassDefFoundError: oracle/i18n/util/LocaleMapper

        at oracle.xml.parser.v2.XMLReader.setEncoding(XMLReader.java:980)

        at oracle.xml.parser.v2.XMLReader.checkXMLDecl(XMLReader.java:3284)

        at oracle.xml.parser.v2.XMLReader.pushXMLReader(XMLReader.java:570)

        at oracle.xml.parser.v2.XMLReader.pushXMLReader(XMLReader.java:274)

        at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:232)

        at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:243)

        at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:214)

        at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:140)

        at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:123)

        at org.glassfish.jersey.jaxb.internal.XmlRootElementJaxbProvider.readFrom(XmlRootElementJaxbProvider.java:140)

        at org.glassfish.jersey.jaxb.internal.AbstractRootElementJaxbProvider.readFrom(AbstractRootElementJaxbProvider.java:135)

        at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$TerminalReaderInterceptor.invokeReadFrom(ReaderInterceptorExecutor.java:257)

        at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$TerminalReaderInterceptor.aroundReadFrom(ReaderInterceptorExecutor.java:236)

        at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor.proceed(ReaderInterceptorExecutor.java:156)

        at org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor.aroundReadFrom(MappableExceptionWrapperInterceptor.java:73)

       at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor.proceed(ReaderInterceptorExecutor.java:156)

        at org.glassfish.jersey.message.internal.MessageBodyFactory.readFrom(MessageBodyFactory.java:1091)

        at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:874)

        at org.glassfish.jersey.server.ContainerRequest.readEntity(ContainerRequest.java:271)

        at org.glassfish.jersey.server.internal.inject.EntityParamValueParamProvider$EntityValueSupplier.apply(EntityParamValueParamProvider.java:97)

        at org.glassfish.jersey.server.internal.inject.EntityParamValueParamProvider$EntityValueSupplier.apply(EntityParamValueParamProvider.java:80)

        at org.glassfish.jersey.server.spi.internal.ParamValueFactoryWithSource.apply(ParamValueFactoryWithSource.java:74)

        at org.glassfish.jersey.server.spi.internal.ParameterValueHelper.getParameterValues(ParameterValueHelper.java:92)

        at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$AbstractMethodParamInvoker.getParamValues(JavaResourceMethodDispatcherProvider.java:133)

        at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:200)

        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:103)

        at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:493)

        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:415)

        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:104)

        at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:277)

        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:272)

        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:268)

        at org.glassfish.jersey.internal.Errors.process(Errors.java:316)

Johan Haleby

unread,
Feb 3, 2018, 12:57:42 AM2/3/18
to rest-a...@googlegroups.com
What is your question? :)

--
You received this message because you are subscribed to the Google Groups "REST assured" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rest-assured+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sara

unread,
Feb 5, 2018, 3:52:33 PM2/5/18
to REST assured
Hello Johan,

Thank you for responding.
Sorry for not describing it clearly.


I am trying to post JSON, XML requests.

The request header is as follows for Json
given().header("Authorization", "XXXX")
        .config(RestAssured.config().encoderConfig(new EncoderConfig().appendDefaultContentCharsetToContentTypeIfUndefined(false)))
.contentType(ContentType.JSON)
.accept(ContentType.JSON);

This is generating desired JSON request body.(I am reading request body from excel)

I am trying to do the same for XML too
 given().header("Authorization", "XXXX")
         .config(RestAssured.config().encoderConfig(new EncoderConfig().appendDefaultContentCharsetToContentTypeIfUndefined(false)))
.contentType(ContentType.XML)
.accept(ContentType.XML);

Here it is throwing above mentioned error.

How can I resolve this?When tried manually using Postman and other tools it is returning 201 status which is expected.The error is being generated only through REST Assured.

Thanks in advance!
Sara.


Sara

unread,
Feb 5, 2018, 4:23:21 PM2/5/18
to REST assured
The response in case of XML is 

HTTP/1.1 500 
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Mon, 05 Feb 2018 21:14:33 GMT
Connection: close

{
    "timestamp": 1517865273364,
    "status": 500,
    "error": "Internal Server Error",
    "message": "java.lang.NoClassDefFoundError: oracle/i18n/util/LocaleMapper",
    "path": "XXXXX"
}

Todd Bradley

unread,
Feb 5, 2018, 4:45:24 PM2/5/18
to rest-a...@googlegroups.com
Sara, have you captured packets in Wireshark to look at the difference between the HTTP requests from Postman and REST-assured?

Sara

unread,
Feb 5, 2018, 5:03:40 PM2/5/18
to REST assured
Just discussed with my Dev team, They are using Postman which has no issue.But I am using ARC(Advanced REST Client) tool to check manually.It is giving There was an error parsing XML data.with 201.
What we are suspecting is we generate universal unique ID as part of response which has dashes - in it.That might be causing the issue.But not sure yet.

Thank you for your suggestion, Todd. I really appreciate it!
I will mention this to them.

Best regards,
Sara

On Monday, February 5, 2018 at 4:45:24 PM UTC-5, Todd Bradley wrote:
Sara, have you captured packets in Wireshark to look at the difference between the HTTP requests from Postman and REST-assured?
Reply all
Reply to author
Forward
0 new messages