Thread: Java Error with irisFetch.Stations

Started: 2022-08-30 23:47:18
Last activity: 2022-09-24 11:37:18
Brandon VanderBeek
2022-08-30 23:47:18
I have recently encountered an error using irisFetch.Stations. Two days ago
(28-Aug-2022), I was able to run the following command without error,

S =
irisFetch.Stations('STATION','*','*','*','*','MinimumLatitude',38,'MaximumLatitude',52,'MinimumLongitude',-131,'MaximumLongitude',-115);

However, for the past two days this command has been giving the error
copied below. I'll note that requesting specifically the 'BHZ' channel
instead of the wildcard '*' runs without error while requesting
specifically the 'HHZ' channel will fail. Any thoughts?

Thanks for the help,
Brandon

Error using irisFetch/Networks/fetchTheStations (line 809)
Java exception occurred:
java.io.IOException: javax.xml.bind.UnmarshalException
- with linked exception:
[com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character ' '
(code 32); expected a semi-colon after the reference for entity 'E'
at [row,col {unknown-source}]: [4556,23]]
at
edu.iris.dmc.service.station.parser.StationXMLParser.parse(StationXMLParser.java:274)
at edu.iris.dmc.service.StationService.fetch(StationService.java:407)
at edu.iris.dmc.service.StationService.fetch(StationService.java:316)
at edu.iris.dmc.service.StationService.fetch(StationService.java:338)
Caused by: javax.xml.bind.UnmarshalException
- with linked exception:
[com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character ' '
(code 32); expected a semi-colon after the reference for entity 'E'
at [row,col {unknown-source}]: [4556,23]]
at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:470)
at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:448)
at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:415)
at
edu.iris.dmc.service.station.parser.StationXMLParser.parse(StationXMLParser.java:252)
... 3 more
Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected
character ' ' (code 32); expected a semi-colon after the reference for
entity 'E'
at [row,col {unknown-source}]: [4556,23]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)
at com.ctc.wstx.sr.StreamScanner.parseEntityName(StreamScanner.java:1994)
at com.ctc.wstx.sr.StreamScanner.fullyResolveEntity(StreamScanner.java:1496)
at
com.ctc.wstx.sr.BasicStreamReader.readTextSecondary(BasicStreamReader.java:4681)
at
com.ctc.wstx.sr.BasicStreamReader.readCoalescedText(BasicStreamReader.java:4126)
at
com.ctc.wstx.sr.BasicStreamReader.finishToken(BasicStreamReader.java:3701)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1023)
at com.ctc.wstx.evt.WstxEventReader.nextEvent(WstxEventReader.java:196)
at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.StAXEventConnector.bridge(StAXEventConnector.java:131)
at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:445)
... 5 more

Error in irisFetch.Networks (line 713)
fetchTheStations();

