0
나는 데이터베이스에 이미지를 저장하려고하지만 오류 얻을 : 온라인에 대한잭슨 방울 예외
@Override
public void createPostImage(Request request) {
try {
ObjectMapper mapper = new ObjectMapper();
Post createPostImage = mapper.readValue(request.body(), Post.class);
System.out.println("CREATE POST IMAGE" + createPostImage);
} catch (IOException ex) {
Logger.getLogger(PostServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
}
}
모습 :
org.codehaus.jackson.map.JsonMappingException: Can not construct instance of java.sql.Blob, problem: abstract types can only be instantiated with additional type information
at [Source: [email protected]; line: 1, column: 27] (through reference chain: com.soul.seeker.models.Post["postImage"])
at org.codehaus.jackson.map.JsonMappingException.from(JsonMappingException.java:163)
at org.codehaus.jackson.map.deser.StdDeserializationContext.instantiationException(StdDeserializationContext.java:233)
at org.codehaus.jackson.map.deser.AbstractDeserializer.deserialize(AbstractDeserializer.java:60)
at org.codehaus.jackson.map.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:299)
at org.codehaus.jackson.map.deser.SettableBeanProperty$MethodProperty.deserializeAndSet(SettableBeanProperty.java:414)
at org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:697)
at org.codehaus.jackson.map.deser.BeanDeserializer.deserialize(BeanDeserializer.java:580)
at org.codehaus.jackson.map.ObjectMapper._readMapAndClose(ObjectMapper.java:2732)
at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1863)
at com.soul.seeker.serviceImpl.PostServiceImpl.createPostImage(PostServiceImpl.java:121)
at com.soul.seeker.Application.lambda$main$8(Application.java:142)
at spark.ResponseTransformerRouteImpl$1.handle(ResponseTransformerRouteImpl.java:47)
at spark.http.matching.Routes.execute(Routes.java:61)
at spark.http.matching.MatcherFilter.doFilter(MatcherFilter.java:130)
at spark.embeddedserver.jetty.JettyHandler.doHandle(JettyHandler.java:50)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:189)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:119)
at org.eclipse.jetty.server.Server.handle(Server.java:517)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:308)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:242)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:261)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:75)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:213)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:147)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)
at java.lang.Thread.run(Thread.java:745)
뽀조 클래스 :
public class Post{
private String post_id;
private String title;
private String details;
private String username;
private String userImage;
private String url;
private List categories;
private String created_at;
private Blob postImage; //BLOB TYPE
private String postImageName;
//getters setters
}
구현 클래스를 유사한 게시물을 찾을 수 있지만 리드를 찾을 수 없습니다. 이 문제를 어떻게 해결할 수 있습니까? 그것은 abstract types can only be instantiated with additional type information
라고합니다. 여기에 전달해야하는 추가 정보는 무엇입니까?
그리고 나는 Post 클래스에'java.sql.Blob' 타입의 것이 있는지 생각하고 있는지 확인하고있다. – Yevgeniy