我創建了一個J2ME應用程序,並將它添加爲另一個應用程序中的jar。原始應用程序以最大權限運行並且工作正常,但是當我在第二個應用程序中將它添加爲jar時,在進行Web服務調用時出現安全異常,並且我注意到該應用程序正在以最低安全級別運行。J2ME:以編程方式設置安全權限
我已經在JAD中爲http和https添加了midlet權限。
javax.microedition.io.Connector.http, javax.microedition.io.Connector.https
有關如何解決這個問題的任何想法?我得到的錯誤是如下:
java.lang.SecurityException: Application not authorized to access the restricted API at com.sun.midp.security.SecurityToken.checkForPermission(+459) at com.sun.midp.security.SecurityToken.checkForPermission(+15) at com.sun.midp.midletsuite.MIDletSuiteImpl.checkForPermission(+20) at com.sun.midp.dev.DevMIDletSuiteImpl.checkForPermission(+28) at com.sun.midp.dev.DevMIDletSuiteImpl.checkForPermission(+7) at com.sun.midp.io.ConnectionBaseAdapter.checkForPermission(+67) at com.sun.midp.io.j2me.http.Protocol.checkForPermission(+17) at com.sun.midp.io.ConnectionBaseAdapter.openPrim(+6) at javax.microedition.io.Connector.openPrim(+299) at javax.microedition.io.Connector.open(+15) at org.ksoap2.transport.ServiceConnectionMidp.<init>(+11) at org.ksoap2.transport.HttpTransport.getServiceConnection(+11) at org.ksoap2.transport.HttpTransport.call(+51) at com.vxceed.xnappexpresssync.comm.WebserviceCall.call(+28) at com.vxceed.xnappexpresssync.comm.WebserviceCall.callServiceMethod(+112) at com.vxceed.xnappexpresssync.utility.Generic.sendRequest(+22) at com.vxceed.xnappexpresssync.main.Authentication.authenticateUser(+77) at app.ui.ServerSync.sendServerRequest(+127) at app.ui.LoginScreen.authenticateUser(+9) at app.ui.LoginScreen.isLoginValidate(+76) at app.ui.LoginScreen.keyPressed(+48) at app.ui.MainAppScreen$Clean.run(+33) at java.util.TimerThread.mainLoop(+237) at java.util.TimerThread.run(+4)
是您的原始應用程序簽名? – 2012-02-14 04:57:33
不,但第二個應用程序是在netbeans中創建的,奇怪的是,當我添加在eclipse中創建的jar並在NetBeans中運行它時,eclipse發出此錯誤時它工作正常。 – Mal 2012-02-16 10:03:21