Hi all,

My name is Netta and I would appreciate your help with this:

I have the following jetty.xml file:

Here is its content:
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "
http://www.eclipse.org/jetty/configure.dtd";>

<!-- =============================================================== -->
<!-- Configure the Jetty Server                                      -->
<!--                                                                 -->
<!-- Documentation of this file format can be found at:              -->
<!-- http://wiki.eclipse.org/Jetty/Reference/jetty.xml_syntax        -->
<!--                                                                 -->
<!-- =============================================================== -->


<Configure id="Server" class="org.eclipse.jetty.server.Server">

    <!-- =========================================================== -->
    <!-- Server Thread Pool                                          -->
    <!-- =========================================================== -->
    <Set name="ThreadPool">
      <!-- Default queued blocking threadpool -->
      <New class="org.eclipse.jetty.util.thread.QueuedThreadPool">
        <Set name="minThreads">10</Set>
        <Set name="maxThreads">10000</Set>
        <Set name="detailedDump">false</Set>
      </New>
    </Set>

    <!-- =========================================================== -->
    <!-- Set connectors                                              -->
    <!-- =========================================================== -->

    <Call name="addConnector">
      <Arg>
          <New class="org.eclipse.jetty.server.bio.SocketConnector">
            <Set name="host"><SystemProperty name="jetty.host" /></Set>
            <Set name="port"><SystemProperty name="jetty.port" 
default="8983"/></Set>
            <Set name="maxIdleTime">50000</Set>
            <Set name="lowResourceMaxIdleTime">1500</Set>
            <Set name="statsOn">false</Set>
            <Set name="requestHeaderSize">1000000</Set>
            <Set name="requestBufferSize">1000000</Set>
          </New>
      </Arg>
    </Call>

    <!-- =========================================================== -->
    <!-- Set handler Collection Structure                            --> 
    <!-- =========================================================== -->
    <Set name="handler">
      <New id="Handlers" 
class="org.eclipse.jetty.server.handler.HandlerCollection">
        <Set name="handlers">
         <Array type="org.eclipse.jetty.server.Handler">
           <Item>
             <New id="Contexts" 
class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/>
           </Item>
           <Item>
             <New id="DefaultHandler" 
class="org.eclipse.jetty.server.handler.DefaultHandler"/>
           </Item>
           <Item>
             <New id="RequestLog" 
class="org.eclipse.jetty.server.handler.RequestLogHandler"/>
           </Item>
         </Array>
        </Set>
      </New>
    </Set>
 
    <!-- =========================================================== -->
    <!-- extra options                                               -->
    <!-- =========================================================== -->
    <Set name="stopAtShutdown">true</Set>
    <Set name="sendServerVersion">false</Set>
    <Set name="sendDateHeader">false</Set>
    <Set name="gracefulShutdown">1000</Set>
    <Set name="dumpAfterStart">false</Set>
    <Set name="dumpBeforeStop">false</Set>

    <Call name="addBean">
      <Arg>
        <New id="DeploymentManager" 
class="org.eclipse.jetty.deploy.DeploymentManager">
          <Set name="contexts">
            <Ref id="Contexts" />
          </Set>
          <Call name="setContextAttribute">
 <Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
            <Arg>.*/servlet-api-[^/]*\.jar$</Arg>
          </Call> 
        </New>
      </Arg>
    </Call>
 
    <Ref id="DeploymentManager">
      <Call name="addAppProvider">
        <Arg>
          <New class="org.eclipse.jetty.deploy.providers.ContextProvider">
            <Set name="monitoredDirName"><SystemProperty name="jetty.home" 
default="."/>/contexts</Set>
            <Set name="scanInterval">0</Set>
          </New>
        </Arg>
      </Call>
    </Ref>

</Configure>

It worked until we decided to upgrade the jetty version from 
8.1.10.v20130312 to 9.4.29.v20200521. Now the server fails to start. 
I'm trying to change it so it will
a - work (i.e. fit the API changes that happen between the versions)
b - will be as close to the original file as possible (since I don't know 
the consequences of changing one part or another, the impact on 
performance it will have, etc.)

This is what I have so far (major changes are in bold):

Here is the content:
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "
http://www.eclipse.org/jetty/configure_9_3.dtd";>

<!-- =============================================================== -->
<!-- Configure the Jetty Server                                      -->
<!--                                                                 -->
<!-- Documentation of this file format can be found at:              -->
<!-- http://wiki.eclipse.org/Jetty/Reference/jetty.xml_syntax        -->
<!--                                                                 -->
<!-- =============================================================== -->


<Configure id="Server" class="org.eclipse.jetty.server.Server">

    <!-- =========================================================== -->
    <!-- Server Thread Pool                                          -->
    <!-- =========================================================== -->
<!--    <Set name="ThreadPool">-->
          <!-- Default queued blocking threadpool -->
<!--      <New class="org.eclipse.jetty.util.thread.QueuedThreadPool">-->  
     There is no setThreadPool method in the new API
<!--        <Set name="minThreads">10</Set>-->
<!--        <Set name="maxThreads">10000</Set>-->
<!--        <Set name="detailedDump">false</Set>-->
<!--      </New>-->
<!--    </Set>-->

    <!-- =========================================================== -->
    <!-- Set connectors                                              -->
    <!-- =========================================================== -->

    <Call name="addConnector">
        <Arg>
            <New class="org.eclipse.jetty.server.ServerConnector">
                <Arg name="server"><Ref refid="Server" /></Arg>
                <Set name="host"><SystemProperty name="jetty.host" 
/></Set>
                <Set name="port"><SystemProperty name="jetty.port" 
default="8983"/></Set>
                <Set name="idleTimeout">50000</Set>
<!--                <Set name="lowResourceMaxIdleTime">1500</Set>-->
<!--                <Set name="statsOn">false</Set>-->          Some 
fields are not available anymore
<!--                <Set name="requestHeaderSize">1000000</Set>-->
<!--                <Set name="requestBufferSize">1000000</Set>-->
            </New>
        </Arg>
    </Call>

    <!-- =========================================================== -->
    <!-- Set handler Collection Structure                            --> 
    <!-- =========================================================== -->
    <Set name="handler">
      <New id="Handlers" 
class="org.eclipse.jetty.server.handler.HandlerCollection">
        <Set name="handlers">
         <Array type="org.eclipse.jetty.server.Handler">
           <Item>
             <New id="Contexts" 
class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/>
           </Item>
           <Item>
             <New id="DefaultHandler" 
class="org.eclipse.jetty.server.handler.DefaultHandler"/>
           </Item>
           <Item>
             <New id="RequestLog" 
class="org.eclipse.jetty.server.handler.RequestLogHandler"/>
           </Item>
         </Array>
        </Set>
      </New>
    </Set>

    <!-- =========================================================== -->
    <!-- extra options                                               -->
    <!-- =========================================================== -->
    <Set name="stopAtShutdown">true</Set>
<!--    <Set name="sendServerVersion">false</Set>-->
<!--    <Set name="sendDateHeader">false</Set>-->
    <Set name="stopTimeout">1000</Set>
    <Set name="dumpAfterStart">false</Set>
    <Set name="dumpBeforeStop">false</Set>

    <Call name="addBean">
      <Arg>
        <New id="DeploymentManager" 
class="org.eclipse.jetty.deploy.DeploymentManager">
          <Set name="contexts">
            <Ref refid="Contexts" />
          </Set>
          <Call name="setContextAttribute">
 <Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
            <Arg>.*/servlet-api-[^/]*\.jar$</Arg>
          </Call> 
        </New>
      </Arg>
    </Call>
 
    <Ref refid="DeploymentManager">
      <Call name="addAppProvider">
        <Arg>
          <New 
class="org.eclipse.jetty.deploy.providers.ScanningAppProvider">         
ContextProvider is not available anymore. I chose ScanningAppProvider 
because
            <Set name="monitoredDirName"><SystemProperty name="jetty.home" 
default="."/>/contexts</Set>                      it seems to have a 
similar interface (a similar behavior - monitoredDirName, scanInterval)
            <Set name="scanInterval">0</Set>
          </New>
        </Arg>
      </Call>
    </Ref>

</Configure>


I have a few questions:

1. The old API had a setThreadPool method for the server. The new one 
hasn't. Instead, it has a constructor that accept a ThreadPool as argument
. My problem is that in the jetty.xml file there is no way to give the 
server an argument, since the configure element doesn't support the Arg 
element.
What can I do?
Is there a way to the "set" the server's ThreadPool in version 
9.4.29.v20200521?
Is there a way to define a server constructor with a ThreadPool argument?
Can I set the ThreadPool fields somehow?

2. The ScanningAppProvider is causing problems. I get the following error 
when I try to start my application:
No suitable constructor: <New 
class="org.eclipse.jetty.deploy.providers.ScanningAppProvider"><Set 
name="monitoredDirName"><SystemProperty name="jetty.home" 
default="."/>/contexts</Set><Set name="scanInterval">0</Set></New> on 
DeploymentManager@8383a14{STOPPED}
 java.lang.IllegalStateException: No suitable constructor: <New 
class="org.eclipse.jetty.deploy.providers.ScanningAppProvider"><Set 
name="monitoredDirName"><SystemProperty name="jetty.home" 
default="."/>/contexts</Set><Set name="scanInterval">0</Set></New> on 
DeploymentManager@8383a14{STOPPED}
        at 
org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.newObj(XmlConfiguration.java:1036)
        at 
org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.itemValue(XmlConfiguration.java:1561)
        at 
org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.value(XmlConfiguration.java:1462)
        at 
org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.access$600(XmlConfiguration.java:416)
        at 
org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration$Args.<init>(XmlConfiguration.java:1720)
        at 
org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration$Args.<init>(XmlConfiguration.java:1707)
        at 
org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.call(XmlConfiguration.java:963)
        at 
org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:536)
        at 
org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.refObj(XmlConfiguration.java:1084)
        at 
org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:551)
        at 
org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:452)
        at 
org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:385)

As far as I can tell, I used the correct xml structure, the correct names 
of the class and methods (at this part, when comparing to the previous 
version that worked, all I changed was the class name, from 
ContextProvider to ScanningAppProvider, so I don't understand why I get 
this error.


I would appreciate any and all comments, suggestions and solutions.

Best regards,
Netta

Attachment: jetty.xml
Description: Binary data

Attachment: jetty_upgraded.xml
Description: Binary data

_______________________________________________
jetty-users mailing list
[email protected]
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/jetty-users

Reply via email to