Hi,
I believe I've fixed the issue, I was able to get ResourceInfo injected and reporting the correct class and method name.
See the fix at [1], can you try it please ?

You mentioned ResourceInfo.getResource returning null, that can happen in a PreMatch ContainerRequestFilter. What kind of filter do you use ?

Re RequestContext: not sure where NPE is coming from, perhaps it was related to a ThreadLocalProxy issue, can you retry ? I was able to use RequestContext to initialize a subresource (it is supposed to be used with subresources only). I've found a minor issue with it (late context value injection), something I will fix

Cheers, Sergey

[1] https://issues.apache.org/jira/browse/CXF-5860

On 08/07/14 10:49, Sergey Beryozkin wrote:
Hi

I've reproduced the issue and am looking into it

Cheers, Sergey
On 07/07/14 09:15, Krzysztof Nowicki wrote:
Hi,

That was also my first thought that package is not exported but when I
checked it seems that export packages are correct:

Exported Packages    org.apache.cxf.jaxrs,version=3.0.0
org.apache.cxf.jaxrs.blueprint,version=3.0.0
org.apache.cxf.jaxrs.ext,version=3.0.0
org.apache.cxf.jaxrs.ext.multipart,version=3.0.0
org.apache.cxf.jaxrs.ext.xml,version=3.0.0
org.apache.cxf.jaxrs.impl,version=3.0.0
org.apache.cxf.jaxrs.impl.tl
<http://org.apache.cxf.jaxrs.impl.tl>,version=3.0.0
org.apache.cxf.jaxrs.interceptor,version=3.0.0
org.apache.cxf.jaxrs.lifecycle,version=3.0.0
org.apache.cxf.jaxrs.model,version=3.0.0
org.apache.cxf.jaxrs.provider,version=3.0.0
org.apache.cxf.jaxrs.security,version=3.0.0
org.apache.cxf.jaxrs.servlet,version=3.0.0
org.apache.cxf.jaxrs.spring,version=3.0.0
org.apache.cxf.jaxrs.utils,version=3.0.0
org.apache.cxf.jaxrs.utils.multipart,version=3.0.0
org.apache.cxf.jaxrs.utils.schemas,version=3.0.0
org.apache.cxf.jaxrs.validation,version=3.0.0



Do you have any ideas what else I can try ?

Cheers,

Krzysztof Nowicki



2014-07-06 22:51 GMT+02:00 Sergey Beryozkin <[email protected]
<mailto:[email protected]>>:

    Hi,
    We have tests where ResourceInfo is injected.
    The problem is that in OSGI it is not visible to it not being
exported.
    Rather than modifying the code, can you experiment with updating the
    Export-Package instruction in the pom.xml ?

    Cheers, Sergey


    On 05/07/14 11:05, Krzysztof Nowicki wrote:

        Hi,

        So I suppose that there is a bug in InjectionUtils class, the
jsr339
        classloader is used for new ThreadLocalProxy so changed a
little bit
           implementation:

        ClassLoader classLoader =
        ThreadLocalProxy.class.__isAssignableFrom(type)
        ? type
                             .getClassLoader() :
        ThreadLocalProxy.class.__getClassLoader();
                      return (ThreadLocalProxy<T>) Proxy
                              .newProxyInstance(classLoader, new
        Class[]{type,
        ThreadLocalProxy.class},
                                      new
        ThreadLocalInvocationHandler<__T>());

        After this I was able to inject ResourceInfo or ResourceContext
        classes,
        but overall it didn't resolve my problem which is determine
target
        Method in filter.

        ResourceInfo after injection was null.

        Also tried this:


JAXRSUtils.getCurrentMessage()__.getExchange().get(__OperationResourceInfo.class)

        but it's also null.

        When I tried to use ResourceContext then in runtime I got:

        java.lang.NullPointerException
        at

org.apache.cxf.jaxrs.impl.__ResourceContextImpl.<init>(__ResourceContextImpl.java:36)[__90:org.apache.cxf.cxf-rt-__frontend-jaxrs:3.0.0]

        at

