Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] NoSuchMethodException at ResourceHandler
  • From: Alexander Farber <farber72@xxxxxxxxxx>
  • Date: Sat, 2 Nov 2024 18:18:31 +0000
  • Accept-language: en-US, de-DE
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7qpGHrvK0T3P7+65x6w3bTlc9h1/o8XnHZe/rrpsH/k=; b=htsRjO/OH7JkldIWd+dOVj1CNMpl+4d6p+eTeZkZxKJjwqpiyKpptX0Rfh9OTGqM0N6Qsqt7znaDUsG9lpqhabsZSQeelctsmen8McsFkmpUAGbJJrsDJLMqwQQ5xiVjtOXXdVnt5ahRaoL48Zh2Leb85U3z+CUjWQkgoUwCXs2oxHxnLjYAtiA3RggnySOIBr0U1kS9olz/CDZ4xb90Em0NpMS1zPUqkfbbbSYi7GiGbS7Fpfi3ROuPerqr2iVbqA+sSyKqC0EoH5bYp+HzwBuePLworGkmurzuAseOefTyiuYnRpq+jxXEjG+w8eDrfrzaE+D256jkqMxlrj6nrA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Qx3wZzcQldGZ9knmtV7g3zTalyjAV4GqRwsBZ8I9nuxVikK1ie/uuJM1yGOW72fNGzekFvJWbxEuTYU6dQMG1uI1aWxkFzosa8227mUHY6GpPTH7iYBNbm5iS05OY9mxaolBdA8ipRc49SxlAs/+LSYyWy3D3GlTUac6AYI+Jh21RNDYs8RUyKjIEY0QK8OEUtyPvwQqJf6ne6AS5KQytq6hJTM33plBZJzGRmxT0qTCdrPF7e75HjbZzoZkxI2i0QS5xnhh9+0cHy7onInSrXVaH62v/cdoTCLc+hBuXI3wSmMlHpq7h7cWdN7tT01dT5B9iyg8Mv94iGJVZ/4zMQ==
  • Delivered-to: jetty-users@xxxxxxxxxxx
  • List-archive: <https://www.eclipse.org/mailman/private/jetty-users/>
  • List-help: <mailto:jetty-users-request@eclipse.org?subject=help>
  • List-subscribe: <https://www.eclipse.org/mailman/listinfo/jetty-users>, <mailto:jetty-users-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://www.eclipse.org/mailman/options/jetty-users>, <mailto:jetty-users-request@eclipse.org?subject=unsubscribe>
  • Msip_labels:
  • Thread-index: AQHbKKZexABZ6nouwECd45Fu5wxDTbKbHEaAgAk3Xko=
  • Thread-topic: [jetty-users] NoSuchMethodException at ResourceHandler

Hi Greg and others,

> From: Greg Wilkins <gregw@xxxxxxxxxxx>
> The method in now call setBaseResourceAsString, so use name=baseResourceAsString
> Note this is a slightly strange style mixing an EE10 WebAppContext with a core ResourceHandler.   
> Typically if you are not using Servlets, just use a ContextHandler.  If you are using Servlet, then use a DefaultServlet to serve static content.

I have tried both name=baseResourceAsString and name=baseResource
and both are unfortunately reported as not found:

java.lang.NoSuchMethodException: class org.eclipse.jetty.ee10.servlet.DefaultServlet.setBaseResourceAsString(class java.lang.String)

and:

java.lang.NoSuchMethodException: class org.eclipse.jetty.ee10.servlet.DefaultServlet.setBaseResource(class java.lang.String)

However when I look at https://javadoc.jetty.org/jetty-12/org/eclipse/jetty/ee10/servlet/ResourceServlet.html
then there is "The following init parameters are supported ... baseResource"

Also I have read the "Operations Guide" and "Programming Guide" for Jetty 12
and searched "https://github.com/jetty/jetty-examples"; - and unfortunately
nowhere is an explanation to find how to set up serving static files via Jetty XML.
There are only examples on embedded Jetty.

My current failing root.xml is below:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://jetty.org/configure_10_0.dtd";>
<Configure class="org.eclipse.jetty.ee10.servlet.ServletContextHandler">
    <Set name="contextPath">/</Set>
    <Set name="handler">
        <New class="org.eclipse.jetty.ee10.servlet.DefaultServlet">
            <Set name="baseResourceAsString"><SystemProperty name="jetty.base"/>/../wordsbyfarber.com</Set>
            <Set name="dirAllowed">true</Set>
        </New>
    </Set>
</Configure>

Best regards
Alex


Back to the top