public class DummyHandler implements DummyService {
public Map foo() {
Map<Integer, String> hmap = new HashMap<Integer, String>();
hmap.put(1, "one");
return hmap;
}
}
Server:
public static void main(String [] args) {
try {
ThriftServiceProcessor processor = new ThriftServiceProcessor(new ThriftCodecManager(), Arrays.<ThriftEventHandler>asList(), new DummyHandler());
ThriftServer server = new ThriftServer(processor, new ThriftServerConfig().setPort(8899));
server.start();
}
catch (Exception x) {
x.printStackTrace();
}
}
When I run the server I get the following stack trace:
java.lang.IllegalArgumentException: Type can not be coerced to a Thrift type: K
at com.facebook.swift.codec.metadata.ThriftCatalog.buildThriftTypeInternal(ThriftCatalog.java:350)
at com.facebook.swift.codec.metadata.ThriftCatalog.buildThriftType(ThriftCatalog.java:246)
at com.facebook.swift.codec.metadata.ThriftCatalog.getThriftTypeReference(ThriftCatalog.java:426)
at com.facebook.swift.codec.metadata.ThriftCatalog.getMapKeyThriftTypeReference(ThriftCatalog.java:394)
at com.facebook.swift.codec.metadata.ThriftCatalog.buildThriftTypeInternal(ThriftCatalog.java:318)
at com.facebook.swift.codec.metadata.ThriftCatalog.buildThriftType(ThriftCatalog.java:246)
at com.facebook.swift.codec.metadata.ThriftCatalog.getThriftType(ThriftCatalog.java:234)
at com.facebook.swift.service.metadata.ThriftMethodMetadata.(ThriftMethodMetadata.java:92)
at com.facebook.swift.service.metadata.ThriftServiceMetadata.(ThriftServiceMetadata.java:73)
at com.facebook.swift.service.ThriftServiceProcessor.(ThriftServiceProcessor.java:78)
at com.facebook.swift.service.ThriftServiceProcessor.(ThriftServiceProcessor.java:67)
at com.bidtheatre.swift.MultiplicationServer.main(MultiplicationServer.java:15)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
I'm having problems using HashMap with Swift.
Interface:
Handler:
Server:
When I run the server I get the following stack trace: java.lang.IllegalArgumentException: Type can not be coerced to a Thrift type: K at com.facebook.swift.codec.metadata.ThriftCatalog.buildThriftTypeInternal(ThriftCatalog.java:350) at com.facebook.swift.codec.metadata.ThriftCatalog.buildThriftType(ThriftCatalog.java:246) at com.facebook.swift.codec.metadata.ThriftCatalog.getThriftTypeReference(ThriftCatalog.java:426) at com.facebook.swift.codec.metadata.ThriftCatalog.getMapKeyThriftTypeReference(ThriftCatalog.java:394) at com.facebook.swift.codec.metadata.ThriftCatalog.buildThriftTypeInternal(ThriftCatalog.java:318) at com.facebook.swift.codec.metadata.ThriftCatalog.buildThriftType(ThriftCatalog.java:246) at com.facebook.swift.codec.metadata.ThriftCatalog.getThriftType(ThriftCatalog.java:234) at com.facebook.swift.service.metadata.ThriftMethodMetadata.(ThriftMethodMetadata.java:92)
at com.facebook.swift.service.metadata.ThriftServiceMetadata.(ThriftServiceMetadata.java:73)
at com.facebook.swift.service.ThriftServiceProcessor.(ThriftServiceProcessor.java:78)
at com.facebook.swift.service.ThriftServiceProcessor.(ThriftServiceProcessor.java:67)
at com.bidtheatre.swift.MultiplicationServer.main(MultiplicationServer.java:15)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Ay idea what's going on?