org.apache.cxf.jaxrs.utils.__JAXRSUtils.createContextValue(__JAXRSUtils.java:1076)[90:org.__apache.cxf.cxf-rt-frontend-__jaxrs:3.0.0]

        at

org.apache.cxf.jaxrs.utils.__InjectionUtils.__injectContextFields(__InjectionUtils.java:977)[90:__org.apache.cxf.cxf-rt-__frontend-jaxrs:3.0.0]

        at

org.apache.cxf.jaxrs.utils.__InjectionUtils.injectContexts(__InjectionUtils.java:946)[90:__org.apache.cxf.cxf-rt-__frontend-jaxrs:3.0.0]

        at

org.apache.cxf.jaxrs.utils.__JAXRSUtils.__runContainerRequestFilters(__JAXRSUtils.java:1626)[90:org.__apache.cxf.cxf-rt-frontend-__jaxrs:3.0.0]

        at

org.apache.cxf.jaxrs.__interceptor.__JAXRSInInterceptor.__processRequest(__JAXRSInInterceptor.java:104)[__90:org.apache.cxf.cxf-rt-__frontend-jaxrs:3.0.0]

        at

org.apache.cxf.jaxrs.__interceptor.__JAXRSInInterceptor.__handleMessage(__JAXRSInInterceptor.java:76)[__90:org.apache.cxf.cxf-rt-__frontend-jaxrs:3.0.0]

        at

org.apache.cxf.phase.__PhaseInterceptorChain.__doIntercept(__PhaseInterceptorChain.java:__307)[91:org.apache.cxf.cxf-__core:3.0.0]

        at

org.apache.cxf.transport.__ChainInitiationObserver.__onMessage(__ChainInitiationObserver.java:__121)[91:org.apache.cxf.cxf-__core:3.0.0]

        at

org.apache.cxf.transport.http.__AbstractHTTPDestination.__invoke(__AbstractHTTPDestination.java:__243)[96:org.apache.cxf.cxf-rt-__transports-http:3.0.0]

        at

org.apache.cxf.transport.__servlet.ServletController.__invokeDestination(__ServletController.java:223)[__96:org.apache.cxf.cxf-rt-__transports-http:3.0.0]

        at

org.apache.cxf.transport.__servlet.ServletController.__invoke(ServletController.java:__197)[96:org.apache.cxf.cxf-rt-__transports-http:3.0.0]

        at

org.apache.cxf.transport.__servlet.ServletController.__invoke(ServletController.java:__149)[96:org.apache.cxf.cxf-rt-__transports-http:3.0.0]

        at

org.apache.cxf.transport.__servlet.CXFNonSpringServlet.__invoke(CXFNonSpringServlet.__java:171)[96:org.apache.cxf.__cxf-rt-transports-http:3.0.0]

        at

org.apache.cxf.transport.__servlet.AbstractHTTPServlet.__handleRequest(__AbstractHTTPServlet.java:286)[__96:org.apache.cxf.cxf-rt-__transports-http:3.0.0]

        at

org.apache.cxf.transport.__servlet.AbstractHTTPServlet.__doGet(AbstractHTTPServlet.__java:211)[96:org.apache.cxf.__cxf-rt-transports-http:3.0.0]

        at

javax.servlet.http.__HttpServlet.service(__HttpServlet.java:575)[102:org.__apache.geronimo.specs.__geronimo-servlet_3.0_spec:1.0]

        at

org.apache.cxf.transport.__servlet.AbstractHTTPServlet.__service(AbstractHTTPServlet.__java:262)[96:org.apache.cxf.__cxf-rt-transports-http:3.0.0]

        at

org.eclipse.jetty.servlet.__ServletHolder.handle(__ServletHolder.java:684)[222:__org.eclipse.jetty.aggregate.__jetty-all-server:8.1.14.__v20131031]

        at

