Unhandled exception in REST resource java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long


(Amit Shah) #1

Hi

Below is flow of reaching to "manage extractor"
Graylog Web UI -> Inputs -> GELF_TCP-9898 -> Manage Extractor.

It gets stuck on “Loading”. With every refresh of URL it prints below message in console log.

2018-01-31 11:36:32,188 ERROR: org.graylog2.shared.rest.exceptionmappers.AnyExceptionClassMapper - Unhandled exception in REST resource
java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long
	at org.graylog2.inputs.InputServiceImpl.getExtractors(InputServiceImpl.java:244) ~[graylog.jar:?]
	at org.graylog2.rest.resources.system.inputs.ExtractorsResource.list(ExtractorsResource.java:197) ~[graylog.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_101]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_101]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_101]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_101]
	at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81) ~[graylog.jar:?]
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144) ~[graylog.jar:?]
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161) ~[graylog.jar:?]
	at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:205) ~[graylog.jar:?]
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99) ~[graylog.jar:?]
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389) ~[graylog.jar:?]
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347) ~[graylog.jar:?]
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102) ~[graylog.jar:?]
	at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326) [graylog.jar:?]
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) [graylog.jar:?]
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) [graylog.jar:?]
	at org.glassfish.jersey.internal.Errors.process(Errors.java:315) [graylog.jar:?]
	at org.glassfish.jersey.internal.Errors.process(Errors.java:297) [graylog.jar:?]
	at org.glassfish.jersey.internal.Errors.process(Errors.java:267) [graylog.jar:?]
	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317) [graylog.jar:?]
	at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305) [graylog.jar:?]
	at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154) [graylog.jar:?]
	at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:384) [graylog.jar:?]
	at org.glassfish.grizzly.http.server.HttpHandler$1.run(HttpHandler.java:224) [graylog.jar:?]
	at com.codahale.metrics.InstrumentedExecutorService$InstrumentedRunnable.run(InstrumentedExecutorService.java:176) [graylog.jar:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_101]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_101]
	at java.lang.Thread.run(Thread.java:745) [?:1.8.0_101]

Please help.
Thanks in Advance.

Regards,
Amit Shah


(Jochen) #2

Which version of Graylog are you using?

Please post the contents of the “inputs” collection in the MongoDB database:
https://docs.mongodb.com/manual/reference/program/mongoexport/#export-in-json-format


(Amit Shah) #3

Thanks Jochen for help.

Please find below content of inputs.json.

