0

Error while parsing GML throws an error like following

org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    org/geotools/wfs/GML.init()V @114: putfield
  Reason:
    Type 'org/geotools/gml2/GMLConfiguration' (current frame, stack[1]) is not assignable to 'org/geotools/xsd/Configuration'
  Current Frame:
    bci: @114
    flags: { }
    locals: { 'org/geotools/wfs/GML', 'java/util/ArrayList', 'org/geotools/feature/type/SchemaImpl', 'org/geotools/feature/AttributeTypeBuilder' }
    stack: { 'org/geotools/wfs/GML', 'org/geotools/gml2/GMLConfiguration' }
  Bytecode:
    0x0000000: bb00 4559 b700 464c 2bbb 0065 59b7 0066
    0x0000010: b600 6ab9 0070 0200 57bb 0072 5912 74b7
    0x0000020: 0077 4dbb 0079 59b7 007a 4e2d 127c b600
    0x0000030: 7f2d 1281 b600 852c bb00 8759 b200 8db7
    0x0000040: 0090 2db6 0094 b900 9a03 0057 2b2c b900
    0x0000050: 7002 0057 b200 9d2a b400 4ea6 002b 2a12
    0x0000060: 9fb5 00a1 2a12 a3b5 00a5 2abb 00a7 59b7
    0x0000070: 00a8 b500 aa2b bb00 ac59 b700 adb6 00ae
    0x0000080: b900 7002 0057 b200 b12a b400 4ea6 002b
    0x0000090: 2a12 9fb5 00a1 2a12 a3b5 00a5 2abb 00b3
    0x00000a0: 59b7 00b4 b500 aa2b bb00 ac59 b700 adb6
    0x00000b0: 00ae b900 7002 0057 b200 b72a b400 4ea6
    0x00000c0: 002b 2a12 9fb5 00a1 2a12 b9b5 00a5 2abb
    0x00000d0: 00bb 59b7 00bc b500 aa2b bb00 be59 b700
    0x00000e0: bfb6 00c0 b900 7002 0057 b200 c32a b400
    0x00000f0: 4ea6 002b 2a12 9fb5 00a1 2a12 b9b5 00a5
    0x0000100: 2abb 00c5 59b7 00c6 b500 aa2b bb00 be59
    0x0000110: b700 bfb6 00c0 b900 7002 0057 2a2b b500
    0x0000120: 48b1                                   
  Stackmap Table:
    append_frame(@134,Object[#108],Object[#150],Object[#121])
    same_frame(@184)
    same_frame(@234)
    same_frame(@284)

    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:978)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
    org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
Root Cause

java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    org/geotools/wfs/GML.init()V @114: putfield
  Reason:
    Type 'org/geotools/gml2/GMLConfiguration' (current frame, stack[1]) is not assignable to 'org/geotools/xsd/Configuration'
  Current Frame:
    bci: @114
    flags: { }
    locals: { 'org/geotools/wfs/GML', 'java/util/ArrayList', 'org/geotools/feature/type/SchemaImpl', 'org/geotools/feature/AttributeTypeBuilder' }
    stack: { 'org/geotools/wfs/GML', 'org/geotools/gml2/GMLConfiguration' }
  Bytecode:
    0x0000000: bb00 4559 b700 464c 2bbb 0065 59b7 0066
    0x0000010: b600 6ab9 0070 0200 57bb 0072 5912 74b7
    0x0000020: 0077 4dbb 0079 59b7 007a 4e2d 127c b600
    0x0000030: 7f2d 1281 b600 852c bb00 8759 b200 8db7
    0x0000040: 0090 2db6 0094 b900 9a03 0057 2b2c b900
    0x0000050: 7002 0057 b200 9d2a b400 4ea6 002b 2a12
    0x0000060: 9fb5 00a1 2a12 a3b5 00a5 2abb 00a7 59b7
    0x0000070: 00a8 b500 aa2b bb00 ac59 b700 adb6 00ae
    0x0000080: b900 7002 0057 b200 b12a b400 4ea6 002b
    0x0000090: 2a12 9fb5 00a1 2a12 a3b5 00a5 2abb 00b3
    0x00000a0: 59b7 00b4 b500 aa2b bb00 ac59 b700 adb6
    0x00000b0: 00ae b900 7002 0057 b200 b72a b400 4ea6
    0x00000c0: 002b 2a12 9fb5 00a1 2a12 b9b5 00a5 2abb
    0x00000d0: 00bb 59b7 00bc b500 aa2b bb00 be59 b700
    0x00000e0: bfb6 00c0 b900 7002 0057 b200 c32a b400
    0x00000f0: 4ea6 002b 2a12 9fb5 00a1 2a12 b9b5 00a5
    0x0000100: 2abb 00c5 59b7 00c6 b500 aa2b bb00 be59
    0x0000110: b700 bfb6 00c0 b900 7002 0057 2a2b b500
    0x0000120: 48b1                                   
  Stackmap Table:
    append_frame(@134,Object[#108],Object[#150],Object[#121])
    same_frame(@184)
    same_frame(@234)
    same_frame(@284)

    springrestful_example.controller.FileController.testGML(FileController.java:3280)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    java.lang.reflect.Method.invoke(Method.java:498)
    org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
    org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
    org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:114)
    org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
    org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
    org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
    org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

gmlparser.java

    @CrossOrigin
    @RequestMapping(value = "/testGML", method = RequestMethod.GET)
    public Map<String, Object> testGML() {
        try {

            URL url;
            URLConnection conn;
            url = new URL("https://trinitystorage01.blob.core.windows.net/trinityiccc/Chennai_GML.gml");

            conn = url.openConnection();

            try {
                GML gml = new GML(Version.GML3);
                SimpleFeatureCollection features = gml.decodeFeatureCollection(url.openStream());

                    try (SimpleFeatureIterator itr = features.features()) {
                          while (itr.hasNext()) {
                            SimpleFeature feature = itr.next();
                            System.out.println(feature);
                          }
                        }
                   catch (Exception e) {
                    System.err.println(e);
                }

            } catch (Exception e) {
                // TODO: handle exception
                System.err.println(e);
            }


        } catch (Exception e) {
            //e.printStackTrace();
            System.err.println(e);
        }
        return null;
    }

pom.xml

   <dependencies>
        <dependency>
            <groupId>org.geotools.xsd</groupId>
            <artifactId>gt-xsd-wfs</artifactId>
            <version>22.3</version>
        </dependency>
        <dependency>
            <groupId>org.geotools</groupId>
            <artifactId>gt-api</artifactId>
            <version>15.2</version>
        </dependency>
        <dependency>
            <groupId>org.geotools</groupId>
            <artifactId>gt-main</artifactId>
            <version>15.2</version>
        </dependency>
    </dependencies>
  • 1
    For the final time you must always use the same version of GeoTools - please define a property geotools.version and use it throughout the pom file - see the quick start tutorial for an example – Ian Turton Mar 19 at 13:21
  • Tried using 22.3 same version for geotools still getting the same error – Parameshwar Mar 20 at 15:03
  • Then we need the minimum viable example that shows the error - that includes the spring elements in this case as I know that code works. – Ian Turton Mar 20 at 15:04

Browse other questions tagged or ask your own question.