Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If jetty.org is down, impossible to start Jetty server (12.0.5) - multiple dtd to eclipse and jetty #12403

Open
ArfyFR opened this issue Oct 18, 2024 · 13 comments · May be fixed by #12407
Open
Assignees
Labels
Bug For general bugs on Jetty side

Comments

@ArfyFR
Copy link

ArfyFR commented Oct 18, 2024

Jetty version(s)
jetty-12.0.5

Jetty Environment
ee10

Java version/vendor (use: java -version)
openjdk 17.0.9 2023-10-17

OS type/version
Linux or Windows

Description
xml in webapps, like

<?xml version="1.0"  encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "https://jetty.org/configure_10_0.dtd">
<Configure class="org.eclipse.jetty.server.handler.ContextHandler">
...

While https://jetty.org/ is down, I got error

2024-10-18 10:41:07.163 [main] WARN  o.e.jetty.deploy.DeploymentManager - Unable to reach node goal: started
java.net.SocketException: Unexpected end of file from server
	at java.base/sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:954)
	at java.base/sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:761)
	at java.base/sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:951)
	at java.base/sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:761)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1688)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1589)
	at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:224)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:677)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:1397)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.java:1363)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(XMLDTDScannerImpl.java:257)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1152)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1040)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:943)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:542)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:889)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:825)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1224)
	at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:637)
	at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:326)
	at org.eclipse.jetty.xml.XmlParser.parse(XmlParser.java:254)
	at org.eclipse.jetty.xml.XmlParser.parse(XmlParser.java:303)
	at org.eclipse.jetty.xml.XmlConfiguration.<init>(XmlConfiguration.java:278)
	at org.eclipse.jetty.deploy.providers.ContextProvider$1.<init>(ContextProvider.java:350)
	at org.eclipse.jetty.deploy.providers.ContextProvider.createContextHandler(ContextProvider.java:349)
	at org.eclipse.jetty.deploy.App.getContextHandler(App.java:108)
	at org.eclipse.jetty.deploy.bindings.StandardDeployer.processBinding(StandardDeployer.java:33)
	at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:183)
	at org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:522)
	at org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:162)
	at org.eclipse.jetty.deploy.providers.ScanningAppProvider.pathAdded(ScanningAppProvider.java:293)
	at org.eclipse.jetty.deploy.providers.ContextProvider.pathAdded(ContextProvider.java:520)
	at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.pathAdded(ScanningAppProvider.java:69)
	at org.eclipse.jetty.util.Scanner.reportAddition(Scanner.java:902)
	at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:868)
	at org.eclipse.jetty.util.Scanner.scan(Scanner.java:775)
	at org.eclipse.jetty.util.Scanner.startScanning(Scanner.java:664)
	at org.eclipse.jetty.util.Scanner.doStart(Scanner.java:636)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93)
	at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:171)
	at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:121)
	at org.eclipse.jetty.deploy.providers.ScanningAppProvider.doStart(ScanningAppProvider.java:264)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93)
	at org.eclipse.jetty.deploy.DeploymentManager.startAppProvider(DeploymentManager.java:592)
	at org.eclipse.jetty.deploy.DeploymentManager.doStart(DeploymentManager.java:263)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93)
	at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:171)
	at org.eclipse.jetty.server.Server.start(Server.java:622)
	at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:121)
	at org.eclipse.jetty.server.Handler$Abstract.doStart(Handler.java:468)
	at org.eclipse.jetty.server.Server.doStart(Server.java:563)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93)
	at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:2030)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.eclipse.jetty.start.Main.invokeMain(Main.java:221)
	at org.eclipse.jetty.start.Main.start(Main.java:519)
	at org.eclipse.jetty.start.Main.main(Main.java:76)
