2016-06-30 12 views
0

私はwebappのために春のMVC &休止を使用しています。 オブジェクトを返す場合はjsonを生成できますが、リストは生成できません。 私が逃したものは何ですか?ジャクソンの部分作業、返すことができませんリスト<Object>またはコレクション<Object>

私はこれにアクセスする場合(1):

{"udId":1,"udTitle":"Mr","udUsername":"username","udFirstname":"firstname","udLastname":"lastname","udGender":"male","udPhoto":"c:/folder/gg.jpg","udPassword":"password","udEmail":"[email protected]","udPhoneHome":"","udPhoneMobile":"","udType":"customer","udLanguage":"ms","udLoginLast":1466875438000,"udLoginCount":0,"udCreateDatetime":1466875438000,"udStatus":2,"bodyMeasures":[{"bmId":1,"bmHeight":171,"bmNeck":null,"bmShoulder":null,"bmArm":null,"bmChest":null,"bmWaist":null,"bmHip":null,"bmInseam":null,"bmThigh":null,"bmCalf":null,"bmFoot":null,"bmHead":null,"bmCreateDatetime":1466875438000,"bodyMeasureHistories":[]}],"addresses":[],"userDetailHistories":[]} 

(2)しかし、私はアクセスする場合は、この:

@ResponseBody 
@RequestMapping("/mobile/userDetails") 
public Collection<UserDetail> generateUserDetailsJson(){ 
    Collection<UserDetail> collection = userDetailService.listUserDetails(); 
    return collection; 
} 

@ResponseBody 
@RequestMapping("/mobile/userDetail") 
public UserDetail generateUserDetailJson(){ 
    return userDetailService.getUserDetail(1); 
} 

結果大丈夫、私はこのJSONリターンを取得します

この例外が発生します。

Info: Hibernate: select this_.ud_id as ud_id1_6_0_, this_.ud_title as ud_title2_6_0_, this_.ud_username as ud_usern3_6_0_, this_.ud_firstname as ud_first4_6_0_, this_.ud_lastname as ud_lastn5_6_0_, this_.ud_gender as ud_gende6_6_0_, this_.ud_photo as ud_photo7_6_0_, this_.ud_password as ud_passw8_6_0_, this_.ud_email as ud_email9_6_0_, this_.ud_phoneHome as ud_phon10_6_0_, this_.ud_phoneMobile as ud_phon11_6_0_, this_.ud_type as ud_type12_6_0_, this_.ud_language as ud_lang13_6_0_, this_.ud_loginLast as ud_logi14_6_0_, this_.ud_loginCount as ud_logi15_6_0_, this_.ud_createDatetime as ud_crea16_6_0_, this_.ud_status as ud_stat17_6_0_ from faddistwardrobedb.user_detail this_ Warning: StandardWrapperValve[dispatcherServlet]: Servlet.service() for servlet dispatcherServlet threw exception java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.ObjectWriter.forType(Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/ObjectWriter; at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.writeInternal(AbstractJackson2HttpMessageConverter.java:264) at org.springframework.http.converter.AbstractGenericHttpMessageConverter.write(AbstractGenericHttpMessageConverter.java:100) at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:225) at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.handleReturnValue(RequestResponseBodyMethodProcessor.java:173) at org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue(HandlerMethodReturnValueHandlerComposite.java:81) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:130) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:344) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) at org.glassfish.tyrus.servlet.TyrusServletFilter.doFilter(TyrusServletFilter.java:295) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176) at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145) at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92) at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:394) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:316) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174) at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:415) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:282) at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167) at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201) at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175) at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235) at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201) at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133) at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112) at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77) at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561) at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545) at java.lang.Thread.run(Thread.java:745) Severe: PWC6117: File "null" not found

私の春の設定ファイルすでにセットアップ:

<mvc:annotation-driven /> 
<tx:annotation-driven /> 

そして、私が使用している春4.3.11

jackson-annotations-2.7.0.jar 

jackson-core-2.7.0.jar 

jackson-databind-2.7.0.jar 

javax.el-2.2.4.jar 

javax.el-api-2.2.4.jar 

エンティティテーブルを休止状態4.3.0 &はすでにジャクソンを設定します。

@Entity 
@Table(name = "body_measure", catalog = "faddistwardrobedb") 
public class BodyMeasure implements java.io.Serializable { 
    @ManyToOne(fetch = FetchType.LAZY) 
    @JsonBackReference 
    @JoinColumn(name = "ud_id") 
    private UserDetail userDetail; 
    //etc.... 
} 

@Entity 
@Table(name = "user_detail", catalog = "faddistwardrobedb") 
public class UserDetail implements java.io.Serializable { 

    @JsonManagedReference 
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "userDetail") 
    //etc..... 
} 

私が逃しているものは何ですか?あるいは、図書館は互いに矛盾しているのだろうか?おかげさまで

+0

警告:StandardWrapperValve [dispatcherServlet]:サーブレットdispatcherServletのServlet.service()が例外java.lang.NoSuchMethodErrorを送出しました:com.fasterxml.jackson.databind.ObjectWriter.forType(Lcom/fasterxml/jackson/databind/JavaType;)は、v2.5以前には存在しなかったので、別のバージョンのjackson-databindが取り込まれていると私に信じています。この方法が必要なv2.7を使っているとします。おそらく起こっていることは、春や冬眠がjackson-databind paulk23

答えて

0

解決策は見つかりましたが、詳細がわからない場合はどうしたらいいですか。 私の解決策: グラスフィッシュ4.1 - >グラスフィッシュ4.1.1 再コンパイルと実行、問題解決。 誰かが同じエラーに直面するのを助けてくれることを願っています。

関連する問題