org.eclipse.jetty.servlet.__ServletHandler.doHandle(__ServletHandler.java:501)[222:__org.eclipse.jetty.aggregate.__jetty-all-server:8.1.14.__v20131031]

        at

org.ops4j.pax.web.service.__jetty.internal.__HttpServiceServletHandler.__doHandle(__HttpServiceServletHandler.__java:69)[232:org.ops4j.pax.__web.pax-web-jetty:3.1.0]

        at

org.eclipse.jetty.server.__handler.ScopedHandler.handle(__ScopedHandler.java:137)[222:__org.eclipse.jetty.aggregate.__jetty-all-server:8.1.14.__v20131031]

        at

org.eclipse.jetty.security.__SecurityHandler.handle(__SecurityHandler.java:557)[222:__org.eclipse.jetty.aggregate.__jetty-all-server:8.1.14.__v20131031]

        at

org.eclipse.jetty.server.__session.SessionHandler.__doHandle(SessionHandler.java:__231)[222:org.eclipse.jetty.__aggregate.jetty-all-server:8.__1.14.v20131031]

        at

org.eclipse.jetty.server.__handler.ContextHandler.__doHandle(ContextHandler.java:__1086)[222:org.eclipse.jetty.__aggregate.jetty-all-server:8.__1.14.v20131031]

        at

org.ops4j.pax.web.service.__jetty.internal.__HttpServiceContext.doHandle(__HttpServiceContext.java:240)[__232:org.ops4j.pax.web.pax-web-__jetty:3.1.0]

        at

org.eclipse.jetty.servlet.__ServletHandler.doScope(__ServletHandler.java:428)[222:__org.eclipse.jetty.aggregate.__jetty-all-server:8.1.14.__v20131031]

        at

org.eclipse.jetty.server.__session.SessionHandler.__doScope(SessionHandler.java:__193)[222:org.eclipse.jetty.__aggregate.jetty-all-server:8.__1.14.v20131031]

        at

org.eclipse.jetty.server.__handler.ContextHandler.__doScope(ContextHandler.java:__1020)[222:org.eclipse.jetty.__aggregate.jetty-all-server:8.__1.14.v20131031]

        at

org.eclipse.jetty.server.__handler.ScopedHandler.handle(__ScopedHandler.java:135)[222:__org.eclipse.jetty.aggregate.__jetty-all-server:8.1.14.__v20131031]

        at

org.ops4j.pax.web.service.__jetty.internal.__JettyServerHandlerCollection.__handle(__JettyServerHandlerCollection.__java:77)[232:org.ops4j.pax.__web.pax-web-jetty:3.1.0]

        at

org.eclipse.jetty.server.__handler.HandlerWrapper.handle(__HandlerWrapper.java:116)[222:__org.eclipse.jetty.aggregate.__jetty-all-server:8.1.14.__v20131031]

        at

org.eclipse.jetty.server.__Server.handle(Server.java:370)__[222:org.eclipse.jetty.__aggregate.jetty-all-server:8.__1.14.v20131031]

        at

org.eclipse.jetty.server.__AbstractHttpConnection.__handleRequest(__AbstractHttpConnection.java:__494)[222:org.eclipse.jetty.__aggregate.jetty-all-server:8.__1.14.v20131031]

        at

org.eclipse.jetty.server.__AbstractHttpConnection.__headerComplete(__AbstractHttpConnection.java:__971)[222:org.eclipse.jetty.__aggregate.jetty-all-server:8.__1.14.v20131031]

        at

org.eclipse.jetty.server.__AbstractHttpConnection$__RequestHandler.headerComplete(__AbstractHttpConnection.java:__1033)[222:org.eclipse.jetty.__aggregate.jetty-all-server:8.__1.14.v20131031]

        at

org.eclipse.jetty.http.__HttpParser.parseNext(__HttpParser.java:644)[222:org.__eclipse.jetty.aggregate.jetty-__all-server:8.1.14.v20131031]

        at

org.eclipse.jetty.http.__HttpParser.parseAvailable(__HttpParser.java:235)[222:org.__eclipse.jetty.aggregate.jetty-__all-server:8.1.14.v20131031]

        at

org.eclipse.jetty.server.__AsyncHttpConnection.handle(__AsyncHttpConnection.java:82)[__222:org.eclipse.jetty.__aggregate.jetty-all-server:8.__1.14.v20131031]

        at

org.eclipse.jetty.io.nio.__SelectChannelEndPoint.handle(__SelectChannelEndPoint.java:__667)[222:org.eclipse.jetty.__aggregate.jetty-all-server:8.__1.14.v20131031]

        at

org.eclipse.jetty.io.nio.__SelectChannelEndPoint$1.run(__SelectChannelEndPoint.java:52)__[222:org.eclipse.jetty.__aggregate.jetty-all-server:8.__1.14.v20131031]

        at

org.eclipse.jetty.util.thread.__QueuedThreadPool.runJob(__QueuedThreadPool.java:608)[__222:org.eclipse.jetty.__aggregate.jetty-all-server:8.__1.14.v20131031]

        at

org.eclipse.jetty.util.thread.__QueuedThreadPool$3.run(__QueuedThreadPool.java:543)[__222:org.eclipse.jetty.__aggregate.jetty-all-server:8.__1.14.v20131031]

        at java.lang.Thread.run(Thread.__java:722)[:1.7.0_06]
        2014-07-04 15:27:08,326 | WARN  | tp1790679978-170 |
        PhaseInterceptorChain            | 91 - org.apache.cxf.cxf-core
        - 3.0.0
        | Exception in handleFault on interceptor

org.apache.cxf.jaxrs.__interceptor.__JAXRSDefaultFaultOutIntercepto__r@5e64b67

        org.apache.cxf.interceptor.__Fault
        at

org.apache.cxf.interceptor.__AbstractFaultChainInitiatorObs__erver.onMessage(__AbstractFaultChainInitiatorObs__erver.java:76)[91:org.apache.__cxf.cxf-core:3.0.0]

        at

org.apache.cxf.phase.__PhaseInterceptorChain.__doIntercept(__PhaseInterceptorChain.java:__371)[91:org.apache.cxf.cxf-__core:3.0.0]

        at

org.apache.cxf.transport.__ChainInitiationObserver.__onMessage(__ChainInitiationObserver.java:__121)[91:org.apache.cxf.cxf-__core:3.0.0]

        at

org.apache.cxf.transport.http.__AbstractHTTPDestination.__invoke(__AbstractHTTPDestination.java:__243)[96:org.apache.cxf.cxf-rt-__transports-http:3.0.0]

        at

org.apache.cxf.transport.__servlet.ServletController.__invokeDestination(__ServletController.java:223)[__96:org.apache.cxf.cxf-rt-__transports-http:3.0.0]

        at

org.apache.cxf.transport.__servlet.ServletController.__invoke(ServletController.java:__197)[96:org.apache.cxf.cxf-rt-__transports-http:3.0.0]

        at

org.apache.cxf.transport.__servlet.ServletController.__invoke(ServletController.java:__149)[96:org.apache.cxf.cxf-rt-__transports-http:3.0.0]

        at

