Opened 3 years ago

Closed 2 years ago

#1968 closed defect (wontfix)

-- not allowed in comment, jetty9

Reported by: Eche|on Owned by: zzz
Priority: major Milestone: 0.9.30
Component: apps/jetty Version: 0.9.29
Keywords: Cc:
Parent Tickets: Sensitive: no

Description

2017-03-14 17:24:03.845:WARN:oejx.XmlParser:FATAL@file:/opt/i2p/eepsite/jetty.xml line:62 col:13 : org.xml.sax.SAXParseException; systemId: file:/opt/i2p/eepsite/jetty.xml; lineNumber: 62; columnNumber: 13; The string "—" is not permitted within comments.

A complete section was commented out, so the additional — inside the comment threw this error

Subtickets

Change History (3)

comment:1 Changed 3 years ago by zzz

Milestone: undecided0.9.30
Owner: set to zzz
Status: newaccepted

Please email me the old file, which should have been backed up as jetty.xml.jetty8, and the migrated file jetty.xml (before you fixed it if you have it, but after you fixed it is fine too).

If you wish you may xxx out the paths inside, that's not important.

comment:2 Changed 3 years ago by zzz

There's two ways to make a new jetty.xml file for the user in the migration:

1) Throw out the user's old files, and create new ones by migrating from the jetty.xml template files in $I2P/eepsite. The migration converts "./eepsite" to absolute paths in the config dir. The user loses any changes, and gets a message "if you made changes, make them again". This guarantees a working setup. It's also the easiest. This is what we did for 5→6 and 6→7/8, both of which were major changes both to jetty.xml and the contexts/ and etc/ files.

2) Try to fix up the user's files in-place, to preserve local changes. This only works if the user's files are pretty recent, and made simple changes the migration parser can deal with. This is what I did for 7/8→9, since the necessary changes were only in jetty.xml. The downside is that if it doesn't work, things break completely, as happened to you. Also, you're left to figure out for yourself how to fix it, perhaps by migrating from the template file as in 1) and fixing up the paths, but we don't tell you that.

In your case, your file was, I think, modified by you to comment out the QueuedThreadPool? and uncomment the ExecutorThreadPool?. Or, perhaps, we at one point shipped it that way, I don't recall.

So our choices are:

a) switch back to option 1)
b) stick with option 2), and perhaps give the user some more help on what to do if it fails. Also, maybe, try to handle migration of a file like yours, but that could be too hard.

comment:3 Changed 2 years ago by zzz

Resolution: wontfix
Status: acceptedclosed

We did option b). Here's the instructions on how to fix it manually. This information is also posted at http://zzz.i2p/topics/2323

This may happen if you installed i2p long ago. The symptom is:

CRIT  [er (eepsite)] uter.startup.LoadClientAppsJob: Error starting up the client class net.i2p.jetty.JettyStart
java.lang.reflect.InvocationTargetException
	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 net.i2p.router.startup.LoadClientAppsJob$RunApp.run(LoadClientAppsJob.java:287)
	at java.lang.Thread.run(Thread.java:745)
	at net.i2p.util.I2PThread.run(I2PThread.java:103)
Caused by: org.xml.sax.SAXParseException; systemId: file:/var/lib/i2p/i2p-config/eepsite/jetty.xml; lineNumber: 62; columnNumber: 13; The string "--" is not permitted within comments.
	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400)
	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
	at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1465)
	at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanComment(XMLScanner.java:820)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanComment(XMLDocumentFragmentScannerImpl.java:1033)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2979)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:118)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:504)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:642)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:326)
	at org.eclipse.jetty.xml.XmlParser.parse(XmlParser.java:210)
	at org.eclipse.jetty.xml.XmlParser.parse(XmlParser.java:226)
	at org.eclipse.jetty.xml.XmlConfiguration.<init>(XmlConfiguration.java:138)
	at net.i2p.jetty.JettyStart.parseArgs(JettyStart.java:89)
	at net.i2p.jetty.JettyStart.<init>(JettyStart.java:71)

Here's an relevant portion of the problematic jetty.xml file (after the failed migration):

<Configure id="Server" class="org.eclipse.jetty.server.Server">

    <!-- =========================================================== -->
    <!-- Server Thread Pool                                          -->
    <!-- =========================================================== -->
    <!-- Modified by I2P migration script for Jetty 9. Do not remove this line -->
    <Arg>

      <!-- PICK ONE -->

      <!-- If you don't have or want threadpool
           Requests above the max will be queued
       -->
     <!--
      <New class="org.eclipse.jetty.util.thread.QueuedThreadPool">
        <!-- Modified by I2P migration script for Jetty 9. Do not remove this line -->
        <Arg type="int">20</Arg>     <!-- maxThreads, overridden below -->
        <Arg type="int">3</Arg>      <!-- minThreads, overridden below -->
        <Arg type="int">60000</Arg>  <!-- maxIdleTimeMs, overridden below -->
        <Set name="minThreads">1</Set>
        <Set name="maxThreads">16</Set>
        <Set name="lowThreads">2</Set>
      </New>
     -->

      <!-- Optional Java 5 bounded threadpool with job queue 
           Requests above the max will be rejected and logged.
           High-traffic sites should increase maximumPoolSize.
       -->
      <New class="org.eclipse.jetty.util.thread.ExecutorThreadPool">
        <!-- corePoolSize (should be at least 3) -->
        <Arg type="int">3</Arg>
        <!-- maximumPoolSize -->
        <Arg type="int">20</Arg>
        <!-- keepAliveTime (milliseconds) -->
        <Arg type="long">60000</Arg>
        <Arg>
            <Call class="java.util.concurrent.TimeUnit" name="valueOf" >
                <Arg>MILLISECONDS</Arg>
            </Call>
        </Arg>
        <Arg>
            <New class="java.util.concurrent.SynchronousQueue" />
        </Arg>
      </New>
    </Arg>

Find the location of the jetty.xml file. It should be listed in the log (see above). It could be ~/.i2p/eepsite/jetty.xml, or /var/lib/i2p/i2p-config/eepsite/jetty.xml, or some other place if you're on Windows or Mac.

The error is about a comment inside a comment. But the real problem is that the wrong section is commented out.

Note that there are two sections, one commented out and one not. The first section is:

      <New class="org.eclipse.jetty.util.thread.QueuedThreadPool">
...
      </New>

Uncomment that section by removing the <-- at the beginning and the —> at the end.

The second section is:

      <New class="org.eclipse.jetty.util.thread.ExecutorThreadPool">
---
      </New>

Just delete that section. (Or you can comment it out, but delete the comments inside or you have comment-in-a-comment again)

When you are done, it should look like this:

<Configure id="Server" class="org.eclipse.jetty.server.Server">

    <!-- =========================================================== -->
    <!-- Server Thread Pool                                          -->
    <!-- =========================================================== -->
    <!-- Modified by I2P migration script for Jetty 9. Do not remove this line -->
    <Arg>

      <!-- PICK ONE -->

      <!-- If you don't have or want threadpool
           Requests above the max will be queued
       -->
      <New class="org.eclipse.jetty.util.thread.QueuedThreadPool">
        <!-- Modified by I2P migration script for Jetty 9. Do not remove this line -->
        <Arg type="int">20</Arg>     <!-- maxThreads, overridden below -->
        <Arg type="int">3</Arg>      <!-- minThreads, overridden below -->
        <Arg type="int">60000</Arg>  <!-- maxIdleTimeMs, overridden below -->
        <Set name="minThreads">1</Set>
        <Set name="maxThreads">16</Set>
        <Set name="lowThreads">2</Set>
      </New>
    </Arg>

Now you can either restart I2P, or just go to http://localhost:7657/configclients in your console, stop the Jetty eepsite, and start it again. Test that your eepsite works, or check the logs.

Note: See TracTickets for help on using tickets.