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

Issue encountered with Jetty 9.4.56 for type ID must be unique even though the type ID is unique in jetty9.xml #12355

Closed
prasads6971 opened this issue Oct 9, 2024 · 5 comments

Comments

@prasads6971
Copy link

prasads6971 commented Oct 9, 2024

Jetty version(s)
9.4.56

Jetty Environment

Java version/vendor
openjdk version "1.8.0_422"

OS type/version
Ubuntu 22.04.5 LTS

Description
In below Jetty9.xml

<Call id="DefaultTimeZone" name="getDefault" class="java.util.TimeZone"/>
<Ref id="DefaultTimeZone">
	<Get id="DefaultTimeZoneID" name="ID"/>
</Ref>

<New id="httpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
	<Set name="secureScheme">https</Set>
	<Set name="securePort"><Property name="jetty.ssl.port" default="8443" /></Set>
	<Set name="outputBufferSize">32768</Set>
	<Set name="requestHeaderSize">8192</Set>
	<Set name="responseHeaderSize">8192</Set>
</New>

<New id="LogStream" class="org.eclipse.jetty.util.RolloverFileOutputStream">
	<Arg>
		<SystemProperty name="jetty.home" default="/opt/logs/jetty"/>/jetty9_yyyy_MM_dd.log
	</Arg>
	<Arg type="boolean">true</Arg>
	<Arg type="int">90</Arg>
	<Arg><Ref id="DefaultTimeZone"/></Arg>
	<!--Get id="ServerLogName" name="datedFilename"/-->
</New>

<New id="ServerLog" class="java.io.PrintStream">
	<Arg>
		<Ref id="LogStream"/>
	</Arg>
</New>

<!-- Redirect the System.err and System.out to the Jetty log file -->
<Call class="java.lang.System" name="setErr">
	<Arg><Ref id="ServerLog"/></Arg>
</Call>
<Call class="java.lang.System" name="setOut">
	<Arg><Ref id="ServerLog"/></Arg>
</Call>	

<!-- Uncomment below for SSL / HTTP configuration -->
<!--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> 
<New id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory">
	<Set name="keyStorePath">H:\keystore\keystore.jks</Set>
	<Set name="KeyStorePassword">OBF:1v2j1uum1xtv1zej1zer1xtn1uvk1v1v</Set>
		<Set name="KeyManagerPassword">OBF:1k8m1i9a1ltu1wfq1uvc1sov1uuu1wg81lq41i6o1k5k</Set>
		<Set name="KeyStoreType">JKS</Set>
		<Set name="trustStorePath">H:\keystore\keystore.jks</Set>
	<Set name="trustStorePassword">OBF:1v2j1uum1xtv1zej1zer1xtn1uvk1v1v</Set>
</New>
<New id="sslConnectionFactory" class="org.eclipse.jetty.server.SslConnectionFactory">
	<Arg name="sslContextFactory">
		<Ref refid="sslContextFactory" />
	</Arg>
	<Arg name="next">http/1.1</Arg>
</New-->
<Set name="connectors">
<Array type="org.eclipse.jetty.server.Connector">
  <Item>
	<New class="org.eclipse.jetty.server.ServerConnector">
	  <Arg><Ref refid="jettyServer"/></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="port">9191</Set>
    </New>
  </Item>
		<!-- Uncomment for SSL / HTTP implementation
		<Item>
    <New id="sslConnector" class="org.eclipse.jetty.server.ServerConnector">
				<Arg name="server">
        <Ref refid="jettyServer" />
				</Arg>
				<Arg name="factories">
					<Array type="org.eclipse.jetty.server.ConnectionFactory">
						<Item>
							<Ref refid="sslConnectionFactory" />
						</Item>
						<Item>
							<New class="org.eclipse.jetty.server.HttpConnectionFactory">
								<Arg name="config">
									<Ref refid="sslHttpConfig" />
								</Arg>
							</New>
						</Item>
					</Array>
				</Arg>
				<Set name="port">8443</Set>
			</New>
		</Item> -->
	</Array>
</Set>

<New id="Context" class="org.eclipse.jetty.webapp.WebAppContext">
	<Set name="contextPath">/</Set>
	<Set name="resourceBase">/opt/binaries/sds/jetty</Set>
	<!--Set name="descriptor">WEB-INF/web.xml</Set-->
	<Set name="errorHandler">
		<New class="com.sds2.w3c.fsmlib.http.jetty.ErrorHandler9">
			<!--
			  - If useParentLogic is set to false (default), the client will
			  - not see any HTML in case of an error. That is how a generic
			  - server process should behave. If an HTML is required, set
			  - this to true and the default Jetty implementation of error
			  - page will be sent back to the client.
			  -->
			<Set name="useParentLogic">false</Set>
		</New>
	</Set>
	<!--
	  - This servlet should get added from the servlet mappings defined in the database
	  -->
	<Call name="insertHandler">
		<Arg>
			<New id="RequestLog" class="org.eclipse.jetty.server.handler.RequestLogHandler">
				<Set name="requestLog">
					<New id="RequestLogImpl" class="org.eclipse.jetty.server.NCSARequestLog">
						<Set name="filename"><Property name="jetty.logs" default="/opt/logs/jetty"/>/jetty9req_yyyy_MM_dd.log</Set>
						<Set name="filenameDateFormat">yyyy_MM_dd</Set>
						<Set name="LogTimeZone">GMT</Set>
						<Set name="retainDays">90</Set>
						<Set name="append">true</Set>
					</New>
				</Set>
			</New>
		</Arg>
	</Call>
</New>

<Set name="handler">
	<New class="org.eclipse.jetty.server.handler.HandlerCollection">
		<Set name="handlers">
			<Array type="org.eclipse.jetty.server.Handler">
				<Item>
					<Ref refid="Context"/>
				</Item>
				<Item>
					<New id="DefaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler" />
				</Item>
			</Array>
		</Set>
	</New>
</Set>
<Set name="stopAtShutdown">true</Set>

We are getting below error:-
Wed Oct 9|10:07:42.708|D|main|EXCEPTION : org.xml.sax.SAXParseException : Attribute value "DefaultTimeZone" of type ID must be unique within the document.|org.eclipse.jetty.xml.XmlParser||
Wed Oct 9|10:07:42.708|W|main|ERROR@ line:7 col:28 : org.xml.sax.SAXParseException; systemId: ; lineNumber: 7; columnNumber: 28; Attribute value "DefaultTimeZone" of type ID must be unique within the document.|org.eclipse.jetty.xml.XmlParser||
Wed Oct 9|10:07:42.709|D|main|EXCEPTION : org.xml.sax.SAXParseException : Attribute value "DefaultTimeZone" of type ID must be unique within the document.|org.eclipse.jetty.xml.XmlParser||
Wed Oct 9|10:07:42.709|W|main|ERROR@ line:25 col:35 : org.xml.sax.SAXParseException; systemId: ; lineNumber: 25; columnNumber: 35; Attribute value "DefaultTimeZone" of type ID must be unique within the document.|org.eclipse.jetty.xml.XmlParser||
Wed Oct 9|10:07:42.709|D|main|EXCEPTION : org.xml.sax.SAXParseException : Attribute value "LogStream" of type ID must be unique within the document.|org.eclipse.jetty.xml.XmlParser||
Wed Oct 9|10:07:42.709|W|main|ERROR@ line:31 col:25 : org.xml.sax.SAXParseException; systemId: ; lineNumber: 31; columnNumber: 25; Attribute value "LogStream" of type ID must be unique within the document.|org.eclipse.jetty.xml.XmlParser||
Wed Oct 9|10:07:42.710|D|main|EXCEPTION : org.xml.sax.SAXParseException : Attribute value "ServerLog" of type ID must be unique within the document.|org.eclipse.jetty.xml.XmlParser||
Wed Oct 9|10:07:42.710|W|main|ERROR@ line:37 col:29 : org.xml.sax.SAXParseException; systemId: ; lineNumber: 37; columnNumber: 29; Attribute value "ServerLog" of type ID must be unique within the document.|org.eclipse.jetty.xml.XmlParser||
Wed Oct 9|10:07:42.710|D|main|EXCEPTION : org.xml.sax.SAXParseException : Attribute value "ServerLog" of type ID must be unique within the document.|org.eclipse.jetty.xml.XmlParser||
Wed Oct 9|10:07:42.710|W|main|ERROR@ line:40 col:29 : org.xml.sax.SAXParseException; systemId: ; lineNumber: 40; columnNumber: 29; Attribute value "ServerLog" of type ID must be unique within the document.|org.eclipse.jetty.xml.XmlParser||

The same used to work fine with Jetty 9.4.50, it seems post upgrade, jetty has enforced some invalid type checks.

@prasads6971 prasads6971 added the Bug For general bugs on Jetty side label Oct 9, 2024
@joakime
Copy link
Contributor

joakime commented Oct 9, 2024

Jetty 9 is at End of Community Support.

You should be using a supported version of Jetty, which is Jetty 12 at this point in time.
If you need to continue to use javax.servlet as opposed to jakarta.servlet, then use the ee8 environment in Jetty 12.

Also, the error you are getting is not from Jetty, but from the JVM, your XML is not valid per standard XML rules.
There will be no further help with Jetty 9.

@joakime
Copy link
Contributor

joakime commented Oct 9, 2024

Here's the Jetty 12 documentation on the Jetty XML syntax.

https://jetty.org/docs/jetty/12/operations-guide/xml/index.html#syntax-ref

@prasads6971
Copy link
Author

Hi @joakime, updated the XML. I can assure you the same XML is working seamlessly with Jetty 9.4.50.
I just wish to know, what change has been encorporated between 9.4.50 and 9.4.56 which seems to cause the above errors.

@joakime
Copy link
Contributor

joakime commented Oct 9, 2024

@prasads6971 Jetty 9 community support is not available anymore.

See

Upgrade to a supported version of Jetty (Jetty 12) for community support.
Seek commercial support if you need to stay on Jetty 9.

That being said, your problem is not Jetty, or Jetty code, it's standard XML syntax issues as handled by the JVM, it is clearly stated as such in your exception message, and has to be address with standard XML syntax fixes for your entirely custom and non-standard jetty9.xml (a filename that isn't used on any version of Jetty). The fact that your custom jetty9.xml worked on older versions of Jetty is just sheer luck and has nothing to do with Jetty or and changes in Jetty.

@joakime
Copy link
Contributor

joakime commented Oct 9, 2024

Closing as out of community support.

If you replicate on a supported version of Jetty (Jetty 12 as of this message), this issue can be reopened.

@joakime joakime closed this as completed Oct 9, 2024
@joakime joakime added Not a bug and removed Bug For general bugs on Jetty side labels Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants