title: (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS)
body: <p>After adding the <strong>ProductServiceUtils</strong>  class started throwinf this error...</p>
  <p>This is the controller</p>
  <pre><code>package com.product.hexagonal.architecture.controller;
  
  import java.io.IOException;
  import java.util.List;
  
  import org.springframework.beans.factory.annotation.Autowired; 
  import org.springframework.http.MediaType;
  import org.springframework.http.ResponseEntity;
  import org.springframework.web.bind.annotation.PathVariable;
  import org.springframework.web.bind.annotation.RequestBody;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestMethod;
  import org.springframework.web.bind.annotation.RequestParam;
  import org.springframework.web.bind.annotation.ResponseBody;
  import org.springframework.web.bind.annotation.RestController;
  import org.springframework.web.multipart.MultipartFile;
  import com.product.hexagonal.architecture.model.Product;
  import com.product.hexagonal.architecture.service.ProductService;
  
  @RestController
  @RequestMapping(path = &quot;/api&quot;)
  public class ProductController {
      @Autowired
      private ProductService productService ;
      private MultipartFile imageFile;
      
      @RequestMapping(value = &quot;/upload&quot;, method = RequestMethod.POST)
      public ResponseEntity&lt;?&gt; uploadImage(@RequestParam MultipartFile imageFile){
          this.imageFile = imageFile;
          productService.uploadToLocalFileSystem(imageFile);
          return ResponseEntity.ok(imageFile);
      }
      
      @RequestMapping(value = &quot;/upload/product&quot;, method = RequestMethod.POST)
      public ResponseEntity&lt;Product&gt; SaveProduct(@RequestBody Product product) {
          this.productService.uploadToLocalFileSystem(this.imageFile);
          this.productService.saveProduct(product);
          return ResponseEntity.ok(product);
      }
  }
  </code></pre>
  <p>This is the Service</p>
  <pre><code>package com.product.hexagonal.architecture.service;
  
  
  import java.util.List;
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Service;
  import org.springframework.web.multipart.MultipartFile;
  
  import com.product.hexagonal.architecture.model.Product;
  import com.product.hexagonal.architecture.repository.ProductRepository;
  
  
  @Service
  public class ProductServiceImpl implements ProductService {
  
      @Autowired
      private ProductServiceUtils productServiceUtils;
      @Autowired
      private ProductRepository productRepository;
      private String fileDownloadUri;
      @Override
      public List&lt;Product&gt; getAll() {
          return productRepository.findAll() ;
      }
      @Override
      public void saveProduct(Product product) {
          product.setImageFile(this.fileDownloadUri);
          productRepository.save(product);
      }
      @Override
      public Product getOne(long id) {
      return productRepository.findById(id).get();
      }
      @Override
      public void deleteProductById(long id) {
          productRepository.deleteById(id);
      }
  
      @Override
      public void uploadToLocalFileSystem(MultipartFile imageFile) {
      this.productServiceUtils.uploadToLocalFileSystem(imageFile);
      this.fileDownloadUri = (this.productServiceUtils.getFileDownloadUri());
      }
  
      @Override
      public  byte[] getImageWithMediaType(String fileName) {
          return this.productServiceUtils.getImageWithMediaType(fileName);
      }
      @Override
      public void update(Product product ) {
          this.productRepository.save(product);
      }
  }
  </code></pre>
  <p>After adding this <strong>ProductServiceUtils</strong> class the error started...
  When i had all code in <strong>ProductService</strong> class everythink was working ....</p>
  <pre><code>package com.product.hexagonal.architecture.service;
  
  import java.io.IOException;
  
  import java.nio.file.Files;
  import java.nio.file.Path;
  import java.nio.file.Paths;
  import java.nio.file.StandardCopyOption;
  
  import org.apache.commons.io.IOUtils;
  import org.springframework.http.ResponseEntity;
  import org.springframework.stereotype.Service;
  import org.springframework.util.StringUtils;
  import org.springframework.web.multipart.MultipartFile;
  import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
  
  @Service
  public class ProductServiceUtils {
      
      private String fileDownloadUri;
      private String  fileName;
      private final String storageDirectoryPath = &quot;C:\\opt\\spring-workspace\\Product-Hexagonal-Architecture\\Images&quot;;
      public ResponseEntity&lt;String&gt;  uploadToLocalFileSystem(MultipartFile imageFile) {
          String fileName = StringUtils.cleanPath(imageFile.getOriginalFilename());
          this.setFileName(fileName);
          Path storageDirectory = Paths.get(storageDirectoryPath);
          if(!Files.exists(storageDirectory)){
              try {
                  Files.createDirectories(storageDirectory); 
              }catch (Exception e){
                  e.printStackTrace();
              }
          }
          Path destination = Paths.get(storageDirectory.toString() + &quot;\\&quot; + fileName);
          try {
              Files.copy(imageFile.getInputStream(), destination, StandardCopyOption.REPLACE_EXISTING);
          } catch (IOException e) {
              e.printStackTrace();
          }
          String fileDownloadUri = ServletUriComponentsBuilder.fromCurrentContextPath()
                  .path(&quot;api/getImage/&quot;)
                  .path(fileName)
                  .toUriString();
          this.setFileDownloadUri(fileDownloadUri);
          return ResponseEntity.ok(fileDownloadUri); 
      }
      public  byte[] getImageWithMediaType(String imageName) {
          Path destination = Paths.get(storageDirectoryPath+&quot;\\&quot;+imageName);
          try {
              return IOUtils.toByteArray(destination.toUri());
          } catch (IOException e) {
              e.printStackTrace();
          }
          return null ;
      }
      public String getFileDownloadUri() {
          return fileDownloadUri;
      }
      public void setFileDownloadUri(String fileDownloadUri) {
          this.fileDownloadUri = fileDownloadUri;
      }
      public String getFileName() {
          return fileName;
      }
      public void setFileName(String fileName) {
          this.fileName = fileName;
      }
      public String getStorageDirectoryPath() {
          return storageDirectoryPath;
      }
  }
  
  </code></pre>
  <pre><code>
  com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class java.io.FileDescriptor and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: org.springframework.web.multipart.support.StandardMultipartHttpServletRequest$StandardMultipartFile[&quot;inputStream&quot;]-&gt;java.io.FileInputStream[&quot;fd&quot;])
      at com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:77) ~[jackson-databind-2.11.4.jar:2.11.4]
      at com.fasterxml.jackson.databind.SerializerProvider.reportBadDefinition(SerializerProvider.java:1277) ~[jackson-databind-2.11.4.jar:2.11.4]
      at com.fasterxml.jackson.databind.DatabindContext.reportBadDefinition(DatabindContext.java:400) ~[jackson-databind-2.11.4.jar:2.11.4]
      at com.fasterxml.jackson.databind.ser.impl.UnknownSerializer.failForEmpty(UnknownSerializer.java:71) ~[jackson-databind-2.11.4.jar:2.11.4]
      at com.fasterxml.jackson.databind.ser.impl.UnknownSerializer.serialize(UnknownSerializer.java:33) ~[jackson-databind-2.11.4.jar:2.11.4]
      at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:728) ~[jackson-databind-2.11.4.jar:2.11.4]
      at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:755) ~[jackson-databind-2.11.4.jar:2.11.4]
      at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:178) ~[jackson-databind-2.11.4.jar:2.11.4]
      at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:728) ~[jackson-databind-2.11.4.jar:2.11.4]
      at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:755) ~[jackson-databind-2.11.4.jar:2.11.4]
      at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:178) ~[jackson-databind-2.11.4.jar:2.11.4]
      at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider._serialize(DefaultSerializerProvider.java:480) ~[jackson-databind-2.11.4.jar:2.11.4]
      at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:319) ~[jackson-databind-2.11.4.jar:2.11.4]
      at com.fasterxml.jackson.databind.ObjectWriter$Prefetch.serialize(ObjectWriter.java:1516) ~[jackson-databind-2.11.4.jar:2.11.4]
      at com.fasterxml.jackson.databind.ObjectWriter.writeValue(ObjectWriter.java:1006) ~[jackson-databind-2.11.4.jar:2.11.4]
      at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.writeInternal(AbstractJackson2HttpMessageConverter.java:345) ~[spring-web-5.3.3.jar:5.3.3]
      at org.springframework.http.converter.AbstractGenericHttpMessageConverter.write(AbstractGenericHttpMessageConverter.java:104) ~[spring-web-5.3.3.jar:5.3.3]
      at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:277) ~[spring-webmvc-5.3.3.jar:5.3.3]
      at org.springframework.web.servlet.mvc.method.annotation.HttpEntityMethodProcessor.handleReturnValue(HttpEntityMethodProcessor.java:219) ~[spring-webmvc-5.3.3.jar:5.3.3]
      at org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue(HandlerMethodReturnValueHandlerComposite.java:78) ~[spring-web-5.3.3.jar:5.3.3]
      at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:124) ~[spring-webmvc-5.3.3.jar:5.3.3]
      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:894) ~[spring-webmvc-5.3.3.jar:5.3.3]
      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808) ~[spring-webmvc-5.3.3.jar:5.3.3]
      at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.3.3.jar:5.3.3]
      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1060) ~[spring-webmvc-5.3.3.jar:5.3.3]
      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962) ~[spring-webmvc-5.3.3.jar:5.3.3]
      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.3.jar:5.3.3]
      at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) ~[spring-webmvc-5.3.3.jar:5.3.3]
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:652) ~[tomcat-embed-core-9.0.41.jar:4.0.FR]
      at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.3.jar:5.3.3]
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) ~[tomcat-embed-core-9.0.41.jar:4.0.FR]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-9.0.41.jar:9.0.41]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.41.jar:9.0.41]
      at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.41.jar:9.0.41]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.41.jar:9.0.41]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.41.jar:9.0.41]
      at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.3.jar:5.3.3]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.3.jar:5.3.3]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.41.jar:9.0.41]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.41.jar:9.0.41]
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) ~[tomcat-embed-core-9.0.41.jar:9.0.41]
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) ~[tomcat-embed-core-9.0.41.jar:9.0.41]
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) ~[tomcat-embed-core-9.0.41.jar:9.0.41]
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) ~[tomcat-embed-core-9.0.41.jar:9.0.41]
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.41.jar:9.0.41]
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) ~[tomcat-embed-core-9.0.41.jar:9.0.41]
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) ~[tomcat-embed-core-9.0.41.jar:9.0.41]
      at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) ~[tomcat-embed-core-9.0.41.jar:9.0.41]
      at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.41.jar:9.0.41]
      at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:888) ~[tomcat-embed-core-9.0.41.jar:9.0.41]
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1597) ~[tomcat-embed-core-9.0.41.jar:9.0.41]
      at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.41.jar:9.0.41]
      at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.41.jar:9.0.41]
      at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]
  </code></pre>
  <p>I guess the problem is when i added the <strong>ProductServiceUtils class</strong>. Probably services comunication i dont know.....any idea???</p>