OSLC / lyo-samples

I downloaded OSLC / lyo-samples and the project built fine using maven. When I try to run CMSample. I get: “MessageBodyReader not found for media type=text/html;charset=UTF-8, type=class org.eclipse.lyo.oslc4j.core.model.ServiceProviderCatalog” I was expecting Content-type = application/xml? ideas?

Jun 21, 2023 2:44:02 PM org.eclipse.lyo.samples.client.CMSample main
SEVERE: MessageBodyReader not found for media type=text/html;charset=UTF-8, type=class org.eclipse.lyo.oslc4j.core.model.ServiceProviderCatalog, genericType=class org.eclipse.lyo.oslc4j.core.model.ServiceProviderCatalog.
org.glassfish.jersey.message.internal.MessageBodyProviderNotFoundException: MessageBodyReader not found for media type=text/html;charset=UTF-8, type=class org.eclipse.lyo.oslc4j.core.model.ServiceProviderCatalog, genericType=class org.eclipse.lyo.oslc4j.core.model.ServiceProviderCatalog.
at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$TerminalReaderInterceptor.aroundReadFrom(ReaderInterceptorExecutor.java:208)
at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor.proceed(ReaderInterceptorExecutor.java:132)
at org.glassfish.jersey.message.internal.MessageBodyFactory.readFrom(MessageBodyFactory.java:1072)
at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:885)
at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:819)
at org.glassfish.jersey.client.ClientResponse.readEntity(ClientResponse.java:298)
at org.glassfish.jersey.client.InboundJaxrsResponse$1.call(InboundJaxrsResponse.java:93)
at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
at org.glassfish.jersey.internal.Errors.process(Errors.java:205)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:365)
at org.glassfish.jersey.client.InboundJaxrsResponse.runInScopeIfPossible(InboundJaxrsResponse.java:244)
at org.glassfish.jersey.client.InboundJaxrsResponse.readEntity(InboundJaxrsResponse.java:90)
at org.eclipse.lyo.client.OslcClient.lookupServiceProviderUrl(OslcClient.java:443)
at org.eclipse.lyo.samples.client.CMSample.main(CMSample.java:121)

I assuming you are talking about this code

The error seems to be related to the response you are getting from the server. either
(a) the content-type is not being set (or set to the wrong type “text/html”) at the client. OR
(b) the server is not handling the “application/rdf+xml” content-type in the header. It is returning htlm, which the client was not expecting.

I suspect it is (b). If you debug/step into the problematic OslcClient::lookupServiceProviderUrl() you can see that it will default to “application/rdf+xml”.

What server are you dealing with? Can you debug on the other end to see what it receive as headers?

The OSLC Server is PTC’s Windchill. I am trying to use (lyo-samples/lyo-client-samples/src/main/java/org/eclipse/lyo/samples/client/CMSample.java at master · OSLC/lyo-samples · GitHub) to access it.

Here are my parameters below:

-catalogURL https://pdmlink.ptc.com/Windchill/oslc/catalog
-user Username
-password "mypassword"
-providerTitle "OSLC Environment (CM)"

When I use the browser to access the catalog URL (no username or password) the catalog is returned (in the body) with response header: Content-Type application/rdf+xml;charset=UTF-8.

I am thinking it some type of text error message coming back from the server. I will have to dig deeper.

Thanks for your response,

Peter.

How about using Postman to send the request as the CMSample does (with user/pass & expected headers)?
This helps isolate whether the problem is on the server or client side.

1 Like

From CMSample.java#L49-L50 :

This will not run against any CM server that requires authentication. Use with the
eclipse/Lyo sample CM servers.

I have no idea why the class accepts username/password but keeps the old notice. I think we added Basic auth support when we required Basic auth on OSLC RefImpl sample servers. But the second part of the warning still stands, as we didn’t test that code with any other OSLC Server.

Response type=text/html is consistent with a 401 auth response page. Are you sure Windchill is supposed to support plain Basic auth?