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" <[email protected]>
To: <[email protected]>
Cc: "Sergey Beryozkin" <[email protected]>
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
[email protected]
http://www.dankulp.com/blog

Reply via email to