私は 投稿をすべて通過したので、重複要求とはみなされません。私は答えが見つかりませんでした。コンテンツタイプtext/htmlのMessageBodyReaderを見つけられません。タイプjava.util.Listを入力してください。
問題は次のとおりです。
私は()(メイン内)、スタンドアロンのアプリケーションを介してコード の同じ部分でGET要求を行うことは非常に奇妙な問題に直面しています。これは、同じ コードがwildfly 10サーバー上のJava EEアプリケーションに入れて展開されているかのように、 それはエラーになりますどこに動作
「コンテンツタイプtext/htmlののMessageBodyReaderのを見つけ、 インタフェースのJavaを入力することができません。 util.List」
コード:
ClientConfig configuration = new ClientConfig();
configuration.property(ClientProperties.CONNECT_TIMEOUT, 10000);
configuration.property(ClientProperties.READ_TIMEOUT, 10000);
Client iexRestClient=ClientBuilder.newClient(configuration);
WebTarget webTarget =
iexRestClient.target("https://api.iextrading.com/1.0/ref-data/symbols/");
Response response =
webTarget.request().accept(MediaType.APPLICATION_JSON).get(Response.class);
System.out.println("response status "+response.getStatus());
List<IEXTicker> tickers = response.readEntity(new
GenericType<List<IEXTicker>>(){});
System.out.println("size of tickers "+tickers.size());
必要なJAR(pom.xmlファイル)
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>2.26</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
<version>2.26</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>2.26</version>
</dependency>
Modelクラス:IEX_Ticker.java
@Entity
@Table(name = "IEX_Ticker")
@JsonIgnoreProperties(ignoreUnknown = true)
public class IEXTicker implements Serializable {
private static final long serialVersionUID = 1L;
public IEXTicker() {
super();
}
@Id
@Column(name = "symbol", length = 20)
private String symbol;
@Column(name = "name", length = 500)
private String name;
@Column(name = "date", length = 20)
private String date;
@Column(name = "isEnabled")
private boolean isEnabled;
@Column(name = "type", length = 20)
private String type;
public String getSymbol() {
return symbol;
}
public void setSymbol(String symbol) {
this.symbol = symbol;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public boolean isEnabled() {
return isEnabled;
}
public void setEnabled(boolean isEnabled) {
this.isEnabled = isEnabled;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String toString() {
return "Symbol :" + symbol + " Name : " + name + " Date : " + date + " IsEnabled :
"+isEnabled+" Type:
"+type;
}
}
エラー:
2017年10月31日午後8時32分17秒ERRORの標準エラー出力:71 - javax.ws.rs .ProcessingException:RESTEASY003145:コンテンツタイプtext/htmlのMessageBodyReaderを見つけられず、インタフェースjava.util.Listを入力できない
2017-10-31 20:32:17エラーstderr:71 - javax.ws.rs.ProcessingException: RESTEASY00 3145:コンテンツタイプtext/htmlのMessageBodyReaderを見つけられず、タイプjava.util.Listを入力してください。
2017-10-31 20:32:18エラーstderr:71 - org.jboss.resteasy.core.interception。 ClientReaderInterceptorContext.throwReaderNotFound(ClientReaderInterceptorContext.java:42)
2017年10月31日20時32分18秒ERROR標準エラー:71 - org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.getReaderで(AbstractReaderInterceptorContext.java:75)
2017-10-31 20:32:18 ERROR stderr:71 - at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.proceed(AbstractReaderInterceptorContext.java:52)
2017-10-31 20:32:18エラーstderr :71 - at org.jboss.resteasy.client.jaxrs.internal.ClientResponse.readFrom(ClientResponse.java:251)
2017-10-31 20:32:18エラーstderr:71 - at org.jboss.resteasy.client.jaxrs.internal.ClientResponse.readEntity(ClientResponse.java:181)
2017-10-31 20:32: 18エラーstderr:71 - at org.jboss.resteasy.specimpl.BuiltResponse.readEntity(BuiltResponse.java:225)
2017-10-31 20:32:18エラーstderr:71 - com.swigel.iex.api .IEXTickerOperation.populateIEXTickerData1(IEXTickerOperation.java:127)
2017年10月31日午前20時32分18秒エラー標準エラー:71 - sun.reflect.NativeMethodAccessorImpl.invoke0(ネイティブメソッド)で
2017年10月31日午前20時32分:18 ERROR stderr:71 - sun.reflect.NativeMethodAccessorImpl.invoke(不明なソース)
2017-10-31 20:32:18エラーstderr:71 - sun.reflect.DelegatingMethodAccessorImplで.invoke(Unknown Source)
2017-10-31 20:32:18エラーstderr:71 - java.lang.reflect.Method。呼び出し元(不明なソース)
2017-10-31 20:32:18エラーstderr:71 - org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52)
2017-10-31 20:32:18 ERROR stderr:71 - org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
2017-10-31 20:32:18エラーstderr:71 - org.jboss.invocationで.InterceptorContext $ Invocation.proceed(InterceptorContext.java:437)
2017-10-31 20:32:18エラーstderr:71 - at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:82) )
2017年10月31日20時32分18秒ERROR標準エラー:71 - org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocationで(Jsr299Bindi ngsInterceptor.java:93)
2017年10月31日午前20時32分18秒ERRORの標準エラー出力:71 - org.jboss.as.ee.component.interceptors.UserInterceptorFactory $ 1.processInvocation(UserInterceptorFactory.java:63)
2017で-10-31 20:32:18 ERROR stderr:71 - org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
2017-10-31 20:32:18エラーstderr:71 - org org.jboss.invocation.InterceptorContext.proceed(InterceptorContext .java:340)
2017-10-31 20:32:18エラーstderr:71 - org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBIn vaptInterceptor.java:47)
2017-10-31 20:32:18エラーstderr:71 - org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
2017-10-31 20:32 :18 ERRORの標準エラー出力:71 - org.jboss.invocation.InterceptorContext $ Invocation.proceed(InterceptorContext.java:437)で
2017年10月31日午後08時32分18秒ERRORの標準エラー出力:71 - org.jboss.weldで。 ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:64)
...今
、jsonNodeデータからリストを作成し、私は、XMLを持っていないコードブロック – SLaks
として、あなたのXMLを投稿してください..私は残りの部分からデータを取得したいです終了点 https://api.iextrading.com/1.0/ref-data/symbols/ これはjson値を返しています。私はすでにモデルクラスを追加しています – user2413660
助けてください.. – user2413660