jsonspringspring-bootthymeleafdandelion

DandelionException: The file 'resources/.......json' is wrongly formatted


I'm using spring boot with thymeleaf and dandelion. I'm using Gradle to build. The error does not show up when i execute the application as gradlew bootRun This error only occurs when I try to run the jar file using java -jar ....jar

NOTE When I remove the file 'resources/lib/icheck/icheck.jquery.json' i get rid of the error. So there can be some error in the JSON file. But I don't find any.

Here is my dandelion configuration

@Configuration
public class DandelionConfig {

    @Bean
    public DandelionDialect dandelionDialect() {
        return new DandelionDialect();
    }

    @Bean
    public DataTablesDialect dataTablesDialect(){
        return new DataTablesDialect();
    }

    @Bean
    public Filter dandelionFilter() {
        return new DandelionFilter();
    }

    @Bean
    public ServletRegistrationBean dandelionServletRegistrationBean() {
        return new ServletRegistrationBean(new DandelionServlet(), "/dandelion-assets/*");
    }
}

According to error message, this is the json file which has the error. 'resources/lib/icheck/icheck.jquery.json'

{
  "name": "icheck",
  "version": "1.0.2",
  "title": "iCheck",
  "author": {
    "name": "Damir Sultanov",
    "email": "info@fronteed.com",
    "homepage": "http://fronteed.com/"
  },
  "licenses": [
    {
      "type": "MIT",
      "url": "http://en.wikipedia.org/wiki/MIT_License"
    }
  ],
  "dependencies": {
    "jquery": ">=1.7"
  },
  "description": "Highly customizable checkboxes and radio buttons (jQuery and Zepto). Features: identical inputs across different browsers and devices (both desktop and mobile), touch devices support (iOS, Android, BlackBerry, Windows Phone, Amazon Kindle), keyboard accessible inputs (Tab, Spacebar, Arrow up/down and other shortcuts), screenreader accessible inputs — (ARIA attributes for VoiceOver and others), customization freedom (use any HTML and CSS to style inputs or try 6 Retina-ready skins), lightweight size (1 kb gzipped). Provides 32 options to customize checkboxes and radio buttons, 11 callbacks to handle changes, 9 methods to make changes programmatically. Saves changes to original inputs, works carefully with any selectors.",
  "keywords": [
    "checkbox",
    "radio",
    "input",
    "field",
    "form",
    "desktop",
    "mobile",
    "custom",
    "replacement",
    "accessibility",
    "skins",
    "ui",
    "checked",
    "disabled",
    "indeterminate",
    "css3",
    "html5",
    "tiny",
    "lightweight",
    "jquery",
    "zepto"
  ],
  "homepage": "http://fronteed.com/iCheck/",
  "docs": "https://github.com/fronteed/iCheck",
  "demo": "http://fronteed.com/iCheck/",
  "download": "http://fronteed.com/iCheck/",
  "bugs": "https://github.com/fronteed/iCheck/issues/"
}

This is the error message I get when I execute the application.

oryAssetCache)
2015-04-01 00:00:41.545  INFO 9652 --- [ost-startStop-1] com.github.dandelion.core.Context        : Asset processor found: JsMinProcessor
2015-04-01 00:00:41.548  INFO 9652 --- [ost-startStop-1] com.github.dandelion.core.Context        : Asset processor found: CssMinProcessor
2015-04-01 00:00:41.556  INFO 9652 --- [ost-startStop-1] com.github.dandelion.core.Context        : Asset processor found: CssUrlRewritingProcessor
2015-04-01 00:00:41.557  INFO 9652 --- [ost-startStop-1] com.github.dandelion.core.Context        : Asset processors disabled. All assets will be left
 untouched.
2015-04-01 00:00:42.173 ERROR 9652 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Exception starting filter dandelionFilter

com.github.dandelion.core.DandelionException: The file 'resources/lib/icheck/icheck.jquery.json' is wrongly formatted. Please correct it before continuing.
        at com.github.dandelion.core.bundle.loader.spi.AbstractBundleLoader.loadBundles(AbstractBundleLoader.java:112)
        at com.github.dandelion.core.Context.initBundleStorage(Context.java:315)
        at com.github.dandelion.core.Context.init(Context.java:122)
        at com.github.dandelion.core.Context.<init>(Context.java:101)
        at com.github.dandelion.core.web.DandelionFilter.init(DandelionFilter.java:106)
        at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
        at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:109)
        at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4615)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5222)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token
 at [Source: org.springframework.boot.loader.jar.ZipInflaterInputStream@556fdc2; line: 15, column: 4] (through reference chain: com.github.dandelion.c
ore.storage.BundleStorageUnit["dependencies"])
        at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:148)
        at com.fasterxml.jackson.databind.DeserializationContext.mappingException(DeserializationContext.java:762)
        at com.fasterxml.jackson.databind.DeserializationContext.mappingException(DeserializationContext.java:758)
        at com.fasterxml.jackson.databind.deser.std.StringCollectionDeserializer.handleNonArray(StringCollectionDeserializer.java:222)
        at com.fasterxml.jackson.databind.deser.std.StringCollectionDeserializer.deserialize(StringCollectionDeserializer.java:164)
        at com.fasterxml.jackson.databind.deser.std.StringCollectionDeserializer.deserialize(StringCollectionDeserializer.java:154)
        at com.fasterxml.jackson.databind.deser.std.StringCollectionDeserializer.deserialize(StringCollectionDeserializer.java:19)
        at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:538)
        at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:99)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:238)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:118)
        at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3066)
        at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2207)
        at com.github.dandelion.core.bundle.loader.spi.AbstractBundleLoader.loadBundles(AbstractBundleLoader.java:104)
        ... 15 common frames omitted

Solution

  • Changing the JSON file to below worked for me.

    {
      "name": "icheck",
      "version": "1.0.2",
      "title": "iCheck",
      "author": {
        "name": "Damir Sultanov",
        "email": "info@fronteed.com",
        "homepage": "http://fronteed.com/"
      },
      "licenses": [
        {
          "type": "MIT",
          "url": "http://en.wikipedia.org/wiki/MIT_License"
        }
      ],
      "keywords": [
        "checkbox",
        "radio",
        "input",
        "field",
        "form",
        "desktop",
        "mobile",
        "custom",
        "replacement",
        "accessibility",
        "skins",
        "ui",
        "checked",
        "disabled",
        "indeterminate",
        "css3",
        "html5",
        "tiny",
        "lightweight",
        "jquery",
        "zepto"
      ],
      "homepage": "http://fronteed.com/iCheck/",
      "docs": "https://github.com/fronteed/iCheck",
      "demo": "http://fronteed.com/iCheck/",
      "download": "http://fronteed.com/iCheck/",
      "bugs": "https://github.com/fronteed/iCheck/issues/"
    }