Skip to content
This repository was archived by the owner on May 1, 2025. It is now read-only.
This repository was archived by the owner on May 1, 2025. It is now read-only.

Receiving error: RESTEASY003145: Unable to find a MessageBodyReader #33

Description

@b-m-r

I created a API key and set it as variable in the IDE. If I now try the to access anything with the Onshape Client I receive following Error:

Exception in thread "main" javax.ws.rs.ProcessingException: RESTEASY003145: Unable to find a MessageBodyReader of content-type application/vnd.onshape.v1+json;charset=UTF-8 and type class java.io.InputStream
	at org.jboss.resteasy.core.interception.ClientReaderInterceptorContext.throwReaderNotFound(ClientReaderInterceptorContext.java:37)
	at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.getReader(AbstractReaderInterceptorContext.java:80)
	at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.proceed(AbstractReaderInterceptorContext.java:53)
	at com.onshape.api.base.CompressionReaderInterceptor.aroundReadFrom(CompressionReaderInterceptor.java:47)
	at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.proceed(AbstractReaderInterceptorContext.java:59)
	at org.jboss.resteasy.client.jaxrs.internal.ClientResponse.readFrom(ClientResponse.java:211)
	at org.jboss.resteasy.specimpl.BuiltResponse.readEntity(BuiltResponse.java:89)
	at org.jboss.resteasy.specimpl.AbstractBuiltResponse.readEntity(AbstractBuiltResponse.java:262)
	at com.onshape.api.base.BaseClient.call(BaseClient.java:426)
	at com.onshape.api.requests.DocumentsGetDocumentsRequest$Builder.call(DocumentsGetDocumentsRequest.java:342)
	at ch.bmr.onshape.DocumentTests.main(DocumentTests.java:36)

What am I doing wrong:

public class DocumentTests {
  private static Onshape CLIENT;

  public static void main(String[] args) throws OnshapeException {

    CLIENT = new Onshape();

    String accessKey = System.getenv("ONSHAPE_API_ACCESSKEY");
    String secretKey = System.getenv("ONSHAPE_API_SECRETKEY");
    if ((accessKey == null || accessKey.isEmpty()) || (secretKey == null || secretKey.isEmpty())) {
      throw new OnshapeException("Please define ONSHAPE_API_ACCESSKEY and ONSHAPE_API_SECRETKEY environment variables");
    }
    CLIENT.setAPICredentials(accessKey, secretKey);
    CLIENT.setBaseURL("https://xxx.onshape.com");

    DocumentsGetDocumentsResponse call = CLIENT.documents()
                                               .getDocuments()
                                               .call();
    System.out.println("call = " + call);
    
  }
}

If I change the variable, I receive an unauthorized exception.
Does anybody can help me or write a quick guide how to connection with oauth or api key works? Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions