2015-03-31 75 views
0

我正在使用百里香和蒲公英彈簧引導。我正在使用Gradle構建。該錯誤不出來,當我執行應用程序gradlew bootRun此錯誤只有當我嘗試使用java -jar ....jarDandelionException:文件'resources/....... json'格式錯誤

注意運行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": "[email protected]", 
    "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: [email protected]c2; 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文件更改爲下方適用於我。

{ 
    "name": "icheck", 
    "version": "1.0.2", 
    "title": "iCheck", 
    "author": { 
    "name": "Damir Sultanov", 
    "email": "[email protected]", 
    "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/" 
} 
0

我有同樣的問題。爲了解決它,只需刪除JSON文件中的「依賴關係」即可。在你的情況下,刪除以下幾行:

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