org.odata4j.exceptions.UnsupportedMediaTypeException: Unknown content type text/html;charset=UTF-8

76 views
Skip to first unread message

Francisco Amores Torres

unread,
Mar 19, 2019, 11:20:02 AM3/19/19
to odata4j-discuss
Hello,

I'm very new to odata4j.

I started with a simple Eclipse project which creates a consumer and tries to read the entities


public static void main(String[] args) {
// TODO Auto-generated method stub
// create consumer instance
ODataConsumer consumer = ODataConsumers.create(serviceUrl);
             // list category names
for (OEntity category : consumer.getEntities("Categories").execute()) {
  String categoryName = category.getProperty("Name", String.class).getValue();
  System.out.println("Category name: " + categoryName);
}

}

However, i'm getting an exception about unsupported media type:

Exception in thread "main" java.lang.RuntimeException: Expected status OK, found Moved Permanently. Server response:

at org.odata4j.jersey.consumer.ODataJerseyClient.doRequest(ODataJerseyClient.java:165)
at org.odata4j.consumer.AbstractODataClient.getMetadata(AbstractODataClient.java:43)
at org.odata4j.consumer.AbstractODataConsumer$CachedEdmDataServices.refreshDelegate(AbstractODataConsumer.java:212)
at org.odata4j.consumer.AbstractODataConsumer$CachedEdmDataServices.getDelegate(AbstractODataConsumer.java:205)
at org.odata4j.internal.EdmDataServicesDecorator.findEdmEntitySet(EdmDataServicesDecorator.java:46)
at org.odata4j.consumer.AbstractODataConsumer$CachedEdmDataServices.findEdmEntitySet(AbstractODataConsumer.java:221)
at org.odata4j.consumer.AbstractODataConsumer.getFeedCustomizationMapping(AbstractODataConsumer.java:235)
at org.odata4j.consumer.AbstractODataConsumer.getEntities(AbstractODataConsumer.java:73)
at org.odata4j.consumer.AbstractODataConsumer.getEntities(AbstractODataConsumer.java:69)
at Tester.main(Tester.java:15)
Caused by: org.odata4j.exceptions.UnsupportedMediaTypeException: Unknown content type text/html;charset=UTF-8
at org.odata4j.format.FormatParserFactory.getParser(FormatParserFactory.java:78)
at org.odata4j.jersey.consumer.ODataJerseyClient.doRequest(ODataJerseyClient.java:161)
... 9 more


Am I missing something? any hint is more than welcome.

Thanks

Francisco Amores Torres

unread,
Mar 19, 2019, 11:55:55 AM3/19/19
to odata4j-discuss
Also, if i switch uri to 

Then I get

Exception in thread "main" java.lang.UnsupportedOperationException
at org.odata4j.format.xml.EdmxFormatParser.parseMetadata(EdmxFormatParser.java:87)
at org.odata4j.consumer.AbstractODataClient.getMetadata(AbstractODataClient.java:44)
at org.odata4j.consumer.AbstractODataConsumer$CachedEdmDataServices.refreshDelegate(AbstractODataConsumer.java:212)
at org.odata4j.consumer.AbstractODataConsumer$CachedEdmDataServices.getDelegate(AbstractODataConsumer.java:205)
at org.odata4j.internal.EdmDataServicesDecorator.findEdmEntitySet(EdmDataServicesDecorator.java:46)
at org.odata4j.consumer.AbstractODataConsumer$CachedEdmDataServices.findEdmEntitySet(AbstractODataConsumer.java:221)
at org.odata4j.consumer.AbstractODataConsumer.getFeedCustomizationMapping(AbstractODataConsumer.java:235)
at org.odata4j.consumer.AbstractODataConsumer.getEntities(AbstractODataConsumer.java:73)
at org.odata4j.consumer.AbstractODataConsumer.getEntities(AbstractODataConsumer.java:69)
at Tester.main(Tester.java:16)

Ralf Handl

unread,
Mar 20, 2019, 6:48:02 AM3/20/19
to odata4j-discuss
Hi Francisco,

odata4j to my knowledge is no longer maintained, there has been no traffic in this group during the last 18 months.

Olingo on the other hand is an actively maintained Java library for OData, so I suggest you look into it instead: http://olingo.apache.org/

Kind regards
Ralf

Francisco Amores Torres

unread,
Mar 25, 2019, 10:43:35 AM3/25/19
to odata4j...@googlegroups.com
thanks!

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


--
Francisco Amores Torres
Reply all
Reply to author
Forward
0 new messages