Configuring the Jetty Runtime - specifying port via Spring property placeholders

View: New views
6 Messages — Rating Filter:   Alert me  

Configuring the Jetty Runtime - specifying port via Spring property placeholders

by Szczepan Faber :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Following the wiki entry:
http://cwiki.apache.org/CXF20DOC/jetty-configuration.html

There is any example:

<httpj:engine-factory bus="cxf">
    ...
    <httpj:engine port="9001">
      ...

How can I make the engine *port* configurable via Spring property placeholders?

I tried following:

<httpj:engine port="${service.port}">

However, it doesn't work. I can understand why it doesn't work:
httpj:engine is a schema extension, not a typical bean wiring stuff
where property placeholders work out of the box.

The question is how can I make it working so that I can configure the
port via a property?

Thanks!
Szczepan

Re: Configuring the Jetty Runtime - specifying port via Spring property placeholders

by Brent Verner-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

  If you're loading the configuration yourself, you can subclass the
appropriate ApplicationContext to disable validation...

        public class NonValidatingClassPathXmlApplicationContext
        extends ClassPathXmlApplicationContext {
                public NonValidatingClassPathXmlApplicationContext(String conf) {
                        super(conf);
                }
                protected void initBeanDefinitionReader( XmlBeanDefinitionReader
beanDefinitionReader) {
                        super.initBeanDefinitionReader(beanDefinitionReader);
                        beanDefinitionReader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_NONE);
                        beanDefinitionReader.setNamespaceAware(true);
                }
        }


hth.
  Brent

On Tue, Oct 20, 2009 at 8:41 AM, szczepiq <szczepiq@...> wrote:

> Hi,
>
> Following the wiki entry:
> http://cwiki.apache.org/CXF20DOC/jetty-configuration.html
>
> There is any example:
>
> <httpj:engine-factory bus="cxf">
>    ...
>    <httpj:engine port="9001">
>      ...
>
> How can I make the engine *port* configurable via Spring property placeholders?
>
> I tried following:
>
> <httpj:engine port="${service.port}">
>
> However, it doesn't work. I can understand why it doesn't work:
> httpj:engine is a schema extension, not a typical bean wiring stuff
> where property placeholders work out of the box.
>
> The question is how can I make it working so that I can configure the
> port via a property?
>
> Thanks!
> Szczepan
>

Re: Configuring the Jetty Runtime - specifying port via Spring property placeholders

by Szczepan Faber :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for the hint.

Although I'm not sure how this problem is related to validation. In my
case ${service.port} is simply not resolved - there are no XML/bean
validation errors.

Cheers,
Szczepan

On Tue, Oct 20, 2009 at 3:46 PM, Brent Verner <dbv@...> wrote:

> Hi,
>
>  If you're loading the configuration yourself, you can subclass the
> appropriate ApplicationContext to disable validation...
>
>        public class NonValidatingClassPathXmlApplicationContext
>        extends ClassPathXmlApplicationContext {
>                public NonValidatingClassPathXmlApplicationContext(String conf) {
>                        super(conf);
>                }
>                protected void initBeanDefinitionReader( XmlBeanDefinitionReader
> beanDefinitionReader) {
>                        super.initBeanDefinitionReader(beanDefinitionReader);
>                        beanDefinitionReader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_NONE);
>                        beanDefinitionReader.setNamespaceAware(true);
>                }
>        }
>
>
> hth.
>  Brent
>
> On Tue, Oct 20, 2009 at 8:41 AM, szczepiq <szczepiq@...> wrote:
>> Hi,
>>
>> Following the wiki entry:
>> http://cwiki.apache.org/CXF20DOC/jetty-configuration.html
>>
>> There is any example:
>>
>> <httpj:engine-factory bus="cxf">
>>    ...
>>    <httpj:engine port="9001">
>>      ...
>>
>> How can I make the engine *port* configurable via Spring property placeholders?
>>
>> I tried following:
>>
>> <httpj:engine port="${service.port}">
>>
>> However, it doesn't work. I can understand why it doesn't work:
>> httpj:engine is a schema extension, not a typical bean wiring stuff
>> where property placeholders work out of the box.
>>
>> The question is how can I make it working so that I can configure the
>> port via a property?
>>
>> Thanks!
>> Szczepan
>>
>

Re: Configuring the Jetty Runtime - specifying port via Spring property placeholders

by Brent Verner-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

  Oh, sorry about that...  Here's what I have in my spring configuration.
AFAIK, the resolution of placeholders all happens within Spring and
cxf just uses the configured beans.

spring config snippet:
...
    <bean id="agent-placeholderConfigurer"
        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="ignoreResourceNotFound" value="true"/>
        <property name="localOverride" value="true" />
        <property name="locations">
            <list>
                <value>classpath:META-INF/serviceManagerAgent.properties</value>
                <value>classpath:serviceManagerAgent-local.properties</value>
            </list>
        </property>
    </bean>
...
                <httpj:engine port="${sma.servicePort}">
                        <httpj:tlsServerParametersRef id="secure" />
                        <httpj:threadingParameters
                                minThreads="${sma.minThreads}"
                                maxThreads="${sma.maxThreads}"
                                />
                        <httpj:sessionSupport>true</httpj:sessionSupport>
                </httpj:engine>


properties file:
...
sma.servicePort: 19001
sma.minThreads: 5
sma.maxThreads: 25



cheers!
  b

On Tue, Oct 20, 2009 at 10:01 AM, szczepiq <szczepiq@...> wrote:

> Thanks for the hint.
>
> Although I'm not sure how this problem is related to validation. In my
> case ${service.port} is simply not resolved - there are no XML/bean
> validation errors.
>
> Cheers,
> Szczepan
>
> On Tue, Oct 20, 2009 at 3:46 PM, Brent Verner <dbv@...> wrote:
>> Hi,
>>
>>  If you're loading the configuration yourself, you can subclass the
>> appropriate ApplicationContext to disable validation...
>>
>>        public class NonValidatingClassPathXmlApplicationContext
>>        extends ClassPathXmlApplicationContext {
>>                public NonValidatingClassPathXmlApplicationContext(String conf) {
>>                        super(conf);
>>                }
>>                protected void initBeanDefinitionReader( XmlBeanDefinitionReader
>> beanDefinitionReader) {
>>                        super.initBeanDefinitionReader(beanDefinitionReader);
>>                        beanDefinitionReader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_NONE);
>>                        beanDefinitionReader.setNamespaceAware(true);
>>                }
>>        }
>>
>>
>> hth.
>>  Brent
>>
>> On Tue, Oct 20, 2009 at 8:41 AM, szczepiq <szczepiq@...> wrote:
>>> Hi,
>>>
>>> Following the wiki entry:
>>> http://cwiki.apache.org/CXF20DOC/jetty-configuration.html
>>>
>>> There is any example:
>>>
>>> <httpj:engine-factory bus="cxf">
>>>    ...
>>>    <httpj:engine port="9001">
>>>      ...
>>>
>>> How can I make the engine *port* configurable via Spring property placeholders?
>>>
>>> I tried following:
>>>
>>> <httpj:engine port="${service.port}">
>>>
>>> However, it doesn't work. I can understand why it doesn't work:
>>> httpj:engine is a schema extension, not a typical bean wiring stuff
>>> where property placeholders work out of the box.
>>>
>>> The question is how can I make it working so that I can configure the
>>> port via a property?
>>>
>>> Thanks!
>>> Szczepan
>>>
>>
>

Re: Configuring the Jetty Runtime - specifying port via Spring property placeholders

by dkulp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



What version of CXF?    Definitely upgrade to the latest.    There was some
bugs in some of our custom namespace handlers that use JAXB under the covers
that wasn't allowing the properties to be injected.   That was fixed a little
while ago though.

Dan

On Tue October 20 2009 8:41:54 am szczepiq wrote:

> Hi,
>
> Following the wiki entry:
> http://cwiki.apache.org/CXF20DOC/jetty-configuration.html
>
> There is any example:
>
> <httpj:engine-factory bus="cxf">
>     ...
>     <httpj:engine port="9001">
>       ...
>
> How can I make the engine *port* configurable via Spring property
>  placeholders?
>
> I tried following:
>
> <httpj:engine port="${service.port}">
>
> However, it doesn't work. I can understand why it doesn't work:
> httpj:engine is a schema extension, not a typical bean wiring stuff
> where property placeholders work out of the box.
>
> The question is how can I make it working so that I can configure the
> port via a property?
>
> Thanks!
> Szczepan
>

--
Daniel Kulp
dkulp@...
http://www.dankulp.com/blog

Re: Configuring the Jetty Runtime - specifying port via Spring property placeholders

by Marcel Casado :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I'm using FUSE ESB 4.1.0.2 that I believe has CXF 2.2.2.1-fuse installed. I'm trying to achieve the same but i can not upgrade CXF . Is there another solution ?

Thanks,

-Marcel


dkulp wrote:

What version of CXF?    Definitely upgrade to the latest.    There was some
bugs in some of our custom namespace handlers that use JAXB under the covers
that wasn't allowing the properties to be injected.   That was fixed a little
while ago though.

Dan

On Tue October 20 2009 8:41:54 am szczepiq wrote:
> Hi,
>
> Following the wiki entry:
> http://cwiki.apache.org/CXF20DOC/jetty-configuration.html
>
> There is any example:
>
> <httpj:engine-factory bus="cxf">
>     ...
>     <httpj:engine port="9001">
>       ...
>
> How can I make the engine *port* configurable via Spring property
>  placeholders?
>
> I tried following:
>
> <httpj:engine port="${service.port}">
>
> However, it doesn't work. I can understand why it doesn't work:
> httpj:engine is a schema extension, not a typical bean wiring stuff
> where property placeholders work out of the box.
>
> The question is how can I make it working so that I can configure the
> port via a property?
>
> Thanks!
> Szczepan
>

--
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog