尝试打开与 http URL 的连接时出现 IOException
我正在尝试使用 Connector.open("http://someurl.something/something");
打开 HttpConnection
这在 8800 over Edge (GSM) 和 Pearl 上运行良好,但不行9800,我得到 IOException 字符串“未指定 apn”。
9800 目前没有 SIM 卡,但有可用的 WiFi 连接,我可以用它浏览网页。
有什么建议吗?
更新: 奇怪的是,如果我在 URL 中加上 ";interface=wifi"
后缀,连接实际上可以工作,但我认为它无法在 EDGE 连接上工作。这真的是正常的黑莓编程吗?您应该提前知道您想要使用哪个连接来上网?
调试日志:
RIM JVM[localhost:8000]
Thread [net_rim_services_impl(8)id=475630592] (Running)
Thread [bbgui(245)id=477799424] (Running)
Thread [net_rim_services_impl(8)id=459870208] (Running)
Thread [net_rim_services_impl(8)id=459871232] (Running)
Thread [net_rim_io_impl(58)id=428531712] (Running)
Thread [net_rim_io_impl(58)id=428689408] (Running)
Thread [net_rim_io_impl(58)id=311932928] (Running)
Thread [net_rim_services_impl(8)id=474839040] (Running)
Thread [net_rim_bb_fileindexservice(203)id=497154048] (Running)
Thread [net_rim_media(79)id=440707072] (Running)
Thread [net_rim_sync_daemon(15)id=92777472] (Running)
Thread [net_rim_bb_qm_peer(223)id=481069056] (Running)
Thread [net_rim_bb_qm_peer(223)id=480703488] (Running)
Thread [net_rim_bb_qm_peer(223)id=480702464] (Running)
Thread [net_rim_bb_qm_peer(223)id=480627712] (Running)
Thread [net_rim_bb_qm_peer(223)id=480217088] (Running)
Thread [net_rim_bb_qm_peer(223)id=461027328] (Running)
Thread [net_rim_bb_qm_peer(223)id=461024256] (Running)
Thread [net_rim_bb_qm_peer(223)id=457939968] (Running)
Thread [net_rim_bb_qm_peer(223)id=452885504] (Running)
Thread [net_rim_bb_mtp(217)id=447907840] (Running)
Thread [net_rim_bb_mtp(217)id=433524736] (Running)
Thread [net_rim_io_impl(58)id=431117312] (Running)
Thread [net_rim_bb_medialibrary(193)id=430075904] (Running)
Thread [net_rim_bb_fileindexservice(203)id=429958144] (Running)
Thread [net_rim_bb_fileindexservice(203)id=429936640] (Running)
Thread [net_rim_bb_fileindexservice(203)id=427557888] (Running)
Thread [net_rim_bb_fileindexservice(203)id=427063296] (Running)
Thread [net_rim_io_impl(58)id=426091520] (Running)
Thread [net_rim_bb_otasl_app(197)id=425690112] (Running)
Thread [net_rim_plazmic_pushactivator(194)id=425257984] (Running)
Thread [net_rim_bb_unifiedsearch_lib(173)id=346654720] (Running)
Thread [net_rim_bb_unifiedsearch_lib(173)id=346533888] (Running)
Thread [net_rim_bb_unifiedsearch_lib(173)id=346399744] (Running)
Thread [net_rim_bb_unifiedsearch_lib(173)id=346395648] (Running)
Thread [net_rim_tid_newWordsExtractor(186)id=333833216] (Running)
Thread [net_rim_bb_geolocationagent(158)id=337898496] (Running)
Thread [net_rim_media_actions_daemon(191)id=336429056] (Running)
Thread [net_rim_tid_newWordsExtractor(186)id=333352960] (Running)
Thread [net_rim_bb_browser_daemon(122)id=327188480] (Running)
Thread [net_rim_bb_supl_app(182)id=328278016] (Running)
Thread [net_rim_bb_browser_daemon(122)id=327185408] (Running)
Thread [net_rim_bb_browser_daemon(122)id=326433792] (Running)
Thread [net_rim_communicationapi(180)id=326834176] (Running)
Thread [net_rim_services_impl(8)id=326049792] (Running)
Thread [net_rim_bb_unifiedsearch_lib(173)id=324888576] (Running)
Thread [net_rim_bb_unifiedsearch_lib(173)id=322599936] (Running)
Thread [net_rim_bb_geolocationagent(158)id=314547200] (Running)
Thread [net_rim_bb_mediaapp_launcher_app(154)id=312229888] (Running)
Thread [net_rim_services_impl(8)id=310903808] (Running)
Thread [net_rim_services_impl(8)id=308922368] (Running)
Thread [net_rim_services_impl(8)id=308917248] (Running)
Thread [net_rim_bb_clock(140)id=304809984] (Running)
Thread [net_rim_bb_gmail(137)id=304393216] (Running)
Thread [net_rim_bb_games_app(127)id=258012160] (Running)
Thread [net_rim_bb_browser_push(125)id=255226880] (Running)
Thread [net_rim_services_impl(8)id=253981696] (Running)
Thread [net_rim_bb_manage_connections_lib(128)id=251244544] (Running)
Thread [net_rim_bb_games_app(127)id=251206656] (Running)
Thread [net_rim_bb_browser_push(125)id=250942464] (Running)
Thread [net_rim_services_impl(8)id=229807104] (Running)
Thread [net_rim_services_impl(8)id=229801984] (Running)
Thread [net_rim_bluetooth(116)id=221846528] (Running)
Thread [net_rim_bluetooth(116)id=221845504] (Running)
Thread [net_rim_bb_profiles_alertengine_app(93)id=209970176] (Running)
Thread [net_rim_bb_ribbon_app(88)id=204950528] (Running)
Thread [net_rim_bb_browser_daemon(122)id=202108928] (Running)
Thread [net_rim_bb_call_control(120)id=201872384] (Running)
Thread [net_rim_bb_drm_agent(115)id=201446400] (Running)
Thread [net_rim_bb_drm_agent(115)id=201418752] (Running)
Thread [net_rim_bb_recentcontacts_lib(114)id=200893440] (Running)
Thread [net_rim_bluetooth(116)id=200869888] (Running)
Thread [net_rim_bb_phone_app(108)id=199077888] (Running)
Thread [net_rim_bb_externalproxy(103)id=198732800] (Running)
Thread [net_rim_io_impl(58)id=198235136] (Running)
Thread [net_rim_io_impl(58)id=197306368] (Running)
Thread [net_rim_services_impl(8)id=197198848] (Running)
Thread [net_rim_bb_profiles_alertengine_app(93)id=197243904] (Running)
Thread [net_rim_bb_profiles_alertengine_app(93)id=196952064] (Running)
Thread [net_rim_bb_ribbon_app(88)id=195816448] (Running)
Thread [net_rim_io_impl(58)id=172915712] (Running)
Thread [net_rim_io_impl(58)id=172859392] (Running)
Thread [net_rim_io_impl(58)id=172643328] (Running)
Thread [net_rim_io_impl(58)id=172412928] (Running)
Thread [net_rim_io_impl(58)id=172270592] (Running)
Thread [net_rim_io_impl(58)id=161918976] (Running)
Thread [net_rim_bb_timeddialogapp(80)id=166284288] (Running)
Thread [net_rim_media(79)id=165790720] (Running)
Thread [net_rim_bb_timeddialogapp(80)id=165358592] (Running)
Thread [net_rim_io_impl(58)id=162753536] (Running)
Thread [net_rim_io_impl(58)id=162475008] (Running)
Thread [net_rim_sync_daemon(15)id=92864512] (Running)
Thread [net_rim_sync_daemon(15)id=92734464] (Running)
Thread [net_rim_sync_daemon(15)id=92696576] (Running)
Thread [net_rim_services_impl(8)id=94301184] (Running)
Thread [net_rim_services_impl(8)id=93739008] (Running)
Thread [net_rim_services_impl(8)id=92962816] (Running)
Thread [net_rim_services_impl(8)id=92957696] (Running)
Thread [net_rim_services_impl(8)id=82066432] (Running)
Thread [net_rim_services_impl(8)id=55119872] (Running)
Thread [net_rim_services_impl(8)id=55117824] (Running)
Thread [net_rim_services_impl(8)id=107651072] (Running)
Thread [net_rim_io_impl(58)id=103059456] (Running)
Thread [net_rim_io_impl(58)id=102155264] (Running)
Thread [net_rim_io_impl(58)id=100837376] (Running)
Thread [net_rim_io_impl(58)id=96834560] (Running)
Thread [net_rim_io_impl(58)id=95902720] (Running)
Thread [net_rim_io_impl(58)id=88369152] (Running)
Thread [net_rim_io_impl(58)id=82084864] (Running)
Thread [net_rim_io_impl(58)id=82790400] (Running)
Thread [net_rim_io_impl(58)id=78573568] (Running)
Thread [net_rim_plazmic_themereader(53)id=74937344] (Running)
Thread [net_rim_vad(52)id=74334208] (Running)
Thread [net_rim_process_launcher(17)id=29642752] (Running)
Thread [net_rim_bb_oldcodcleanup(12)id=24213504] (Running)
Thread [net_rim_sync_daemon(15)id=10183680] (Running)
Thread [net_rim_sync_daemon(15)id=8462336] (Running)
Thread [net_rim_bb_oldcodcleanup(12)id=5769216] (Running)
Thread [net_rim_services_impl(8)id=4771840] (Running)
Thread [net_rim_services_impl(8)id=4595712] (Running)
Thread [net_rim_app_manager(1)id=1024] (Running)
Thread [bbgui(245)id=458247168] (Running)
Thread [bbgui(245)id=458246144] (Running)
Thread [bbgui(245)id=497027072] (Suspended (exception IOException))
ClientProtocol.ensureOpen() line: 179
ClientProtocol.<init>(SocketHost, URL, boolean, boolean, boolean, boolean, WPTCPServiceRecord, ServiceRecord) line: 136
Protocol.doConnection(URL, int, boolean) line: 134
Protocol.openConnection(URL, int, boolean) line: 59
Protocol.openPrim(URL, int, boolean) line: 67
Protocol.openPrim(String, int, boolean) line: 34
RIMConnector.open(int, String, int, boolean, FirewallContext) line: 239
RIMConnector.open(int, String, int, boolean) line: 58
Connector.open(String) line: 831
BBNativeClient.run() line: 209
Thread.run() line: 379
I am trying to open a HttpConnection with Connector.open("http://someurl.something/something");
This works fine on an 8800 over Edge (GSM) and also a Pearl, but not the 9800 where I get IOException with string "apn is not specified".
The 9800 has no SIM card at the moment, but it has a working WiFi connection and I can browse the web with it.
Any suggestions?
Update:
curiously, if I suffix the URL with ";interface=wifi"
the connection actually works, but I assume it will then not work on EDGE connections. Is this really normal Blackberry programming, that you should know in advance which connection you want to Internet with?
Debug log:
RIM JVM[localhost:8000]
Thread [net_rim_services_impl(8)id=475630592] (Running)
Thread [bbgui(245)id=477799424] (Running)
Thread [net_rim_services_impl(8)id=459870208] (Running)
Thread [net_rim_services_impl(8)id=459871232] (Running)
Thread [net_rim_io_impl(58)id=428531712] (Running)
Thread [net_rim_io_impl(58)id=428689408] (Running)
Thread [net_rim_io_impl(58)id=311932928] (Running)
Thread [net_rim_services_impl(8)id=474839040] (Running)
Thread [net_rim_bb_fileindexservice(203)id=497154048] (Running)
Thread [net_rim_media(79)id=440707072] (Running)
Thread [net_rim_sync_daemon(15)id=92777472] (Running)
Thread [net_rim_bb_qm_peer(223)id=481069056] (Running)
Thread [net_rim_bb_qm_peer(223)id=480703488] (Running)
Thread [net_rim_bb_qm_peer(223)id=480702464] (Running)
Thread [net_rim_bb_qm_peer(223)id=480627712] (Running)
Thread [net_rim_bb_qm_peer(223)id=480217088] (Running)
Thread [net_rim_bb_qm_peer(223)id=461027328] (Running)
Thread [net_rim_bb_qm_peer(223)id=461024256] (Running)
Thread [net_rim_bb_qm_peer(223)id=457939968] (Running)
Thread [net_rim_bb_qm_peer(223)id=452885504] (Running)
Thread [net_rim_bb_mtp(217)id=447907840] (Running)
Thread [net_rim_bb_mtp(217)id=433524736] (Running)
Thread [net_rim_io_impl(58)id=431117312] (Running)
Thread [net_rim_bb_medialibrary(193)id=430075904] (Running)
Thread [net_rim_bb_fileindexservice(203)id=429958144] (Running)
Thread [net_rim_bb_fileindexservice(203)id=429936640] (Running)
Thread [net_rim_bb_fileindexservice(203)id=427557888] (Running)
Thread [net_rim_bb_fileindexservice(203)id=427063296] (Running)
Thread [net_rim_io_impl(58)id=426091520] (Running)
Thread [net_rim_bb_otasl_app(197)id=425690112] (Running)
Thread [net_rim_plazmic_pushactivator(194)id=425257984] (Running)
Thread [net_rim_bb_unifiedsearch_lib(173)id=346654720] (Running)
Thread [net_rim_bb_unifiedsearch_lib(173)id=346533888] (Running)
Thread [net_rim_bb_unifiedsearch_lib(173)id=346399744] (Running)
Thread [net_rim_bb_unifiedsearch_lib(173)id=346395648] (Running)
Thread [net_rim_tid_newWordsExtractor(186)id=333833216] (Running)
Thread [net_rim_bb_geolocationagent(158)id=337898496] (Running)
Thread [net_rim_media_actions_daemon(191)id=336429056] (Running)
Thread [net_rim_tid_newWordsExtractor(186)id=333352960] (Running)
Thread [net_rim_bb_browser_daemon(122)id=327188480] (Running)
Thread [net_rim_bb_supl_app(182)id=328278016] (Running)
Thread [net_rim_bb_browser_daemon(122)id=327185408] (Running)
Thread [net_rim_bb_browser_daemon(122)id=326433792] (Running)
Thread [net_rim_communicationapi(180)id=326834176] (Running)
Thread [net_rim_services_impl(8)id=326049792] (Running)
Thread [net_rim_bb_unifiedsearch_lib(173)id=324888576] (Running)
Thread [net_rim_bb_unifiedsearch_lib(173)id=322599936] (Running)
Thread [net_rim_bb_geolocationagent(158)id=314547200] (Running)
Thread [net_rim_bb_mediaapp_launcher_app(154)id=312229888] (Running)
Thread [net_rim_services_impl(8)id=310903808] (Running)
Thread [net_rim_services_impl(8)id=308922368] (Running)
Thread [net_rim_services_impl(8)id=308917248] (Running)
Thread [net_rim_bb_clock(140)id=304809984] (Running)
Thread [net_rim_bb_gmail(137)id=304393216] (Running)
Thread [net_rim_bb_games_app(127)id=258012160] (Running)
Thread [net_rim_bb_browser_push(125)id=255226880] (Running)
Thread [net_rim_services_impl(8)id=253981696] (Running)
Thread [net_rim_bb_manage_connections_lib(128)id=251244544] (Running)
Thread [net_rim_bb_games_app(127)id=251206656] (Running)
Thread [net_rim_bb_browser_push(125)id=250942464] (Running)
Thread [net_rim_services_impl(8)id=229807104] (Running)
Thread [net_rim_services_impl(8)id=229801984] (Running)
Thread [net_rim_bluetooth(116)id=221846528] (Running)
Thread [net_rim_bluetooth(116)id=221845504] (Running)
Thread [net_rim_bb_profiles_alertengine_app(93)id=209970176] (Running)
Thread [net_rim_bb_ribbon_app(88)id=204950528] (Running)
Thread [net_rim_bb_browser_daemon(122)id=202108928] (Running)
Thread [net_rim_bb_call_control(120)id=201872384] (Running)
Thread [net_rim_bb_drm_agent(115)id=201446400] (Running)
Thread [net_rim_bb_drm_agent(115)id=201418752] (Running)
Thread [net_rim_bb_recentcontacts_lib(114)id=200893440] (Running)
Thread [net_rim_bluetooth(116)id=200869888] (Running)
Thread [net_rim_bb_phone_app(108)id=199077888] (Running)
Thread [net_rim_bb_externalproxy(103)id=198732800] (Running)
Thread [net_rim_io_impl(58)id=198235136] (Running)
Thread [net_rim_io_impl(58)id=197306368] (Running)
Thread [net_rim_services_impl(8)id=197198848] (Running)
Thread [net_rim_bb_profiles_alertengine_app(93)id=197243904] (Running)
Thread [net_rim_bb_profiles_alertengine_app(93)id=196952064] (Running)
Thread [net_rim_bb_ribbon_app(88)id=195816448] (Running)
Thread [net_rim_io_impl(58)id=172915712] (Running)
Thread [net_rim_io_impl(58)id=172859392] (Running)
Thread [net_rim_io_impl(58)id=172643328] (Running)
Thread [net_rim_io_impl(58)id=172412928] (Running)
Thread [net_rim_io_impl(58)id=172270592] (Running)
Thread [net_rim_io_impl(58)id=161918976] (Running)
Thread [net_rim_bb_timeddialogapp(80)id=166284288] (Running)
Thread [net_rim_media(79)id=165790720] (Running)
Thread [net_rim_bb_timeddialogapp(80)id=165358592] (Running)
Thread [net_rim_io_impl(58)id=162753536] (Running)
Thread [net_rim_io_impl(58)id=162475008] (Running)
Thread [net_rim_sync_daemon(15)id=92864512] (Running)
Thread [net_rim_sync_daemon(15)id=92734464] (Running)
Thread [net_rim_sync_daemon(15)id=92696576] (Running)
Thread [net_rim_services_impl(8)id=94301184] (Running)
Thread [net_rim_services_impl(8)id=93739008] (Running)
Thread [net_rim_services_impl(8)id=92962816] (Running)
Thread [net_rim_services_impl(8)id=92957696] (Running)
Thread [net_rim_services_impl(8)id=82066432] (Running)
Thread [net_rim_services_impl(8)id=55119872] (Running)
Thread [net_rim_services_impl(8)id=55117824] (Running)
Thread [net_rim_services_impl(8)id=107651072] (Running)
Thread [net_rim_io_impl(58)id=103059456] (Running)
Thread [net_rim_io_impl(58)id=102155264] (Running)
Thread [net_rim_io_impl(58)id=100837376] (Running)
Thread [net_rim_io_impl(58)id=96834560] (Running)
Thread [net_rim_io_impl(58)id=95902720] (Running)
Thread [net_rim_io_impl(58)id=88369152] (Running)
Thread [net_rim_io_impl(58)id=82084864] (Running)
Thread [net_rim_io_impl(58)id=82790400] (Running)
Thread [net_rim_io_impl(58)id=78573568] (Running)
Thread [net_rim_plazmic_themereader(53)id=74937344] (Running)
Thread [net_rim_vad(52)id=74334208] (Running)
Thread [net_rim_process_launcher(17)id=29642752] (Running)
Thread [net_rim_bb_oldcodcleanup(12)id=24213504] (Running)
Thread [net_rim_sync_daemon(15)id=10183680] (Running)
Thread [net_rim_sync_daemon(15)id=8462336] (Running)
Thread [net_rim_bb_oldcodcleanup(12)id=5769216] (Running)
Thread [net_rim_services_impl(8)id=4771840] (Running)
Thread [net_rim_services_impl(8)id=4595712] (Running)
Thread [net_rim_app_manager(1)id=1024] (Running)
Thread [bbgui(245)id=458247168] (Running)
Thread [bbgui(245)id=458246144] (Running)
Thread [bbgui(245)id=497027072] (Suspended (exception IOException))
ClientProtocol.ensureOpen() line: 179
ClientProtocol.<init>(SocketHost, URL, boolean, boolean, boolean, boolean, WPTCPServiceRecord, ServiceRecord) line: 136
Protocol.doConnection(URL, int, boolean) line: 134
Protocol.openConnection(URL, int, boolean) line: 59
Protocol.openPrim(URL, int, boolean) line: 67
Protocol.openPrim(String, int, boolean) line: 34
RIMConnector.open(int, String, int, boolean, FirewallContext) line: 239
RIMConnector.open(int, String, int, boolean) line: 58
Connector.open(String) line: 831
BBNativeClient.run() line: 209
Thread.run() line: 379
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
仅当设备有 wifi 并且已连接时才添加
";interface=wifi"
:Add
";interface=wifi"
only if the device has wifi and it's connected:如果您相信“kgkowalski”在此论坛中所说的话页面,这是一个黑莓 bug。他提出了一个解决方法——稍等一下,然后重试请求。
If you believe what "kgkowalski" says in this forum page, it is a Blackberry bug. He suggests a workaround - just wait a bit an retry the request.
请尝试使用 https 连接...也许会有帮助
Please try to use Https connection... May be it will help