0

我正在使用带有百里香和蒲公英的弹簧靴。我正在使用 Gradle 进行构建。当我执行应用程序时,该错误不会出现,因为gradlew bootRun此错误仅在我尝试使用运行 jar 文件时发生java -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
4

2 回答 2

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/"
}
于 2015-04-01T05:07:35.100 回答
0

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

"dependencies": {
    "jquery": ">=1.7"
  },
于 2015-05-12T22:39:30.493 回答