2024-10-18 10:41:07.184 [main] WARN  o.eclipse.jetty.xml.XmlConfiguration - Unable to execute XmlConfiguration
java.net.SocketException: Unexpected end of file from server
	at java.base/sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:954)
	at java.base/sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:761)
	at java.base/sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:951)
	at java.base/sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:761)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1688)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1589)
	at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:224)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:677)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:1397)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.java:1363)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(XMLDTDScannerImpl.java:257)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1152)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1040)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:943)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:542)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:889)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:825)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1224)
	at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:637)
	at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:326)
	at org.eclipse.jetty.xml.XmlParser.parse(XmlParser.java:254)
	at org.eclipse.jetty.xml.XmlParser.parse(XmlParser.java:303)
	at org.eclipse.jetty.xml.XmlConfiguration.<init>(XmlConfiguration.java:278)
	at org.eclipse.jetty.deploy.providers.ContextProvider$1.<init>(ContextProvider.java:350)
	at org.eclipse.jetty.deploy.providers.ContextProvider.createContextHandler(ContextProvider.java:349)
	at org.eclipse.jetty.deploy.App.getContextHandler(App.java:108)
	at org.eclipse.jetty.deploy.bindings.StandardDeployer.processBinding(StandardDeployer.java:33)
	at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:183)
	at org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:522)
	at org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:162)
	at org.eclipse.jetty.deploy.providers.ScanningAppProvider.pathAdded(ScanningAppProvider.java:293)
	at org.eclipse.jetty.deploy.providers.ContextProvider.pathAdded(ContextProvider.java:520)
	at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.pathAdded(ScanningAppProvider.java:69)
	at org.eclipse.jetty.util.Scanner.reportAddition(Scanner.java:902)
	at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:868)
	at org.eclipse.jetty.util.Scanner.scan(Scanner.java:775)
	at org.eclipse.jetty.util.Scanner.startScanning(Scanner.java:664)
	at org.eclipse.jetty.util.Scanner.doStart(Scanner.java:636)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93)
	at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:171)
	at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:121)
	at org.eclipse.jetty.deploy.providers.ScanningAppProvider.doStart(ScanningAppProvider.java:264)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93)
	at org.eclipse.jetty.deploy.DeploymentManager.startAppProvider(DeploymentManager.java:592)
	at org.eclipse.jetty.deploy.DeploymentManager.doStart(DeploymentManager.java:263)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93)
	at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:171)
	at org.eclipse.jetty.server.Server.start(Server.java:622)
	at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:121)
	at org.eclipse.jetty.server.Handler$Abstract.doStart(Handler.java:468)
	at org.eclipse.jetty.server.Server.doStart(Server.java:563)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93)
	at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:2030)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.eclipse.jetty.start.Main.invokeMain(Main.java:221)
	at org.eclipse.jetty.start.Main.start(Main.java:519)
	at org.eclipse.jetty.start.Main.main(Main.java:76)

How to reproduce?
Shutdown jetty.org ? ;)

@ArfyFR ArfyFR added the Bug For general bugs on Jetty side label Oct 18, 2024
@ArfyFR
Copy link
Author

ArfyFR commented Oct 18, 2024

Note: XML in webapps with links to eclipse.dev

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://eclipse.dev/jetty/configure_10_0.dtd">

was working (after removing those with https://jetty.org/configure_10_0.dtd)

@ArfyFR ArfyFR changed the title If jetty.org is down, impossible to start Jetty server (12.0.5) If jetty.org is down, impossible to start Jetty server (12.0.5) - multiple dtd to eclipse and jetty Oct 18, 2024
@joakime
Copy link
Contributor

joakime commented Oct 18, 2024

The existence or not of jetty.org (or any of the other valid hostnames in the DTD references) shouldn't matter.
Those should be mapped properly for local discovery via the XML catalog present in Jetty.

I'll test this out and see if a fix is necessary for jetty-12.0.x HEAD.

Btw, you should upgrade to Jetty 12.0.14, you are missing several fixes for various security advisories.

@ArfyFR
Copy link
Author

ArfyFR commented Oct 18, 2024

The XML which failed, was a "org.eclipse.jetty.fcgi.proxy.FastCGIProxyHandler" one:

<?xml version="1.0"  encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "https://jetty.org/configure_10_0.dtd">
<Configure class="org.eclipse.jetty.server.handler.ContextHandler">

  <Set name="contextPath">/fastcgi</Set>

      <Set name="handler">
        <New class="org.eclipse.jetty.server.handler.PathMappingsHandler">
          <Call name="addMapping">
            <Arg>
              <New class="org.eclipse.jetty.http.pathmap.ServletPathSpec"><Arg>/</Arg></New>
            </Arg>
            <Arg>
              <New class="org.eclipse.jetty.fcgi.proxy.FastCGIProxyHandler">
                <Arg>(http?)://([^/]+)(/fastcgi)(.*)</Arg>
                <Arg>http://localhost:7899$4</Arg>
                <Arg>/gtc</Arg>
                <Set name="scriptPattern"><Call class="java.util.regex.Pattern" name="compile"><Arg>()(/?.+)$</Arg></Call></Set>
                <Set name="fastCGISecure">false</Set>
              </New>
            </Arg>
          </Call>
        </New>
      </Set>

</Configure>
...

it may perhaps help you to reproduce

@joakime
Copy link
Contributor

joakime commented Oct 18, 2024

PUBLIC "-//Mort Bay Consulting//DTD Configure//EN"

That looks wrong, I need to double check.

@joakime joakime self-assigned this Oct 18, 2024
@ArfyFR
Copy link
Author

ArfyFR commented Oct 18, 2024

PUBLIC "-//Mort Bay Consulting//DTD Configure//EN"

That looks wrong, need to double check.

It comes from here: https://jetty.org/docs/jetty/12/operations-guide/protocols/index.html#fcgi-configure
I wrote my fastcgi xml from the Wordpress example there

@joakime
Copy link
Contributor

joakime commented Oct 18, 2024

It comes from here: https://jetty.org/docs/jetty/12/operations-guide/protocols/index.html#fcgi-configure
I wrote my fastcgi xml from the Wordpress example there

That PUBLIC definition isn't registered in the xml catalog.
I'll go add them.
That is the likely cause of the issue, not the URI/URL.

It should read ...

<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://jetty.org/configure_10_0.dtd">

@ArfyFR
Copy link
Author

ArfyFR commented Oct 18, 2024

This URI/URL worked for months ... just not while jetty.org was down

If I change in the dtd jetty.org to jetty.or, removing the 'g', I can reproduce the problem. I mean like that:

<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "https://jetty.or/configure_10_0.dtd">

@joakime
Copy link
Contributor

joakime commented Oct 18, 2024

This URI/URL worked for months ... just not while jetty.org was down

If I change in the dtd jetty.org to jetty.or, removing the 'g', I can reproduce the problem. I mean like that:

<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "https://jetty.or/configure_10_0.dtd">

Removing the g in org will make that a different System ID that wont match the XML catalog.

https://github.com/jetty/jetty.project/blob/jetty-12.0.x/jetty-core/jetty-xml/src/main/resources/org/eclipse/jetty/xml/catalog-configure.xml

Can you run this and report back the output?

$ cd /path/to/my-jetty-base
$ java -jar /opt/jetty-home/start.jar --list-config

Feel free to overwrite sensitive things with XXXXX just don't delete any of the lines in the output.
I want to confirm your environment setup before I implement a possible solution.

@ArfyFR
Copy link
Author

ArfyFR commented Oct 18, 2024

Enabled Modules:
----------------

JVM Version & Properties:
-------------------------
 java.home = C:\tools\64bits\java\jdk-17.0.9+9
 java.vm.vendor = Eclipse Adoptium
 java.vm.version = 17.0.9+9
 java.vm.name = OpenJDK 64-Bit Server VM
 java.vm.info = mixed mode, sharing
 java.runtime.name = OpenJDK Runtime Environment
 java.runtime.version = 17.0.9+9
 java.io.tmpdir = C:\Users\borsc\AppData\Local\Temp\
 user.dir = C:\DEV\GIT\gtc
 user.language = fr
 user.country = FR

Jetty Version & Properties:
---------------------------
 jetty.version = 12.0.5
 jetty.tag.version = jetty-12.0.5
 jetty.build = 3aed62e4959bb8c01f5975fe81e078e3ff626126
 jetty.home = C:\tools\noarch\jetty\12.0.5
 jetty.base = C:\DEV\GIT\gtc

Config Search Order:
--------------------
 <command-line>
 ${jetty.base} -> C:\DEV\GIT\gtc
 ${jetty.home} -> C:\tools\noarch\jetty\12.0.5

System Properties:
------------------
 (no system properties specified)

Properties: Jetty
-----------------
 java.version = 17.0.9
 java.version.major = 17
 java.version.micro = 9
 java.version.minor = 0
 java.version.platform = 17
 jetty.base = C:\DEV\GIT\gtc
 jetty.base.uri = file:///C:/DEV/GIT/gtc
 jetty.home = C:\tools\noarch\jetty\12.0.5
 jetty.home.uri = file:///C:/tools/noarch/jetty/12.0.5
 runtime.feature.alpn = true

Classpath: Jetty
----------------
No classpath entries and/or version information available show.

Active XMLs: Jetty
------------------
 (no xml files specified)

@joakime
Copy link
Contributor

joakime commented Oct 18, 2024

You have nothing configured in your ${jetty.base} ?

Are you using the jetty-home and jetty-base split?
Or something else?

Your stacktrace shows that you are using Jetty's start.jar, so I'm a bit confused now.

org.eclipse.jetty.start.Main.main(Main.java:76)

joakime added a commit that referenced this issue Oct 18, 2024
* The XmlConfiguration instance should not
  use an XML parser from the classloader.
  As that XML parser can be broken when
  it comes to XML entity resolution behaviors.
  (We always want local entity resolution,
  never external)
  Switching to SAXParserFactory.newDefaultInstance() ensures this
  behavior that we want/need.
* More unit tests for behavior.
@joakime
Copy link
Contributor

joakime commented Oct 18, 2024

A simple test of your scenario ...

First, make sure that any requests to a host jetty.org will fail, by changing it in /etc/hosts to point to a non-existent IP on my local network.

[joakim@hyperion bases]$ grep jetty.org /etc/hosts
192.168.1.244   jetty.org
[joakim@hyperion bases]$ curl -vvv https://jetty.org/
*   Trying 192.168.1.244:443...
* connect to 192.168.1.244 port 443 failed: No route to host
* Failed to connect to jetty.org port 443 after 3090 ms: No route to host
* Closing connection 0
curl: (7) Failed to connect to jetty.org port 443 after 3090 ms: No route to host

Now, lets configure a fresh jetty-base ...

[joakim@hyperion bases]$ mkdir fastcgi-12
[joakim@hyperion bases]$ cd fastcgi-12/
[joakim@hyperion fastcgi-12]$ java -jar ~/code/jetty/distros/jetty-home-12.0.14/start.jar --add-modules=http,fcgi-proxy
INFO  : mkdir ${jetty.base}/start.d
INFO  : server          transitively enabled, ini template available with --add-modules=server
INFO  : proxy           transitively enabled
INFO  : logging-jetty   transitively enabled
INFO  : http            initialized in ${jetty.base}/start.d/http.ini
INFO  : resources       transitively enabled
INFO  : client          transitively enabled
INFO  : fcgi-proxy      initialized in ${jetty.base}/start.d/fcgi-proxy.ini
INFO  : threadpool      transitively enabled, ini template available with --add-modules=threadpool
INFO  : logging/slf4j   transitive provider of logging/slf4j for logging-jetty
INFO  : logging/slf4j   dynamic dependency of logging-jetty
INFO  : bytebufferpool  transitively enabled, ini template available with --add-modules=bytebufferpool
INFO  : mkdir ${jetty.base}/resources
INFO  : copy ${jetty.home}/modules/logging/jetty/resources/jetty-logging.properties to ${jetty.base}/resources/jetty-logging.properties
INFO  : Base directory was modified
[joakim@hyperion fastcgi-12]$ tree -F
./
├── resources/
│   └── jetty-logging.properties
└── start.d/
    ├── fcgi-proxy.ini
    └── http.ini

2 directories, 3 files

Lets add an XML with the Mortbay style of XML PUBLIC Id.

[joakim@hyperion fastcgi-12]$ mkdir etc
[joakim@hyperion fastcgi-12]$ gedit etc/mortbay-publicid.xml 
[joakim@hyperion fastcgi-12]$ cat etc/mortbay-publicid.xml 
<?xml version="1.0"  encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "https://jetty.org/configure_10_0.dtd">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
</Configure>
[joakim@hyperion fastcgi-12]$ echo "etc/mortbay-publicid.xml" > start.d/mortbay.ini
[joakim@hyperion fastcgi-12]$ tree -F
./
├── etc/
│   └── mortbay-publicid.xml
├── resources/
│   └── jetty-logging.properties
└── start.d/
    ├── fcgi-proxy.ini
    ├── http.ini
    └── mortbay.ini

3 directories, 5 files

Double check the configuration to make sure that this XML is loaded.

[joakim@hyperion fastcgi-12]$ java -jar ~/code/jetty/distros/jetty-home-12.0.14/start.jar --list-config

Enabled Modules:
----------------
  0) resources                 transitive provider of resources for logging-jetty
  1) logging/slf4j             transitive provider of logging/slf4j for logging-jetty
                               dynamic dependency of logging-jetty
  2) logging-jetty             transitive provider of logging for threadpool
                               transitive provider of logging for bytebufferpool
                               transitive provider of logging for server
  3) bytebufferpool            transitive provider of bytebufferpool for server
                               ini template available with --add-modules=bytebufferpool
  4) client                    transitive provider of client for proxy
  5) threadpool                transitive provider of threadpool for server
                               ini template available with --add-modules=threadpool
  6) server                    transitive provider of server for http
                               transitive provider of server for proxy
                               ini template available with --add-modules=server
  7) proxy                     transitive provider of proxy for fcgi-proxy
  8) fcgi-proxy                ${jetty.base}/start.d/fcgi-proxy.ini
  9) http                      ${jetty.base}/start.d/http.ini

