简体   繁体   English

java.lang.IllegalArgumentException:索引 0 处方案中的非法字符:localhost

[英]java.lang.IllegalArgumentException: Illegal character in scheme at index 0: localhost

I'am developping an android app that receive an data from server (localhost - mssql and nodejs), save data and then display it我正在开发一个 android 应用程序,它从服务器(本地主机 - mssql 和 nodejs)接收数据,保存数据然后显示它

after receiving the server response I get this error收到服务器响应后我收到此错误

I follow the instructions below enter link description here instead of the web server I use localhost.我按照下面的说明在此处输入链接描述,而不是我使用本地主机的 web 服务器。 Thank you谢谢

 Illegal character in scheme at index 0: 192.168.2.7:3000
    java.net.URISyntaxException: Illegal character in scheme at index 0: 192.168.2.7:3000
            at java.net.URI.validateScheme(URI.java:419)
            at java.net.URI.parseURI(URI.java:363)
            at java.net.URI.<init>(URI.java:204)
            at cz.uhk.fim.jedlima3.searchrooms.asyncTask.DownloadDatabaseAsync.doInBackground(DownloadDatabaseAsync.java:30)
            at cz.uhk.fim.jedlima3.searchrooms.asyncTask.DownloadDatabaseAsync.doInBackground(DownloadDatabaseAsync.java:15)
            at android.os.AsyncTask$2.call(AsyncTask.java:287)
            at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
            at java.util.concurrent.FutureTask.run(FutureTask.java:137)
            at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
            at java.lang.Thread.run(Thread.java:864)

您应该从 url 中删除空间并定义方案httphttps

如果您使用 localhost,则像这样传递 url - http://localhost:8080/api/notes定义方案很重要(http/https)也不要使用空间。

While we are using any services which are running on our local machines, please try to call the service by using the http protocal instead of directly calling the service.当我们使用在本地机器上运行的任何服务时,请尝试使用 http 协议调用该服务,而不是直接调用该服务。 Example: localhost:1234/hello(wrong will give the above exception) http://localhost:1234/hello(correct way)示例:localhost:1234/hello(错误会给出上述异常) http://localhost:1234/hello(正确方式)

确保 URL、 http:// 或 https:// 中没有拼写错误

不要在像这样在属性文件中定义 URL 时输入 ":dev.baseURL=http://localhost:8080/products/

Make sure you do not forget the // in http://确保不要忘记 http:// 中的 //

remove space in the url at the starting point删除起始点 url 中的空间

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 java.lang.IllegalArgumentException:方案中索引0处的非法字符: - java.lang.IllegalArgumentException: Illegal character in scheme at index 0: 引起:java.lang.IllegalArgumentException:索引 120 处查询中的非法字符 - Caused by: java.lang.IllegalArgumentException: Illegal character in query at index 120 原因:java.lang.IllegalArgumentException:索引72的查询中的非法字符 - Caused by: java.lang.IllegalArgumentException: Illegal character in query at index 72 java.lang.IllegalArgumentException:索引59处查询中的非法字符 - java.lang.IllegalArgumentException: Illegal character in query at index 59 java.lang.IllegalArgumentException:发出 https 请求时索引 7 处的非法字符 - java.lang.IllegalArgumentException: Illegal character in authority at index 7 while making https request http连接中的错误java.lang.IllegalArgumentException:索引76处的查询中的非法字符 - Error in http connection java.lang.IllegalArgumentException: Illegal character in query at index 76 java.lang.IllegalArgumentException: 非法 base64 字符 -1 - java.lang.IllegalArgumentException: Illegal base64 character -1 java.lang.IllegalArgumentException: SimpleDateFormat 的非法模式字符“Y” - java.lang.IllegalArgumentException: Illegal pattern character 'Y' for SimpleDateFormat 无法通过“ java.lang.IllegalArgumentException:路径中的非法字符”发布到URL - Fail to post to URL with “java.lang.IllegalArgumentException: Illegal character in path” java.lang.IllegalArgumentException: 非法字符 (d83d) - java.lang.IllegalArgumentException: Illegal character (d83d)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM