简体   繁体   English

无法找出URIException

[英]can't figure out URIException

I receive the following error: 我收到以下错误:

java.net.URISyntaxException: Illegal character in scheme name at index 0: "http://localhost:8080/MyService"

Is there really something wrong with my 'h' character? 我的“ h”角色确实存在问题吗? Or is there maybe some hidden character I'm not seeing? 还是可能有一些我看不见的隐藏角色?

I am loading that string in from a property file, so I even made sure I called trim() before using it to construct the URI. 我正在从属性文件中加载该字符串,因此我甚至确保在使用它构造URI之前先调用trim()。

This is the code where it is occuring. 这是发生的代码。 the value of uri is that of the string in the exception printout. uri的值是异常打印输出中字符串的值。 Client is that of the jersey framework 客户是球衣框架的客户

    final Client CLIENT = Client.create();
    final WebResource webResource = CLIENT.resource(uri);

问题不在于h,而是字符串中的第一个字符是引号(“)。

我相信(如果我没记错的话),该特定错误消息不应引用URI,因此必须以URI开头。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM