You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Vinicius Carvalho <ja...@gmail.com> on 2009/10/14 04:03:21 UTC
CXF on AppEngine
Hello there! I'm trying to get CXF working on Appengine, but I could
not found a way. I just need to user JAX-RS, and since AppEngine does
not support JAXB I'm using it without any JAXB jars or references.
Here's my beans.xml:
<jaxrs:server id="locationService" address="/location">
<jaxrs:serviceBeans>
<ref bean="myService"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<bean class="org.apache.cxf.jaxrs.provider.AegisElementProvider"/>
<bean class="org.apache.cxf.jaxrs.provider.AegisJSONProvider"/>
</jaxrs:providers>
</jaxrs:server>
I've also modified cxf.xml removing:
<bean id="org.apache.cxf.wsdl.WSDLManager"
class="org.apache.cxf.wsdl11.WSDLManagerImpl">
<property name="bus" ref="cxf"/>
</bean>
<bean id="org.apache.cxf.transports.http.QueryHandlerRegistry"
class="org.apache.cxf.transport.http.QueryHandlerRegistryImpl">
<property name="bus" ref="cxf"/>
<property name="queryHandlers">
<list>
<bean class="org.apache.cxf.transport.http.WSDLQueryHandler">
<property name="bus" ref="cxf"/>
</bean>
</list>
</property>
</bean>
Since those seemed to be using jaxb classes.
Well, after deploying this modified version of CXF I still get this error:
org.springframework.web.context.ContextLoader
initWebApplicationContext: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'locationService': Invocation of init method
failed; nested exception is java.lang.ExceptionInInitializerError
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1337)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:530)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:135)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1218)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:500)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.createHandler(AppVersionHandlerMap.java:191)
at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.getHandler(AppVersionHandlerMap.java:168)
at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:127)
at com.google.apphosting.runtime.JavaRuntime.handleRequest(JavaRuntime.java:239)
at com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRequest(RuntimePb.java:5135)
at com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRequest(RuntimePb.java:5133)
at com.google.net.rpc.impl.BlockingApplicationHandler.handleRequest(BlockingApplicationHandler.java:24)
at com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:363)
at com.google.net.rpc.impl.Server$2.run(Server.java:814)
at com.google.tracing.LocalTraceSpanRunnable.run(LocalTraceSpanRunnable.java:56)
at com.google.tracing.LocalTraceSpanBuilder.internalContinueSpan(LocalTraceSpanBuilder.java:516)
at com.google.net.rpc.impl.Server.startRpc(Server.java:769)
at com.google.net.rpc.impl.Server.processRequest(Server.java:351)
at com.google.net.rpc.impl.ServerConnection.messageReceived(ServerConnection.java:437)
at com.google.net.rpc.impl.RpcConnection.parseMessages(RpcConnection.java:319)
at com.google.net.rpc.impl.RpcConnection.dataReceived(RpcConnection.java:290)
at com.google.net.async.Connection.handleReadEvent(Connection.java:436)
at com.google.net.async.EventDispatcher.processNetworkEvents(EventDispatcher.java:762)
at com.google.net.async.EventDispatcher.internalLoop(EventDispatcher.java:207)
at com.google.net.async.EventDispatcher.loop(EventDispatcher.java:101)
at com.google.net.rpc.RpcService.runUntilServerShutdown(RpcService.java:251)
at com.google.apphosting.runtime.JavaRuntime$RpcRunnable.run(JavaRuntime.java:396)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ExceptionInInitializerError
at org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean.setupFactory(AbstractJAXRSFactoryBean.java:231)
at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:96)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Method.java:40)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1413)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1374)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
... 44 more
Caused by: java.lang.SecurityException: Unable to get members for
class org.apache.cxf.jaxrs.provider.JAXBElementProvider
at com.google.appengine.runtime.Request.process-8835d92e4daee7d0(Request.java)
at java.lang.Class.getMethods(Class.java:180)
at org.apache.cxf.jaxrs.model.AbstractResourceInfo.initContextSetterMethods(AbstractResourceInfo.java:113)
at org.apache.cxf.jaxrs.model.AbstractResourceInfo.<init>(AbstractResourceInfo.java:61)
at org.apache.cxf.jaxrs.model.ProviderInfo.<init>(ProviderInfo.java:27)
at org.apache.cxf.jaxrs.provider.ProviderFactory.setProviders(ProviderFactory.java:298)
at org.apache.cxf.jaxrs.provider.ProviderFactory.<clinit>(ProviderFactory.java:73)
... 53 more
Why is JAXBElementProvider still being loaded if I am using
AegisElementProvider?
Regards
Re: CXF on AppEngine
Posted by Daniel Kulp <dk...@apache.org>.
You can TRY with 2.3 snapshots. For 2.3, I've significantly reduced the
amount of @Resource annotation things that are used internally. Thus, it
might work better, or at least get furthur.
What is the full stack trace? Maybe we can detect this and turn of the
remaining @Resource processing that we do. I haven't tried anything on
AppEngine yet so I'd need your help testing any changes we do.
Dan
On Sun January 3 2010 4:38:27 am sistar wrote:
> Hello..
>
> Google Appengine now supports JAXB, but in the latest Release But
> javax.annotation.Resource is not on the Whitelist.
> As CXF uses @Resource I am stuck with my own attempts to get CXF JAX-RS
> woring on GAE.
> See my
> http://groups.google.com/group/google-appengine-java/browse_thread/thread/a
> 4f32561f7322665# post on the GAE Group on this topic.
> cheers Ralf
>
> Vinicius Carvalho wrote:
> > Hello there! I'm trying to get CXF working on Appengine, but I could
> > not found a way. I just need to user JAX-RS, and since AppEngine does
> > not support JAXB I'm using it without any JAXB jars or references.
> > Here's my beans.xml:
> >
> > <jaxrs:server id="locationService" address="/location">
> > <jaxrs:serviceBeans>
> > <ref bean="myService"/>
> > </jaxrs:serviceBeans>
> >
> > <jaxrs:providers>
> > <bean
class="org.apache.cxf.jaxrs.provider.AegisElementProvider"/>
> > <bean
class="org.apache.cxf.jaxrs.provider.AegisJSONProvider"/>
> > </jaxrs:providers>
> > </jaxrs:server>
> >
> > I've also modified cxf.xml removing:
> >
> > <bean id="org.apache.cxf.wsdl.WSDLManager"
> > class="org.apache.cxf.wsdl11.WSDLManagerImpl">
> > <property name="bus" ref="cxf"/>
> > </bean>
> >
> > <bean id="org.apache.cxf.transports.http.QueryHandlerRegistry"
> > class="org.apache.cxf.transport.http.QueryHandlerRegistryImpl">
> > <property name="bus" ref="cxf"/>
> > <property name="queryHandlers">
> > <list>
> > <bean
class="org.apache.cxf.transport.http.WSDLQueryHandler">
> > <property name="bus" ref="cxf"/>
> > </bean>
> > </list>
> > </property>
> > </bean>
> >
> > Since those seemed to be using jaxb classes.
> >
> > Well, after deploying this modified version of CXF I still get this
> > error:
> >
> > org.springframework.web.context.ContextLoader
> > initWebApplicationContext: Context initialization failed
> > org.springframework.beans.factory.BeanCreationException: Error
> > creating bean with name 'locationService': Invocation of init method
> > failed; nested exception is java.lang.ExceptionInInitializerError
> > at
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFact
> >ory.initializeBean(AbstractAutowireCapableBeanFactory.java:1337) at
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFact
> >ory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473) at
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFact
> >ory$1.run(AbstractAutowireCapableBeanFactory.java:409) at
> > java.security.AccessController.doPrivileged(Native Method)
> > at
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFact
> >ory.createBean(AbstractAutowireCapableBeanFactory.java:380) at
> > org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject
> >(AbstractBeanFactory.java:264) at
> > org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.ge
> >tSingleton(DefaultSingletonBeanRegistry.java:221) at
> > org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(A
> >bstractBeanFactory.java:261) at
> > org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Abs
> >tractBeanFactory.java:185) at
> > org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Abs
> >tractBeanFactory.java:164) at
> > org.springframework.beans.factory.support.DefaultListableBeanFactory.preI
> >nstantiateSingletons(DefaultListableBeanFactory.java:429) at
> > org.springframework.context.support.AbstractApplicationContext.finishBean
> >FactoryInitialization(AbstractApplicationContext.java:729) at
> > org.springframework.context.support.AbstractApplicationContext.refresh(Ab
> >stractApplicationContext.java:381) at
> > org.springframework.web.context.ContextLoader.createWebApplicationContext
> >(ContextLoader.java:255) at
> > org.springframework.web.context.ContextLoader.initWebApplicationContext(C
> >ontextLoader.java:199) at
> > org.springframework.web.context.ContextLoaderListener.contextInitialized(
> >ContextLoaderListener.java:45) at
> > org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java
> >:530) at org.mortbay.jetty.servlet.Context.startContext(Context.java:135)
> > at
> > org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:12
> >18) at
> > org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:500)
> > at
> > org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448) at
> > org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
> > at
> > com.google.apphosting.runtime.jetty.AppVersionHandlerMap.createHandler(Ap
> >pVersionHandlerMap.java:191) at
> > com.google.apphosting.runtime.jetty.AppVersionHandlerMap.getHandler(AppVe
> >rsionHandlerMap.java:168) at
> > com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequ
> >est(JettyServletEngineAdapter.java:127) at
> > com.google.apphosting.runtime.JavaRuntime.handleRequest(JavaRuntime.java:
> >239) at
> > com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRe
> >quest(RuntimePb.java:5135) at
> > com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRe
> >quest(RuntimePb.java:5133) at
> > com.google.net.rpc.impl.BlockingApplicationHandler.handleRequest(Blocking
> >ApplicationHandler.java:24) at
> > com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:363) at
> > com.google.net.rpc.impl.Server$2.run(Server.java:814)
> > at
> > com.google.tracing.LocalTraceSpanRunnable.run(LocalTraceSpanRunnable.java
> >:56) at
> > com.google.tracing.LocalTraceSpanBuilder.internalContinueSpan(LocalTraceS
> >panBuilder.java:516) at
> > com.google.net.rpc.impl.Server.startRpc(Server.java:769)
> > at com.google.net.rpc.impl.Server.processRequest(Server.java:351)
> > at
> > com.google.net.rpc.impl.ServerConnection.messageReceived(ServerConnection
> >.java:437) at
> > com.google.net.rpc.impl.RpcConnection.parseMessages(RpcConnection.java:31
> >9) at
> > com.google.net.rpc.impl.RpcConnection.dataReceived(RpcConnection.java:290
> >) at com.google.net.async.Connection.handleReadEvent(Connection.java:436)
> > at
> > com.google.net.async.EventDispatcher.processNetworkEvents(EventDispatcher
> >.java:762) at
> > com.google.net.async.EventDispatcher.internalLoop(EventDispatcher.java:20
> >7) at com.google.net.async.EventDispatcher.loop(EventDispatcher.java:101)
> > at
> > com.google.net.rpc.RpcService.runUntilServerShutdown(RpcService.java:251)
> > at
> > com.google.apphosting.runtime.JavaRuntime$RpcRunnable.run(JavaRuntime.jav
> >a:396) at java.lang.Thread.run(Unknown Source)
> > Caused by: java.lang.ExceptionInInitializerError
> > at
> > org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean.setupFactory(AbstractJAXRSF
> >actoryBean.java:231) at
> > org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean
> >.java:96) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> > at java.lang.reflect.Method.invoke(Method.java:40)
> > at
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFact
> >ory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1413)
> > at
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFact
> >ory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1374) at
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFact
> >ory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334) ... 44
> > more
> > Caused by: java.lang.SecurityException: Unable to get members for
> > class org.apache.cxf.jaxrs.provider.JAXBElementProvider
> > at
> > com.google.appengine.runtime.Request.process-8835d92e4daee7d0(Request.jav
> >a) at java.lang.Class.getMethods(Class.java:180)
> > at
> > org.apache.cxf.jaxrs.model.AbstractResourceInfo.initContextSetterMethods(
> >AbstractResourceInfo.java:113) at
> > org.apache.cxf.jaxrs.model.AbstractResourceInfo.<init>(AbstractResourceIn
> >fo.java:61) at
> > org.apache.cxf.jaxrs.model.ProviderInfo.<init>(ProviderInfo.java:27) at
> > org.apache.cxf.jaxrs.provider.ProviderFactory.setProviders(ProviderFactor
> >y.java:298) at
> > org.apache.cxf.jaxrs.provider.ProviderFactory.<clinit>(ProviderFactory.ja
> >va:73) ... 53 more
> >
> >
> > Why is JAXBElementProvider still being loaded if I am using
> > AegisElementProvider?
> >
> > Regards
>
--
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog
Re: CXF on AppEngine
Posted by sistar <ra...@gmail.com>.
Hello..
Google Appengine now supports JAXB, but in the latest Release But
javax.annotation.Resource is not on the Whitelist.
As CXF uses @Resource I am stuck with my own attempts to get CXF JAX-RS
woring on GAE.
See my
http://groups.google.com/group/google-appengine-java/browse_thread/thread/a4f32561f7322665#
post on the GAE Group on this topic.
cheers Ralf
Vinicius Carvalho wrote:
>
> Hello there! I'm trying to get CXF working on Appengine, but I could
> not found a way. I just need to user JAX-RS, and since AppEngine does
> not support JAXB I'm using it without any JAXB jars or references.
> Here's my beans.xml:
>
> <jaxrs:server id="locationService" address="/location">
> <jaxrs:serviceBeans>
> <ref bean="myService"/>
> </jaxrs:serviceBeans>
>
> <jaxrs:providers>
> <bean class="org.apache.cxf.jaxrs.provider.AegisElementProvider"/>
> <bean class="org.apache.cxf.jaxrs.provider.AegisJSONProvider"/>
> </jaxrs:providers>
> </jaxrs:server>
>
> I've also modified cxf.xml removing:
>
> <bean id="org.apache.cxf.wsdl.WSDLManager"
> class="org.apache.cxf.wsdl11.WSDLManagerImpl">
> <property name="bus" ref="cxf"/>
> </bean>
>
> <bean id="org.apache.cxf.transports.http.QueryHandlerRegistry"
> class="org.apache.cxf.transport.http.QueryHandlerRegistryImpl">
> <property name="bus" ref="cxf"/>
> <property name="queryHandlers">
> <list>
> <bean class="org.apache.cxf.transport.http.WSDLQueryHandler">
> <property name="bus" ref="cxf"/>
> </bean>
> </list>
> </property>
> </bean>
>
> Since those seemed to be using jaxb classes.
>
> Well, after deploying this modified version of CXF I still get this error:
>
> org.springframework.web.context.ContextLoader
> initWebApplicationContext: Context initialization failed
> org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'locationService': Invocation of init method
> failed; nested exception is java.lang.ExceptionInInitializerError
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1337)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
> at java.security.AccessController.doPrivileged(Native Method)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
> at
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
> at
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
> at
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
> at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
> at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
> at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
> at
> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
> at
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
> at
> org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
> at
> org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
> at
> org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
> at
> org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:530)
> at org.mortbay.jetty.servlet.Context.startContext(Context.java:135)
> at
> org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1218)
> at
> org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:500)
> at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
> at
> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
> at
> com.google.apphosting.runtime.jetty.AppVersionHandlerMap.createHandler(AppVersionHandlerMap.java:191)
> at
> com.google.apphosting.runtime.jetty.AppVersionHandlerMap.getHandler(AppVersionHandlerMap.java:168)
> at
> com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:127)
> at
> com.google.apphosting.runtime.JavaRuntime.handleRequest(JavaRuntime.java:239)
> at
> com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRequest(RuntimePb.java:5135)
> at
> com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRequest(RuntimePb.java:5133)
> at
> com.google.net.rpc.impl.BlockingApplicationHandler.handleRequest(BlockingApplicationHandler.java:24)
> at com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:363)
> at com.google.net.rpc.impl.Server$2.run(Server.java:814)
> at
> com.google.tracing.LocalTraceSpanRunnable.run(LocalTraceSpanRunnable.java:56)
> at
> com.google.tracing.LocalTraceSpanBuilder.internalContinueSpan(LocalTraceSpanBuilder.java:516)
> at com.google.net.rpc.impl.Server.startRpc(Server.java:769)
> at com.google.net.rpc.impl.Server.processRequest(Server.java:351)
> at
> com.google.net.rpc.impl.ServerConnection.messageReceived(ServerConnection.java:437)
> at
> com.google.net.rpc.impl.RpcConnection.parseMessages(RpcConnection.java:319)
> at
> com.google.net.rpc.impl.RpcConnection.dataReceived(RpcConnection.java:290)
> at com.google.net.async.Connection.handleReadEvent(Connection.java:436)
> at
> com.google.net.async.EventDispatcher.processNetworkEvents(EventDispatcher.java:762)
> at
> com.google.net.async.EventDispatcher.internalLoop(EventDispatcher.java:207)
> at com.google.net.async.EventDispatcher.loop(EventDispatcher.java:101)
> at
> com.google.net.rpc.RpcService.runUntilServerShutdown(RpcService.java:251)
> at
> com.google.apphosting.runtime.JavaRuntime$RpcRunnable.run(JavaRuntime.java:396)
> at java.lang.Thread.run(Unknown Source)
> Caused by: java.lang.ExceptionInInitializerError
> at
> org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean.setupFactory(AbstractJAXRSFactoryBean.java:231)
> at
> org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:96)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Method.java:40)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1413)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1374)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
> ... 44 more
> Caused by: java.lang.SecurityException: Unable to get members for
> class org.apache.cxf.jaxrs.provider.JAXBElementProvider
> at
> com.google.appengine.runtime.Request.process-8835d92e4daee7d0(Request.java)
> at java.lang.Class.getMethods(Class.java:180)
> at
> org.apache.cxf.jaxrs.model.AbstractResourceInfo.initContextSetterMethods(AbstractResourceInfo.java:113)
> at
> org.apache.cxf.jaxrs.model.AbstractResourceInfo.<init>(AbstractResourceInfo.java:61)
> at org.apache.cxf.jaxrs.model.ProviderInfo.<init>(ProviderInfo.java:27)
> at
> org.apache.cxf.jaxrs.provider.ProviderFactory.setProviders(ProviderFactory.java:298)
> at
> org.apache.cxf.jaxrs.provider.ProviderFactory.<clinit>(ProviderFactory.java:73)
> ... 53 more
>
>
> Why is JAXBElementProvider still being loaded if I am using
> AegisElementProvider?
>
> Regards
>
>
--
View this message in context: http://old.nabble.com/CXF-on-AppEngine-tp25884251p27000105.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: CXF on AppEngine
Posted by Daniel Kulp <dk...@apache.org>.
On Thu October 15 2009 5:55:28 am Sergey Beryozkin wrote:
> Sure, I'll fix it.
>
> By the way, Dan, how difficult would it be to enhance CXF for WSDLManager
> be loaded only when it is used. I recall you were doing some work for
> 2.2.4 and I was able to verify that a number of dependencies for CXF-JAXRS
> case only dropped as a result, but wsdl4j was still required, that is why
> cxf.xml was also modified, as reported in this thread...
No, all that work is for 2.3, not for 2.2. It completely changes all the
loading of pretty much everything which is a bit disruptive for 2.2. With
2.3, you can probably get rid of wsdl4j. Right now with 2.3, you cannot get
rid of jaxws-api. That's still on my list of things to try and figure out.
Dan
>
> cheers, Sergey
>
> ----- Original Message -----
> From: "Daniel Kulp" <dk...@apache.org>
> To: <us...@cxf.apache.org>
> Cc: "Sergey Beryozkin" <se...@iona.com>
> Sent: Wednesday, October 14, 2009 7:15 PM
> Subject: Re: CXF on AppEngine
>
> > On Wed October 14 2009 1:53:27 pm Sergey Beryozkin wrote:
> >> Hi
> >>
> >> thanks for your post.
> >> At the moment. the default providers are preinstantiated, the Aegis one
> >> you registered will be chosen before the default one...
> >> Ideally, the default providers would be created on teh demand but it
> >> would introduce its own complexity (synchronization, etc)...
> >> Not sure yet how to deal with this issue. Is it really the fact that
> >> JAXB classes are referenced from the JAXB provider that causes this
> >> SecurityException ?
> >
> > Yea. That will definitely cause an issue on AppEngine. My suggestion
> > would be to change all the calls in setProviders(Object... providers) to
> > be wrapped with an exception catch that would log that it wasn't
> > registered:
> >
> > if (MessageBodyReader.class.isAssignableFrom(oClass)) {
> > try {
> > messageReaders.add(new
> > ProviderInfo<MessageBodyReader>((MessageBodyReader)o));
> > }catch (Throwable t) {
> > //could not register it
> > }
> > }
> >
> >
> > Also, change the calls in the static initializer to be more like the
> > JSONProvider which is then not loaded if the requirements for the
> > JSONProvider are not met.
> >
> > Dan
> >
> >> thanks, Sergey
> >>
> >> Vinicius Carvalho wrote:
> >> > Hello there! I'm trying to get CXF working on Appengine, but I could
> >> > not found a way. I just need to user JAX-RS, and since AppEngine does
> >> > not support JAXB I'm using it without any JAXB jars or references.
> >> > Here's my beans.xml:
> >> >
> >> > <jaxrs:server id="locationService" address="/location">
> >> > <jaxrs:serviceBeans>
> >> > <ref bean="myService"/>
> >> > </jaxrs:serviceBeans>
> >> >
> >> > <jaxrs:providers>
> >> > <bean
> >> > class="org.apache.cxf.jaxrs.provider.AegisElementProvider"/> <bean
> >> > class="org.apache.cxf.jaxrs.provider.AegisJSONProvider"/>
> >> > </jaxrs:providers>
> >> > </jaxrs:server>
> >> >
> >> > I've also modified cxf.xml removing:
> >> >
> >> > <bean id="org.apache.cxf.wsdl.WSDLManager"
> >> > class="org.apache.cxf.wsdl11.WSDLManagerImpl">
> >> > <property name="bus" ref="cxf"/>
> >> > </bean>
> >> >
> >> > <bean id="org.apache.cxf.transports.http.QueryHandlerRegistry"
> >> > class="org.apache.cxf.transport.http.QueryHandlerRegistryImpl">
> >> > <property name="bus" ref="cxf"/>
> >> > <property name="queryHandlers">
> >> > <list>
> >> > <bean class="org.apache.cxf.transport.http.WSDLQueryHandler">
> >> > <property name="bus" ref="cxf"/>
> >> > </bean>
> >> > </list>
> >> > </property>
> >> > </bean>
> >> >
> >> > Since those seemed to be using jaxb classes.
> >> >
> >> > Well, after deploying this modified version of CXF I still get this
> >> > error:
> >> >
> >> > org.springframework.web.context.ContextLoader
> >> > initWebApplicationContext: Context initialization failed
> >> > org.springframework.beans.factory.BeanCreationException: Error
> >> > creating bean with name 'locationService': Invocation of init method
> >> > failed; nested exception is java.lang.ExceptionInInitializerError
> >> > at
> >> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanF
> >> >act ory.initializeBean(AbstractAutowireCapableBeanFactory.java:1337) at
> >> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanF
> >> >act ory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473) at
> >> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanF
> >> >act ory$1.run(AbstractAutowireCapableBeanFactory.java:409) at
> >> > java.security.AccessController.doPrivileged(Native Method)
> >> > at
> >> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanF
> >> >act ory.createBean(AbstractAutowireCapableBeanFactory.java:380) at
> >> > org.springframework.beans.factory.support.AbstractBeanFactory$1.getObj
> >> >ect (AbstractBeanFactory.java:264) at
> >> > org.springframework.beans.factory.support.DefaultSingletonBeanRegistry
> >> >.ge tSingleton(DefaultSingletonBeanRegistry.java:221) at
> >> > org.springframework.beans.factory.support.AbstractBeanFactory.doGetBea
> >> >n(A bstractBeanFactory.java:261) at
> >> > org.springframework.beans.factory.support.AbstractBeanFactory.getBean(
> >> >Abs tractBeanFactory.java:185) at
> >> > org.springframework.beans.factory.support.AbstractBeanFactory.getBean(
> >> >Abs tractBeanFactory.java:164) at
> >> > org.springframework.beans.factory.support.DefaultListableBeanFactory.p
> >> >reI nstantiateSingletons(DefaultListableBeanFactory.java:429) at
> >> > org.springframework.context.support.AbstractApplicationContext.finishB
> >> >ean FactoryInitialization(AbstractApplicationContext.java:729) at
> >> > org.springframework.context.support.AbstractApplicationContext.refresh
> >> >(Ab stractApplicationContext.java:381) at
> >> > org.springframework.web.context.ContextLoader.createWebApplicationCont
> >> >ext (ContextLoader.java:255) at
> >> > org.springframework.web.context.ContextLoader.initWebApplicationContex
> >> >t(C ontextLoader.java:199) at
> >> > org.springframework.web.context.ContextLoaderListener.contextInitializ
> >> >ed( ContextLoaderListener.java:45) at
> >> > org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.j
> >> >ava
> >> >
> >> >:530) at
> >> >: org.mortbay.jetty.servlet.Context.startContext(Context.java:135)
> >> >
> >> > at
> >> > org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java
> >> >:12 18) at
> >> > org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:5
> >> >00) at
> >> > org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
> >> > at
> >> > org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:4
> >> >0) at
> >> > com.google.apphosting.runtime.jetty.AppVersionHandlerMap.createHandler
> >> >(Ap pVersionHandlerMap.java:191) at
> >> > com.google.apphosting.runtime.jetty.AppVersionHandlerMap.getHandler(Ap
> >> >pVe rsionHandlerMap.java:168) at
> >> > com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceR
> >> >equ est(JettyServletEngineAdapter.java:127) at
> >> > com.google.apphosting.runtime.JavaRuntime.handleRequest(JavaRuntime.ja
> >> >va: 239) at
> >> > com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockin
> >> >gRe quest(RuntimePb.java:5135) at
> >> > com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockin
> >> >gRe quest(RuntimePb.java:5133) at
> >> > com.google.net.rpc.impl.BlockingApplicationHandler.handleRequest(Block
> >> >ing ApplicationHandler.java:24) at
> >> > com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:363)
> >> > at com.google.net.rpc.impl.Server$2.run(Server.java:814)
> >> > at
> >> > com.google.tracing.LocalTraceSpanRunnable.run(LocalTraceSpanRunnable.j
> >> >ava
> >> >
> >> >:56) at
> >> >
> >> > com.google.tracing.LocalTraceSpanBuilder.internalContinueSpan(LocalTra
> >> >ceS panBuilder.java:516) at
> >> > com.google.net.rpc.impl.Server.startRpc(Server.java:769)
> >> > at com.google.net.rpc.impl.Server.processRequest(Server.java:351)
> >> > at
> >> > com.google.net.rpc.impl.ServerConnection.messageReceived(ServerConnect
> >> >ion .java:437) at
> >> > com.google.net.rpc.impl.RpcConnection.parseMessages(RpcConnection.java
> >> >:31 9) at
> >> > com.google.net.rpc.impl.RpcConnection.dataReceived(RpcConnection.java:
> >> >290 ) at
> >> > com.google.net.async.Connection.handleReadEvent(Connection.java:436)
> >> > at
> >> > com.google.net.async.EventDispatcher.processNetworkEvents(EventDispatc
> >> >her .java:762) at
> >> > com.google.net.async.EventDispatcher.internalLoop(EventDispatcher.java
> >> >:20 7) at
> >> > com.google.net.async.EventDispatcher.loop(EventDispatcher.java:101) at
> >> > com.google.net.rpc.RpcService.runUntilServerShutdown(RpcService.java:2
> >> >51) at
> >> > com.google.apphosting.runtime.JavaRuntime$RpcRunnable.run(JavaRuntime.
> >> >jav a:396) at java.lang.Thread.run(Unknown Source)
> >> > Caused by: java.lang.ExceptionInInitializerError
> >> > at
> >> > org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean.setupFactory(AbstractJAX
> >> >RSF actoryBean.java:231) at
> >> > org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryB
> >> >ean .java:96) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> >> > Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> >> > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at
> >> > java.lang.reflect.Method.invoke(Method.java:40)
> >> > at
> >> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanF
> >> >act
> >> > ory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:141
> >> >3) at
> >> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanF
> >> >act ory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1374)
> >> > at
> >> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanF
> >> >act ory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
> >> > ... 44 more
> >> > Caused by: java.lang.SecurityException: Unable to get members for
> >> > class org.apache.cxf.jaxrs.provider.JAXBElementProvider
> >> > at
> >> > com.google.appengine.runtime.Request.process-8835d92e4daee7d0(Request.
> >> >jav a) at java.lang.Class.getMethods(Class.java:180)
> >> > at
> >> > org.apache.cxf.jaxrs.model.AbstractResourceInfo.initContextSetterMetho
> >> >ds( AbstractResourceInfo.java:113) at
> >> > org.apache.cxf.jaxrs.model.AbstractResourceInfo.<init>(AbstractResourc
> >> >eIn fo.java:61) at
> >> > org.apache.cxf.jaxrs.model.ProviderInfo.<init>(ProviderInfo.java:27)
> >> > at
> >> > org.apache.cxf.jaxrs.provider.ProviderFactory.setProviders(ProviderFac
> >> >tor y.java:298) at
> >> > org.apache.cxf.jaxrs.provider.ProviderFactory.<clinit>(ProviderFactory
> >> >.ja va:73) ... 53 more
> >> >
> >> >
> >> > Why is JAXBElementProvider still being loaded if I am using
> >> > AegisElementProvider?
> >> >
> >> > Regards
>
--
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog
Re: CXF on AppEngine
Posted by Sergey Beryozkin <sb...@progress.com>.
Sure, I'll fix it.
By the way, Dan, how difficult would it be to enhance CXF for WSDLManager be loaded only when it is used. I recall you were doing
some work for 2.2.4 and I was able to verify that a number of dependencies for CXF-JAXRS case only dropped as a result, but wsdl4j
was still required, that is why cxf.xml was also modified, as reported in this thread...
cheers, Sergey
----- Original Message -----
From: "Daniel Kulp" <dk...@apache.org>
To: <us...@cxf.apache.org>
Cc: "Sergey Beryozkin" <se...@iona.com>
Sent: Wednesday, October 14, 2009 7:15 PM
Subject: Re: CXF on AppEngine
> On Wed October 14 2009 1:53:27 pm Sergey Beryozkin wrote:
>> Hi
>>
>> thanks for your post.
>> At the moment. the default providers are preinstantiated, the Aegis one you
>> registered will be chosen before the default one...
>> Ideally, the default providers would be created on teh demand but it would
>> introduce its own complexity (synchronization, etc)...
>> Not sure yet how to deal with this issue. Is it really the fact that JAXB
>> classes are referenced from the JAXB provider that causes this
>> SecurityException ?
>
> Yea. That will definitely cause an issue on AppEngine. My suggestion would
> be to change all the calls in setProviders(Object... providers) to be wrapped
> with an exception catch that would log that it wasn't registered:
>
> if (MessageBodyReader.class.isAssignableFrom(oClass)) {
> try {
> messageReaders.add(new
> ProviderInfo<MessageBodyReader>((MessageBodyReader)o));
> }catch (Throwable t) {
> //could not register it
> }
> }
>
>
> Also, change the calls in the static initializer to be more like the
> JSONProvider which is then not loaded if the requirements for the
> JSONProvider are not met.
>
> Dan
>
>
>
>
>
>
>>
>> thanks, Sergey
>>
>> Vinicius Carvalho wrote:
>> > Hello there! I'm trying to get CXF working on Appengine, but I could
>> > not found a way. I just need to user JAX-RS, and since AppEngine does
>> > not support JAXB I'm using it without any JAXB jars or references.
>> > Here's my beans.xml:
>> >
>> > <jaxrs:server id="locationService" address="/location">
>> > <jaxrs:serviceBeans>
>> > <ref bean="myService"/>
>> > </jaxrs:serviceBeans>
>> >
>> > <jaxrs:providers>
>> > <bean class="org.apache.cxf.jaxrs.provider.AegisElementProvider"/>
>> > <bean class="org.apache.cxf.jaxrs.provider.AegisJSONProvider"/>
>> > </jaxrs:providers>
>> > </jaxrs:server>
>> >
>> > I've also modified cxf.xml removing:
>> >
>> > <bean id="org.apache.cxf.wsdl.WSDLManager"
>> > class="org.apache.cxf.wsdl11.WSDLManagerImpl">
>> > <property name="bus" ref="cxf"/>
>> > </bean>
>> >
>> > <bean id="org.apache.cxf.transports.http.QueryHandlerRegistry"
>> > class="org.apache.cxf.transport.http.QueryHandlerRegistryImpl">
>> > <property name="bus" ref="cxf"/>
>> > <property name="queryHandlers">
>> > <list>
>> > <bean class="org.apache.cxf.transport.http.WSDLQueryHandler">
>> > <property name="bus" ref="cxf"/>
>> > </bean>
>> > </list>
>> > </property>
>> > </bean>
>> >
>> > Since those seemed to be using jaxb classes.
>> >
>> > Well, after deploying this modified version of CXF I still get this
>> > error:
>> >
>> > org.springframework.web.context.ContextLoader
>> > initWebApplicationContext: Context initialization failed
>> > org.springframework.beans.factory.BeanCreationException: Error
>> > creating bean with name 'locationService': Invocation of init method
>> > failed; nested exception is java.lang.ExceptionInInitializerError
>> > at
>> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFact
>> >ory.initializeBean(AbstractAutowireCapableBeanFactory.java:1337) at
>> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFact
>> >ory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473) at
>> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFact
>> >ory$1.run(AbstractAutowireCapableBeanFactory.java:409) at
>> > java.security.AccessController.doPrivileged(Native Method)
>> > at
>> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFact
>> >ory.createBean(AbstractAutowireCapableBeanFactory.java:380) at
>> > org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject
>> >(AbstractBeanFactory.java:264) at
>> > org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.ge
>> >tSingleton(DefaultSingletonBeanRegistry.java:221) at
>> > org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(A
>> >bstractBeanFactory.java:261) at
>> > org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Abs
>> >tractBeanFactory.java:185) at
>> > org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Abs
>> >tractBeanFactory.java:164) at
>> > org.springframework.beans.factory.support.DefaultListableBeanFactory.preI
>> >nstantiateSingletons(DefaultListableBeanFactory.java:429) at
>> > org.springframework.context.support.AbstractApplicationContext.finishBean
>> >FactoryInitialization(AbstractApplicationContext.java:729) at
>> > org.springframework.context.support.AbstractApplicationContext.refresh(Ab
>> >stractApplicationContext.java:381) at
>> > org.springframework.web.context.ContextLoader.createWebApplicationContext
>> >(ContextLoader.java:255) at
>> > org.springframework.web.context.ContextLoader.initWebApplicationContext(C
>> >ontextLoader.java:199) at
>> > org.springframework.web.context.ContextLoaderListener.contextInitialized(
>> >ContextLoaderListener.java:45) at
>> > org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java
>> >:530) at org.mortbay.jetty.servlet.Context.startContext(Context.java:135)
>> > at
>> > org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:12
>> >18) at
>> > org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:500)
>> > at
>> > org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448) at
>> > org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
>> > at
>> > com.google.apphosting.runtime.jetty.AppVersionHandlerMap.createHandler(Ap
>> >pVersionHandlerMap.java:191) at
>> > com.google.apphosting.runtime.jetty.AppVersionHandlerMap.getHandler(AppVe
>> >rsionHandlerMap.java:168) at
>> > com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequ
>> >est(JettyServletEngineAdapter.java:127) at
>> > com.google.apphosting.runtime.JavaRuntime.handleRequest(JavaRuntime.java:
>> >239) at
>> > com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRe
>> >quest(RuntimePb.java:5135) at
>> > com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRe
>> >quest(RuntimePb.java:5133) at
>> > com.google.net.rpc.impl.BlockingApplicationHandler.handleRequest(Blocking
>> >ApplicationHandler.java:24) at
>> > com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:363) at
>> > com.google.net.rpc.impl.Server$2.run(Server.java:814)
>> > at
>> > com.google.tracing.LocalTraceSpanRunnable.run(LocalTraceSpanRunnable.java
>> >:56) at
>> > com.google.tracing.LocalTraceSpanBuilder.internalContinueSpan(LocalTraceS
>> >panBuilder.java:516) at
>> > com.google.net.rpc.impl.Server.startRpc(Server.java:769)
>> > at com.google.net.rpc.impl.Server.processRequest(Server.java:351)
>> > at
>> > com.google.net.rpc.impl.ServerConnection.messageReceived(ServerConnection
>> >.java:437) at
>> > com.google.net.rpc.impl.RpcConnection.parseMessages(RpcConnection.java:31
>> >9) at
>> > com.google.net.rpc.impl.RpcConnection.dataReceived(RpcConnection.java:290
>> >) at com.google.net.async.Connection.handleReadEvent(Connection.java:436)
>> > at
>> > com.google.net.async.EventDispatcher.processNetworkEvents(EventDispatcher
>> >.java:762) at
>> > com.google.net.async.EventDispatcher.internalLoop(EventDispatcher.java:20
>> >7) at com.google.net.async.EventDispatcher.loop(EventDispatcher.java:101)
>> > at
>> > com.google.net.rpc.RpcService.runUntilServerShutdown(RpcService.java:251)
>> > at
>> > com.google.apphosting.runtime.JavaRuntime$RpcRunnable.run(JavaRuntime.jav
>> >a:396) at java.lang.Thread.run(Unknown Source)
>> > Caused by: java.lang.ExceptionInInitializerError
>> > at
>> > org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean.setupFactory(AbstractJAXRSF
>> >actoryBean.java:231) at
>> > org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean
>> >.java:96) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>> > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>> > at java.lang.reflect.Method.invoke(Method.java:40)
>> > at
>> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFact
>> >ory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1413)
>> > at
>> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFact
>> >ory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1374) at
>> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFact
>> >ory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334) ... 44
>> > more
>> > Caused by: java.lang.SecurityException: Unable to get members for
>> > class org.apache.cxf.jaxrs.provider.JAXBElementProvider
>> > at
>> > com.google.appengine.runtime.Request.process-8835d92e4daee7d0(Request.jav
>> >a) at java.lang.Class.getMethods(Class.java:180)
>> > at
>> > org.apache.cxf.jaxrs.model.AbstractResourceInfo.initContextSetterMethods(
>> >AbstractResourceInfo.java:113) at
>> > org.apache.cxf.jaxrs.model.AbstractResourceInfo.<init>(AbstractResourceIn
>> >fo.java:61) at
>> > org.apache.cxf.jaxrs.model.ProviderInfo.<init>(ProviderInfo.java:27) at
>> > org.apache.cxf.jaxrs.provider.ProviderFactory.setProviders(ProviderFactor
>> >y.java:298) at
>> > org.apache.cxf.jaxrs.provider.ProviderFactory.<clinit>(ProviderFactory.ja
>> >va:73) ... 53 more
>> >
>> >
>> > Why is JAXBElementProvider still being loaded if I am using
>> > AegisElementProvider?
>> >
>> > Regards
>>
>
> --
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog
Re: CXF on AppEngine
Posted by Daniel Kulp <dk...@apache.org>.
On Wed October 14 2009 1:53:27 pm Sergey Beryozkin wrote:
> Hi
>
> thanks for your post.
> At the moment. the default providers are preinstantiated, the Aegis one you
> registered will be chosen before the default one...
> Ideally, the default providers would be created on teh demand but it would
> introduce its own complexity (synchronization, etc)...
> Not sure yet how to deal with this issue. Is it really the fact that JAXB
> classes are referenced from the JAXB provider that causes this
> SecurityException ?
Yea. That will definitely cause an issue on AppEngine. My suggestion would
be to change all the calls in setProviders(Object... providers) to be wrapped
with an exception catch that would log that it wasn't registered:
if (MessageBodyReader.class.isAssignableFrom(oClass)) {
try {
messageReaders.add(new
ProviderInfo<MessageBodyReader>((MessageBodyReader)o));
}catch (Throwable t) {
//could not register it
}
}
Also, change the calls in the static initializer to be more like the
JSONProvider which is then not loaded if the requirements for the
JSONProvider are not met.
Dan
>
> thanks, Sergey
>
> Vinicius Carvalho wrote:
> > Hello there! I'm trying to get CXF working on Appengine, but I could
> > not found a way. I just need to user JAX-RS, and since AppEngine does
> > not support JAXB I'm using it without any JAXB jars or references.
> > Here's my beans.xml:
> >
> > <jaxrs:server id="locationService" address="/location">
> > <jaxrs:serviceBeans>
> > <ref bean="myService"/>
> > </jaxrs:serviceBeans>
> >
> > <jaxrs:providers>
> > <bean class="org.apache.cxf.jaxrs.provider.AegisElementProvider"/>
> > <bean class="org.apache.cxf.jaxrs.provider.AegisJSONProvider"/>
> > </jaxrs:providers>
> > </jaxrs:server>
> >
> > I've also modified cxf.xml removing:
> >
> > <bean id="org.apache.cxf.wsdl.WSDLManager"
> > class="org.apache.cxf.wsdl11.WSDLManagerImpl">
> > <property name="bus" ref="cxf"/>
> > </bean>
> >
> > <bean id="org.apache.cxf.transports.http.QueryHandlerRegistry"
> > class="org.apache.cxf.transport.http.QueryHandlerRegistryImpl">
> > <property name="bus" ref="cxf"/>
> > <property name="queryHandlers">
> > <list>
> > <bean class="org.apache.cxf.transport.http.WSDLQueryHandler">
> > <property name="bus" ref="cxf"/>
> > </bean>
> > </list>
> > </property>
> > </bean>
> >
> > Since those seemed to be using jaxb classes.
> >
> > Well, after deploying this modified version of CXF I still get this
> > error:
> >
> > org.springframework.web.context.ContextLoader
> > initWebApplicationContext: Context initialization failed
> > org.springframework.beans.factory.BeanCreationException: Error
> > creating bean with name 'locationService': Invocation of init method
> > failed; nested exception is java.lang.ExceptionInInitializerError
> > at
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFact
> >ory.initializeBean(AbstractAutowireCapableBeanFactory.java:1337) at
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFact
> >ory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473) at
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFact
> >ory$1.run(AbstractAutowireCapableBeanFactory.java:409) at
> > java.security.AccessController.doPrivileged(Native Method)
> > at
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFact
> >ory.createBean(AbstractAutowireCapableBeanFactory.java:380) at
> > org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject
> >(AbstractBeanFactory.java:264) at
> > org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.ge
> >tSingleton(DefaultSingletonBeanRegistry.java:221) at
> > org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(A
> >bstractBeanFactory.java:261) at
> > org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Abs
> >tractBeanFactory.java:185) at
> > org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Abs
> >tractBeanFactory.java:164) at
> > org.springframework.beans.factory.support.DefaultListableBeanFactory.preI
> >nstantiateSingletons(DefaultListableBeanFactory.java:429) at
> > org.springframework.context.support.AbstractApplicationContext.finishBean
> >FactoryInitialization(AbstractApplicationContext.java:729) at
> > org.springframework.context.support.AbstractApplicationContext.refresh(Ab
> >stractApplicationContext.java:381) at
> > org.springframework.web.context.ContextLoader.createWebApplicationContext
> >(ContextLoader.java:255) at
> > org.springframework.web.context.ContextLoader.initWebApplicationContext(C
> >ontextLoader.java:199) at
> > org.springframework.web.context.ContextLoaderListener.contextInitialized(
> >ContextLoaderListener.java:45) at
> > org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java
> >:530) at org.mortbay.jetty.servlet.Context.startContext(Context.java:135)
> > at
> > org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:12
> >18) at
> > org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:500)
> > at
> > org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448) at
> > org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
> > at
> > com.google.apphosting.runtime.jetty.AppVersionHandlerMap.createHandler(Ap
> >pVersionHandlerMap.java:191) at
> > com.google.apphosting.runtime.jetty.AppVersionHandlerMap.getHandler(AppVe
> >rsionHandlerMap.java:168) at
> > com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequ
> >est(JettyServletEngineAdapter.java:127) at
> > com.google.apphosting.runtime.JavaRuntime.handleRequest(JavaRuntime.java:
> >239) at
> > com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRe
> >quest(RuntimePb.java:5135) at
> > com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRe
> >quest(RuntimePb.java:5133) at
> > com.google.net.rpc.impl.BlockingApplicationHandler.handleRequest(Blocking
> >ApplicationHandler.java:24) at
> > com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:363) at
> > com.google.net.rpc.impl.Server$2.run(Server.java:814)
> > at
> > com.google.tracing.LocalTraceSpanRunnable.run(LocalTraceSpanRunnable.java
> >:56) at
> > com.google.tracing.LocalTraceSpanBuilder.internalContinueSpan(LocalTraceS
> >panBuilder.java:516) at
> > com.google.net.rpc.impl.Server.startRpc(Server.java:769)
> > at com.google.net.rpc.impl.Server.processRequest(Server.java:351)
> > at
> > com.google.net.rpc.impl.ServerConnection.messageReceived(ServerConnection
> >.java:437) at
> > com.google.net.rpc.impl.RpcConnection.parseMessages(RpcConnection.java:31
> >9) at
> > com.google.net.rpc.impl.RpcConnection.dataReceived(RpcConnection.java:290
> >) at com.google.net.async.Connection.handleReadEvent(Connection.java:436)
> > at
> > com.google.net.async.EventDispatcher.processNetworkEvents(EventDispatcher
> >.java:762) at
> > com.google.net.async.EventDispatcher.internalLoop(EventDispatcher.java:20
> >7) at com.google.net.async.EventDispatcher.loop(EventDispatcher.java:101)
> > at
> > com.google.net.rpc.RpcService.runUntilServerShutdown(RpcService.java:251)
> > at
> > com.google.apphosting.runtime.JavaRuntime$RpcRunnable.run(JavaRuntime.jav
> >a:396) at java.lang.Thread.run(Unknown Source)
> > Caused by: java.lang.ExceptionInInitializerError
> > at
> > org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean.setupFactory(AbstractJAXRSF
> >actoryBean.java:231) at
> > org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean
> >.java:96) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> > at java.lang.reflect.Method.invoke(Method.java:40)
> > at
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFact
> >ory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1413)
> > at
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFact
> >ory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1374) at
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFact
> >ory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334) ... 44
> > more
> > Caused by: java.lang.SecurityException: Unable to get members for
> > class org.apache.cxf.jaxrs.provider.JAXBElementProvider
> > at
> > com.google.appengine.runtime.Request.process-8835d92e4daee7d0(Request.jav
> >a) at java.lang.Class.getMethods(Class.java:180)
> > at
> > org.apache.cxf.jaxrs.model.AbstractResourceInfo.initContextSetterMethods(
> >AbstractResourceInfo.java:113) at
> > org.apache.cxf.jaxrs.model.AbstractResourceInfo.<init>(AbstractResourceIn
> >fo.java:61) at
> > org.apache.cxf.jaxrs.model.ProviderInfo.<init>(ProviderInfo.java:27) at
> > org.apache.cxf.jaxrs.provider.ProviderFactory.setProviders(ProviderFactor
> >y.java:298) at
> > org.apache.cxf.jaxrs.provider.ProviderFactory.<clinit>(ProviderFactory.ja
> >va:73) ... 53 more
> >
> >
> > Why is JAXBElementProvider still being loaded if I am using
> > AegisElementProvider?
> >
> > Regards
>
--
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog
Re: CXF on AppEngine
Posted by Sergey Beryozkin <se...@iona.com>.
Hi
thanks for your post.
At the moment. the default providers are preinstantiated, the Aegis one you
registered will be chosen before the default one...
Ideally, the default providers would be created on teh demand but it would
introduce its own complexity (synchronization, etc)...
Not sure yet how to deal with this issue. Is it really the fact that JAXB
classes are referenced from the JAXB provider that causes this
SecurityException ?
thanks, Sergey
Vinicius Carvalho wrote:
>
> Hello there! I'm trying to get CXF working on Appengine, but I could
> not found a way. I just need to user JAX-RS, and since AppEngine does
> not support JAXB I'm using it without any JAXB jars or references.
> Here's my beans.xml:
>
> <jaxrs:server id="locationService" address="/location">
> <jaxrs:serviceBeans>
> <ref bean="myService"/>
> </jaxrs:serviceBeans>
>
> <jaxrs:providers>
> <bean class="org.apache.cxf.jaxrs.provider.AegisElementProvider"/>
> <bean class="org.apache.cxf.jaxrs.provider.AegisJSONProvider"/>
> </jaxrs:providers>
> </jaxrs:server>
>
> I've also modified cxf.xml removing:
>
> <bean id="org.apache.cxf.wsdl.WSDLManager"
> class="org.apache.cxf.wsdl11.WSDLManagerImpl">
> <property name="bus" ref="cxf"/>
> </bean>
>
> <bean id="org.apache.cxf.transports.http.QueryHandlerRegistry"
> class="org.apache.cxf.transport.http.QueryHandlerRegistryImpl">
> <property name="bus" ref="cxf"/>
> <property name="queryHandlers">
> <list>
> <bean class="org.apache.cxf.transport.http.WSDLQueryHandler">
> <property name="bus" ref="cxf"/>
> </bean>
> </list>
> </property>
> </bean>
>
> Since those seemed to be using jaxb classes.
>
> Well, after deploying this modified version of CXF I still get this error:
>
> org.springframework.web.context.ContextLoader
> initWebApplicationContext: Context initialization failed
> org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'locationService': Invocation of init method
> failed; nested exception is java.lang.ExceptionInInitializerError
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1337)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
> at java.security.AccessController.doPrivileged(Native Method)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
> at
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
> at
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
> at
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
> at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
> at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
> at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
> at
> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
> at
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
> at
> org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
> at
> org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
> at
> org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
> at
> org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:530)
> at org.mortbay.jetty.servlet.Context.startContext(Context.java:135)
> at
> org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1218)
> at
> org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:500)
> at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
> at
> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
> at
> com.google.apphosting.runtime.jetty.AppVersionHandlerMap.createHandler(AppVersionHandlerMap.java:191)
> at
> com.google.apphosting.runtime.jetty.AppVersionHandlerMap.getHandler(AppVersionHandlerMap.java:168)
> at
> com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:127)
> at
> com.google.apphosting.runtime.JavaRuntime.handleRequest(JavaRuntime.java:239)
> at
> com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRequest(RuntimePb.java:5135)
> at
> com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRequest(RuntimePb.java:5133)
> at
> com.google.net.rpc.impl.BlockingApplicationHandler.handleRequest(BlockingApplicationHandler.java:24)
> at com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:363)
> at com.google.net.rpc.impl.Server$2.run(Server.java:814)
> at
> com.google.tracing.LocalTraceSpanRunnable.run(LocalTraceSpanRunnable.java:56)
> at
> com.google.tracing.LocalTraceSpanBuilder.internalContinueSpan(LocalTraceSpanBuilder.java:516)
> at com.google.net.rpc.impl.Server.startRpc(Server.java:769)
> at com.google.net.rpc.impl.Server.processRequest(Server.java:351)
> at
> com.google.net.rpc.impl.ServerConnection.messageReceived(ServerConnection.java:437)
> at
> com.google.net.rpc.impl.RpcConnection.parseMessages(RpcConnection.java:319)
> at
> com.google.net.rpc.impl.RpcConnection.dataReceived(RpcConnection.java:290)
> at com.google.net.async.Connection.handleReadEvent(Connection.java:436)
> at
> com.google.net.async.EventDispatcher.processNetworkEvents(EventDispatcher.java:762)
> at
> com.google.net.async.EventDispatcher.internalLoop(EventDispatcher.java:207)
> at com.google.net.async.EventDispatcher.loop(EventDispatcher.java:101)
> at
> com.google.net.rpc.RpcService.runUntilServerShutdown(RpcService.java:251)
> at
> com.google.apphosting.runtime.JavaRuntime$RpcRunnable.run(JavaRuntime.java:396)
> at java.lang.Thread.run(Unknown Source)
> Caused by: java.lang.ExceptionInInitializerError
> at
> org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean.setupFactory(AbstractJAXRSFactoryBean.java:231)
> at
> org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:96)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Method.java:40)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1413)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1374)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
> ... 44 more
> Caused by: java.lang.SecurityException: Unable to get members for
> class org.apache.cxf.jaxrs.provider.JAXBElementProvider
> at
> com.google.appengine.runtime.Request.process-8835d92e4daee7d0(Request.java)
> at java.lang.Class.getMethods(Class.java:180)
> at
> org.apache.cxf.jaxrs.model.AbstractResourceInfo.initContextSetterMethods(AbstractResourceInfo.java:113)
> at
> org.apache.cxf.jaxrs.model.AbstractResourceInfo.<init>(AbstractResourceInfo.java:61)
> at org.apache.cxf.jaxrs.model.ProviderInfo.<init>(ProviderInfo.java:27)
> at
> org.apache.cxf.jaxrs.provider.ProviderFactory.setProviders(ProviderFactory.java:298)
> at
> org.apache.cxf.jaxrs.provider.ProviderFactory.<clinit>(ProviderFactory.java:73)
> ... 53 more
>
>
> Why is JAXBElementProvider still being loaded if I am using
> AegisElementProvider?
>
> Regards
>
>
--
View this message in context: http://www.nabble.com/CXF-on-AppEngine-tp25884251p25895965.html
Sent from the cxf-user mailing list archive at Nabble.com.