org.apache.cxf.transport.__servlet.CXFNonSpringServlet.__invoke(CXFNonSpringServlet.__java..




        Thanks,

        Krzysztof Nowicki





        2014-07-04 16:42 GMT+02:00 Sergey Beryozkin
        <[email protected] <mailto:[email protected]>
        <mailto:[email protected] <mailto:[email protected]>>>__:


             Hi

             So the problem is here:


              > Caused by: java.lang.____IllegalArgumentException:
interface
              > org.apache.cxf.jaxrs.impl.tl
        <http://org.apache.cxf.jaxrs.impl.tl>
             <http://org.apache.cxf.jaxrs.__impl.tl
        <http://org.apache.cxf.jaxrs.impl.tl>>.__ThreadLocalProxy is not
             visible from class
              > loader
              >          at
        java.lang.reflect.Proxy.____getProxyClass(Proxy.java:373)
              >          at

        java.lang.reflect.Proxy.____newProxyInstance(Proxy.java:____601)


             and we have SpringDM.

             The JAX-RS frontend pom exports 'org.apache.cxf.jaxrs*'

             So I'm not sure why org.apache.cxf.jaxrs.impl.tl
        <http://org.apache.cxf.jaxrs.impl.tl>
             <http://org.apache.cxf.jaxrs.__impl.tl
        <http://org.apache.cxf.jaxrs.impl.tl>>.__ThreadLocalProxy
would not

             be visible :-)

             Dan, do you have an idea why it might be the case ?

             Thanks, Sergey


             On 04/07/14 13:15, Krzysztof Nowicki wrote:

                 Hi,

                 Can you help me with following issue, it occurs when
        I'm trying
                 inject
                 ResourceInfo into filter:

                 Exception in thread "SpringOsgiExtenderThread-116"

        org.springframework.beans.____factory.BeanCreationException:
Error

                 creating
                 bean with name 'oAuthServer': Invocation of init method
        failed;
                 nested
                 exception is


org.apache.cxf.service.____factory.____ServiceConstructionException
                           at


org.springframework.beans.____factory.support.____AbstractAutowireCapableBeanFac____tory.initializeBean(____AbstractAutowireCapableBeanFac____tory.java:1482)

                           at


org.springframework.beans.____factory.support.____AbstractAutowireCapableBeanFac____tory.doCreateBean(____AbstractAutowireCapableBeanFac____tory.java:521)

                           at


org.springframework.beans.____factory.support.____AbstractAutowireCapableBeanFac____tory.createBean(____AbstractAutowireCapableBeanFac____tory.java:458)

                           at


org.springframework.beans.____factory.support.____AbstractBeanFactory$1.____getObject(AbstractBeanFactory.____java:295)

                           at


org.springframework.beans.____factory.support.____DefaultSingletonBeanRegistry.____getSingleton(____DefaultSingletonBeanRegistry.____java:223)

                           at


org.springframework.beans.____factory.support.____AbstractBeanFactory.doGetBean(____AbstractBeanFactory.java:__292)

                           at


org.springframework.beans.____factory.support.____AbstractBeanFactory.getBean(____AbstractBeanFactory.java:194)

                           at


org.springframework.beans.____factory.support.____DefaultListableBeanFactory.____preInstantiateSingletons(____DefaultListableBeanFactory.____java:628)

                           at


org.springframework.context.____support.____AbstractApplicationContext.____finishBeanFactoryInitializatio____n(__AbstractApplicationContext.____java:932)

                           at


org.springframework.osgi.____context.support.____AbstractDelegatedExecutionAppl____icationContext.access$1600(______AbstractDelegatedExecutionAppl____icationContext.java:69)

                           at


org.springframework.osgi.____context.support.____AbstractDelegatedExecutionAppl____icationContext$4.run(____AbstractDelegatedExecutionAppl____icationContext.java:355)

                           at


org.springframework.osgi.util.____internal.PrivilegedUtils.____executeWithCustomTCCL(____PrivilegedUtils.java:85)

                           at


org.springframework.osgi.____context.support.____AbstractDelegatedExecutionAppl____icationContext.____completeRefresh(____AbstractDelegatedExecutionAppl____icationContext.java:320)

                           at


org.springframework.osgi.____extender.internal.____dependencies.startup.____DependencyWaiterApplicationCon____textExecutor$____CompleteRefreshTask.run(____DependencyWaiterApplicationCon____textExecutor.java:132)

                           at java.lang.Thread.run(Thread.____java:722)
                 Caused by:


org.apache.cxf.service.____factory.____ServiceConstructionException
                           at


