WojciechZankowski / iextrading4j

IEX Cloud open source API wrapper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IllegalStateException

hpdrago opened this issue · comments

Summary

Hi Woj,

I am getting this error now getting a quote.

java.lang.IllegalStateException: MessageBodyReader not found for media type=text/html; charset=utf-8, type=class pl.zankowski.iextrading4j.api.stocks.Quote, genericType=class pl.zankowski.iextrading4j.api.stocks.Quote.
at pl.zankowski.iextrading4j.client.rest.manager.RestManager.executeRequest(RestManager.java:41)
at pl.zankowski.iextrading4j.client.rest.AbstractRestEndpoint.execute(AbstractRestEndpoint.java:16)
at pl.zankowski.iextrading4j.client.rest.endpoint.GenericRestEndpoint.executeRequest(GenericRestEndpoint.java:14)
at pl.zankowski.iextrading4j.client.IEXTradingClient.executeRequest(IEXTradingClient.java:35)
at com.stocktracker.servicelayer.stockinformationprovider.IEXTradingStockService.getIEXTradingQuote(IEXTradingStockService.java:57)
at com.stocktracker.servicelayer.stockinformationprovider.IEXTradingStockService.getStockTickerQuote(IEXTradingStockService.java:38)
at com.stocktracker.servicelayer.stockinformationprovider.StockQuoteServiceExecutor.getQuoteFromIEXTrading(StockQuoteServiceExecutor.java:186)
at com.stocktracker.servicelayer.stockinformationprovider.StockQuoteServiceExecutor.asynchronousGetStockQuote(StockQuoteServiceExecutor.java:53)
at com.stocktracker.servicelayer.stockinformationprovider.StockQuoteServiceExecutor$$FastClassBySpringCGLIB$$3cc405ee.invoke()
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.aop.interceptor.AsyncExecutionInterceptor$1.call(AsyncExecutionInterceptor.java:115)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.glassfish.jersey.message.internal.MessageBodyProviderNotFoundException: MessageBodyReader not found for media type=text/html; charset=utf-8, type=class pl.zankowski.iextrading4j.api.stocks.Quote, genericType=class pl.zankowski.iextrading4j.api.stocks.Quote.
at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$TerminalReaderInterceptor.aroundReadFrom(ReaderInterceptorExecutor.java:173)
at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor.proceed(ReaderInterceptorExecutor.java:134)
at org.glassfish.jersey.message.internal.MessageBodyFactory.readFrom(MessageBodyFactory.java:988)
at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:833)
at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:795)
at org.glassfish.jersey.client.InboundJaxrsResponse.readEntity(InboundJaxrsResponse.java:102)
at org.glassfish.jersey.client.ScopedJaxrsResponse.access$101(ScopedJaxrsResponse.java:56)
at org.glassfish.jersey.client.ScopedJaxrsResponse$2.call(ScopedJaxrsResponse.java:87)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:228)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:397)
at org.glassfish.jersey.client.ScopedJaxrsResponse.readEntity(ScopedJaxrsResponse.java:84)
at pl.zankowski.iextrading4j.client.rest.manager.RestManager.executeRequest(RestManager.java:38)
... 16 common frames omitted

Details

Date/time of issue

What you expected to happen

What actually happened

Other Information (sample code, links, etc.)

This happens on version 2.0.1 and I tried the latest 2.1.1 and both have the same issues.

Hey,

My best guess is that no symbol or bad symbol has been provided, but I would need to have more details to confirm it.

Look what happens when you call their API with 'null' symbol:

https://api.iextrading.com/1.0/stock/null/quote

We get 'Unknown symbol' text which obviously cannot be parsed into Quote object.

Different story is that I should have provide some error handling into library. I will definietly do it soon.

Cheers,

Wojtek

Great, no problem!