cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: CXF on AppEngine
Date Thu, 15 Oct 2009 13:39:44 GMT
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" <dkulp@apache.org>
> To: <users@cxf.apache.org>
> Cc: "Sergey Beryozkin" <sergey.beryozkin@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

Mime
View raw message