org.apache.cxf.jaxrs.____JAXRSServerFactoryBean.create(____JAXRSServerFactoryBean.java:____210)

                           at

        sun.reflect.____NativeMethodAccessorImpl.____invoke0(Native
Method)
                           at


sun.reflect.____NativeMethodAccessorImpl.____invoke(____NativeMethodAccessorImpl.java:____57)

                           at


sun.reflect.____DelegatingMethodAccessorImpl.____invoke(____DelegatingMethodAccessorImpl.____java:43)

                           at
        java.lang.reflect.Method.____invoke(Method.java:601)
                           at


org.springframework.beans.____factory.support.____AbstractAutowireCapableBeanFac____tory.invokeCustomInitMethod(______AbstractAutowireCapableBeanFac____tory.java:1608)

                           at


org.springframework.beans.____factory.support.____AbstractAutowireCapableBeanFac____tory.invokeInitMethods(____AbstractAutowireCapableBeanFac____tory.java:1549)

                           at


org.springframework.beans.____factory.support.____AbstractAutowireCapableBeanFac____tory.initializeBean(____AbstractAutowireCapableBeanFac____tory.java:1479)

                           ... 14 more
                 Caused by: java.lang.____IllegalArgumentException:
        interface
        org.apache.cxf.jaxrs.impl.tl
<http://org.apache.cxf.jaxrs.impl.tl>
                 <http://org.apache.cxf.jaxrs.__impl.tl
        <http://org.apache.cxf.jaxrs.impl.tl>>.__ThreadLocalProxy is not
                 visible from class
                 loader
                           at
        java.lang.reflect.Proxy.____getProxyClass(Proxy.java:373)
                           at

        java.lang.reflect.Proxy.____newProxyInstance(Proxy.java:____601)
                           at


org.apache.cxf.jaxrs.utils.____InjectionUtils.____createThreadLocalProxy(____InjectionUtils.java:975)

                           at


org.apache.cxf.jaxrs.model.____AbstractResourceInfo.____getFieldThreadLocalProxy(____AbstractResourceInfo.java:142)

                           at


org.apache.cxf.jaxrs.model.____AbstractResourceInfo.____findContextFields(____AbstractResourceInfo.java:124)

                           at


org.apache.cxf.jaxrs.model.____AbstractResourceInfo.____findContexts(____AbstractResourceInfo.java:82)

                           at


org.apache.cxf.jaxrs.model.____AbstractResourceInfo.<init>(____AbstractResourceInfo.java:76)

                           at


org.apache.cxf.jaxrs.model.____ProviderInfo.<init>(____ProviderInfo.java:38)

                           at


org.apache.cxf.jaxrs.model.____ProviderInfo.<init>(____ProviderInfo.java:32)

                           at


org.apache.cxf.jaxrs.provider.____ProviderFactory.____prepareProviders(____ProviderFactory.java:1242)

                           at


org.apache.cxf.jaxrs.provider.____ServerProviderFactory.____setProviders(____ServerProviderFactory.java:____216)

                           at


org.apache.cxf.jaxrs.provider.____ProviderFactory.____setUserProviders(____ProviderFactory.java:766)

                           at


org.apache.cxf.jaxrs.____AbstractJAXRSFactoryBean.____setupFactory(____AbstractJAXRSFactoryBean.java:____322)

                           at


org.apache.cxf.jaxrs.____JAXRSServerFactoryBean.____setupFactory(____JAXRSServerFactoryBean.java:____228)

                           at


org.apache.cxf.jaxrs.____JAXRSServerFactoryBean.create(____JAXRSServerFactoryBean.java:____173)


                           ... 21 more


                 Thanks,

                 Krzysztof Nowicki



             --
             Sergey Beryozkin

             Talend Community Coders
        http://coders.talend.com/

             Blog: http://sberyozkin.blogspot.com




    --
    Sergey Beryozkin

    Talend Community Coders
    http://coders.talend.com/

    Blog: http://sberyozkin.blogspot.com





Reply via email to