Simple EJB Integration with JSON

Help
2009-09-25
2013-06-06
  • I am trying a simple EJB integration sample using resteasy.

    I have the below method
    @Produces("application/json")
    @BadgerFish
    @Path("/findPersonByName/{name}")
    public Person findPersonByName(@PathParam("name") String name) {
        System.out.println("reached the method");
        return constructSamplePerson();
    }

    when I try to access this method I am getting the below exception. Could you please let me know what I've done wrong?

    08:05:05,281 ERROR  Failed executing GET /person/findPersonByName
    org.jboss.resteasy.spi.LoggableFailure: content-type was null and expecting to extract a b
    ody
            at org.jboss.resteasy.core.MessageBodyParameterInjector.inject(MessageBodyParamete
    rInjector.java:58)
            at org.jboss.resteasy.core.MethodInjectorImpl.injectArguments(MethodInjectorImpl.j
    ava:93)
            at org.jboss.resteasy.core.ResourceLocator.createResource(ResourceLocator.java:64)

            at org.jboss.resteasy.core.ResourceLocator.createResource(ResourceLocator.java:57)

            at org.jboss.resteasy.core.ResourceLocator.invoke(ResourceLocator.java:94)
            at org.jboss.resteasy.core.DispatcherUtilities.getJaxrsResponse(DispatcherUtilitie
    s.java:142)
            at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java
    :356)
            at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java
    :173)
            at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpSer
    vletDispatcher.java:93)
            at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpSer
    vletDispatcher.java:68)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFil
    terChain.java:290)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain
    .java:206)
            at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:
    96)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFil
    terChain.java:235)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain
    .java:206)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
    235)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
    191)
            at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociati
    onValve.java:190)
            at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)

            at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(Securit
    yContextEstablishmentValve.java:126)
            at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(Security
    ContextEstablishmentValve.java:70)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
            at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionV
    alve.java:158)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:10
    9)
            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
            at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
            at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11P
    rotocol.java:598)
            at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
            at java.lang.Thread.run(Thread.java:619)