DandelionException:文件'resources/.......json'格式错误

Posted

技术标签:

【中文标题】DandelionException:文件\'resources/.......json\'格式错误【英文标题】:DandelionException: The file 'resources/.......json' is wrongly formattedDandelionException:文件'resources/.......json'格式错误 【发布时间】:2015-06-05 05:32:50 【问题描述】:

我正在使用带有百里香叶和蒲公英的弹簧靴。我正在使用 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

【问题讨论】:

【参考方案1】:

我有同样的问题。为了解决它,只需删除 JSON 文件中的“依赖项”。在您的情况下,删除以下行:

"dependencies": 
    "jquery": ">=1.7"
  ,

【讨论】:

【参考方案2】:

将 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/"

【讨论】:

以上是关于DandelionException:文件'resources/.......json'格式错误的主要内容,如果未能解决你的问题,请参考以下文章

qh_res是啥文件夹

Assets和res目录的区别

Android问题之res/raw和assets的区别及文件大小限制

Delphi 2009 - 未重新创建 res 文件

android - 从 /res/raw 文件夹中检索所有文件作为文件类型

如何正确地将资源 (*.res) 文件添加到带有组件的包中?