JVM Version & Properties:
-------------------------
 java.home = /home/joakim/java/jvm/jdk-17.0.11+9
 java.vm.vendor = Eclipse Adoptium
 java.vm.version = 17.0.11+9
 java.vm.name = OpenJDK 64-Bit Server VM
 java.vm.info = mixed mode, sharing
 java.runtime.name = OpenJDK Runtime Environment
 java.runtime.version = 17.0.11+9
 java.io.tmpdir = /tmp
 user.dir = /home/joakim/code/jetty/distros/bases/fastcgi-12
 user.language = en
 user.country = US

Jetty Version & Properties:
---------------------------
 jetty.version = 12.0.14
 jetty.tag.version = jetty-12.0.14
 jetty.build = e77516598a07cca826d27fa8a4f7c70e953921a6
 jetty.home = /home/joakim/code/jetty/distros/jetty-home-12.0.14
 jetty.base = /home/joakim/code/jetty/distros/bases/fastcgi-12

Config Search Order:
--------------------
 <command-line>
 ${jetty.base} -> /home/joakim/code/jetty/distros/bases/fastcgi-12
 ${jetty.home} -> /home/joakim/code/jetty/distros/jetty-home-12.0.14

System Properties:
------------------
 (no system properties specified)

Properties: Jetty
-----------------
 java.version = 17.0.11
 java.version.major = 17
 java.version.micro = 11
 java.version.minor = 0
 java.version.platform = 17
 jetty.base = /home/joakim/code/jetty/distros/bases/fastcgi-12
 jetty.base.uri = file:///home/joakim/code/jetty/distros/bases/fastcgi-12
 jetty.home = /home/joakim/code/jetty/distros/jetty-home-12.0.14
 jetty.home.uri = file:///home/joakim/code/jetty/distros/jetty-home-12.0.14
 jetty.webapp.addHiddenClasses = org.eclipse.jetty.logging.,${jetty.home.uri}/lib/logging/,org.slf4j.
 runtime.feature.alpn = true
 slf4j.version = 2.0.13

