蒲公英异常:文件' resources / ....... json'格式错误

时间:2015-03-31 18:41:22

标签: json spring spring-boot thymeleaf dandelion

我正在使用带有百里香和蒲公英的弹簧靴。我正在使用Gradle构建。当我以gradlew bootRun执行应用程序时,错误不会显示此错误仅在我尝试使用java -jar ....jar运行jar文件时出现

注意当我删除文件'resources/lib/icheck/icheck.jquery.json'时,我摆脱了错误。因此JSON文件中可能存在一些错误。但我找不到任何。

这是我的蒲公英配置

@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/*");
    }
}

根据错误消息,这是有错误的json文件。 '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/"
}

这是我执行应用程序时收到的错误消息。

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

2 个答案:

答案 0 :(得分:1)

将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"
    }
  ],
  "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/"
}

答案 1 :(得分:0)

I have same issue. In order to resolve it, just remove "dependencies" in your JSON file. In your case, remove the lines below:

if __name__ == "__main__":
    from tornado.ioloop import IOLoop
    print IOLoop.instance().run_sync(routine1)