[
   {
      "created_at" : {
         "$date" : "2016-07-07T16:35:39.849+0000"
      },
      "title" : "GELF_UDP_9896",
      "global" : true,
      "type" : "org.graylog2.inputs.gelf.udp.GELFUDPInput",
      "_id" : {
         "$oid" : "577e84dbaa061835b753dad9"
      },
      "configuration" : {
         "recv_buffer_size" : 262144,
         "override_source" : null,
         "port" : 9896,
         "bind_address" : "0.0.0.0"
      },
      "creator_user_id" : "admin",
      "content_pack" : "577e84d438b2a2356618bfd6"
   },
   {
      "created_at" : {
         "$date" : "2016-07-07T16:35:39.863+0000"
      },
      "content_pack" : "577e84d438b2a2356618bfd6",
      "creator_user_id" : "admin",
      "global" : true,
      "type" : "org.graylog2.inputs.syslog.tcp.SyslogTCPInput",
      "configuration" : {
         "tls_key_password" : "",
         "tls_key_file" : "",
         "use_null_delimiter" : false,
         "bind_address" : "0.0.0.0",
         "force_rdns" : false,
         "expand_structured_data" : false,
         "tls_client_auth" : "disabled",
         "recv_buffer_size" : 1048576,
         "tls_client_auth_cert_file" : "",
         "tls_enable" : false,
         "allow_override_date" : true,
         "max_message_size" : 2097152,
         "tls_cert_file" : "",
         "port" : 514,
         "override_source" : null,
         "tcp_keepalive" : false,
         "store_full_message" : false
      },
      "_id" : {
         "$oid" : "577e84dbaa061835b753dadc"
      },
      "title" : "SYSLOG_TCP_514"
   },
   {
      "creator_user_id" : "admin",
      "content_pack" : "577e84d438b2a2356618bfd6",
      "title" : "GELF_TCP_12201",
      "configuration" : {
         "override_source" : null,
         "port" : 12201,
         "bind_address" : "0.0.0.0",
         "tcp_keepalive" : false,
         "tls_client_auth" : "disabled",
         "tls_key_password" : "",
         "max_message_size" : 2097152,
         "tls_key_file" : "",
         "use_null_delimiter" : true,
         "tls_cert_file" : "",
         "recv_buffer_size" : 1048576,
         "tls_client_auth_cert_file" : "",
         "tls_enable" : false
      },
      "_id" : {
         "$oid" : "577e84dbaa061835b753dade"
      },
      "global" : true,
      "type" : "org.graylog2.inputs.gelf.tcp.GELFTCPInput",
      "created_at" : {
         "$date" : "2016-07-07T16:35:39.867+0000"
      }
   },
   {
      "creator_user_id" : "admin",
      "content_pack" : "577e84d438b2a2356618bfd6",
      "title" : "GELF_TCP_9898",
      "type" : "org.graylog2.inputs.gelf.tcp.GELFTCPInput",
      "global" : true,
      "_id" : {
         "$oid" : "577e84dbaa061835b753dae1"
      },
      "extractors" : [
         {
            "converters" : [],
            "target_field" : "split_message",
            "condition_type" : "none",
            "order" : 0,
            "extractor_config" : {
               "split_by" : "] {",
               "index" : 2
            },
            "cursor_strategy" : "copy",
            "condition_value" : "",
            "type" : "split_and_index",
            "source_field" : "message",
            "title" : "split message",
            "id" : "a31e3480-9790-11e7-ac6c-0262c389d8f7",
            "creator_user_id" : "admin"
         },
         {
            "id" : "a31fbb20-9790-11e7-ac6c-0262c389d8f7",
            "creator_user_id" : "admin",
            "type" : "regex_replace",
            "condition_value" : "",
            "cursor_strategy" : "copy",
            "title" : "onlyjson",
            "source_field" : "split_message",
            "condition_type" : "none",
            "target_field" : "onlyjson",
            "order" : 1,
            "extractor_config" : {
               "replacement" : "{\"method\"",
               "regex" : "\"method\""
            },
            "converters" : []
         },
         {
            "converters" : [],
            "extractor_config" : {
               "list_separator" : ", ",
               "key_separator" : "_",
               "kv_separator" : ":"
            },
            "order" : 3,
            "condition_type" : "none",
            "target_field" : "",
            "source_field" : "onlyjson",
            "title" : "extract_json_fields",
            "type" : "json",
            "condition_value" : "",
            "cursor_strategy" : "copy",
            "creator_user_id" : "admin",
            "id" : "a322c860-9790-11e7-9384-0a55565a9893"
         },
         {
            "creator_user_id" : "admin",
            "id" : "a3247610-9790-11e7-ac6c-0262c389d8f7",
            "source_field" : "split_message",
            "title" : "onlyjson2",
            "type" : "regex_replace",
            "condition_value" : "",
            "cursor_strategy" : "copy",
            "order" : 2,
            "extractor_config" : {
               "replacement" : "{\"uuid\"",
               "regex" : "\"uuid\""
            },
            "condition_type" : "none",
            "target_field" : "onlyjson",
            "converters" : []
         }
      ],
      "configuration" : {
         "max_message_size" : 2097152,
         "tls_key_password" : "",
         "tls_key_file" : "",
         "use_null_delimiter" : true,
         "tls_cert_file" : "",
         "port" : 9898,
         "bind_address" : "0.0.0.0",
         "override_source" : null,
         "tls_client_auth" : "disabled",
         "tcp_keepalive" : false,
         "tls_client_auth_cert_file" : "",
         "recv_buffer_size" : 1048576,
         "tls_enable" : false
      },
      "created_at" : {
         "$date" : "2016-07-07T16:35:39.878+0000"
      }
   },
   {
      "created_at" : {
         "$date" : "2017-09-26T06:57:32.675+0000"
      },
      "creator_user_id" : "admin",
      "name" : "GELF TCP",
      "content_pack" : null,
      "title" : "SYSLOG_TCP_9897",
      "configuration" : {
         "port" : 9897,
         "bind_address" : "0.0.0.0",
         "override_source" : null,
         "tls_client_auth" : "disabled",
         "tcp_keepalive" : false,
         "max_message_size" : 2097152,
         "tls_key_password" : "",
         "use_null_delimiter" : true,
         "tls_cert_file" : "",
         "tls_key_file" : "",
         "tls_client_auth_cert_file" : "",
         "recv_buffer_size" : 1048576,
         "tls_enable" : false
      },
      "_id" : {
         "$oid" : "577e84dbaa061835b753dae3"
      },
      "global" : true,
      "type" : "org.graylog2.inputs.gelf.tcp.GELFTCPInput"
   },
   {
      "created_at" : {
         "$date" : "2017-09-26T06:01:31.703+0000"
      },
      "title" : "Cloudtrail",
      "_id" : {
         "$oid" : "59a3e182aa06183adc4e5043"
      },
      "configuration" : {
         "aws_s3_region" : "eu-west-1",
         "aws_sqs_region" : "eu-west-1",
         "throttling_allowed" : false,
         "use_proxy" : false,
         "aws_sqs_queue_name" : "tr-eu-prod-neon-sqs"
      },
      "global" : true,
      "type" : "org.graylog.aws.inputs.cloudtrail.CloudTrailInput",
      "creator_user_id" : "admin",
      "name" : "AWS CloudTrail Input",
      "content_pack" : null
   }
]

(Amit Shah) #4

Graylog Version: Graylog 2.1.2+50e449a


(Jochen) #5

Please upgrade to Graylog 2.4.3 (the latest stable version at the time of writing) and check if the problem occurs there as well.

If it does, please create a bug report with the information from this discussion topic at https://github.com/Graylog2/graylog2-server/issues


(Amit Shah) #6

Hi,

Migration is planned in near future. Is “inputs.json” of any help to understand issue or in resolving this issue?
Is this bug? or some configuration issue?

Thanks for help.
Amit Shah.


(Jochen) #7

The “order” fields of the extractors in your “inputs” collection look fine in JSON, so it’s either a different type than just number in BSON (the format MongoDB is using internally) or the MongoDB driver used in that particular version of Graylog has a bug.

You can try exporting that particular input in a content pack, delete it, and re-import it from the content pack.
If that doesn’t work, you should delete that particular input and recreate it from scratch.

For reference:


(Amit Shah) #8

Hi Chen,

Great help. It worked with recreation of “inputs”.

Thanks a lot.
I really appreciate your help.

Regards,
Amit.


(system) #9

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.