Classpath: Jetty
----------------
Version Information on 14 entries in the classpath.
Note: order presented here is how they would appear on the classpath.
      changes to the --module=name command line options will be reflected here.
 0:                    (dir) | ${jetty.base}/resources
 1:                   2.0.13 | ${jetty.home}/lib/logging/slf4j-api-2.0.13.jar | http://www.opensource.org/licenses/mit-license.php
 2:                  12.0.14 | ${jetty.home}/lib/logging/jetty-slf4j-impl-12.0.14.jar | EPL-2.0 OR Apache-2.0
 3:                  12.0.14 | ${jetty.home}/lib/jetty-alpn-client-12.0.14.jar | EPL-2.0 OR Apache-2.0
 4:                  12.0.14 | ${jetty.home}/lib/jetty-alpn-java-client-12.0.14.jar | EPL-2.0 OR Apache-2.0
 5:                  12.0.14 | ${jetty.home}/lib/jetty-client-12.0.14.jar | EPL-2.0 OR Apache-2.0
 6:                  12.0.14 | ${jetty.home}/lib/jetty-http-12.0.14.jar | EPL-2.0 OR Apache-2.0
 7:                  12.0.14 | ${jetty.home}/lib/jetty-server-12.0.14.jar | EPL-2.0 OR Apache-2.0
 8:                  12.0.14 | ${jetty.home}/lib/jetty-xml-12.0.14.jar | EPL-2.0 OR Apache-2.0
 9:                  12.0.14 | ${jetty.home}/lib/jetty-util-12.0.14.jar | EPL-2.0 OR Apache-2.0
10:                  12.0.14 | ${jetty.home}/lib/jetty-io-12.0.14.jar | EPL-2.0 OR Apache-2.0
11:                  12.0.14 | ${jetty.home}/lib/jetty-proxy-12.0.14.jar | EPL-2.0 OR Apache-2.0
12:                  12.0.14 | ${jetty.home}/lib/fcgi/jetty-fcgi-client-12.0.14.jar | EPL-2.0 OR Apache-2.0
13:                  12.0.14 | ${jetty.home}/lib/fcgi/jetty-fcgi-proxy-12.0.14.jar | EPL-2.0 OR Apache-2.0

Active XMLs: Jetty
------------------
 ${jetty.home}/etc/jetty-bytebufferpool.xml
 ${jetty.home}/etc/jetty-threadpool.xml
 ${jetty.home}/etc/jetty.xml
 ${jetty.home}/etc/jetty-http.xml
 ${jetty.base}/etc/mortbay-publicid.xml

