2014-04-11 84 views
0

當我使用java中的框架的WS.url()API發出HTTP請求時,我收到了URISyntaxException。 下面是excetption的堆棧軌跡。從Java播放框架向Solr發送HTTP請求時發生URISyntax異常

play.api.Application$$anon$1: Execution exception[[IllegalArgumentException: null]] 
    at play.api.Application$class.handleError(Application.scala:293) ~[play_2.10.jar:2.2.0] 
    at play.api.DefaultApplication.handleError(Application.scala:399) [play_2.10.jar:2.2.0] 
    at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$2$$anonfun$applyOrElse$3.apply(PlayDefaultUpstreamHandler.scala:261) [play_2.10.jar:2.2.0] 
    at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$2$$anonfun$applyOrElse$3.apply(PlayDefaultUpstreamHandler.scala:261) [play_2.10.jar:2.2.0] 
    at scala.Option.map(Option.scala:145) [scala-library.jar:na] 
    at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$2.applyOrElse(PlayDefaultUpstreamHandler.scala:261) [play_2.10.jar:2.2.0] 
Caused by: java.lang.IllegalArgumentException: null 
    at java.net.URI.create(URI.java:841) ~[na:1.6.0_65] 
    at com.ning.http.client.RequestBuilderBase.buildURI(RequestBuilderBase.java:390) ~[async-http-client.jar:na] 
    at com.ning.http.client.RequestBuilderBase.setUrl(RequestBuilderBase.java:373) ~[async-http-client.jar:na] 
    at play.libs.WS$WSRequest.setUrl(WS.java:137) ~[play-java_2.10.jar:2.2.0] 
    at play.libs.WS$WSRequestHolder.execute(WS.java:454) ~[play-java_2.10.jar:2.2.0] 
    at play.libs.WS$WSRequestHolder.get(WS.java:352) ~[play-java_2.10.jar:2.2.0] 
Caused by: java.net.URISyntaxException: Illegal character in query at index 419: http://solrUrl.com/solr/catalog/select?facet=true&fl=identifier_ntk,catgroup_id,name,shortDescription,thumbnail,sequence,parentCatgroup_id_facet,childCatgroup_id,storeent_id,childCatentry_id&debugQuery=false&start=0&q=*:*&timeAllowed=15000&json.nl=map&wt=json&fq=storeent_id:(%2210001%22)&fq=catalog_id:%2210001%22&fq=parentCatgroup_id_facet:(+10001_\-1)&version=2&rows=50 
    at java.net.URI$Parser.fail(URI.java:2810) ~[na:1.6.0_65] 
    at java.net.URI$Parser.checkChars(URI.java:2983) ~[na:1.6.0_65] 
    at java.net.URI$Parser.parseHierarchical(URI.java:3073) ~[na:1.6.0_65] 
    at java.net.URI$Parser.parse(URI.java:3015) ~[na:1.6.0_65] 
    at java.net.URI.<init>(URI.java:577) ~[na:1.6.0_65] 
    at java.net.URI.create(URI.java:839) ~[na:1.6.0_65] 

你能幫我解決嗎?

+0

你是否看到在瀏覽器的堆棧跟蹤中得到任何迴應? – sidgate

回答

0

這似乎並不成爲一個問題的Solr:

產生的原因:java.net.URISyntaxException:在指數419查詢非法字符: http://solrUrl.com/solr/catalog/select?facet=true&fl=identifier_ntk,catgroup_id,.....

在java.net.URI $ Parser.fail(URI.java:2810)〜[na:1.6.0_65] at java.net.URI $ Parser.checkChars(URI.java:2983)〜[na:1.6.0_65] at java.net.URI $ Parser.parseHierarchical(URI.java:3073)〜[na:1.6.0_65]

看起來網址可能在播放方面有誤。該指數似乎指向最後一個或最後一個字符。在打開它之前,我會打印該URL,看看它裏面是否有什麼有趣的東西。就像在URL末尾有一個錯誤的換行符或類似的東西。