Error in irisFetch.Stations (line 639)
[stationStructure, urlParams] =
irisFetch.Networks(detailLevel,varargin{:});

  • Robert Casey
    2022-09-23 17:37:59

    Hi Brandon-

    Thank you for this feedback. We're currently working to resolve this issue. Tracking down the source of the problem (other than the fact that we upgraded our Java platform) and why it's affecting MATLAB users only has been tricky, but we're getting there. I am also conducting tests using the IRIS-WS java library in hopes this might point to a solution for irisFetch end users.

    The feedback you provide below is useful, as the error pops up selectively on certain station metadata, and we're trying to isolate what is special in those cases.

    So, this is station-level metadata that fits in a lat-lon box. It pulls back a very big list, about 6MB in size.

    I run the query like so: http://service.iris.edu/fdsnws/station/1/query?net=*&level=station&minlat=38&maxlat=52&minlon=-131&maxlon=-115&nodata=404 http://service.iris.edu/fdsnws/station/1/query?net=*&level=station&minlat=38&maxlat=52&minlon=-131&maxlon=-115&nodata=404>

    These kinds of errors crop up when ampersand characters appear in XML but are not properly formatted to represent special characters (entities). These are like & for ampersand, > for greater-than, etc. So, this XML does have a lot of ampersands in site descriptions, like PG&E and so forth. In fact, I would guess that PG&E is the culprit, as this fits to what I see in the error:

    [com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character ' ' (code 32); expected a semi-colon after the reference for entity 'E'

    The error appears 3 times, but it's all for the same position. This is for station AE06, network GM. This station only has channels HH? and HN?, so when you do your search, this station will come up. If you search on BH? channels, this station will not appear.

    What I cannot figure out is why I am seeing the string
    <Description>PG&amp;E Dam</Description>
    come back, which should be fine, when it looks like irisFetch is getting back
    <Description>PG&E Dam</Description>
    which would trigger the unmarshalling error you are seeing.


    I ran Java 8 and Java 11 runs of IRIS-WS which simulates irisFetch.stations for station AE06, even printing out the Site details and I can't seem to trigger a parsing error. What is notable is that I am explicitly calling on JAXB libraries in my classpath and not falling back on something that MATLAB or other utility might be using. I am hoping we can test this on our instance of MATLAB to see if it makes a difference. I don't have a license for it.

    My classpath includes: ./IRIS-WS-2.0.19.jar
    ./javax.xml.bind-3.0-b71.jar
    ./jaxb-impl-2.3.1.jar
    ./jaxb-core-2.3.0.1.jar
    ./activation-1.0.2.jar

    -Rob




    On Sep 23, 2022, at 10:09 AM, Brandon VanderBeek (via IRIS) <data-request-help-bounce<at>lists.ds.iris.edu> wrote:

    I have recently encountered an error using irisFetch.Stations. Two days ago (28-Aug-2022), I was able to run the following command without error,

    S = irisFetch.Stations('STATION','*','*','*','*','MinimumLatitude',38,'MaximumLatitude',52,'MinimumLongitude',-131,'MaximumLongitude',-115);

    However, for the past two days this command has been giving the error copied below. I'll note that requesting specifically the 'BHZ' channel instead of the wildcard '*' runs without error while requesting specifically the 'HHZ' channel will fail. Any thoughts?

    Thanks for the help,
    Brandon

    Error using irisFetch/Networks/fetchTheStations (line 809)
    Java exception occurred:
    java.io.IOException: javax.xml.bind.UnmarshalException
    - with linked exception:
    [com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character ' ' (code 32); expected a semi-colon after the reference for entity 'E'
    at [row,col {unknown-source}]: [4556,23]]
    at edu.iris.dmc.service.station.parser.StationXMLParser.parse(StationXMLParser.java:274)
    at edu.iris.dmc.service.StationService.fetch(StationService.java:407)
    at edu.iris.dmc.service.StationService.fetch(StationService.java:316)
    at edu.iris.dmc.service.StationService.fetch(StationService.java:338)
    Caused by: javax.xml.bind.UnmarshalException
    - with linked exception:
    [com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character ' ' (code 32); expected a semi-colon after the reference for entity 'E'
    at [row,col {unknown-source}]: [4556,23]]
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:470)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:448)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:415)
    at edu.iris.dmc.service.station.parser.StationXMLParser.parse(StationXMLParser.java:252)
    ... 3 more
    Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character ' ' (code 32); expected a semi-colon after the reference for entity 'E'
    at [row,col {unknown-source}]: [4556,23]
    at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)
    at com.ctc.wstx.sr.StreamScanner.parseEntityName(StreamScanner.java:1994)
    at com.ctc.wstx.sr.StreamScanner.fullyResolveEntity(StreamScanner.java:1496)
    at com.ctc.wstx.sr.BasicStreamReader.readTextSecondary(BasicStreamReader.java:4681)
    at com.ctc.wstx.sr.BasicStreamReader.readCoalescedText(BasicStreamReader.java:4126)
    at com.ctc.wstx.sr.BasicStreamReader.finishToken(BasicStreamReader.java:3701)
    at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1023)
    at com.ctc.wstx.evt.WstxEventReader.nextEvent(WstxEventReader.java:196)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.StAXEventConnector.bridge(StAXEventConnector.java:131)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:445)
    ... 5 more

    Error in irisFetch.Networks (line 713)
    fetchTheStations();

    Error in irisFetch.Stations (line 639)
    [stationStructure, urlParams] = irisFetch.Networks(detailLevel,varargin{:});

    ----------------------
    Data Request Help
    Topic home: http://ds.iris.edu/message-center/topic/data-request-help/ | Unsubscribe: data-request-help-unsubscribe<at>lists.ds.iris.edu

    Sent from the IRIS Message Center (http://ds.iris.edu/message-center/)
    Update subscription preferences at http://ds.iris.edu/account/profile/


    • Brandon VanderBeek
      2022-09-24 11:37:18
      Thanks for the reply! I will look into the classpath solution and update
      you if this solves the problem on my end.

      -Brandon

      On Sat, Sep 24, 2022 at 2:39 AM rob<at>iris.washington.edu (via IRIS) <
      data-request-help-bounce<at>lists.ds.iris.edu> wrote:


      Hi Brandon-

      Thank you for this feedback. We're currently working to resolve this
      issue. Tracking down the source of the problem (other than the fact that
      we upgraded our Java platform) and why it's affecting MATLAB users only has
      been tricky, but we're getting there. I am also conducting tests using the
      IRIS-WS java library in hopes this might point to a solution for irisFetch
      end users.

      The feedback you provide below is useful, as the error pops up selectively
      on certain station metadata, and we're trying to isolate what is special in
      those cases.

      So, this is station-level metadata that fits in a lat-lon box. It pulls
      back a very big list, about 6MB in size.

      I run the query like so:
      http://service.iris.edu/fdsnws/station/1/query?net=*&level=station&minlat=38&maxlat=52&minlon=-131&maxlon=-115&nodata=404

      These kinds of errors crop up when ampersand characters appear in XML but
      are not properly formatted to represent special characters (entities).
      These are like &amp; for ampersand, &gt; for greater-than, etc. So, this
      XML does have a lot of ampersands in site descriptions, like PG&E and so
      forth. In fact, I would guess that PG&E is the culprit, as this fits to
      what I see in the error:

      [com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character ' '
      (code 32); expected a semi-colon after the reference for entity 'E'


      The error appears 3 times, but it's all for the same position. This is
      for station AE06, network GM. This station only has channels HH? and HN?,
      so when you do your search, this station will come up. If you search on
      BH? channels, this station will not appear.

      What I cannot figure out is why I am seeing the string
      <Description>PG&amp;E Dam</Description>
      come back, which should be fine, when it looks like irisFetch is getting
      back
      <Description>PG&E Dam</Description>
      which would trigger the unmarshalling error you are seeing.


      I ran Java 8 and Java 11 runs of IRIS-WS which simulates
      irisFetch.stations for station AE06, even printing out the Site details and
      I can't seem to trigger a parsing error. What is notable is that I am
      explicitly calling on JAXB libraries in my classpath and not falling back
      on something that MATLAB or other utility might be using. I am hoping we
      can test this on our instance of MATLAB to see if it makes a difference. I
      don't have a license for it.

      My classpath includes: ./IRIS-WS-2.0.19.jar
      ./javax.xml.bind-3.0-b71.jar
      ./jaxb-impl-2.3.1.jar
      ./jaxb-core-2.3.0.1.jar
      ./activation-1.0.2.jar

      -Rob




      On Sep 23, 2022, at 10:09 AM, Brandon VanderBeek (via IRIS) <
      data-request-help-bounce<at>lists.ds.iris.edu> wrote:

      I have recently encountered an error using irisFetch.Stations. Two days
      ago (28-Aug-2022), I was able to run the following command without error,

      S =
      irisFetch.Stations('STATION','*','*','*','*','MinimumLatitude',38,'MaximumLatitude',52,'MinimumLongitude',-131,'MaximumLongitude',-115);

      However, for the past two days this command has been giving the error
      copied below. I'll note that requesting specifically the 'BHZ' channel
      instead of the wildcard '*' runs without error while requesting
      specifically the 'HHZ' channel will fail. Any thoughts?

      Thanks for the help,
      Brandon

      Error using irisFetch/Networks/fetchTheStations (line 809)
      Java exception occurred:
      java.io.IOException: javax.xml.bind.UnmarshalException
      - with linked exception:
      [com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character ' '
      (code 32); expected a semi-colon after the reference for entity 'E'
      at [row,col {unknown-source}]: [4556,23]]
      at
      edu.iris.dmc.service.station.parser.StationXMLParser.parse(StationXMLParser.java:274)
      at edu.iris.dmc.service.StationService.fetch(StationService.java:407)
      at edu.iris.dmc.service.StationService.fetch(StationService.java:316)
      at edu.iris.dmc.service.StationService.fetch(StationService.java:338)
      Caused by: javax.xml.bind.UnmarshalException
      - with linked exception:
      [com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character ' '
      (code 32); expected a semi-colon after the reference for entity 'E'
      at [row,col {unknown-source}]: [4556,23]]
      at
      com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:470)
      at
      com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:448)
      at
      com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:415)
      at
      edu.iris.dmc.service.station.parser.StationXMLParser.parse(StationXMLParser.java:252)
      ... 3 more
      Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected
      character ' ' (code 32); expected a semi-colon after the reference for
      entity 'E'
      at [row,col {unknown-source}]: [4556,23]
      at
      com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)
      at com.ctc.wstx.sr.StreamScanner.parseEntityName(StreamScanner.java:1994)
      at
      com.ctc.wstx.sr.StreamScanner.fullyResolveEntity(StreamScanner.java:1496)
      at
      com.ctc.wstx.sr.BasicStreamReader.readTextSecondary(BasicStreamReader.java:4681)
      at
      com.ctc.wstx.sr.BasicStreamReader.readCoalescedText(BasicStreamReader.java:4126)
      at
      com.ctc.wstx.sr.BasicStreamReader.finishToken(BasicStreamReader.java:3701)
      at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1023)
      at com.ctc.wstx.evt.WstxEventReader.nextEvent(WstxEventReader.java:196)
      at
      com.sun.xml.internal.bind.v2.runtime.unmarshaller.StAXEventConnector.bridge(StAXEventConnector.java:131)
      at
      com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:445)
      ... 5 more

      Error in irisFetch.Networks (line 713)
      fetchTheStations();

      Error in irisFetch.Stations (line 639)
      [stationStructure, urlParams] =
      irisFetch.Networks(detailLevel,varargin{:});

      ----------------------
      Data Request Help
      Topic home: http://ds.iris.edu/message-center/topic/data-request-help/ |
      Unsubscribe: data-request-help-unsubscribe<at>lists.ds.iris.edu

      Sent from the IRIS Message Center (http://ds.iris.edu/message-center/)
      Update subscription preferences at http://ds.iris.edu/account/profile/



      ----------------------
      Data Request Help
      Topic home: http://ds.iris.edu/message-center/topic/data-request-help/ |
      Unsubscribe: data-request-help-unsubscribe<at>lists.ds.iris.edu

      Sent from the IRIS Message Center (http://ds.iris.edu/message-center/)
      Update subscription preferences at http://ds.iris.edu/account/profile/


07:43:28 v.b4412d20