cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: cxf 3.0.0 issue
Date Sun, 06 Jul 2014 20:51:51 GMT
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.JAXRSDefaultFaultOutInterceptor@5e64b67
> org.apache.cxf.interceptor.Fault
> at
> org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.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 <sberyozkin@gmail.com
> <mailto:sberyozkin@gmail.com>>:
>
>     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>.__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>.__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>.__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

Mime
View raw message