`
阿尔萨斯
  • 浏览: 4109163 次
社区版块
存档分类
最新评论

[J2ME Q&A]Target port denied to untrusted applications问题回应

 
阅读更多
<iframe align="center" marginwidth="0" marginheight="0" src="http://www.zealware.com/csdnblog336280.html" frameborder="0" width="336" scrolling="no" height="280"></iframe>

[When]

开发J2ME程序的时候,用户可能在运行Socket程序连接远端Socket服务器时出现不受信任的错误,如下面的代码:

SocketConnection sc =

(SocketConnection)Connector.open("socket://localhost:8080");

报错为:
Uncaught exception java/lang/SecurityException:

Target port denied to untrusted applications.

[HowTo]

可能导致的原因之一:

SocketConnection的使用中,只有受信任的midlet才可以去访问服务器的808080端口。如果不受信任的midlet尝试去访问服务器的808080端口,那么SecurityException会被抛出。

这时候,只要在J2ME Wireless Toolkit 选项里面的安全域里面选trusted

[More Details]

WTKàKtoolbarà“偏好”菜单:

TrustedDomainInKToolbar




分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics