NoSuchMethodException for NKContextServer.setThreadPool when starting a new frontend

Poster Content
nk4um User
Posts: 27
April 10, 2015 13:16

Hi Peter,

Thanks a lot for your suggestion. It works now. I saw that in the documentation Jetty 7 was used but now it's 9. So I also referred to the documentation of Jetty but I didn't find too much difference. Referring to the configuration file of the current module is really a straightforward way, how come I didn't realize it! :D

Have a nice day.

Regards, Yang

Posted by pjr (View)
Hi Yang - oops, look like that example configuration is still the Jetty 7 syntax. If you're using the latest updates then everything was changed with the update to Jetty 9 earlier in the year.

Please take a look at modules/urn.org.netkernel.fulcrum.front-x.x.x/etc/HTTPServerConfig.xml where x.x.x is the most recent version.

You should see something like this (notice the DTD declaration at the top is now required by Jetty)

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<!-- =============================================================== -->
<!-- Configure the Jetty Server                                      -->
<!--                                                                 -->
<!-- Documentation of this file format can be found at:              -->
<!-- http://www.eclipse.org/jetty/documentation/9.2.6.v20141205/embedding-jetty.html#d0e19067 -->
<!-- 
	***NOTE:  With Jetty 9 it is now essential that this configuration
	   has a DTD declaration (see above) ***                         -->
<!-- =============================================================== -->

<Configure id="Server" class="org.eclipse.jetty.server.Server">
  <!-- =========================================================== -->
  <!-- Server Thread Pool                                          -->
  <!-- =========================================================== -->
  	<!-- uncomment to change type of threadpool
	<Arg name="threadpool"><New id="threadpool" class="org.eclipse.jetty.util.thread.QueuedThreadPool"/></Arg>
	-->
	<Get name="ThreadPool">
		<Set name="minThreads" type="int"><Property name="threads.min" default="4"/></Set>
		<Set name="maxThreads" type="int"><Property name="threads.max" default="20"/></Set>
		<Set name="idleTimeout" type="int"><Property name="threads.timeout" default="60000"/></Set>
		<Set name="detailedDump">false</Set>
		<Set name="name">JettyBEF</Set>
	</Get>
	
	<!-- =========================================================== -->
    <!-- Http Configuration.                                         -->
    <!-- This is a common configuration instance used by all         -->
    <!-- connectors that can carry HTTP semantics (HTTP, HTTPS, SPDY)-->
    <!-- It configures the non wire protocol aspects of the HTTP     -->
    <!-- semantic.                                                   -->
    <!--                                                             -->
    <!-- This configuration is only defined here and is used by      -->
    <!-- reference below                                             -->
    <!--                                                             -->
    <!-- Consult the javadoc of o.e.j.server.HttpConfiguration       -->
    <!-- for all configuration that may be set here.                 -->
    <!-- =========================================================== -->
    <New id="httpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
      <Set name="secureScheme">https</Set>
      <Set name="securePort"><Property name="netkernel.http.backend.secure.port" default="1061" /></Set>
      <Set name="outputBufferSize"><Property name="jetty.output.buffer.size" default="32768" /></Set>
      <Set name="outputAggregationSize"><Property name="jetty.output.aggregation.size" default="8192" /></Set>
      <Set name="requestHeaderSize"><Property name="jetty.request.header.size" default="8192" /></Set>
      <Set name="responseHeaderSize"><Property name="jetty.response.header.size" default="8192" /></Set>
      <Set name="sendServerVersion"><Property name="jetty.send.server.version" default="true" /></Set>
      <Set name="sendDateHeader"><Property name="jetty.send.date.header" default="true" /></Set>
      <Set name="headerCacheSize">512</Set>
      <Set name="delayDispatchUntilContent"><Property name="jetty.delayDispatchUntilContent" default="false"/></Set>
    </New>

  <!-- =========================================================== -->
  <!-- Set connectors                                              -->
  <!-- =========================================================== -->
  <!--NEW JETTY-->
  <Call name="addConnector">
    <Arg>
      <New class="org.eclipse.jetty.server.ServerConnector">
      	<Arg name="server"><Ref refid="Server" /></Arg>
        <Arg name="acceptors" type="int"><Property name="http.acceptors" default="-1"/></Arg>
        <Arg name="selectors" type="int"><Property name="http.selectors" default="-1"/></Arg>
        <Arg name="factories">
          <Array type="org.eclipse.jetty.server.ConnectionFactory">
            <Item>
              <New class="org.eclipse.jetty.server.HttpConnectionFactory">
                <Arg name="config"><Ref refid="httpConfig" /></Arg>
              </New>
            </Item>
          </Array>
        </Arg>
        <Set name="name">Frontend Fulcrum: <SystemProperty name="netkernel.http.frontend.port" default="8080" /></Set>
        <Set name="host"><SystemProperty name="netkernel.http.frontend.host" default="0.0.0.0" /></Set>
        <Set name="port"><SystemProperty name="netkernel.http.frontend.port" default="8080" /></Set>
        <Set name="idleTimeout"><Property name="http.timeout" default="30000"/></Set>
        <Set name="soLingerTime"><Property name="http.soLingerTime" default="-1"/></Set>
        <Set name="acceptorPriorityDelta"><Property name="http.acceptorPriorityDelta" default="0"/></Set>
        <Set name="selectorPriorityDelta"><Property name="http.selectorPriorityDelta" default="0"/></Set>
        <Set name="acceptQueueSize"><Property name="http.acceptQueueSize" default="0"/></Set>
        <!-- Enable Connector Statistics -->
	      <Call name="addBean">
	        <Arg>
	            <New id="ConnectorStatistics" class="org.eclipse.jetty.server.ConnectorStatistics"/>
	        </Arg>
	      </Call>
      </New>
    </Arg>
  </Call>
  
  <!--TLS Configuration - UNCOMMENT THE FOLLOWING THREE STATEMENT BLOCKS TO ENABLE TLS-->
  <!-- =========================================================== -->
  <!-- Create a TLS specific HttpConfiguration based on the        -->
  <!-- common HttpConfiguration defined above                      -->
  <!-- Add a SecureRequestCustomizer to extract certificate and    -->
  <!-- session information                                         -->
  <!-- =========================================================== -->
  <!-- UNCOMMENT TO ENABLE TLS
  <New id="sslHttpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
    <Arg><Ref refid="httpConfig"/></Arg>
    <Call name="addCustomizer">
      <Arg><New class="org.eclipse.jetty.server.SecureRequestCustomizer"/></Arg>
    </Call>
  </New>
  -->
  
  <!-- ============================================================= -->
  <!-- Create a TLS (SSL) Context Factory                            -->
  <!-- ============================================================= -->
  <!-- UNCOMMENT TO ENABLE TLS
  <New id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory">
    <Set name="KeyStorePath"><Property name="jetty.base" default="." />/<Property name="jetty.keystore" default="/home/pjr/workspace/keystore"/></Set>
    <Set name="KeyStorePassword"><Property name="jetty.keystore.password" default="test123"/></Set>
    <Set name="KeyManagerPassword"><Property name="jetty.keymanager.password" default="test123"/></Set>
    <Set name="TrustStorePath"><Property name="jetty.base" default="." />/<Property name="jetty.truststore" default="/home/pjr/workspace/keystore"/></Set>
    <Set name="TrustStorePassword"><Property name="jetty.truststore.password" default="test123"/></Set>
    <Set name="EndpointIdentificationAlgorithm"></Set>
    <Set name="NeedClientAuth"><Property name="jetty.ssl.needClientAuth" default="false"/></Set>
    <Set name="WantClientAuth"><Property name="jetty.ssl.wantClientAuth" default="false"/></Set>
    <Set name="ExcludeCipherSuites">
     <Array type="String">
      <Item>SSL_RSA_WITH_DES_CBC_SHA</Item>
      <Item>SSL_DHE_RSA_WITH_DES_CBC_SHA</Item>
      <Item>SSL_DHE_DSS_WITH_DES_CBC_SHA</Item>
      <Item>SSL_RSA_EXPORT_WITH_RC4_40_MD5</Item>
      <Item>SSL_RSA_EXPORT_WITH_DES40_CBC_SHA</Item>
      <Item>SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA</Item>
      <Item>SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA</Item>
     </Array>
    </Set>
  </New>
  -->
  
  <!-- =========================================================== -->
  <!-- Add a SSL Connector with protocol factories                 -->
  <!-- =========================================================== -->
  <!-- UNCOMMENT TO ENABLE TLS
  <Call  name="addConnector">
    <Arg>
      <New id="sslConnector" class="org.eclipse.jetty.server.ServerConnector">
        <Arg name="server"><Ref refid="Server" /></Arg>
        <Arg name="acceptors" type="int"><Property name="ssl.acceptors" default="-1"/></Arg>
        <Arg name="selectors" type="int"><Property name="ssl.selectors" default="-1"/></Arg>
        <Arg name="factories">
          <Array type="org.eclipse.jetty.server.ConnectionFactory">
          	<Item>
	          	<New class="org.eclipse.jetty.server.SslConnectionFactory">
		        	<Arg name="next">http/1.1</Arg>
		        	<Arg name="sslContextFactory"><Ref refid="sslContextFactory"/></Arg>
		      	</New>
          	</Item>
          	<Item>
          		<New class="org.eclipse.jetty.server.HttpConnectionFactory">
			        <Arg name="config"><Ref refid="sslHttpConfig" /></Arg>
			    </New>
          	</Item>
          </Array>
        </Arg>
        <Set name="host"><SystemProperty name="netkernel.http.frontend.host" default="0.0.0.0" /></Set>
        <Set name="port"><Property name="netkernel.http.frontend.secure.port" default="8443" /></Set>
        <Set name="idleTimeout"><Property name="ssl.timeout" default="30000"/></Set>
        <Set name="soLingerTime"><Property name="ssl.soLingerTime" default="-1"/></Set>
        <Set name="acceptorPriorityDelta"><Property name="ssl.acceptorPriorityDelta" default="0"/></Set>
        <Set name="selectorPriorityDelta"><Property name="ssl.selectorPriorityDelta" default="0"/></Set>
        <Set name="acceptQueueSize"><Property name="ssl.acceptQueueSize" default="0"/></Set>
      </New>
    </Arg>
  </Call>
  -->
  
  <Call name="setHandler">
		<Arg>
			<New id="NetKernelHandler" class="org.eclipse.jetty.server.handler.HandlerList">
				<!--Uncomment for NCSA Logging
				<Call name="addHandler">
					<Arg>
						<New id="Logger" class="org.eclipse.jetty.server.handler.RequestLogHandler">
							 <Set name="requestLog">
								 <New id="RequestLogImpl" class="org.eclipse.jetty.server.NCSARequestLog">
								      <Set name="filename">./log/FEFNetKernelHTTP_yyyy_mm_dd.log</Set>
									  <Set name="filenameDateFormat">yyyy_MM_dd</Set>
									  <Set name="retainDays">90</Set>
									  <Set name="append">true</Set>
									  <Set name="extended">true</Set>
									  <Set name="logCookies">false</Set>
									  <Set name="LogTimeZone">GMT</Set>
									</New>
							 </Set>
						 </New>
					</Arg>
				</Call>
				-->
				<Call name="addHandler">
					<Arg>
						<New id="NetKernelWebSocketHandler" class="org.netkernel.http.transport.NetKernelWebSocketHandler">
							<!--<Set name="maxIdleTime">300000</Set>-->	
						</New>
					</Arg>
				</Call>
				<Call name="addHandler">
					<Arg>
						<New id="NetKernelHandler" class="org.netkernel.http.transport.NetKernelHandler">
						</New>
					</Arg>
				</Call>
			</New>
		</Arg>
	</Call>
		
  <!-- =========================================================== -->
  <!-- extra options                                               -->
  <!-- =========================================================== -->
  <Set name="stopAtShutdown">false</Set>
</Configure>

If all you really want is to change the port number of the front-end fulcrum you can do this much more easily by setting the system property "netkernel.http.frontend.port"

So in the jvmsettings.cnf you can add -Pnetkernel.http.frontend.port=8083

Sorry about the old configuration reference - we'll fix that doc and update it.

Let me know if this works for you.

Peter

Like · Post Reply
nk4um Moderator
Posts: 901
April 10, 2015 10:33

Hi Yang - oops, look like that example configuration is still the Jetty 7 syntax. If you're using the latest updates then everything was changed with the update to Jetty 9 earlier in the year.

Please take a look at modules/urn.org.netkernel.fulcrum.front-x.x.x/etc/HTTPServerConfig.xml where x.x.x is the most recent version.

You should see something like this (notice the DTD declaration at the top is now required by Jetty)

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<!-- =============================================================== -->
<!-- Configure the Jetty Server                                      -->
<!--                                                                 -->
<!-- Documentation of this file format can be found at:              -->
<!-- http://www.eclipse.org/jetty/documentation/9.2.6.v20141205/embedding-jetty.html#d0e19067 -->
<!-- 
	***NOTE:  With Jetty 9 it is now essential that this configuration
	   has a DTD declaration (see above) ***                         -->
<!-- =============================================================== -->

<Configure id="Server" class="org.eclipse.jetty.server.Server">
  <!-- =========================================================== -->
  <!-- Server Thread Pool                                          -->
  <!-- =========================================================== -->
  	<!-- uncomment to change type of threadpool
	<Arg name="threadpool"><New id="threadpool" class="org.eclipse.jetty.util.thread.QueuedThreadPool"/></Arg>
	-->
	<Get name="ThreadPool">
		<Set name="minThreads" type="int"><Property name="threads.min" default="4"/></Set>
		<Set name="maxThreads" type="int"><Property name="threads.max" default="20"/></Set>
		<Set name="idleTimeout" type="int"><Property name="threads.timeout" default="60000"/></Set>
		<Set name="detailedDump">false</Set>
		<Set name="name">JettyBEF</Set>
	</Get>
	
	<!-- =========================================================== -->
    <!-- Http Configuration.                                         -->
    <!-- This is a common configuration instance used by all         -->
    <!-- connectors that can carry HTTP semantics (HTTP, HTTPS, SPDY)-->
    <!-- It configures the non wire protocol aspects of the HTTP     -->
    <!-- semantic.                                                   -->
    <!--                                                             -->
    <!-- This configuration is only defined here and is used by      -->
    <!-- reference below                                             -->
    <!--                                                             -->
    <!-- Consult the javadoc of o.e.j.server.HttpConfiguration       -->
    <!-- for all configuration that may be set here.                 -->
    <!-- =========================================================== -->
    <New id="httpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
      <Set name="secureScheme">https</Set>
      <Set name="securePort"><Property name="netkernel.http.backend.secure.port" default="1061" /></Set>
      <Set name="outputBufferSize"><Property name="jetty.output.buffer.size" default="32768" /></Set>
      <Set name="outputAggregationSize"><Property name="jetty.output.aggregation.size" default="8192" /></Set>
      <Set name="requestHeaderSize"><Property name="jetty.request.header.size" default="8192" /></Set>
      <Set name="responseHeaderSize"><Property name="jetty.response.header.size" default="8192" /></Set>
      <Set name="sendServerVersion"><Property name="jetty.send.server.version" default="true" /></Set>
      <Set name="sendDateHeader"><Property name="jetty.send.date.header" default="true" /></Set>
      <Set name="headerCacheSize">512</Set>
      <Set name="delayDispatchUntilContent"><Property name="jetty.delayDispatchUntilContent" default="false"/></Set>
    </New>

  <!-- =========================================================== -->
  <!-- Set connectors                                              -->
  <!-- =========================================================== -->
  <!--NEW JETTY-->
  <Call name="addConnector">
    <Arg>
      <New class="org.eclipse.jetty.server.ServerConnector">
      	<Arg name="server"><Ref refid="Server" /></Arg>
        <Arg name="acceptors" type="int"><Property name="http.acceptors" default="-1"/></Arg>
        <Arg name="selectors" type="int"><Property name="http.selectors" default="-1"/></Arg>
        <Arg name="factories">
          <Array type="org.eclipse.jetty.server.ConnectionFactory">
            <Item>
              <New class="org.eclipse.jetty.server.HttpConnectionFactory">
                <Arg name="config"><Ref refid="httpConfig" /></Arg>
              </New>
            </Item>
          </Array>
        </Arg>
        <Set name="name">Frontend Fulcrum: <SystemProperty name="netkernel.http.frontend.port" default="8080" /></Set>
        <Set name="host"><SystemProperty name="netkernel.http.frontend.host" default="0.0.0.0" /></Set>
        <Set name="port"><SystemProperty name="netkernel.http.frontend.port" default="8080" /></Set>
        <Set name="idleTimeout"><Property name="http.timeout" default="30000"/></Set>
        <Set name="soLingerTime"><Property name="http.soLingerTime" default="-1"/></Set>
        <Set name="acceptorPriorityDelta"><Property name="http.acceptorPriorityDelta" default="0"/></Set>
        <Set name="selectorPriorityDelta"><Property name="http.selectorPriorityDelta" default="0"/></Set>
        <Set name="acceptQueueSize"><Property name="http.acceptQueueSize" default="0"/></Set>
        <!-- Enable Connector Statistics -->
	      <Call name="addBean">
	        <Arg>
	            <New id="ConnectorStatistics" class="org.eclipse.jetty.server.ConnectorStatistics"/>
	        </Arg>
	      </Call>
      </New>
    </Arg>
  </Call>
  
  <!--TLS Configuration - UNCOMMENT THE FOLLOWING THREE STATEMENT BLOCKS TO ENABLE TLS-->
  <!-- =========================================================== -->
  <!-- Create a TLS specific HttpConfiguration based on the        -->
  <!-- common HttpConfiguration defined above                      -->
  <!-- Add a SecureRequestCustomizer to extract certificate and    -->
  <!-- session information                                         -->
  <!-- =========================================================== -->
  <!-- UNCOMMENT TO ENABLE TLS
  <New id="sslHttpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
    <Arg><Ref refid="httpConfig"/></Arg>
    <Call name="addCustomizer">
      <Arg><New class="org.eclipse.jetty.server.SecureRequestCustomizer"/></Arg>
    </Call>
  </New>
  -->
  
  <!-- ============================================================= -->
  <!-- Create a TLS (SSL) Context Factory                            -->
  <!-- ============================================================= -->
  <!-- UNCOMMENT TO ENABLE TLS
  <New id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory">
    <Set name="KeyStorePath"><Property name="jetty.base" default="." />/<Property name="jetty.keystore" default="/home/pjr/workspace/keystore"/></Set>
    <Set name="KeyStorePassword"><Property name="jetty.keystore.password" default="test123"/></Set>
    <Set name="KeyManagerPassword"><Property name="jetty.keymanager.password" default="test123"/></Set>
    <Set name="TrustStorePath"><Property name="jetty.base" default="." />/<Property name="jetty.truststore" default="/home/pjr/workspace/keystore"/></Set>
    <Set name="TrustStorePassword"><Property name="jetty.truststore.password" default="test123"/></Set>
    <Set name="EndpointIdentificationAlgorithm"></Set>
    <Set name="NeedClientAuth"><Property name="jetty.ssl.needClientAuth" default="false"/></Set>
    <Set name="WantClientAuth"><Property name="jetty.ssl.wantClientAuth" default="false"/></Set>
    <Set name="ExcludeCipherSuites">
     <Array type="String">
      <Item>SSL_RSA_WITH_DES_CBC_SHA</Item>
      <Item>SSL_DHE_RSA_WITH_DES_CBC_SHA</Item>
      <Item>SSL_DHE_DSS_WITH_DES_CBC_SHA</Item>
      <Item>SSL_RSA_EXPORT_WITH_RC4_40_MD5</Item>
      <Item>SSL_RSA_EXPORT_WITH_DES40_CBC_SHA</Item>
      <Item>SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA</Item>
      <Item>SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA</Item>
     </Array>
    </Set>
  </New>
  -->
  
  <!-- =========================================================== -->
  <!-- Add a SSL Connector with protocol factories                 -->
  <!-- =========================================================== -->
  <!-- UNCOMMENT TO ENABLE TLS
  <Call  name="addConnector">
    <Arg>
      <New id="sslConnector" class="org.eclipse.jetty.server.ServerConnector">
        <Arg name="server"><Ref refid="Server" /></Arg>
        <Arg name="acceptors" type="int"><Property name="ssl.acceptors" default="-1"/></Arg>
        <Arg name="selectors" type="int"><Property name="ssl.selectors" default="-1"/></Arg>
        <Arg name="factories">
          <Array type="org.eclipse.jetty.server.ConnectionFactory">
          	<Item>
	          	<New class="org.eclipse.jetty.server.SslConnectionFactory">
		        	<Arg name="next">http/1.1</Arg>
		        	<Arg name="sslContextFactory"><Ref refid="sslContextFactory"/></Arg>
		      	</New>
          	</Item>
          	<Item>
          		<New class="org.eclipse.jetty.server.HttpConnectionFactory">
			        <Arg name="config"><Ref refid="sslHttpConfig" /></Arg>
			    </New>
          	</Item>
          </Array>
        </Arg>
        <Set name="host"><SystemProperty name="netkernel.http.frontend.host" default="0.0.0.0" /></Set>
        <Set name="port"><Property name="netkernel.http.frontend.secure.port" default="8443" /></Set>
        <Set name="idleTimeout"><Property name="ssl.timeout" default="30000"/></Set>
        <Set name="soLingerTime"><Property name="ssl.soLingerTime" default="-1"/></Set>
        <Set name="acceptorPriorityDelta"><Property name="ssl.acceptorPriorityDelta" default="0"/></Set>
        <Set name="selectorPriorityDelta"><Property name="ssl.selectorPriorityDelta" default="0"/></Set>
        <Set name="acceptQueueSize"><Property name="ssl.acceptQueueSize" default="0"/></Set>
      </New>
    </Arg>
  </Call>
  -->
  
  <Call name="setHandler">
		<Arg>
			<New id="NetKernelHandler" class="org.eclipse.jetty.server.handler.HandlerList">
				<!--Uncomment for NCSA Logging
				<Call name="addHandler">
					<Arg>
						<New id="Logger" class="org.eclipse.jetty.server.handler.RequestLogHandler">
							 <Set name="requestLog">
								 <New id="RequestLogImpl" class="org.eclipse.jetty.server.NCSARequestLog">
								      <Set name="filename">./log/FEFNetKernelHTTP_yyyy_mm_dd.log</Set>
									  <Set name="filenameDateFormat">yyyy_MM_dd</Set>
									  <Set name="retainDays">90</Set>
									  <Set name="append">true</Set>
									  <Set name="extended">true</Set>
									  <Set name="logCookies">false</Set>
									  <Set name="LogTimeZone">GMT</Set>
									</New>
							 </Set>
						 </New>
					</Arg>
				</Call>
				-->
				<Call name="addHandler">
					<Arg>
						<New id="NetKernelWebSocketHandler" class="org.netkernel.http.transport.NetKernelWebSocketHandler">
							<!--<Set name="maxIdleTime">300000</Set>-->	
						</New>
					</Arg>
				</Call>
				<Call name="addHandler">
					<Arg>
						<New id="NetKernelHandler" class="org.netkernel.http.transport.NetKernelHandler">
						</New>
					</Arg>
				</Call>
			</New>
		</Arg>
	</Call>
		
  <!-- =========================================================== -->
  <!-- extra options                                               -->
  <!-- =========================================================== -->
  <Set name="stopAtShutdown">false</Set>
</Configure>

If all you really want is to change the port number of the front-end fulcrum you can do this much more easily by setting the system property "netkernel.http.frontend.port"

So in the jvmsettings.cnf you can add -Pnetkernel.http.frontend.port=8083

Sorry about the old configuration reference - we'll fix that doc and update it.

Let me know if this works for you.

Peter

Like · Post Reply
1 person likes this post
nk4um User
Posts: 27

Hi there,

I would like to start a new frontend with a different port, and here are the corresponding configuration files I used, referring to the documentation of HTTPTransport http://docs.netkernel.org/book/view/book:tpt:http:book/doc:tpt:http:HTTPTransport.

HTTPServerConfig:

<Configureid="Server" class="org.eclipse.jetty.server.Server">
  < !-- =========================================================== -->
  < !-- Server Thread Pool -->
  < !-- =========================================================== -->
  <Setname="ThreadPool">
    <Newclass="org.eclipse.jetty.util.thread.QueuedThreadPool">
      <Setname="minThreads">4&lt;/Set&gt;
      <Setname="maxThreads">128&lt;/Set&gt;
      < !--<Set name="lowThreads">2</Set>-->
      <Setname="name">JettyFEF&lt;/Set&gt;
    &lt;/New&gt;
  &lt;/Set&gt;
  <Callname="addConnector">
    <Arg>
      <Newclass="org.eclipse.jetty.server.nio.SelectChannelConnector">
        <Setname="port">
          <SystemPropertyname="kbodata.http.frontend.port" default="8083" /&gt;
        &lt;/Set&gt;
        <Setname="maxIdleTime">30000&lt;/Set&gt;
        <Setname="Acceptors">4&lt;/Set&gt;
        <Setname="lowResourcesConnections">50&lt;/Set&gt;
        <Setname="lowResourceMaxIdleTime">5000&lt;/Set&gt;
        <Setname="statsOn">true&lt;/Set&gt;
      &lt;/New&gt;
    &lt;/Arg&gt;
  &lt;/Call&gt;
  <Callname="setHandler">
    <Arg>
      <Newid="NetKernelHandler" class="org.eclipse.jetty.server.handler.HandlerList">
        <Callname="addHandler">
          <Arg>
            <Newid="Logger" class="org.eclipse.jetty.server.handler.RequestLogHandler">
              <Setname="requestLog">
                <Newid="RequestLogImpl" class="org.eclipse.jetty.server.NCSARequestLog">
                  <Setname="filename">./log/KBODataFulcrum_yyyy_mm_dd.log&lt;/Set&gt;
                  <Setname="filenameDateFormat">yyyy_MM_dd&lt;/Set&gt;
                  <Setname="retainDays">90&lt;/Set&gt;
                  <Setname="append">true&lt;/Set&gt;
                  <Setname="extended">true&lt;/Set&gt;
                  <Setname="logCookies">false&lt;/Set&gt;
                  <Setname="LogTimeZone">GMT&lt;/Set&gt;
                &lt;/New&gt;
              &lt;/Set&gt;
            &lt;/New&gt;
          &lt;/Arg&gt;
        &lt;/Call&gt;
        <Callname="addHandler">
          <Arg>
            <Newid="NetKernelWebSocketHandler" class="org.netkernel.http.transport.NetKernelWebSocketHandler">
              <Setname="maxIdleTime">300000&lt;/Set&gt;
              < !--5 Minutes-->
            &lt;/New&gt;
          &lt;/Arg&gt;
        &lt;/Call&gt;
        <Callname="addHandler">
          <Arg>
            <Newid="NetKernelHandler" class="org.netkernel.http.transport.NetKernelHandler" /&gt;
          &lt;/Arg&gt;
        &lt;/Call&gt;
      &lt;/New&gt;
    &lt;/Arg&gt;
  &lt;/Call&gt;
  < !-- =========================================================== -->
  < !-- extra options -->
  < !-- =========================================================== -->
  <Setname="stopAtShutdown">false&lt;/Set&gt;
  <Setname="sendServerVersion">true&lt;/Set&gt;
  <Setname="sendDateHeader">true&lt;/Set&gt;
  <Setname="gracefulShutdown">100&lt;/Set&gt;
&lt;/Configure&gt;

Root space definition:

<rootspacename="elbeesee kbodata fulcrum" public="false" private-filter="false">
  <endpoint>
    <id>fulcrum.frontend.HTTPTransport&lt;/id&gt;
    <prototype>HTTPTransport&lt;/prototype&gt;
    <private /&gt;
  &lt;/endpoint&gt;
  <overlay>
    <prototype>HTTPBridge&lt;/prototype&gt;
    <exceptionHandler>res:/introspect/exceptionhandler&lt;/exceptionHandler&gt;
    <config>
      <rewrite>
        <match>https?://[^/]*/([^?]*)(\?.*)?&lt;/match&gt;
        <to>res:/$1&lt;/to&gt;
      &lt;/rewrite&gt;
      <rewrite>
        <match>ws://[^/]*/([^\?]*)(\?.*)?&lt;/match&gt;
        <to>ws:/$1&lt;/to&gt;
      &lt;/rewrite&gt;
    &lt;/config&gt;
    <spacename="Frontend Fulcrum HTTP Bridge Overlay">
      < !--Import application modules here-->
      < !--Dynamic Imports-->
      <endpoint>
        <prototype>SimpleImportDiscovery&lt;/prototype&gt;
        <grammar>active:SimpleImportDiscovery&lt;/grammar&gt;
        <type>KBOData&lt;/type&gt;
      &lt;/endpoint&gt;
      <endpoint>
        <prototype>DynamicImport&lt;/prototype&gt;
        <config>active:SimpleImportDiscovery&lt;/config&gt;
      &lt;/endpoint&gt;
      <import>
        <uri>urn:org:netkernel:ext:layer1&lt;/uri&gt;
        <private /&gt;
      &lt;/import&gt;
      < !--Default Root -->
      <mapper>
        <config>
          <endpoint>
            <grammar>res:/&lt;/grammar&gt;
            <request>
              <identifier>res:/defaultRoot.html&lt;/identifier&gt;
            &lt;/request&gt;
            <headername="mime">text/html&lt;/header&gt;
          &lt;/endpoint&gt;
        &lt;/config&gt;
        <space>
          <fileset>
            <regex>res:/defaultRoot.html&lt;/regex&gt;
          &lt;/fileset&gt;
        &lt;/space&gt;
      &lt;/mapper&gt;
      <import>
        <uri>urn:org:netkernel:ext:system&lt;/uri&gt;
        <private /&gt;
      &lt;/import&gt;
    &lt;/space&gt;
  &lt;/overlay&gt;
  <fileset>
    <private /&gt;
    <glob>etc/HTTPServerConfig.xml&lt;/glob&gt;
  &lt;/fileset&gt;
  <import>
    <private /&gt;
    <uri>urn:org:netkernel:ext:system&lt;/uri&gt;
  &lt;/import&gt;
  <import>
    <private /&gt;
    <uri>urn:org:netkernel:xml:core&lt;/uri&gt;
  &lt;/import&gt;
  <import>
    <private /&gt;
    <uri>urn:org:netkernel:tpt:http&lt;/uri&gt;
  &lt;/import&gt;
  <import>
    <private /&gt;
    <uri>urn:org:netkernel:mod:security&lt;/uri&gt;
  &lt;/import&gt;
  <import>
    <private /&gt;
    <uri>urn:org:netkernel:nkse:style&lt;/uri&gt;
  &lt;/import&gt;
  <mapper>
    <config>
      <endpoint>
        <request>
          <identifier>meta:ExceptionStyler&lt;/identifier&gt;
        &lt;/request&gt;
      &lt;/endpoint&gt;
    &lt;/config&gt;
    <space>
      <import>
        <uri>urn:org:netkernel:ext:introspect&lt;/uri&gt;
      &lt;/import&gt;
    &lt;/space&gt;
  &lt;/mapper&gt;
&lt;/rootspace&gt;

However, I can't make it work due to the following exception:

W 22:54:45 HTTPTranspor~ Config error at <Set name="threadPool">
    <New class="org.eclipse.jetty.util.thread.QueuedThreadPool">
      <Set name="minThreads">4</Set>
      <Set name="maxThreads">128</Set>
      
      <Set name="name">JettyFEF</Set>
    </New>
  </Set>
W 22:54:45 HTTPTranspor~ Failed to start HTTP server
java.lang.NoSuchMethodException: class org.netkernel.http.transport.NKContextServer.setThreadPool(class org.eclipse.jetty.util.thread.QueuedThreadPool)
	at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.set(XmlConfiguration.java:582)
	at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:411)
	at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:298)
	at org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:248)
	at org.netkernel.http.transport.HTTPTransportEndpoint.postCommission(HTTPTransportEndpoint.java:118)
	at org.netkernel.module.standard.endpoint.StandardTransportImpl.doPostCommission(StandardTransportImpl.java:53)
	at org.netkernel.module.standard.endpoint.StandardEndpointImpl.innerPostCommission(StandardEndpointImpl.java:149)
	at org.netkernel.module.standard.endpoint.StandardEndpointImpl.postCommissionMapping(StandardEndpointImpl.java:114)
	at org.netkernel.module.standard.StandardSpace.postCommissionSpace(StandardSpace.java:219)
	at org.netkernel.module.standard.RootSpace.postCommissionSpace(RootSpace.java:27)
	at org.netkernel.module.standard.StandardModule.postCommissionModule(StandardModule.java:210)
	at org.netkernel.layer0.boot.ModuleManager.sync(ModuleManager.java:348)
	at org.netkernel.layer0.boot.ModuleManager.stepUpRunLevel(ModuleManager.java:646)
	at org.netkernel.layer0.boot.ModuleManager.setRunLevel(ModuleManager.java:630)
	at org.netkernel.ext.system.init.InitEndpoint.initBoot(InitEndpoint.java:125)
	at org.netkernel.ext.system.init.InitEndpoint.access$000(InitEndpoint.java:21)
	at org.netkernel.ext.system.init.InitEndpoint$InitModuleManagerSyncListener.syncComplete(InitEndpoint.java:144)
	at org.netkernel.layer0.boot.ModuleManager.notifySyncListener(ModuleManager.java:618)
	at InnerBoot.<init>(InnerBoot.java:146)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
	at BootLoader.main(BootLoader.java:57)
W 22:54:45 HTTPTranspor~ Endpoint [HTTPTransportEndpoint] post-commission failed:
<ex>
 <ex>
  <id>java.lang.NoSuchMethodException</id>
  <message>class org.netkernel.http.transport.NKContextServer.setThreadPool(class org.eclipse.jetty.util.thread.QueuedThreadPool)</message>
  <stack>
   <level>org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.set() line:582</level>
   <level>org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure() line:411</level>
   <level>org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure() line:298</level>
   <level>org.eclipse.jetty.xml.XmlConfiguration.configure() line:248</level>
   <level>org.netkernel.http.transport.HTTPTransportEndpoint.postCommission() line:118</level>
   <level>org.netkernel.module.standard.endpoint.StandardTransportImpl.doPostCommission() line:53</level>
   <level>org.netkernel.module.standard.endpoint.StandardEndpointImpl.innerPostCommission() line:149</level>
   <level>org.netkernel.module.standard.endpoint.StandardEndpointImpl.postCommissionMapping() line:114</level>
   <level>org.netkernel.module.standard.StandardSpace.postCommissionSpace() line:219</level>
   <level>org.netkernel.module.standard.RootSpace.postCommissionSpace() line:27</level>
   <level>... 14 more</level>
  </stack>
 </ex>
</ex>

I generated the javadoc of HTTPTransport and cannot find the method class org.netkernel.http.transport.NKContextServer.setThreadPool. Maybe this is the reason? Is there any solution to get around it? The version of netkernel I am using is the latest standard edition. Thank you very much in advance.

Regards, Yang

Like · Post Reply