Yup, it's listed on the Active XMLs entry.

Now lets run with this odd XML, and double check that the internal references for XML entities are indeed pulled from the XML catalog we ship with, and not going to external entity sources.

This call should fail in the same way that the OP reported, as jetty.org is not accessible, from this testing machine.

[joakim@hyperion fastcgi-12]$ java -jar ~/code/jetty/distros/jetty-home-12.0.14/start.jar
2024-10-18 16:19:10.910:INFO :oejs.Server:main: jetty-12.0.14; built: 2024-09-30T14:22:54.197Z; git: e77516598a07cca826d27fa8a4f7c70e953921a6; jvm 17.0.11+9
2024-10-18 16:19:10.941:INFO :oejs.AbstractConnector:main: Started ServerConnector@1bd4fdd{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
2024-10-18 16:19:10.950:INFO :oejs.Server:main: Started oejs.Server@6ca8564a{STARTING}[12.0.14,sto=5000] @789ms

It works, without error.
There is something off about the OPs configuration (in many ways).

Looking closely at the behaviors, I can see that our XmlConfiguration object will use an XML Parser / Factory from the classloader if one is present.
So I opened PR #12407 to ensure that in the case of our XmlConfiguration this will not happen anymore, and will always use the JVM internal XML Parser / Factory.

@joakime joakime linked a pull request Oct 18, 2024 that will close this issue
@ArfyFR
Copy link
Author

ArfyFR commented Oct 19, 2024

Sorry for late reply. Here is the right --list-config

Enabled Modules:
----------------
  0) resources                 transitive provider of resources for logging-logback
  1) logging/slf4j             dynamic dependency of logging-logback
                               transitive provider of logging/slf4j for logging-logback
  2) logging-logback           ${jetty.base}\start.d\logging-logback.ini
  3) bytebufferpool            transitive provider of bytebufferpool for server
                               ini template available with --add-modules=bytebufferpool
  4) client                    transitive provider of client for ee10-websocket-jakarta
                               transitive provider of client for proxy
  5) threadpool                transitive provider of threadpool for server
                               ini template available with --add-modules=threadpool
  6) server                    transitive provider of server for http
																		  
                               transitive provider of server for deploy
																	 
																		 
                               transitive provider of server for sessions
                               transitive provider of server for ee10-security
                               transitive provider of server for ee10-servlet
                               transitive provider of server for jndi
                               transitive provider of server for proxy
                               transitive provider of server for ee10-plus
                               transitive provider of server for plus
                               transitive provider of server for rewrite
                               transitive provider of server for security
                               transitive provider of server for gzip
                               ini template available with --add-modules=server
  7) deploy                    transitive provider of deploy for ee10-deploy
  8) sessions                  transitive provider of sessions for ee10-servlet
                               ini template available with --add-modules=sessions
  9) ee10-servlet              transitive provider of ee10-servlet for ee10-webapp
                               transitive provider of ee10-servlet for ee10-security
 10) security                  transitive provider of security for ee10-security
 11) ee10-security             transitive provider of ee10-security for ee10-webapp
                               transitive provider of ee10-security for ee10-plus
 12) ee10-webapp               transitive provider of ee10-webapp for ee10-plus
                               transitive provider of ee10-webapp for ee10-deploy
                               ini template available with --add-modules=ee10-webapp
 13) plus                      transitive provider of plus for jndi
 14) jndi                      transitive provider of jndi for ee10-plus
 15) ee10-plus                 transitive provider of ee10-plus for ee10-annotations
 16) ee10-annotations          transitive provider of ee10-annotations for ee10-websocket-jakarta
 17) ee10-deploy               ${jetty.base}\start.d\ee10-deploy.ini
 18) ee10-websocket-jakarta    ${jetty.base}\start.d\ee10-websocket-jakarta.ini
 19) proxy                     transitive provider of proxy for fcgi-proxy
 20) fcgi-proxy                ${jetty.base}\start.d\fcgi-proxy.ini
 21) gzip                      ${jetty.base}\start.d\gzip.ini
 22) http                      ${jetty.base}\start.d\http.ini
 23) rewrite                   ${jetty.base}\start.d\rewrite.ini

JVM Version & Properties:
-------------------------
 java.home = C:\tools\64bits\java\jdk-17.0.9+9
 java.vm.vendor = Eclipse Adoptium
 java.vm.version = 17.0.9+9
 java.vm.name = OpenJDK 64-Bit Server VM
 java.vm.info = mixed mode, sharing
 java.runtime.name = OpenJDK Runtime Environment
 java.runtime.version = 17.0.9+9
 java.io.tmpdir = C:\Users\borsc\AppData\Local\Temp\
 user.dir = C:\DEV\GIT\gtc\dist\tools\jetty\gtc-base
 user.language = fr
 user.country = FR

