Results 1 to 20 of 20
- 03-16-2012, 11:26 AM #1
Member
- Join Date
- Oct 2010
- Posts
- 42
- Rep Power
- 0
getting error when applet access port of tomcat.
hi all,
i have applet and i am trying to access url to get some result. this url is basically contain localhost:8080 (i am using tomcat).
i am getting error is :-
and my applet code is like:-Java Code:java.security.AccessControlException: access denied (java.net.SocketPermission l ocalhost:8080 connect,resolve) at java.security.AccessControlContext.checkPermission(AccessControlConte xt.java:323) at java.security.AccessController.checkPermission(AccessController.java: 546) at java.lang.SecurityManager.checkPermission(SecurityManager.java:532) at java.lang.SecurityManager.checkConnect(SecurityManager.java:1034) at sun.net.www.http.HttpClient.openServer(HttpClient.java:527) at sun.net.www.http.HttpClient.<init>(HttpClient.java:233) at sun.net.www.http.HttpClient.New(HttpClient.java:306) at sun.net.www.http.HttpClient.New(HttpClient.java:323) at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLC onnection.java:860) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConne ction.java:801) at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection .java:726) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon nection.java:1049) at java.net.URL.openStream(URL.java:1010) at AccessPointClient.getStream(AccessPointClient.java:157) at AccessPointClient.issueRequest(AccessPointClient.java:181) at AccessPointClient.login(AccessPointClient.java:90) at ApointTest.getData(ApointTest.java:84) at ApointTest.init(ApointTest.java:53) at sun.applet.AppletPanel.run(AppletPanel.java:424) at java.lang.Thread.run(Thread.java:619) java.lang.NullPointerException at ApointTest.printData(ApointTest.java:95) at ApointTest.init(ApointTest.java:62) at sun.applet.AppletPanel.run(AppletPanel.java:424) at java.lang.Thread.run(Thread.java:619)
when i run my application in eclipse it works fine but when i try to access in browser it give me this error.Java Code:String uri = "http://localhost:8080/myapplication";
all jar which i am using in my application are signed.
thanks
Anchit
- 03-17-2012, 07:51 PM #2
Re: getting error when applet access port of tomcat.
Is there more than one jar file?
For testing, can you make a small,simple program that tries to connect, put it in a jar file, sign that jar file and load it in the browser?
- 03-22-2012, 11:23 AM #3
Member
- Join Date
- Oct 2010
- Posts
- 42
- Rep Power
- 0
Re: getting error when applet access port of tomcat.
hi norm,
yes i am working with 4 .jar file ....
and i tried with small program .. but this not working.
main thing is, i started tomcat and run application(is used to fetch data from database). i am get data by drafting URL in applet any use that URL to get data and display in database.
i think this error about, access "localhost:8080" in applet program:-
java.security.AccessControlException: access denied (java.net.SocketPermission l
ocalhost:8080 connect,resolve)
thanks for reply norm
- 03-22-2012, 12:16 PM #4
Re: getting error when applet access port of tomcat.
How are you loading the html with the applet into the browser? What URL are you using in the browser?
For testing the Socket permission problem, a small simple program would be the easiest. When you get that to work then you will be able to work on the real program.If you don't understand my response, don't ignore it, ask a question.
- 03-22-2012, 12:51 PM #5
Member
- Join Date
- Oct 2010
- Posts
- 42
- Rep Power
- 0
Re: getting error when applet access port of tomcat.
i try open this file by two ways:-
1. by open this file locally(just double click on .html file name which i write the code below) // here it give me warning message because i am having some signed .jar file
2. by open this file as "appletviewer http://localhost:8080/myapp/index1.html" // here i am getting error which i mention in my last post.
my applet code :-
file name :- index1.html
and code for test1.class is :-Java Code:<body> <applet code="Test1.class" archive="first.jar" height="200" width="200"> </applet><br> </body>
i hope this will help you to understand my problem.Java Code:public void init() { String uri = "http://localhost:8080/myapp1/url_for_get_some_data"; // i am sending this url to other class which will fetch data from my application which is running on tomcat server // that application have some logic to retrieve data from database and pass this to applet and applet will show that data //in browser or appletviewer }
please let me know if you any problem to understand.
thanks for reply norm.Last edited by anchitanc; 03-22-2012 at 12:58 PM.
- 03-22-2012, 12:57 PM #6
Re: getting error when applet access port of tomcat.
You need to load the html with the applet from the server using the http protocol.by open this file locally(just double click on .html file
You are loading the file from a local disk using the file: protocol.
An applet can only connect to a server it was loaded from. Loading it from a disk file is not connecting to a server.
Use a URL with http://localhost:8080/htmlfilename.html to load the applet from the server.If you don't understand my response, don't ignore it, ask a question.
- 03-22-2012, 01:03 PM #7
Member
- Join Date
- Oct 2010
- Posts
- 42
- Rep Power
- 0
Re: getting error when applet access port of tomcat.
ya that is right .. got it ..
but i am still getting same error.
can you please suggest me how to use tomcat port in my program.
- 03-22-2012, 01:42 PM #8
Re: getting error when applet access port of tomcat.
How are you now loading the html page with the applet in the browser?
If you don't understand my response, don't ignore it, ask a question.
- 03-22-2012, 02:34 PM #9
Member
- Join Date
- Oct 2010
- Posts
- 42
- Rep Power
- 0
Re: getting error when applet access port of tomcat.
i tried with the both ..
with browser :- not giving error and not a output.
in appletviewer:- error only.
- 03-22-2012, 02:43 PM #10
Member
- Join Date
- Oct 2010
- Posts
- 42
- Rep Power
- 0
Re: getting error when applet access port of tomcat.
i tried same with JBOSS (put my application in JOSS which i was using with tomcat, with no change in applet and java code) also .. here i am getting correct output in browser without any error.
and when i tried same thing with appletviewer i got this new error:-Java Code:appletviewer http://10.253.193.82:8080/myapp1/index1.html *** attempt to login *** java.lang.ExceptionInInitializerError at sun.misc.Unsafe.ensureClassInitialized(Native Method) at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAc cessorFactory.java:25) at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java :122) at java.lang.reflect.Field.acquireFieldAccessor(Field.java:918) at java.lang.reflect.Field.getFieldAccessor(Field.java:899) at java.lang.reflect.Field.getLong(Field.java:528) at java.io.ObjectStreamClass.getDeclaredSUID(ObjectStreamClass.java:1614 ) at java.io.ObjectStreamClass.access$700(ObjectStreamClass.java:52) at java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:425) at java.security.AccessController.doPrivileged(Native Method) at java.io.ObjectStreamClass.<init>(ObjectStreamClass.java:413) at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:310) at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:547) at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:158 3) at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496) at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:158 3) at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1 732) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329) at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1667) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1323) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351) at test2.issueRequest(test2.java:210) at test2.login(test2.java:92) at test1.getData(test1.java:84) at test1.init(test1.java:53) at sun.applet.AppletPanel.run(test1.java:424) at java.lang.Thread.run(Thread.java:619) ... 28 more
- 03-22-2012, 03:09 PM #11
Re: getting error when applet access port of tomcat.
I'd recommend that you use the browser.i am getting correct output in browser without any error.If you don't understand my response, don't ignore it, ask a question.
- 03-22-2012, 03:52 PM #12
Member
- Join Date
- Oct 2010
- Posts
- 42
- Rep Power
- 0
Re: getting error when applet access port of tomcat.
:) ya that is great option but ..... i need to use appletviewer.
can please give me some idea about those errors. why i am getting?
please suggest me if you have any idea about this.
- 03-22-2012, 04:02 PM #13
Re: getting error when applet access port of tomcat.
Why does the code work in the browser and not in appletviewer? The error comes from the readObject() method call.
Are they using the same version of java?If you don't understand my response, don't ignore it, ask a question.
- 03-22-2012, 04:14 PM #14
Member
- Join Date
- Oct 2010
- Posts
- 42
- Rep Power
- 0
Re: getting error when applet access port of tomcat.
yes...
- 03-22-2012, 04:15 PM #15
Re: getting error when applet access port of tomcat.
Browser vs av
If you don't understand my response, don't ignore it, ask a question.
- 03-22-2012, 04:21 PM #16
Member
- Join Date
- Oct 2010
- Posts
- 42
- Rep Power
- 0
Re: getting error when applet access port of tomcat.
i have no idea why i am seeing this error ....
- 03-22-2012, 04:31 PM #17
Re: getting error when applet access port of tomcat.
I don't know why it works in the browser and fails in appletviewer if they use the same URL and the same version of java.
If you don't understand my response, don't ignore it, ask a question.
- 03-22-2012, 05:27 PM #18
Member
- Join Date
- Oct 2010
- Posts
- 42
- Rep Power
- 0
Re: getting error when applet access port of tomcat.
thanks norm .... i will try to find out other solution.
- 03-22-2012, 05:29 PM #19
Re: getting error when applet access port of tomcat.
Good luck. Be sure to come back and let us know what the problem was and how you solved it.
If you don't understand my response, don't ignore it, ask a question.
- 03-26-2012, 01:50 PM #20
Member
- Join Date
- Oct 2010
- Posts
- 42
- Rep Power
- 0
Re: getting error when applet access port of tomcat.
hi norm,
that problem has been resolved. by adding this statement in java.policy file
grant {
permission java.security.AllPermission;
};
and in my program i was using localhost in url and i started JBOSS as a run -b 0.0.0.0 (for access JBoss through ip address )
thanks
Anchit
Similar Threads
-
getting error when applet try to access some jar file
By anchitanc in forum Java AppletsReplies: 21Last Post: 01-05-2012, 01:59 PM -
applet and mysql in jsp using tomcat servlets
By gedas in forum Java AppletsReplies: 4Last Post: 04-05-2011, 09:41 PM -
'Admin port configuration not found' error in
By javaquestions in forum IntelliJ IDEAReplies: 0Last Post: 10-26-2009, 07:30 PM -
Signed Applet to write on LPT1 port - permission error
By ConvoyTh in forum Java AppletsReplies: 0Last Post: 07-02-2009, 10:56 AM -
Access Serial port
By hasani6leap in forum Advanced JavaReplies: 0Last Post: 02-12-2008, 09:45 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks