user3071643
user3071643

Reputation: 1533

maven jetty error 'Config error at <Set name="ThreadPool">'

I'm trying to configure a jetty-servlet in java using maven. I've create a jetty.xml file with the following entries

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
  <Set name="ThreadPool">
    <New class="org.eclipse.jetty.util.thread.QueuedThreadPool">
      <Set name="minThreads">10</Set>
      <Set name="maxThreads">200</Set>
      <Set name="detailedDump">false</Set>
    </New>
</Set>
</Configure>

upon running the server

mvn jetty:run

I see the error

[WARNING] Config error at <Set name="ThreadPool">
<New class="org.eclipse.jetty.util.thread.QueuedThreadPool"><Set 
  name="minThreads">10</Set><Set name="maxThreads">200</Set><Set 
  name="detailedDump">false</Set></New>
</Set>

but cannot figure out what the problem actually is. I've also included jetty-util as a dependency in the pom.xml file. I'm using jetty version 9.4.12.v20180830 and java 8. Thanks for any help!

Upvotes: 0

Views: 559

Answers (1)

Joakim Erdfelt
Joakim Erdfelt

Reputation: 49472

ThreadPool is a constructor argument for Server.

See: Javadoc for org.eclipse.jetty.server.Server

It's not a field and/or setter on Server, so you cannot use the <Set name="ThreadPool"> syntax.

Instead of replacing the threadpool, just "Get" the existing one and change settings on it.

Eg:

<Get name="ThreadPool">
  <Set name="minThreads" type="int">10</Set>
  <Set name="maxThreads" type="int">200</Set>
  <Set name="detailedDump">false</Set>
</Get>

Upvotes: 1

Related Questions