0

java.lang.IllegalArgumentException: The class '[B' is not in the trusted packages: [java.util, java.lang, com.trisha.clients.collection, com.trisha.clients.collection.]. If you believe this class is safe to deserialize, please provide its name. If the serialization is only done by a trusted source, you can also enable trust all ().

Seems it does not like this. please help with right config file

.yml file

server:
  port: 8787

spring.kafka.consumer.properties.spring.json.trusted.packages=*:
spring:
  application:
    name: message-processor
  cloud:
    function:
      definition: messageProcessor
    stream:
      kafka:
        streams:
          binder:
            brokers:
              - localhost:9092
              - localhost:36161
              - localhost :40237
#            auto-create-topics: true
#            consumer-properties:

#      default-binder: kafka
spring.cloud.stream:
  bindings:
    messageProcessor-in-0:
      destination: first-topic
    messageProcessor-out-0:
      destination: first-topic.web-domains
  kafka:
    default:
      consumer:
        properties:
          spring.json.trusted.packages: com.trisha.clients.collection
    bindings:
      messageProcessor-in-0:
        consumer:
          configuration:
            key:
              deserializer: org.apache.kafka.common.serialization.StringDeserializer
            value:
              deserializer: org.springframework.kafka.support.serializer.JsonDeserializer
      messageProcessor-out-0:
        producer:
          configuration:
            key:
              serializer: org.apache.kafka.common.serialization.StringSerializer
            value:
              serializer: org.springframework.kafka.support.serializer.JsonSerializer

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
  • 1
    Why are you serializing `byte[]` using JSON? It will create base64 text, which is larger than the actual `byte[]` - just use the default byte array (de)serializers instead. – Gary Russell Dec 06 '22 at 14:11
  • Your error lies within your app code rather than the config. Please show it – OneCricketeer Dec 06 '22 at 14:58

0 Answers0