[arin-tech-discuss] How to solve the exception with "Could not find JAXBContextFinder for media type: textml"
Vicky Zheng
vickyzheng at yahoo.com
Wed Mar 26 21:25:20 EDT 2014
Just found the root cause. This error message came from Jersey library.
It's working fine now.
Thanks,
Vicky
On Wednesday, March 26, 2014 6:41:48 PM, Vicky Zheng <vickyzheng at yahoo.com> wrote:
Hi Andy,
You are right. I do use accept() for other method call. The reason I use type() instead of accept() because the type call return another error message "Your payload must be sent with the media type: application/xml</message></additionalInfo><code>E_BAD_REQUEST</code><components/><message>Cannot consume content type".
Here is the code: response = webResource.accept(MediaType.APPLICATION_XML).post(ClientResponse.class, pocPayload);
Please advise.
Thanks,
Vicky
On Wednesday, March 26, 2014 4:37:26 PM, Andy Newton <andy at arin.net> wrote:
Hi Vicky,
That error appears to be generated because our servers are receiving the request with an Accept header of “text/html” and not “application/xml”.
While I am not familiar with the toolkit you are using, my guess is that the working code is using webResource.accept( MediaType.APPLICATION_XML ) and the other code is using webResource.type( MediaType.APPLICATION_XML ).
Andy Newton,
Chief Engineer, ARIN
From: Vicky Zheng <vickyzheng at yahoo.com>
Reply-To: Vicky Zheng <vickyzheng at yahoo.com>
Date: Wednesday, March 26, 2014 at 3:03 PM
To: Andrew Newton <andy at arin.net>, "arin-tech-discuss at arin.net" <arin-tech-discuss at arin.net>
Subject: Re: [arin-tech-discuss] How to solve the exception with "Could not find JAXBContextFinder for media type: textml"
Sorry, the error message should be:
>HTTP Status 500 - Could not find JAXBContextFinder for media type: text/html
>The server encountered an internal error (Could not find JAXBContextFinder for media type: text/html) that prevented it from fulfilling this request
>
>
>Thanks,
>Vicky
>
>
>
>
>On Wednesday, March 26, 2014 2:33:41 PM, Vicky Zheng <vickyzheng at yahoo.com> wrote:
>
>Thanks Andy for the response. My confuse is in my code, I did put the type is "MediaType.APPLICATION_XML".
>Don't get why the server get this exception.
>I used the following code to get Poc and it is working fine.
>public String getPOC(String pocHandle)throws Exception{
> config = new DefaultClientConfig();
> client = Client.create(config);
> String pocPayLoad = null;
> try{
> webResource = client.resource("https://reg.arin.net/rest/poc/"+pocHandle+"?apikey="+getAPIkey());
> pocPayLoad = webResource.accept(MediaType.APPLICATION_XML).get(String.class);
> }catch(Exception e){
> logger.info("Exception:"+e.getMessage());
> }
> return pocPayLoad;
> }
>
>Thanks,
>Vicky
>
>
>
>
>
>
>On Wednesday, March 26, 2014 2:09:51 PM, Andy Newton <andy at arin.net> wrote:
>
>Hi Vicky,
>
>
>By looking at your code snippet, my guess is that the media type is not being registered properly with JAXB. “textml” is not a valid media type as far as I know. The media type to use with Reg-RWS is “application/xml”.
>
>
>I hope this helps.
>
>
>Andy Newton,
>Chief Engineer, ARIN
>
>
>From: Vicky Zheng <vickyzheng at yahoo.com>
>Reply-To: Vicky Zheng <vickyzheng at yahoo.com>
>Date: Wednesday, March 26, 2014 at 1:52 PM
>To: "arin-tech-discuss at arin.net" <arin-tech-discuss at arin.net>
>Subject: [arin-tech-discuss] How to solve the exception with "Could not find JAXBContextFinder for media type: textml"
>
>
>
>Hello,
>> I created java function to call Arin service to add Poc payload. The XML string come from Arin web sample.
>>
>> I'm receiving the response from Arin service with "Could not find JAXBContextFinder for media type: textml.
>>JBoss Web/7.0.10.Final
>>The server encountered an internal error (Could not find JAXBContextFinder for media type: textml) that prevented it from fulfilling this request.
>>
>>".
>> Could any one please give me a hint what's the root cause?
>> Here is the java function
>>public void addPoc()
>>
>>{
>> config = new DefaultClientConfig();
>> client = Client.create(config);
>> webResource = client.resource("https://reg.arin.net/rest/poc;makeLink=true"+"?apikey="+getAPIkey());
>> response = webResource.type(MediaType.APPLICATION_XML).post(ClientResponse.class, pocPayload);
>> String rePocPayLoad = response.getEntity(String.class);
>> return rePocPayLoad;
>>
>>}
>>
>>
>>
>>
>>Thanks!
>>Vicky
>>
>
>
>
>
>
>
>
>
_______________________________________________
arin-tech-discuss mailing list
arin-tech-discuss at arin.net
http://lists.arin.net/mailman/listinfo/arin-tech-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.arin.net/pipermail/arin-tech-discuss/attachments/20140326/88b8d0a1/attachment.html>
More information about the arin-tech-discuss
mailing list