Re: Using custom SSLSocketFactory
Hello Marcel, We introduced in CXF 2.2.7 "CXF-2693 : Allow to use HttpsURLConnection's defaultSSLSocketFactory and defaultHostnameVerifier in CXF client". This adds the attributes "useHttpsURLConnectionDefaultSslSocketFactory" and "useHttpsURLConnectionDefaultHostnameVerifier" to the configuration element (2). I understand this is slightly different from what you ask for this may be a convenient workaround. Would it do the job ? Cyrille -- Cyrille Le Clerc clecl...@xebia.fr (1) https://issues.apache.org/jira/browse/CXF-2693 (2) http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-The%7B%7BtlsClientParameters%7D%7Delement On Mon, Apr 12, 2010 at 9:37 PM, Marcel Stör wrote: > > On 12.04.2010, at 18:20, Marcel Stör wrote: > > > Java allows to use a custom VM-wide SSLSocketFactory implementation like so: > > > > javax.net.ssl.HttpsURLConnection.setDefaultSSLSocketFactory(SSLSocketFactory) > > > > I noticed, however, that CXF does not honor this "setting" and overrides > > the SSLSocketFactory to be used in > > org.apache.cxf.transport.https.HttpsURLConnectionFactory.decorateWithTLS(HttpURLConnection). > > > > Question: how can I use my (customer's) own configuration of a > > SSLSocketFactory with CXF? > > > > Not quite sure if it's relevant for the problem stated above...We're creating > the CXF proxy factory beans in Spring like this: > > > > > > > > > > > This means that there's no Java code that directly interoperates with CXF in > our application. > > Regards, > Marcel > > -- > Marcel Stör, http://www.frightanic.com > Couchsurfing: http://www.couchsurfing.com/people/marcelstoer > Skype: marcelstoer > O< ascii ribbon campaign - stop html mail - www.asciiribbon.org >
Re: CXF JMX Metrics
Hello David, Here is a web page that summarizes all the CXF response time of one cluster node of a live application I work on. It will show you real data. That are all the informations we need. This JSP page (cxf.jsp) is just used for troubleshooting ; we use Hyperic for monitoring with the attached plugin (cxf-plugin.xml). Hyperic plugin for CXF : http://xebia-france.googlecode.com/svn/jmx/jmx-demo/trunk/src/main/hyperic/cxf-plugin.xml CXF JMX metrics page : http://xebia-france.googlecode.com/svn/jmx/jmx-demo/trunk/src/main/webapp/tools/jmx/cxf.jsp Hope this helps, Cyrille -- Cyrille Le Clerc clecl...@xebia.fr On Fri, Mar 12, 2010 at 7:42 PM, David Valeri wrote: > I've got CXF running in an OSGi container and managing its own Jetty instance > rather than using the container's HTTP service. I have JMX enabled on CXF > per the instructions in the documentation. > > I'm seeing the following MBeans in JConsole: > > org.apache.cxf.Bus > org.apache.cxf.Bus.Service.Endpoint > org.apache.cxf.WorkQueueManager > org.apache.cxf.transport.http_jetty.jettyhttphandler > > I'm not seeing a bean for CXFJettySslSocketConnector because I am deploying a > custom connector and the bean is being registered by Jetty based on my custom > class name. > > In these beans, I am not seeing much that is indicative of the runtime health > of the services running in CXF. The Jetty connector and the optional > statistics handler, which I have enabled, collect performance metrics that > can be used to gauge the overall health of all services running on a > particular port and the CXF metrics allow one to gauge if the services > started appropriately. > > The docs mention a CounterRepository that stores max response time. Is there > anything else in CXF worth monitoring that can indicate runtime health? > > Thank you in advance for any help! >
Re: What companies are using CXF?
Hello, One of the three big French telecommunications operator use CXF for its portal, one of the ten biggest French web portals. Sorry, I can't name it :-) We use CXF for: * JAX-WS implementation on both client and server sides, * JAX-RS implementation on server side : consumed by widgets and desktops and soon by ajax calls on the home pages and hopefully soon by mobile applications. We use it doing * contract first starting from the WSDL for SOAP and by XSD for REST style calls, * monitoring integrated in Hyperic HQ * security with Basic Auth (Spring Security) + SSL Cyrille -- Cyrille Le Clerc clecl...@xebia.fr On Tue, Jan 19, 2010 at 11:16 PM, easternwahoo wrote: > > I am writing a justification for use of CXF at my company, and I need to list > any commercial companies that are using it. I've searched the Apache CXF > site and the FuseSource site. The only company I found was Sabre, but they > use the ESB product, but they don't mention CXF. > -- > View this message in context: > http://old.nabble.com/What-companies-are-using-CXF--tp27233720p27233720.html > Sent from the cxf-user mailing list archive at Nabble.com. >
Re: Missing EndpointReferenceType
Hello, According to the pom.xml (1), the jar name is cxf-rt-ws-addr. Cyrille -- Cyrille Le Clerc clecl...@xebia.fr http://blog.xebia.fr (1) http://svn.apache.org/viewvc/cxf/tags/cxf-2.2.5/rt/ws/addr/pom.xml?view=markup On Thu, Jan 7, 2010 at 1:14 AM, Coder One wrote: > I thought I found find EndpointReferenceType at the location below, but no > luck...which jar is it part of? > > http://svn.apache.org/viewvc/cxf/tags/cxf-2.2.5/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ > > Thanks > > > >
Re: Versioning of web services?
Hi, Here is the humble experience of our team ; we have been exposing a bunch of web services for about two years : * SOAP and REST services are versionned via ** the endpoint url : sample http://mycompany.com/services/UserProfileService/1.0/ ** the namespace of XML entities : sample http://mycompany.com/userprofile/v1_0/ ** SOAP action : sample http://mycompany.com/userprofile/v1_0/get * Even if many famous XML APIs (Amazon, Google, etc) use date versioning (e.g. 2009-04-03), we are happy with number versioning ( e.g. 2.3 ) because : ** it is easier to remember a number than a date. ** number versioning is self explanatory. We use minor version change when we add elements, enumerated values, etc ; we use major version change for data structure refactoring. Minor changes can most of the time be applied with simple package name renaming in the consumer code. * We versioned namespaces with "_" instead of "." because a while ago, CXF wsdl2java tool truncated the package name after the first point. Not sure it is still the case, we should have proposed a patch, shame on us :-) * We initially tried to have different version life cycles for sub schemas of our data structures (user v2.3 aggregates user.webprofile v1.0 + user.cellphoneprofile v1.6, etc) but it has not proven to be efficient for our reality because : ** we did not reuse a XSD for anything else than our web service (i.e. one XSD is used by exactly one WSDL) ** consumers were confused when they upgraded minor versions. We could not say "search and replace all the packages x.y.z.1_0 by x.y.z.1_1" ; instead, we had to say "change this package to ... and this package to and this other package to ..." :-( * We never used routing relying on "SOAP action" nor on "XML namespace" ; all the routing is done on the endpoint URL. * On the server side, we implemented service business logic versioning with : ** business logic located in the implementation of the latest version of the service ** java bean to java bean mapping to adapt to older versions of a given service ** mapping frameworks like Dozer have not proven to be useful, we now prefer hand coded mapping ( 'userV13.setLastName(userV21.getLastName()) ...' ). * We failed to remove old versions of the services, our consumers did not upgrade. It causes a bit more work on the provider side but less on the consumer side. Even if some will say SOA heresy, is it that bad ? Consumers are quite happy with it :-) * OK, we admit it, we don't know who are our consumers, especially for REST services authenticated by internet users credentials. Still a SOA heresy but still the sign that some consumers feel our services are useful :-) * We use per operation and per version JMX monitoring. It tells us prehistoric versions are still very famous :-) * According to Hyperic HQ, we have 8.000 requests per minute and per server on our web WS application without major issues ; bean to bean mapping processing is very cheap, we never see it when we generate thread dump with the great jstack tool. * URL based versioning helps to get monitoring and audit with simple greps on access logs. We hope this feedback helps, Michael and Cyrille -- Michael Figuière mfigui...@xebia.fr Cyrille Le Clerc clecl...@xebia.fr On Mon, Dec 14, 2009 at 12:41 PM, Sergey Beryozkin wrote: > > Hi, > > Apologies for a late reply, I was planning to reply for a while :-) > As far as approaches toward versioning SOAP services are concerned, see [1] > which Oliver also referenced in the other email and which is being used in > production and also check [2] for some general information. > [3] captures some good advice on how to deal with versioing restful services, > some of it may apply to SOAP services too. > > It is also may make sense to explicitly require or at least recommend the > consumers to ignore unrecognized tags, provided that the breaking change is > signalled by a namespace change. It may let you avoid the 'noise' (frequent > namespace change) when the schemas get updated with the tags which don't > affect the existing consumers, example, an element called "book" has a new > element "category" added which should not affect the consumers knowing about > the book/name only. This is called a forward compatibility. See Versioning in > [4] for example (though Web3s is defunct now at least publicly). > > Likewise, a service provider should typically ensure a backward > compatibility, that is newer services should continue accept the requests > from older clients. > > For the same reason (that is, to avoid the 'noise' but at the code level), > I'd recommend just to have a single complex type in every resource method > signature on input/output. If the policy is to ensure the code gets
Re: Proposal : HTTP view for managed endpoints
Dear all, It's a very appealing feature, I would like to have it not only as html but also as rss and in a shell client scripts friendly format. Here are my humble insights about web services monitoring and management : * Exposing management and monitoring features on web pages can be a security breach (try to Google the management URI of your favorite open source Java EE server, it's frightening :-) ). * Nobody is perfect, I may expose a bunch of management jsp pages but I protect them Spring Security URI based authentication and authorization. * Monitoring counters are often difficult to render on a simple web page because they most of the time are trends-up measures (1) and rendering them requires correlation to create "Per Minute" indicators (invocations per minute, etc). * Web based monitoring would a nice and appealing feature but I feel most production scenarios will prefer JMX oriented monitoring tools for security, graphing and recording. I am personally very happy with the Hyperic HQ Open Source edition to monitor CXF and JBoss Jopr (also Open Source) seems to be as efficient. * a REST based API would even be more powerful than raw html ! It would be great for non JMX enabled monitoring tools (Nagios, etc) to have shell script friendly format (). We would expose basic html for web browsers, RSS for widgets and dashboards, raw text for non JMX enabled monitoring tools (Nagios, etc). * Such a web based monitoring solution could be very generic and not only apply to CXF metrics ; the forthcoming Spring 3 @ManagedMetric annotation could help. * For security reasons, I would feel more comfortable with a dedicated base URI to ease URL based protection (with Spring Security, web.xml, etc). Using the @RolesAllowed standard annotation would be key to ease method level authorization. * By the way, would it make sense to look at the @RolesAllowed standard annotation to protect the existing web services list (ie call to "/services/") ? I hope I was not too long :-) Cyrille -- Cyrille Le Clerc clecl...@xebia.fr (1) Hyperic HQ doc : "trendsup: Values will always increase. Because of that, the rate of change becomes more important, so HQ automatically creates a secondary metric: a per-minute rate measurement...". See http://support.hyperic.com/display/DOC/Metric+Parameters On Fri, Dec 11, 2009 at 2:33 PM, Sergey Beryozkin wrote: > > Hi > > Now that both JAXWS and JAXRS operations can be monitored over JMX (hope > Cyrille will confirm it later on), I reckon it would be cool to let users > issue _manage queries against individual endpoints and get an HTML view, > rather than having to launch a JConsole, ex : > > GET http://myjaxwsservice?_manage > GET http://myjaxrsservice?_manage > > A custom QueryHandler implementation, registered as part of the management > feature, will convert the information from the JMX mbeans into an HTML page. > For a start, it can just do some plain HTML in code. At the next stage, we > can think about produceing nicer pages and adding some polling JavaScript > code, etc. > > Any comments ? I think it would be a very nice feature which would make the > CXF management feature very visible to users. If someone could take upon this > task then it would be appreciated a lot. Perhaps I might also look into it > later on. > > cheers, Sergey >
Re: JAX-RS service and JMX Performance Monitoring
Hello, Your problem is solved in CXF 2.2.5. This NullPointerException you have with version 2.2.4 has been fixed by commit 830533 : "[CXF-2505, CXF-2502, CXF-2489] Bunch of fixes for WS-A + WS-Sec + Mgmt" that is included in version 2.2.5. Cyrille -- Cyrille Le Clerc clecl...@xebia.fr http://blog.xebia.fr On Tue, Nov 24, 2009 at 5:56 PM, Sergey Beryozkin wrote: > Hi > > Cyrille has recently opened > > http://issues.apache.org/jira/browse/CXF-2541 > > cheers, Sergey > > - Original Message - From: "devylon" > To: > Sent: Tuesday, November 24, 2009 4:51 PM > Subject: JAX-RS service and JMX Performance Monitoring > > >> >> I'm just wondering if the JMX performance monitoring has an issue with >> JAX-RS >> services. >> My project contains soap web-services as well as jax-rs services. >> >> i enabled jmx monitoring in my spring context: >> > class="org.apache.cxf.management.jmx.InstrumentationManagerImpl"> >> >> >> >> >> > class="org.apache.cxf.management.counters.CounterRepository" > >> >> >> >> when ever i invoke the soap web-service operation everything is fine. BUT >> when i call a jax-rs service i got an exception in my stacktrace: >> 2009-11-24 16:59:19,715 WARN | >> org.apache.cxf.common.logging.LogUtils.doLog(345) | Interceptor has thrown >> exception, unwinding now >> java.lang.NullPointerException >> at >> >> org.apache.cxf.management.interceptor.AbstractMessageResponseTimeInterceptor.increaseCounter(AbstractMessageResponseTimeInterceptor.java:111) >> at >> >> org.apache.cxf.management.interceptor.AbstractMessageResponseTimeInterceptor.endHandlingMessage(AbstractMessageResponseTimeInterceptor.java:74) >> at >> >> org.apache.cxf.management.interceptor.ResponseTimeMessageOutInterceptor.handleMessage(ResponseTimeMessageOutInterceptor.java:42) >> at >> >> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236) >> at >> >> org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:74) >> at >> >> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236) >> at >> >> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:104) >> at >> >> org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:98) >> at >> >> org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:392) >> at >> >> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:133) >> at >> >> org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:142) >> at >> >> org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:50) >> >> is this a bug in cxf ? i'm using version 2.2.4 >> >> best, >> ingo >> -- >> View this message in context: >> http://old.nabble.com/JAX-RS-service-and-JMX-Performance-Monitoring-tp26498558p26498558.html >> Sent from the cxf-user mailing list archive at Nabble.com. >> > >
Re: JAX-RS service and JMX Performance Monitoring
Hello, Your problem is solved in CXF 2.2.5. This NullPointerException you have with version 2.2.4 has been fixed by commit 830533 : "[CXF-2505, CXF-2502, CXF-2489] Bunch of fixes for WS-A + WS-Sec + Mgmt" that is included in version 2.2.5. Cyrille -- Cyrille Le Clerc clecl...@xebia.fr http://blog.xebia.fr http://fisheye6.atlassian.com/browse/cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/interceptor/AbstractMessageResponseTimeInterceptor.java?r1=830533&r2=760073 On Tue, Nov 24, 2009 at 5:56 PM, Sergey Beryozkin wrote: > > Hi > > Cyrille has recently opened > > http://issues.apache.org/jira/browse/CXF-2541 > > cheers, Sergey > > - Original Message - From: "devylon" > To: > Sent: Tuesday, November 24, 2009 4:51 PM > Subject: JAX-RS service and JMX Performance Monitoring > > >> >> I'm just wondering if the JMX performance monitoring has an issue with JAX-RS >> services. >> My project contains soap web-services as well as jax-rs services. >> >> i enabled jmx monitoring in my spring context: >> > class="org.apache.cxf.management.jmx.InstrumentationManagerImpl"> >> >> >> >> >> > class="org.apache.cxf.management.counters.CounterRepository" > >> >> >> >> when ever i invoke the soap web-service operation everything is fine. BUT >> when i call a jax-rs service i got an exception in my stacktrace: >> 2009-11-24 16:59:19,715 WARN | >> org.apache.cxf.common.logging.LogUtils.doLog(345) | Interceptor has thrown >> exception, unwinding now >> java.lang.NullPointerException >> at >> org.apache.cxf.management.interceptor.AbstractMessageResponseTimeInterceptor.increaseCounter(AbstractMessageResponseTimeInterceptor.java:111) >> at >> org.apache.cxf.management.interceptor.AbstractMessageResponseTimeInterceptor.endHandlingMessage(AbstractMessageResponseTimeInterceptor.java:74) >> at >> org.apache.cxf.management.interceptor.ResponseTimeMessageOutInterceptor.handleMessage(ResponseTimeMessageOutInterceptor.java:42) >> at >> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236) >> at >> org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:74) >> at >> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236) >> at >> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:104) >> at >> org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:98) >> at >> org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:392) >> at >> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:133) >> at >> org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:142) >> at >> org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:50) >> >> is this a bug in cxf ? i'm using version 2.2.4 >> >> best, >> ingo >> -- >> View this message in context: >> http://old.nabble.com/JAX-RS-service-and-JMX-Performance-Monitoring-tp26498558p26498558.html >> Sent from the cxf-user mailing list archive at Nabble.com. >> >
Re: unsupported operation exception
Hello Matthew, I faced the same problem in my JAX-RS application. I created CXF-2556 "UnsupportedOperationException in WadlGenerator" and proposed a patch. Unfortunately, I don't see any workaround waiting for the patch. As our application doesn't really need the WADL generation, we will wait for the next CXF version. Hope this helps, Cyrille https://issues.apache.org/jira/browse/CXF-2556 -- Cyrille Le Clerc clecl...@xebia.fr http://blog.xebia.fr On Mon, Nov 23, 2009 at 6:58 AM, Matthew Shaw wrote: > Hi, > > > > I am getting a UnsupportedOperationException when deploying a jax-rs > service to jboss as 5. I am using jaxb-2.1 to marshall / unmarshall > requests. Are there any classpath issues that I should be aware of with > JBoss? I am running with a spring container. > > > > Here is the stack trace.. > > > > 15:05:34,014 ERROR [[CXFServlet]] Servlet.service() for servlet > CXFServlet threw exception > > java.lang.RuntimeException: org.apache.cxf.interceptor.Fault > > at > org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage > (AbstractFaultChainInitiatorObserver.java:99) > > at > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC > hain.java:284) > > at > org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiati > onObserver.java:104) > > at > org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestin > ation.java:98) > > at > org.apache.cxf.transport.servlet.ServletController.invokeDestination(Ser > vletController.java:392) > > at > org.apache.cxf.transport.servlet.ServletController.invoke(ServletControl > ler.java:170) > > at > org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFSe > rvlet.java:142) > > at > org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPS > ervlet.java:50) > > at > javax.servlet.http.HttpServlet.service(HttpServlet.java:617) > > at > org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTT > PServlet.java:101) > > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica > tionFilterChain.java:290) > > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt > erChain.java:206) > > at > org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilte > r.java:96) > > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica > tionFilterChain.java:235) > > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt > erChain.java:206) > > at > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv > e.java:235) > > at > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv > e.java:191) > > at > org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAs > sociationValve.java:190) > > at > org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.j > ava:92) > > at > org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process( > SecurityContextEstablishmentValve.java:126) > > at > org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(S > ecurityContextEstablishmentValve.java:70) > > at > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java > :127) > > at > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java > :102) > > at > org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConn > ectionValve.java:158) > > at > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve. > java:109) > > at > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:3 > 30) > > at > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:82 > 9) > > at > org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process( > Http11Protocol.java:598) > > at > org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) > > at java.lang.Thread.run(Unknown Source) > > Caused by: org.apache.cxf.interceptor.Fault > > at > org.apache.cxf.inter
Re: unsupported operation exception
Hello Matthew, I faced the same problem in my JAX-RS application. I created CXF-2556 "UnsupportedOperationException in WadlGenerator" and proposed a patch. Unfortunately, I don't see any workaround waiting for the patch. As our application doesn't really need the WADL generation, we will wait for the next CXF version. Hope this helps, Cyrille -- Cyrille Le Clerc clecl...@xebia.fr http://blog.xebia.fr On Mon, Nov 23, 2009 at 6:58 AM, Matthew Shaw wrote: > > Hi, > > > > I am getting a UnsupportedOperationException when deploying a jax-rs > service to jboss as 5. I am using jaxb-2.1 to marshall / unmarshall > requests. Are there any classpath issues that I should be aware of with > JBoss? I am running with a spring container. > > > > Here is the stack trace.. > > > > 15:05:34,014 ERROR [[CXFServlet]] Servlet.service() for servlet > CXFServlet threw exception > > java.lang.RuntimeException: org.apache.cxf.interceptor.Fault > > at > org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage > (AbstractFaultChainInitiatorObserver.java:99) > > at > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC > hain.java:284) > > at > org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiati > onObserver.java:104) > > at > org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestin > ation.java:98) > > at > org.apache.cxf.transport.servlet.ServletController.invokeDestination(Ser > vletController.java:392) > > at > org.apache.cxf.transport.servlet.ServletController.invoke(ServletControl > ler.java:170) > > at > org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFSe > rvlet.java:142) > > at > org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPS > ervlet.java:50) > > at > javax.servlet.http.HttpServlet.service(HttpServlet.java:617) > > at > org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTT > PServlet.java:101) > > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica > tionFilterChain.java:290) > > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt > erChain.java:206) > > at > org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilte > r.java:96) > > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica > tionFilterChain.java:235) > > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt > erChain.java:206) > > at > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv > e.java:235) > > at > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv > e.java:191) > > at > org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAs > sociationValve.java:190) > > at > org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.j > ava:92) > > at > org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process( > SecurityContextEstablishmentValve.java:126) > > at > org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(S > ecurityContextEstablishmentValve.java:70) > > at > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java > :127) > > at > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java > :102) > > at > org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConn > ectionValve.java:158) > > at > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve. > java:109) > > at > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:3 > 30) > > at > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:82 > 9) > > at > org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process( > Http11Protocol.java:598) > > at > org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) > > at java.lang.Thread.run(Unknown Source) > > Caused by: org.apache.cxf.interceptor.Fault > > at > org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage > (AbstractFaultChainInitiatorObs
Re: CXF and Hibernate
Hello Suneet, It looks like you need a kind of OpenSessionInViewFilter to have an Hibernate session available during the CXF marshalling phase. More details here : http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/orm/hibernate3/support/OpenSessionInViewFilter.html Hope this helps, Cyrille *Cyrille Le Clerc* [image: Xebia IT Architects] <http://www.xebia.fr> Email : Tél : Mobile : Web : clecl...@xebia.fr +33(0)1 46 91 76 16 +33(0)6 61 33 69 86 www.xebia.fr blog.xebia.fr *Siège Social* La Défense Colisée 10 / 12 Avenue de l'Arche Faubourg de l'Arche 92419 Courbevoie Cedex [image: Xebia blogue !]<http://feeds.feedburner.com/%7Er/XebiaFrance/%7E6/4> On Fri, Jul 17, 2009 at 5:36 PM, Suneet Shah wrote: > Hello > > I have a number Spring / Hibernate pojos that I am exposing as webservices > using CXF. However, I am running the following problem and was wondering if > someone on the list may have any suggestions on how I can work around this. > > Group class > - collection of Users > - Attributes > There is a many to many relationship between User and Group and I am using > lazy loading to avoid having to load users until its necessary. > > However, when I call an operation that returns a Group or a list of Groups, > I get the following error. > > Caused by: com.sun.xml.bind.api.AccessorException: > org.hibernate.LazyInitializationException: failed to lazily initialize a > collection of role: Group.users, no session or session was closed > at > com.sun.xml.bind.v2.runtime.reflect.AdaptedAccessor.get(AdaptedAccessor.java:74) > at > com.sun.xml.bind.v2.runtime.property.SingleElementNodeProperty.serializeBody(SingleElementNodeProperty.java:126) > at > com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:322) > > I suspect that is happening when cxf marshalls the object and hibernate has > problem because the dependant objects have not been initialized. > How can I work around this? I don't want to have to load the user > collection just to marshall the object. > > How are other people addressing this type of problem? > > Thanks >
Re: CXF JMX Intstrumentation
Hello Daniel, I unfortunately have difficulties to use the provided InstrumentationManagerImpl on my Tomcat based web applications for the following reasons : * I want to create a unique MBeanServer Connector via a JVM parameter (-Dcom.sun.management.jmxremote.port=) and I cannot create one more connector per web app of my Tomcat. * I am interested in benefiting of the Spring Framework MBeanExporter to customise my MBeans Object Names and add theam a property that holds the Web Application Name (I run several web application in the same tomcats). Would the CXF project be interested in contributions to leverage Spring JMX which partially overlaps with CXF JMX ? Cyrille -- Cyrille Le Clerc http://blog.xebia.fr/ On Thu, Feb 19, 2009 at 4:28 PM, Daniel Kulp wrote: > > With 2.1.4, the IM added some methods to call different methods on the > ManagementFactory. > > There is a usePlatformMBeanServer flag that will cause it to call: > ManagementFactory.getPlatformMBeanServer() > > And a serverName property that will cause it to call: > ManagementFactory.getPlatformMBeanServer(serverName) > > Not sure if either of them helps you or not. > > Dan > > > > > On Thu February 19 2009 4:30:46 am Adrian C wrote: > > Hi, > > > > I am hoping to used CXF's JMX's instrumentation and from the quick look > > that I had a this there does not seem to be an out of the box way to > > integrate with an existing MBeanServer. The only way that I can see to do > > this is to override the InstrumentationManagerImpl init's method ... > > > > Am I mistaken in this? Is there another way to do this? > > > > Thanks > > -- > Daniel Kulp > dk...@apache.org > http://www.dankulp.com/blog
Re: CXF JMX Intstrumentation
Here is an implementation of InstrumentManager that relies on a Spring MbeanExporter. Hope this helps, Cyrille SPRING CONFIGURATION = JAVA CODE === import javax.annotation.PostConstruct; import javax.annotation.Resource; import javax.management.JMException; import javax.management.MBeanServer; import javax.management.ObjectName; import org.apache.cxf.Bus; import org.apache.cxf.bus.ManagedBus; import org.apache.cxf.management.InstrumentationManager; import org.apache.cxf.management.ManagedComponent; import org.apache.log4j.Logger; import org.springframework.beans.factory.InitializingBean; import org.springframework.jmx.export.MBeanExporter; import org.springframework.util.Assert; /** * Spring {...@link MBeanExporter} based implementation of CXF {...@link InstrumentationManager}. * Out of the box {...@link org.apache.cxf.management.jmx.InstrumentationManagerImpl} creates a dedicated {...@link MBeanServer} associated with agentId "org.apache.cxf" * @author mailto:cyrille.lecl...@pobox.com";>Cyrille Le Clerc */ public class InstrumentationManagerImpl implements InstrumentationManager, InitializingBean { private static final Logger logger = Logger.getLogger(InstrumentationManagerImpl.class); private Bus bus; protected MBeanExporter mbeanExporter; public void afterPropertiesSet() throws Exception { Assert.notNull(this.mbeanExporter, "mbeanExporter can NOT be null"); } public Bus getBus() { return bus; } public MBeanServer getMBeanServer() { return mbeanExporter.getServer(); } @PostConstruct public void register() { if(logger.isDebugEnabled()) { logger.debug(getClass() + "-postconstruct"); } if (null != bus) { bus.setExtension(this, InstrumentationManager.class); ManagedBus mbus = new ManagedBus(bus); //mbeanExporter.registerManagedResource(mbus); } } public ObjectName register(ManagedComponent managedComponent) throws JMException { ObjectName name = register(managedComponent, false); return name; } public ObjectName register(ManagedComponent managedComponent, boolean forceRegistration) throws JMException { ObjectName name = managedComponent.getObjectName(); register(managedComponent, name, forceRegistration); return name; } public void register(Object obj, ObjectName name) throws JMException { register(obj, name, false); } /** * TODO handle forceRegistration == true */ public void register(Object obj, ObjectName name, boolean forceRegistration) throws JMException { if (logger.isDebugEnabled()) { logger.debug("register object=" + obj + ", objectName=" + name + ", forceRegistration=" + forceRegistration + ")"); } mbeanExporter.registerManagedResource(obj, name); } @Resource(name = "cxf") public void setBus(Bus bus) { this.bus = bus; } public void setMbeanExporter(MBeanExporter mbeanExporter) { this.mbeanExporter = mbeanExporter; } public void shutdown() { } public void unregister(ManagedComponent component) throws JMException { throw new UnsupportedOperationException(); } public void unregister(ObjectName name) throws JMException { throw new UnsupportedOperationException(); } } On Thu, Feb 19, 2009 at 10:30 AM, Adrian C wrote: > > Hi, > > I am hoping to used CXF's JMX's instrumentation and from the quick look > that > I had a this there does not seem to be an out of the box way to integrate > with an existing MBeanServer. The only way that I can see to do this is to > override the InstrumentationManagerImpl init's method ... > > Am I mistaken in this? Is there another way to do this? > > Thanks > -- > View this message in context: > http://www.nabble.com/CXF-JMX-Intstrumentation-tp22096753p22096753.html > Sent from the cxf-user mailing list archive at Nabble.com. > >
Re: HTTP Connection Pooling
Hekko Adrian, This new feature is tracked by " http://issues.apache.org/jira/browse/CXF-291 CXF-291 - Support Commons HTTP Client for HTTP conduit ". I note that Commons Http Client is under a complete rewrite and that version 4 is still in a beta status (beta 3 as of 2008/12/17). It may make sense to wait for the first release of version 4. More over, java.net.HttpURLConnection in Java 6 is getting closer to Commons Http Client even though I regret that the CookieHandler is statically set and that connection pool size ( http.maxConnections ) is only statically set at java.net.HttpURLConnection underlying layer initialisation. Cyrille -- Cyrille Le Clerc clecl...@xebia.fr Adrian C wrote: > > Hi, > What was the design decision behind using java.net.URL. Is there a reason > that apache-commons-httpclient was not used? > > Thanks, > Adrian > > On Mon, Dec 15, 2008 at 7:01 PM, Cyrille Le Clerc > > wrote: > >> >> CXF relies on the out-of-the-box java.net URL and HttpURLConnection . >> >> The JVM offers connections pooling mechanisms called "HTTP Persistent >> Connections". Basically, you have to define the JVM property >> "http.maxConnections" (default 5) to a higher value. >> >> Details are available here : >> http://java.sun.com/javase/6/docs/technotes/guides/net/http-keepalive.html >> >> Hope this helps, >> >> Cyrille >> -- >> Cyrille Le Clerc >> clecl...@xebia.fr >> >> >> pashpour wrote: >> > >> > Hi folks, >> >Any luck with HTTP pooling? >> > >> > Thanks, >> > >> > Pash >> > >> > Simon MaticLangford wrote: >> >> >> >> Hi, >> >> >> >> >> >> >> >> Is there anyway to get CXF to use an HTTP connection pool? Looking at >> the >> >> connection factory it appears to use url.openConnection() directly, >> but >> >> wondered if there is a way other that writing my own implementation of >> >> the interface? Specifically I want to reuse connections using a client >> >> certificate over SSL due to the overhead of establishing SSL >> connections. >> >> >> >> >> >> >> >> Thanks >> >> >> >> >> >> >> >> Simon >> >> >> >> >> >> >> >> >> >> >> >> Simon Matić Langford >> >> >> >> Java Development Lead >> >> >> >> www.betfair.com <http://www.betfair.com/> >> >> >> >> >> >> >> >> Waterfront | Hammersmith Embankment | Chancellors Road | London | W6 >> 9HP >> >> >> >> >> >> >> >> The information in this e-mail and any attachment is confidential and >> is >> >> intended only for the named recipient(s). The e-mail may not be >> disclosed >> >> or used by any person other than the addressee, nor may it be copied >> in >> >> any way. If you are not a named recipient please notify the sender >> >> immediately and delete any copies of this message. Any unauthorized >> >> copying, disclosure or distribution of the material in this e-mail is >> >> strictly forbidden. Any view or opinions presented are solely those of >> >> the author and do not necessarily represent those of Betfair. Betfair >> is >> >> the trading name of The Sporting Exchange Limited whose registered >> office >> >> is: Waterfront, Hammersmith Embankment, Chancellors Road, London W6 >> 9HP. >> >> Registered in England with No. 3770548. >> >> >> >> >> >> >> >> >> In order to protect our email recipients, Betfair Group use SkyScan >> from >> >> MessageLabs to scan all Incoming and Outgoing mail for viruses. >> >> >> >> >> >> >> >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/HTTP-Connection-Pooling-tp18319313p21019615.html >> Sent from the cxf-user mailing list archive at Nabble.com. >> >> > > -- View this message in context: http://www.nabble.com/HTTP-Connection-Pooling-tp18319313p21052859.html Sent from the cxf-user mailing list archive at Nabble.com.
Re: HTTP Connection Pooling
CXF relies on the out-of-the-box java.net URL and HttpURLConnection . The JVM offers connections pooling mechanisms called "HTTP Persistent Connections". Basically, you have to define the JVM property "http.maxConnections" (default 5) to a higher value. Details are available here : http://java.sun.com/javase/6/docs/technotes/guides/net/http-keepalive.html Hope this helps, Cyrille -- Cyrille Le Clerc clecl...@xebia.fr pashpour wrote: > > Hi folks, >Any luck with HTTP pooling? > > Thanks, > > Pash > > Simon MaticLangford wrote: >> >> Hi, >> >> >> >> Is there anyway to get CXF to use an HTTP connection pool? Looking at the >> connection factory it appears to use url.openConnection() directly, but >> wondered if there is a way other that writing my own implementation of >> the interface? Specifically I want to reuse connections using a client >> certificate over SSL due to the overhead of establishing SSL connections. >> >> >> >> Thanks >> >> >> >> Simon >> >> >> >> >> >> Simon Matić Langford >> >> Java Development Lead >> >> www.betfair.com <http://www.betfair.com/> >> >> >> >> Waterfront | Hammersmith Embankment | Chancellors Road | London | W6 9HP >> >> >> >> The information in this e-mail and any attachment is confidential and is >> intended only for the named recipient(s). The e-mail may not be disclosed >> or used by any person other than the addressee, nor may it be copied in >> any way. If you are not a named recipient please notify the sender >> immediately and delete any copies of this message. Any unauthorized >> copying, disclosure or distribution of the material in this e-mail is >> strictly forbidden. Any view or opinions presented are solely those of >> the author and do not necessarily represent those of Betfair. Betfair is >> the trading name of The Sporting Exchange Limited whose registered office >> is: Waterfront, Hammersmith Embankment, Chancellors Road, London W6 9HP. >> Registered in England with No. 3770548. >> >> >> >> In order to protect our email recipients, Betfair Group use SkyScan from >> MessageLabs to scan all Incoming and Outgoing mail for viruses. >> >> >> > > -- View this message in context: http://www.nabble.com/HTTP-Connection-Pooling-tp18319313p21019615.html Sent from the cxf-user mailing list archive at Nabble.com.
Re: Improving user error messages for failed webservice connection?
We have developped a on our project a FaultEnhancerInterceptor that add the following details when an exception occurs : * Service : exchange.get(Message.WSDL_INTERFACE) * Operation : exchange.get(OperationInfo.class).getName() * Target URL : exchange.get(Message.ENDPOINT_ADDRESS) If the exception is an unexpected exception (e.g. a SOAPFault), we wrap the cause exception in a RuntimeException that holds all these details; otherwise, we do not modify the exception. Moreover, we log the exception : if debug level is enabled, we log the stacktrace. Otherwise, we log the concatenation of the toString() of the stack of exceptions. Our interceptor is packaged as a CXF feature. Code is available here : http://xebia-france.googlecode.com/svn/trunk/ws/cxf-demo/src/main/java/fr/xebia/cxf/feature/FaultEnhancerFeature.java http://xebia-france.googlecode.com/svn/trunk/ws/cxf-demo/src/main/java/fr/xebia/cxf/interceptor/FaultEnhancerInterceptor.java Hope this helps, Cyrille -- cyrille.lecl...@pobox.com /** * We rely on {...@link Interceptor#handleFault(Message)} of a {...@link Service#getOutInterceptors()} instead of * {...@link Interceptor#handleMessage(Message)} of {...@link Service#getOutFaultInterceptors()} because {...@link ClientOutFaultObserver} swallows * {...@link Interceptor#handleMessage(Message)} of the {...@link Service#getOutFaultInterceptors()} for exceptions that occur on * {...@link Phase#SEND} ("do nothing for exception occurred during client sending out request"). * * @author mailto:cyrille.lecl...@pobox.com Cyrille Le Clerc */ public class FaultEnhancerInterceptor extends AbstractPhaseInterceptor { private final Logger logger = Logger.getLogger(FaultEnhancerInterceptor.class); public FaultEnhancerInterceptor() { super(Phase.PRE_LOGICAL); } public void handleMessage(Message message) throws Fault { // do nothing. This class only handles Faults } @Override public void handleFault(Message message) { Exchange exchange = message.getExchange(); if (exchange == null) { // do nothing } else { Fault fault = (Fault)message.getContent(Exception.class); FaultMode mode = message.get(FaultMode.class); String msg = "Exception invoking service " + exchange.get(Message.WSDL_INTERFACE); if (exchange.get(OperationInfo.class) != null) { msg += ", operation=" + exchange.get(OperationInfo.class).getName(); } if (exchange.get(Message.ENDPOINT_ADDRESS) != null) { msg += ", url=" + exchange.get(Message.ENDPOINT_ADDRESS); } Throwable cause = fault.getCause() == null ? fault : fault.getCause(); Fault enhancedFault; Level level; if (FaultMode.UNCHECKED_APPLICATION_FAULT.equals(mode) || FaultMode.LOGICAL_RUNTIME_FAULT.equals(mode) || FaultMode.RUNTIME_FAULT.equals(mode)) { level = Level.ERROR; enhancedFault = new Fault(new RuntimeException(msg, cause)); } else if (FaultMode.CHECKED_APPLICATION_FAULT.equals(mode)) { enhancedFault = fault; level = Level.INFO; } else /* mode == null */{ enhancedFault = new Fault(new RuntimeException(msg, cause)); level = Level.INFO; } if (logger.isDebugEnabled()) { logger.log(level, msg, cause); } else { List throwables = ExceptionUtils.getThrowableList(cause); StringBuilder msgBuilder = new StringBuilder(msg); for (Throwable throwable : throwables) { msgBuilder.append(" " + throwable); } logger.log(level,msgBuilder.toString()); } message.setContent(Exception.class, enhancedFault); if (exchange.get(Exception.class) != null) { exchange.put(Exception.class, enhancedFault); } } } } dkulp wrote: > > On Thursday 11 December 2008 3:57:24 am Kent Närling wrote: >> We have several application that are configured to connect to a >> webservice >> interface for our server. >> Naturally, it happens that this connection is sometimes configured >> incorrectly or maybe the server is down etc >> Unfortunately, this gives very bad and hard to read errors in the logs! > ... >> (furthermore this is logged inside the MessageSenderInterceptor, is there >> any way to turn this off?) > > Actually, it's not logged there. There isn't any log statements in the > MessageSenderInterceptor. It's PROBABLY logged in the > PhaseInterceptorChain.In anycase, you can use the standard > java.util.logging con