[J2ME Q&A]untrusted domain is not configured问题回应

简介:

 [When]

第一次使用Netbean 4.0/5.0开发程序的时候,用户可能在运行程序时,遇到下面这种报错,导致模拟器一闪而过

正在通过存储根 DefaultColorPhone 来运行 
域名不正确,请切换到 'untrusted'
java.lang.SecurityException: untrusted domain is not configured

        at com.sun.midp.security.Permissions.forDomain(Permissions.java:530)
        at com.sun.midp.dev.DevMIDletSuiteImpl.create(DevMIDletSuiteImpl.java:148)
        at com.sun.midp.dev.DevMIDletSuiteImpl.create(DevMIDletSuiteImpl.java:91)
        at com.sun.midp.main.Main.runLocalClass(Main.java:453)
        at com.sun.midp.main.Main.main(Main.java:126)
Execution completed.

 

[HowTo]

可能导致的原因之一:

用户的Windows登录用户名是中文的,或者用户的程序路径中有中文。

 

原因之二:

Netbean中有相应的信任域的设置方式。可能用户没有设置。

建议用户在NetBean选中项目,然后右键à属性,找到运行, 然后配置一下里面的域,按照他说的选择untrusted

[More Details]

因为Netbean会在c:\document and settings\${username}\建一个.netbean的子目录,并将一些相关的属性与设定均建于该目录下,但由于Netbean使用简体中文,如果${username}是中文字,将因无法确认untrusted domain的路径而导致其认定错误 

修改方法:

Netbean安装完且尚未执行前,先至 ” C:\Program Files\netbeans-5.0\etc” 下找netbeans.conf档,并于其中找到下列内容 
# netbeans_default_userdir="${HOME}/.netbeans/5.0" 
修改成netbeans_default_userdir="F:\prog\JAVA\.netbeans\4.0" 后,再启动netbean即可(上述目录可视需要改变,但建议最好为纯英文字)

And

 

Understanding Protection Domains

A protection comprises two parts:

  1. Permissions which are allowed (granted to contained MIDlet suites), and permissions for which the user must be consulted
  2. Criteria for entry into the protection domain

When you click on the Run button in the J2ME Wireless Toolkit, the current MIDlet suite is run in a protection domain called Untrusted. In this domain, the user is consulted for all permissions. That's why the emulator prompts you for permission when HTTPMIDlet attempts its HTTP connection.

You can change the MIDlet suite's runtime protection domain by choosing Edit -> Preferences, then clicking on the Security tab:

 
Selecting a Protection Domain 
(Click for the full image.)

The J2ME Wireless Toolkit includes four protection domains. MIDlets in the Minimum domain are denied all permissions. The Untrusted domain prompts the user for every permission. The Trusteddomain is a kind of MIDlet security nirvana where all permissions are granted; it's equivalent toMaximum.

 

[Tips]

鉴于从C++开发,到Java开发,许许多多的人都遇到过类似的问题。所以我们强烈建议:

1:你的Windows用户名千万避免有中文字符;

2:你的程序运行路径或者工程路径或者组件注册路径,避免有中文字符;

3:作为一个专职开发者,请养成起英文文件夹名的好习惯;

目录
相关文章
|
27天前
|
域名解析 网络协议 数据库
什么是 Fully Qualified Domain Name(FQDN)
什么是 Fully Qualified Domain Name(FQDN)
12 0
|
1月前
|
应用服务中间件 nginx 容器
upstream server temporarily disabled while connecting to upstream(记录bug)
upstream server temporarily disabled while connecting to upstream(记录bug)
24 0
|
3月前
|
SQL JavaScript 关系型数据库
Client does not support authentication protocol requested by server
Client does not support authentication protocol requested by server
34 0
|
5月前
|
关系型数据库 MySQL 数据库
MySql错误 1251 - Client does not support authentication protocol requested by server
MySql错误 1251 - Client does not support authentication protocol requested by server
59 0
|
网络协议 Ubuntu 网络安全
WARNING: POSSIBLE DNS SPOOFING DETECTED!
在 win10 系统中,首次提交项目代码到公司内部 GitLab 远程仓库,出现 WARNING: POSSIBLE DNS SPOOFING DETECTED! 错误,如上图 因为我们的远程仓库是没问题的,在Ubuntu系统里日常代码提交都正常,根据错误描述提示,分析应该是 known_hosts 文件中的内容 [git.sg-ai.com]:2289 改变导致.
WARNING: POSSIBLE DNS SPOOFING DETECTED!
RFC and session issue - why we should use DESTINATION NONE?
RFC and session issue - why we should use DESTINATION NONE?
113 0
RFC and session issue - why we should use DESTINATION NONE?
|
数据库
Symantec Backup Exec Agent 推送错误Error connecting to the remote computer. Ensure that the computer is available, has WMI enabled and is not blocked by a
如果在Symantec Backup Server上推送Symantec Backup Exec Agent到数据库服务器遇到“"Error connecting to the remote computer. Ensure that the computer is available, has WMI enabled and is not blocked by a firewall"这个错误, 如下截图所示     那么完全可以参考下面官方提供的三个解决方案解决问题,几次碰到这个问题,每次都要搜索一下,特此记录一下,方便以后查找。
1296 0
|
网络安全
Received disconnect from **.**).***.*** port 22:2: Too many authentication failures 解决办法
登录云服务器(使用云服务器自己的命令行工具) 之后只需要修改这个地方就可以了 vim  /etc/ssh/sshd_config 将这行注释去掉,并且修改他的值稍微大一点即可 MaxAuthTries 10
4565 0

相关产品

  • 云迁移中心