Hi Again,
I have a theory, based on an incomplete understanding of how Spring extensions
work :)
The bus attribute on the JettyHTTPServerEngineFactoryConfigType complex type is
defined as:
<xs:attribute name="bus" type="xs:string" default="cxf"/>
If this default is applied by Spring before it applies my custom value it would
explain the behaviour I'm seeing:
If I just have the engine-factory config I get a "No bean named 'cxf'" error.
If I add the import for "classpath:META-INF/cxf/cxf.xml" I get an assertion
from setBus: assert this.bus == null || this.bus == bus;
Which means it's impossible to use a custom bus with the
JettyHTTPServerEngineFactoryConfigType.
Secondary question: do I need to have a custom bus?
I have an OSGi container that has many different CXF buses in it, but not
usually more than one per bundle.
What is the scope of a bus?
Can I just use the normal "cxf" bus with a custom "id" to differentiate them?
Jim
On Mon, Aug 20, 2012 at 03:41:33PM +0100, James Talbut wrote:
> Hi,
>
> I'm getting the "No bean named 'cxf' is defined" error when trying to
> configure Jetty for my CXF service using a named bus.
> The Spring config file (trimmed to what I hope is relevant parts is):
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:aop="http://www.springframework.org/schema/aop"
> xmlns:tx="http://www.springframework.org/schema/tx"
> xmlns:context="http://www.springframework.org/schema/context"
> xmlns:osgi="http://www.springframework.org/schema/osgi"
> xmlns:cxf="http://cxf.apache.org/core"
> xmlns:jaxws="http://cxf.apache.org/jaxws"
> xmlns:jee="http://www.springframework.org/schema/jee"
> xmlns:camel="http://camel.apache.org/schema/spring"
> xmlns:camel-cxf="http://camel.apache.org/schema/cxf"
> xmlns:http="http://cxf.apache.org/transports/http/configuration"
> xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration"
> xmlns:sec="http://cxf.apache.org/configuration/security"
> xsi:schemaLocation="
> http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
> http://www.springframework.org/schema/aop
> http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
> http://www.springframework.org/schema/tx
> http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
> http://www.springframework.org/schema/context
> http://www.springframework.org/schema/context/spring-context-2.5.xsd
> http://www.springframework.org/schema/jee
> http://www.springframework.org/schema/jee/spring-jee-2.5.xsd
> http://www.springframework.org/schema/osgi
> http://www.springframework.org/schema/osgi/spring-osgi.xsd
> http://cxf.apache.org/core
> http://cxf.apache.org/schemas/core.xsd
> http://cxf.apache.org/jaxws
> http://cxf.apache.org/schemas/jaxws.xsd
> http://cxf.apache.org/configuration/security
> http://cxf.apache.org/schemas/configuration/security.xsd
> http://cxf.apache.org/transports/http/configuration
> http://cxf.apache.org/schemas/configuration/http-conf.xsd
> http://cxf.apache.org/transports/http-jetty/configuration
> http://cxf.apache.org/schemas/configuration/http-jetty.xsd
> http://cxf.apache.org/configuration/security
> http://cxf.apache.org/schemas/configuration/security.xsd
> http://camel.apache.org/schema/spring
> http://camel.apache.org/schema/spring/camel-spring.xsd
> http://camel.apache.org/schema/cxf
> http://camel.apache.org/schema/cxf/camel-cxf.xsd
> ">
>
> ...
>
> <bean id="CounterRepository"
> class="org.apache.cxf.management.counters.CounterRepository">
> <property name="bus" ref="online-tests" />
> </bean>
>
> <cxf:bus name="online-tests" id="online-tests" >
> <cxf:inInterceptors>
> <ref bean="cxfInboundLoggingInterceptor" />
> </cxf:inInterceptors>
> <cxf:outInterceptors>
> <ref bean="cxfOutboundLoggingInterceptor" />
> </cxf:outInterceptors>
> <cxf:outFaultInterceptors>
> <ref bean="cxfOutboundLoggingInterceptor" />
> </cxf:outFaultInterceptors>
> </cxf:bus>
>
> <httpj:engine-factory bus="online-tests" >
> <httpj:engine port="8017" >
> <httpj:threadingParameters minThreads="10" maxThreads="50" />
> </httpj:engine>
> </httpj:engine-factory>
>
> <jaxws:endpoint id="targetProxy" implementor="#coreService"
> address="http://0.0.0.0:12345/OnlineTests" bus="online-tests">
> <jaxws:properties>
> </jaxws:properties>
> </jaxws:endpoint>
>
> <jaxws:client id="clientTest"
> serviceClass="net.groupgti.olt._1_0.OnlineTestsPortType"
> address="http://127.0.0.1:12345/OnlineTests"
> bus="online-tests" />
>
> </beans>
>
>
> I've tried playing around with the bus name, id and "bus" attribute, but I
> can't get rid of the error (except by removing the engine-factory element).
> Interestingly if I change the bus attribute on the engine-factory element to
> something that doesn't exist I get the nonexistent name in the error message.
>
> How can I configure the maximum thread pool size?
>
> Thanks
>
> Jim