Jetty Version & Properties:
---------------------------
 jetty.version = 12.0.5
 jetty.tag.version = jetty-12.0.5
 jetty.build = 3aed62e4959bb8c01f5975fe81e078e3ff626126
 jetty.home = C:\tools\noarch\jetty\12.0.5
 jetty.base = C:\DEV\GIT\gtc\dist\tools\jetty\gtc-base

Config Search Order:
--------------------
 <command-line>
 ${jetty.base} -> C:\DEV\GIT\gtc\dist\tools\jetty\gtc-base
 ${jetty.home} -> C:\tools\noarch\jetty\12.0.5

System Properties:
------------------
 (no system properties specified)

Properties: Jetty
-----------------
 java.version = 17.0.9
 java.version.major = 17
 java.version.micro = 9
 java.version.minor = 0
 java.version.platform = 17
 jetty.base = C:\DEV\GIT\gtc\dist\tools\jetty\gtc-base
 jetty.base.uri = file:///C:/DEV/GIT/gtc/dist/tools/jetty/gtc-base
 jetty.home = C:\tools\noarch\jetty\12.0.5
 jetty.home.uri = file:///C:/tools/noarch/jetty/12.0.5
 jetty.http.port = 80
 jetty.webapp.addServerClasses = ch.qos.logback.,org.slf4j.
 logback.version = 1.4.14
 runtime.feature.alpn = true
 slf4j.version = 2.0.9

Classpath: Jetty
----------------
Version Information on 20 entries in the classpath.
Note: order presented here is how they would appear on the classpath.
      changes to the --module=name command line options will be reflected here.
 0:                    (dir) | ${jetty.base}\resources
 1:                    2.0.9 | ${jetty.home}\lib\logging\slf4j-api-2.0.9.jar
 2:                   1.4.14 | ${jetty.base}\lib\logging\logback-classic-1.4.14.jar
 3:                   1.4.14 | ${jetty.base}\lib\logging\logback-core-1.4.14.jar
 4:                   12.0.5 | ${jetty.home}\lib\jetty-client-12.0.5.jar
 5:                   12.0.5 | ${jetty.home}\lib\jetty-alpn-client-12.0.5.jar
 6:                   12.0.5 | ${jetty.home}\lib\jetty-http-12.0.5.jar
 7:                   12.0.5 | ${jetty.home}\lib\jetty-server-12.0.5.jar
 8:                   12.0.5 | ${jetty.home}\lib\jetty-xml-12.0.5.jar
 9:                   12.0.5 | ${jetty.home}\lib\jetty-util-12.0.5.jar
10:                   12.0.5 | ${jetty.home}\lib\jetty-io-12.0.5.jar
11:                   12.0.5 | ${jetty.home}\lib\jetty-deploy-12.0.5.jar
12:                   12.0.5 | ${jetty.home}\lib\jetty-session-12.0.5.jar
13:                   12.0.5 | ${jetty.home}\lib\jetty-security-12.0.5.jar
14:                   12.0.5 | ${jetty.home}\lib\jetty-plus-12.0.5.jar
15:                   12.0.5 | ${jetty.home}\lib\jetty-jndi-12.0.5.jar
16:                   12.0.5 | ${jetty.home}\lib\jetty-proxy-12.0.5.jar
17:                   12.0.5 | ${jetty.home}\lib\fcgi\jetty-fcgi-client-12.0.5.jar
18:                   12.0.5 | ${jetty.home}\lib\fcgi\jetty-fcgi-proxy-12.0.5.jar
19:                   12.0.5 | ${jetty.home}\lib\jetty-rewrite-12.0.5.jar

Active XMLs: Jetty
------------------
 ${jetty.home}\etc\jetty-bytebufferpool.xml
 ${jetty.home}\etc\jetty-threadpool.xml
 ${jetty.home}\etc\jetty.xml
 ${jetty.base}\etc\jetty-deploy.xml
 ${jetty.home}\etc\sessions\id-manager.xml
 ${jetty.home}\etc\jetty-gzip.xml
 ${jetty.home}\etc\jetty-http.xml
 ${jetty.home}\etc\jetty-rewrite.xml
 ${jetty.base}\etc\jetty-rewrite-rules.xml

Properties: ee10
----------------
 contextHandlerClass = org.eclipse.jetty.ee10.webapp.WebAppContext
 jetty.deploy.extractWars = true
 jetty.deploy.monitoredDir = webapps
 jetty.deploy.scanInterval = 1

Classpath: ee10
---------------
Version Information on 24 entries in the classpath.
Note: order presented here is how they would appear on the classpath.
      changes to the --module=name command line options will be reflected here.
 0:                    6.0.0 | ${jetty.home}\lib\jakarta.servlet-api-6.0.0.jar
 1:                   12.0.5 | ${jetty.home}\lib\jetty-ee10-servlet-12.0.5.jar
 2:                   12.0.5 | ${jetty.home}\lib\jetty-ee10-webapp-12.0.5.jar
 3:                   12.0.5 | ${jetty.home}\lib\jetty-ee10-plus-12.0.5.jar
 4:                    2.0.1 | ${jetty.home}\lib\jakarta.transaction-api-2.0.1.jar
 5:                    2.1.0 | ${jetty.home}\lib\jakarta.interceptor-api-2.1.0.jar
 6:                    4.0.1 | ${jetty.home}\lib\jakarta.enterprise.cdi-api-4.0.1.jar
 7:                      2.0 | ${jetty.home}\lib\jakarta.inject-api-2.0.1.jar
 8:                    4.0.1 | ${jetty.home}\lib\jakarta.enterprise.lang-model-4.0.1.jar
 9:                   12.0.5 | ${jetty.home}\lib\jetty-ee10-annotations-12.0.5.jar
10:                      9.6 | ${jetty.home}\lib\ee10-annotations\asm-9.6.jar
11:                      9.6 | ${jetty.home}\lib\ee10-annotations\asm-analysis-9.6.jar
12:                      9.6 | ${jetty.home}\lib\ee10-annotations\asm-commons-9.6.jar
13:                      9.6 | ${jetty.home}\lib\ee10-annotations\asm-tree-9.6.jar
14:                    2.1.1 | ${jetty.home}\lib\ee10-annotations\jakarta.annotation-api-2.1.1.jar
15:                   12.0.5 | ${jetty.home}\lib\jetty-websocket-core-common-12.0.5.jar
16:                   12.0.5 | ${jetty.home}\lib\jetty-websocket-core-client-12.0.5.jar
17:                   12.0.5 | ${jetty.home}\lib\jetty-websocket-core-server-12.0.5.jar
18:                   12.0.5 | ${jetty.home}\lib\ee10-websocket\jetty-ee10-websocket-servlet-12.0.5.jar
19:                    2.1.1 | ${jetty.home}\lib\ee10-websocket\jakarta.websocket-client-api-2.1.1.jar
20:                    2.1.1 | ${jetty.home}\lib\ee10-websocket\jakarta.websocket-api-2.1.1.jar
21:                   12.0.5 | ${jetty.home}\lib\ee10-websocket\jetty-ee10-websocket-jakarta-client-12.0.5.jar
22:                   12.0.5 | ${jetty.home}\lib\ee10-websocket\jetty-ee10-websocket-jakarta-common-12.0.5.jar
23:                   12.0.5 | ${jetty.home}\lib\ee10-websocket\jetty-ee10-websocket-jakarta-server-12.0.5.jar

Active XMLs: ee10
-----------------
 ${jetty.home}\etc\jetty-ee10-webapp.xml
 ${jetty.home}\etc\jetty-ee10-deploy.xml

@ArfyFR
Copy link
Author

ArfyFR commented Oct 19, 2024

About the test with system's hosts and jetty.org to a false IP

I tried, and yes, it's reproduced: but with another error java.net.UnknownHostException: jetty.org with 0.0.0.0

java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.eclipse.jetty.start.Main.invokeMain(Main.java:221)
        at org.eclipse.jetty.start.Main.start(Main.java:519)
        at org.eclipse.jetty.start.Main.main(Main.java:76)
Caused by: java.net.UnknownHostException: jetty.org
        at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:572)
        at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327)
        at java.base/java.net.Socket.connect(Socket.java:633)
...

With 192.168.88.99: Connection timed out

java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.eclipse.jetty.start.Main.invokeMain(Main.java:221)
        at org.eclipse.jetty.start.Main.start(Main.java:519)
        at org.eclipse.jetty.start.Main.main(Main.java:76)
Caused by: java.net.ConnectException: Connection timed out: connect
        at java.base/sun.nio.ch.Net.connect0(Native Method)
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For general bugs on Jetty side
Projects
Status: 🏗 In progress
Development

Successfully merging a pull request may close this issue.

2 participants