I've experimented a bit more and found something strange. I wanted to know
whether the jetty.xml is actually being read. So I changed the starting
root element "<Configure" to "<xConfigure" and sure enough I get the
following message in my console on startup:

*karaf@root> 2012-12-17 09:01:36,481 | ERROR | g.ops4j.pax.web) |
JettyServerImpl                  | e.jetty.internal.JettyServerImpl  100 |
org.xml.sax.SAXParseException: The element type "xConfigure" must be
terminated by the matching end-tag "</xConfigure>".
*

This is as expected as the jetty.xml does not contain a valid XML document.

But, then I tried to use my own configuration file (org.ops4j.pax.web.cfg)
with the following contents:

*org.apache.karaf.features.configKey=org.ops4j.pax.web*
*org.osgi.service.http.port=${seco.httpPort}*
*org.osgi.service.http.port.secure=${seco.httpsPort}*
*org.ops4j.pax.web.session.timeout=30*
*javax.servlet.context.tempdir=${karaf.data}/pax-web-jsp*
*org.ops4j.pax.web.config.file=${karaf.base}/etc/jetty2.xml*

The variables for the ports are set in custom.properties and work as thy
should. However, I do not get any error on startup. This indicates that
jetty2.xml is not parsed at all (since it contains the same error that I
put in jetty.xml). Furthermore, it also means that jetty.xml is not parsed
either since it also contains an invalid XML document.

So, for some reason, if you use your own org.ops4j.pax.web.cfg, no jetty
configuration file is read at all. Sounds like a bug somewhere.

I don't think this is the cause for my problem since I've tried to skip my
own org.ops4j.pax.web.cfg but still haven't managed to set my special
property correctly.

/Bengt



2012/12/17 Bengt Rodehav <be...@rodehav.com>

> Good idea,
>
> I already have my own org.ops4j.pax.web.cfg but it's easy to forget to
> include the org.ops4j.pax.web.config.file attribute causing jetty.xml not
> to be used at all.
>
> BTW do you use the metadata services? If not, I suggest to do so since
> it's then easy to look at the configuration in the web console and see all
> possible values.
>
> /Bengt
>
>
> 2012/12/17 Jean-Baptiste Onofré <j...@nanthrax.net>
>
>> FYI, in order to give more "visibility" to the users:
>>
>> https://issues.apache.org/**jira/browse/KARAF-2053<https://issues.apache.org/jira/browse/KARAF-2053>
>>
>> Regards
>> JB
>>
>>
>> On 12/17/2012 07:55 AM, Bengt Rodehav wrote:
>>
>>> Thanks for the advice Freeman - I'll think about that.
>>>
>>> /Bengt
>>>
>>>
>>> 2012/12/17 Freeman Fang <freeman.f...@gmail.com
>>> <mailto:freeman.f...@gmail.com**>>
>>>
>>>
>>>     Hi,
>>>
>>>     As you also have your own etc/org.ops4j.pax.web.cfg, it means it
>>>     will override the configuration for http feature
>>>            <config name="org.ops4j.pax.web">
>>>                  org.osgi.service.http.port=**8181
>>>                  javax.servlet.context.tempdir=**
>>> ${karaf.data}/pax-web-jsp
>>>                  org.ops4j.pax.web.config.file=**
>>> ${karaf.base}/etc/jetty.xml
>>>              </config>
>>>
>>>     So you need ensure your own etc/org.ops4j.pax.web.cfg has something
>>> like
>>>     org.ops4j.pax.web.config.file=**Your_karaf_kit_path/etc/jetty.**xml
>>>
>>>     So that the etc/jetty.xml could be picked up.
>>>
>>>     Freeman
>>>     -------------
>>>     Freeman(Yue) Fang
>>>
>>>     Red Hat, Inc.
>>>     FuseSource is now part of Red Hat
>>>     Web: http://fusesource.com | http://www.redhat.com/
>>>     Twitter: freemanfang
>>>     Blog: http://freemanfang.blogspot.**com<http://freemanfang.blogspot.com>
>>>     
>>> http://blog.sina.com.cn/u/**1473905042<http://blog.sina.com.cn/u/1473905042>
>>>     weibo: @Freeman小屋
>>>
>>>     On 2012-12-14, at 下午11:21, Bengt Rodehav wrote:
>>>
>>>      Thanks for your reply Achim.
>>>>
>>>>     However, I don't quite understand how this works - is this
>>>>     described somewhere? Things that would be nice to understand are:
>>>>
>>>>     - What role does the jettyconfig file has?
>>>>     - What role does etc/jetty.xml has? Is it generated?
>>>>     - How is the final jetty configuration built up?
>>>>     - When do I have to use a fragment (as described on the wiki)?
>>>>
>>>>     To top it off I also have my ownd etc/org.ops4j.pax.web.cfg file.
>>>>     I'm not sure how it works together with the default configuration
>>>>     in the feature.
>>>>
>>>>     Just trying to get a grasp on this...
>>>>
>>>>     /Bengt
>>>>
>>>>
>>>>
>>>>
>>>>     2012/12/14 Achim Nierbeck <bcanh...@googlemail.com
>>>>     <mailto:bcanhome@googlemail.**com <bcanh...@googlemail.com>>>
>>>>
>>>>
>>>>         Hi Bengt,
>>>>
>>>>         since the Jetty.xml isn't the "lead" configuration for the
>>>>         jetty file and since the jetty is started in the "embedded"
>>>>         style you need to get a hold of this a bit different, or
>>>>         you use a jetty-web.xml file.
>>>>
>>>>         I'm not sure about the right syntax right now, but since it
>>>>         doesn't work and the jetty.xml is interpreted after the server
>>>>         is configured you probably need some getAttribute first.
>>>>         A maybe not so good matching example can be found at [1]
>>>>
>>>>         regards, Achim
>>>>
>>>>         [1] - 
>>>> http://nierbeck.de/cgi-bin/**weblog_basic/index.php?p=165<http://nierbeck.de/cgi-bin/weblog_basic/index.php?p=165>
>>>>
>>>>
>>>>
>>>>         2012/12/14 Bengt Rodehav <be...@rodehav.com
>>>>         <mailto:be...@rodehav.com>>
>>>>
>>>>
>>>>             I'm running a web application on Karaf 2.2.8. I need to
>>>>             send quite a lot of data to the server using the POST
>>>>             method. I get the following error message on the web
>>>>             browser side:
>>>>
>>>>             Form too large1588889>200000
>>>>
>>>>             After googling I found how to reconfigure this on
>>>>             
>>>> http://wiki.eclipse.org/Jetty/**Howto/Configure_Form_Size<http://wiki.eclipse.org/Jetty/Howto/Configure_Form_Size>
>>>> .
>>>>
>>>>             I therefore modified the etc/jetty.xml as follows:
>>>>
>>>>             ...
>>>>             <Configure class="org.eclipse.jetty.**server.Server">
>>>>                 <Call name="setAttribute">
>>>>
>>>>             <Arg>org.eclipse.jetty.server.**
>>>> Request.maxFormContentSize</**Arg>
>>>>                   <Arg>2000000</Arg>
>>>>                 </Call>
>>>>             ...
>>>>
>>>>             But I still get the same error message. The configuration
>>>>             hasn't changed. Am I doing this the wrong way?
>>>>
>>>>             /Bengt
>>>>
>>>>
>>>>
>>>>
>>>>         --
>>>>
>>>>         Apache Karaf <http://karaf.apache.org/> Committer & PMC
>>>>         OPS4J Pax Web 
>>>> <http://wiki.ops4j.org/**display/paxweb/Pax+Web/<http://wiki.ops4j.org/display/paxweb/Pax+Web/>
>>>> >
>>>>         Committer & Project Lead
>>>>         OPS4J Pax for Vaadin
>>>>         
>>>> <http://team.ops4j.org/wiki/**display/PAXVAADIN/Home<http://team.ops4j.org/wiki/display/PAXVAADIN/Home>>
>>>> Commiter &
>>>>         Project Lead
>>>>         blog <http://notizblog.nierbeck.de/**>
>>>>
>>>>
>>>>
>>>
>>>
>> --
>> Jean-Baptiste Onofré
>> jbono...@apache.org
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
>>
>
>

Reply via email to