Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-4305

FIQL only gives nullpointerexception. @Context SearchContext does not seem to work.

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.5.2, 2.5.3
    • 2.4.8, 2.5.4, 2.6.1
    • JAX-RS
    • None
    • Tomcat 6.0.30
      Spring 3.1.1
      Windows Vista

    • Unknown

    Description

      I tried using FIQL in version 2.5.2 and 2.5.3. I cant get "@Context SearchContext searchContext" to work. It is just null. I tried putting it as instance variable and method parameter with no success.

      I tried different queries, here is one: http://localhost:8080/testFiql/testFiql?_s=name==hello

      The exception I get:
      org.apache.cxf.interceptor.Fault
      at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:155)
      at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:121)
      at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:167)
      at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:94)
      at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
      at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106)
      at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
      at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:123)
      at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:207)
      at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:213)
      at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:154)
      at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:128)
      at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:185)
      at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:113)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
      at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:164)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
      at java.lang.Thread.run(Thread.java:662)
      Caused by: java.lang.NullPointerException
      at com.gustav.test.SearchTestFiql.testFiqlSearch(SearchTestFiql.java:20)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:173)
      at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:89)

      testFiql.java:
      package com.gustav.test;
      import javax.ws.rs.Path;
      import javax.ws.rs.core.Context;

      import org.apache.cxf.jaxrs.ext.search.SearchCondition;
      import org.apache.cxf.jaxrs.ext.search.SearchContext;
      import org.springframework.stereotype.Service;

      @Service("testFiql")
      @Path("/")
      public class SearchTestFiql {

      // @Context
      // private SearchContext searchContext;

      @Path("testFiql")
      public void testFiqlSearch(@Context SearchContext searchContext)

      { System.out.println("Entering testFiqlSearch"); SearchCondition<String> sc = searchContext.getCondition(String.class); System.out.println("Search conditions: " + sc.getSearchConditions()); System.out.println("Exiting testFiqlSearch"); }

      }

      Please tell me if I can provide any more information which might help.
      I would gladly provide the entire Eclipse Maven project if I knew a way to attach it.

      Best regards,
      Gustav

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            sergey_beryozkin Sergey Beryozkin
            gussoh Gustav Sohtell
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment