MeyerCa
asked on
Java Applet works in IE but not Netscape 7.x....
I have a digitally signed applet that needs to brigde the cross domain communications issues inherint with the Java Security "Sandbox".
The applet works as expected in I.E. 6.x but when attempting to load in Netscape, I get an error consistant with what I would expect if the applet was NOT signed.
Here is the error:
Error: java.security.AccessContro lException : access denied (java.net.SocketPermission machine.name.com resolve)
Here is the html code I am using to embed the applet:
<applet
code="wrapper.class"
archive="wrapper.jar"
name=wrapper
width=0
height=0>
</applet>
When I access the page, it gives me the alert box that you would expect to see when accessing a signed applet (in both browsers) but it just doesnt work in Netscape.
Any tips/tricks?
Thanks,
Chris Meyer
The applet works as expected in I.E. 6.x but when attempting to load in Netscape, I get an error consistant with what I would expect if the applet was NOT signed.
Here is the error:
Error: java.security.AccessContro
Here is the html code I am using to embed the applet:
<applet
code="wrapper.class"
archive="wrapper.jar"
name=wrapper
width=0
height=0>
</applet>
When I access the page, it gives me the alert box that you would expect to see when accessing a signed applet (in both browsers) but it just doesnt work in Netscape.
Any tips/tricks?
Thanks,
Chris Meyer
I don't think there's an easy answer beyond checking your NS signing step-bystep
ASKER
What do you mean by "NS signing"
Do you mean, some setting in netscape? or the actuall signing of the applet?
Do you mean, some setting in netscape? or the actuall signing of the applet?
ASKER
<b>Here are the contents of the Java Console with the trace level set to 5 (basic, net, security, ext, liveconnect ...) from IE 6.x</b>
Invoking method: public void wrapper.cmiSetURL(java.lan
Needs conversion: java.lang.String --> java.lang.String
Invoking method: public void wrapper.cmiSetSessionID(ja
Needs conversion: java.lang.String --> java.lang.String
Invoking method: public java.lang.String wrapper.cmiPost(java.lang.
Needs conversion: java.lang.String --> java.lang.String
Needs conversion: java.lang.String --> java.lang.String
Connecting http://ipd.company.corp/cgi-bin/docentcgi.exe/lms,IPD,2151/SQN%3D20814431,CMD=GET,file=aicc_catcher.jsm,SVR=ipd.company.ad%3A2680,SID=ipd.company.ad%3A2680-0001-2-990888F5-00000CCC/ with no proxy
Connecting http://ipd.company.corp/cgi-bin/docentcgi.exe/lms,IPD,2151/SQN%3D20814431,CMD=GET,file=aicc_catcher.jsm,SVR=ipd.company.ad%3A2680,SID=ipd.company.ad%3A2680-0001-2-990888F5-00000CCC/ with cookie "SID=ipd.company.ad:2680-0
<b>Here is the results of the same test in Netscape 7.1</b>
JavaScript: caller and callee have same origin
JavaScript: default security policy = http://test.srv.company.corp
JavaScript: caller and callee have same origin
JavaScript: default security policy = http://test.srv.company.corp
JavaScript: caller and callee have same origin
JavaScript: default security policy = http://test.srv.company.corp
Error: java.security.AccessContro
JavaScript: calling Java system code
JavaScript: default security policy = http://test.srv.company.corp
JavaScript: calling Java system code
JavaScript: default security policy = http://test.srv.company.corp
JavaScript: calling Java system code
JavaScript: default security policy = http://test.srv.company.corp
I dont get it!
Any clues?
Chris
Can't help in detail i'm afraid. This page could have some useful links:
http://mindprod.com/jgloss/signedapplets.html
http://mindprod.com/jgloss/signedapplets.html
> What do you mean by "NS signing"
you didn't answer the question?
you didn't answer the question?
ASKER
Hey objects...
I see you pretty much the "man" (or woman as the case may be) on this board. Do you have any insight on this one?
Ill be happy to post the code of the applet if necessary.
Thanks,
Chris
I see you pretty much the "man" (or woman as the case may be) on this board. Do you have any insight on this one?
Ill be happy to post the code of the applet if necessary.
Thanks,
Chris
not sure what CEHJ was referring to with "NS signing".
post a stack trace for the error I'll see what I can find.
post a stack trace for the error I'll see what I can find.
ASKER
This what you are looking for?
Full thread dump Java HotSpot(TM) Client VM (1.4.1_05-b01 mixed mode):
"TimerQueue" daemon prio=5 tid=0x02128110 nid=0xb30 in Object.wait() [13c3f000..13c3fd8c]
at java.lang.Object.wait(Nati ve Method)
- waiting on <04FA0F60> (a javax.swing.TimerQueue)
at javax.swing.TimerQueue.run (Unknown Source)
- locked <04FA0F60> (a javax.swing.TimerQueue)
at java.lang.Thread.run(Unkno wn Source)
"AWT-EventQueue-1" prio=7 tid=0x02474AB8 nid=0x59c waiting on condition [13b3f000..13b3fd8c]
at sun.plugin.JavaRunTime.dum pAllStacks (Native Method)
at sun.plugin.ConsoleWindow$1 .actionPer formed(Unk nown Source)
at javax.swing.JComponent$Act ionStandin .actionPer formed(Unk nown Source)
at javax.swing.SwingUtilities .notifyAct ion(Unknow n Source)
at javax.swing.JComponent.pro cessKeyBin ding(Unkno wn Source)
at javax.swing.KeyboardManage r.fireBind ing(Unknow n Source)
at javax.swing.KeyboardManage r.fireKeyb oardAction (Unknown Source)
at javax.swing.JComponent.pro cessKeyBin dingsForAl lComponent s(Unknown Source)
at javax.swing.JComponent.pro cessKeyBin dings(Unkn own Source)
at javax.swing.JComponent.pro cessKeyEve nt(Unknown Source)
at java.awt.Component.process Event(Unkn own Source)
at java.awt.Container.process Event(Unkn own Source)
at java.awt.Component.dispatc hEventImpl (Unknown Source)
at java.awt.Container.dispatc hEventImpl (Unknown Source)
at java.awt.Component.dispatc hEvent(Unk nown Source)
at java.awt.KeyboardFocusMana ger.redisp atchEvent( Unknown Source)
at java.awt.DefaultKeyboardFo cusManager .dispatchK eyEvent(Un known Source)
at java.awt.DefaultKeyboardFo cusManager .preDispat chKeyEvent (Unknown Source)
at java.awt.DefaultKeyboardFo cusManager .typeAhead Assertions (Unknown Source)
at java.awt.DefaultKeyboardFo cusManager .dispatchE vent(Unkno wn Source)
at java.awt.Component.dispatc hEventImpl (Unknown Source)
at java.awt.Container.dispatc hEventImpl (Unknown Source)
at java.awt.Window.dispatchEv entImpl(Un known Source)
at java.awt.Component.dispatc hEvent(Unk nown Source)
at java.awt.EventQueue.dispat chEvent(Un known Source)
at java.awt.EventDispatchThre ad.pumpOne EventForHi erarchy(Un known Source)
at java.awt.EventDispatchThre ad.pumpEve ntsForHier archy(Unkn own Source)
at java.awt.EventDispatchThre ad.pumpEve nts(Unknow n Source)
at java.awt.EventDispatchThre ad.pumpEve nts(Unknow n Source)
at java.awt.EventDispatchThre ad.run(Unk nown Source)
"AWT-EventQueue-2" prio=4 tid=0x02577AE0 nid=0x92c in Object.wait() [13a3f000..13a3fd8c]
at java.lang.Object.wait(Nati ve Method)
at java.lang.Object.wait(Unkn own Source)
at java.awt.EventQueue.getNex tEvent(Unk nown Source)
- locked <04F39300> (a java.awt.EventQueue)
at java.awt.EventDispatchThre ad.pumpOne EventForHi erarchy(Un known Source)
at java.awt.EventDispatchThre ad.pumpEve ntsForHier archy(Unkn own Source)
at java.awt.EventDispatchThre ad.pumpEve nts(Unknow n Source)
at java.awt.EventDispatchThre ad.pumpEve nts(Unknow n Source)
at java.awt.EventDispatchThre ad.run(Unk nown Source)
"thread applet-aicc_wrapper.class" prio=4 tid=0x02474DA0 nid=0xec8 in Object.wait() [1383f000..1383fd8c]
at java.lang.Object.wait(Nati ve Method)
- waiting on <04F3FF30> (a sun.plugin.AppletViewer)
at java.lang.Object.wait(Unkn own Source)
at sun.applet.AppletPanel.get NextEvent( Unknown Source)
- locked <04F3FF30> (a sun.plugin.AppletViewer)
at sun.applet.AppletPanel.run (Unknown Source)
at java.lang.Thread.run(Unkno wn Source)
"AWT-EventQueue-0" prio=7 tid=0x02576520 nid=0x5f8 in Object.wait() [1353f000..1353fd8c]
at java.lang.Object.wait(Nati ve Method)
at java.lang.Object.wait(Unkn own Source)
at java.awt.EventQueue.getNex tEvent(Unk nown Source)
- locked <04EED188> (a java.awt.EventQueue)
at java.awt.EventDispatchThre ad.pumpOne EventForHi erarchy(Un known Source)
at java.awt.EventDispatchThre ad.pumpEve ntsForHier archy(Unkn own Source)
at java.awt.EventDispatchThre ad.pumpEve nts(Unknow n Source)
at java.awt.EventDispatchThre ad.pumpEve nts(Unknow n Source)
at java.awt.EventDispatchThre ad.run(Unk nown Source)
"Java2D Disposer" daemon prio=10 tid=0x024AA7C8 nid=0x9b0 in Object.wait() [1343f000..1343fd8c]
at java.lang.Object.wait(Nati ve Method)
at java.lang.ref.ReferenceQue ue.remove( Unknown Source)
- locked <04F401B8> (a java.lang.ref.ReferenceQue ue$Lock)
at java.lang.ref.ReferenceQue ue.remove( Unknown Source)
at sun.java2d.Disposer.run(Un known Source)
at java.lang.Thread.run(Unkno wn Source)
"Cache Cleanup Thread" prio=4 tid=0x022917F8 nid=0x908 in Object.wait() [1333f000..1333fd8c]
at java.lang.Object.wait(Nati ve Method)
- waiting on <04F24648> (a sun.plugin.cache.CleanupTh read)
at sun.plugin.cache.CleanupTh read.run(U nknown Source)
- locked <04F24648> (a sun.plugin.cache.CleanupTh read)
"Main Console Writer" prio=7 tid=0x02288FD8 nid=0x8d8 in Object.wait() [1323f000..1323fd8c]
at java.lang.Object.wait(Nati ve Method)
at java.lang.Object.wait(Unkn own Source)
at sun.plugin.MainConsoleWrit er.run(Unk nown Source)
- locked <04F04300> (a java.util.LinkedList)
at java.lang.Thread.run(Unkno wn Source)
"AWT-Windows" daemon prio=7 tid=0x022869C0 nid=0x18c runnable [1313f000..1313fd8c]
at sun.awt.windows.WToolkit.e ventLoop(N ative Method)
at sun.awt.windows.WToolkit.r un(Unknown Source)
at java.lang.Thread.run(Unkno wn Source)
"AWT-Shutdown" prio=5 tid=0x022866A8 nid=0x770 in Object.wait() [1303f000..1303fd8c]
at java.lang.Object.wait(Nati ve Method)
- waiting on <04F043C8> (a java.lang.Object)
at java.lang.Object.wait(Unkn own Source)
at sun.awt.AWTAutoShutdown.ru n(Unknown Source)
- locked <04F043C8> (a java.lang.Object)
at java.lang.Thread.run(Unkno wn Source)
"Signal Dispatcher" daemon prio=10 tid=0x021B6458 nid=0xd80 runnable [0..0]
"Finalizer" daemon prio=9 tid=0x0212FFF0 nid=0xe3c in Object.wait() [ea5f000..ea5fd8c]
at java.lang.Object.wait(Nati ve Method)
at java.lang.ref.ReferenceQue ue.remove( Unknown Source)
- locked <04EE3AA8> (a java.lang.ref.ReferenceQue ue$Lock)
at java.lang.ref.ReferenceQue ue.remove( Unknown Source)
at java.lang.ref.Finalizer$Fi nalizerThr ead.run(Un known Source)
"Reference Handler" daemon prio=10 tid=0x0212ECD0 nid=0xc24 in Object.wait() [e95f000..e95fd8c]
at java.lang.Object.wait(Nati ve Method)
at java.lang.Object.wait(Unkn own Source)
at java.lang.ref.Reference$Re ferenceHan dler.run(U nknown Source)
- locked <04EE3B10> (a java.lang.ref.Reference$Lo ck)
"main" prio=5 tid=0x02127408 nid=0x248 runnable [0..12ea38]
"VM Thread" prio=5 tid=0x019BD3D0 nid=0xda8 runnable
"VM Periodic Task Thread" prio=10 tid=0x0205F470 nid=0xf14 waiting on condition
"Suspend Checker Thread" prio=10 tid=0x01A1BD40 nid=0xb88 runnable
-------------------------- ---------- ---------- ------
Done.
Full thread dump Java HotSpot(TM) Client VM (1.4.1_05-b01 mixed mode):
"TimerQueue" daemon prio=5 tid=0x02128110 nid=0xb30 in Object.wait() [13c3f000..13c3fd8c]
at java.lang.Object.wait(Nati
- waiting on <04FA0F60> (a javax.swing.TimerQueue)
at javax.swing.TimerQueue.run
- locked <04FA0F60> (a javax.swing.TimerQueue)
at java.lang.Thread.run(Unkno
"AWT-EventQueue-1" prio=7 tid=0x02474AB8 nid=0x59c waiting on condition [13b3f000..13b3fd8c]
at sun.plugin.JavaRunTime.dum
at sun.plugin.ConsoleWindow$1
at javax.swing.JComponent$Act
at javax.swing.SwingUtilities
at javax.swing.JComponent.pro
at javax.swing.KeyboardManage
at javax.swing.KeyboardManage
at javax.swing.JComponent.pro
at javax.swing.JComponent.pro
at javax.swing.JComponent.pro
at java.awt.Component.process
at java.awt.Container.process
at java.awt.Component.dispatc
at java.awt.Container.dispatc
at java.awt.Component.dispatc
at java.awt.KeyboardFocusMana
at java.awt.DefaultKeyboardFo
at java.awt.DefaultKeyboardFo
at java.awt.DefaultKeyboardFo
at java.awt.DefaultKeyboardFo
at java.awt.Component.dispatc
at java.awt.Container.dispatc
at java.awt.Window.dispatchEv
at java.awt.Component.dispatc
at java.awt.EventQueue.dispat
at java.awt.EventDispatchThre
at java.awt.EventDispatchThre
at java.awt.EventDispatchThre
at java.awt.EventDispatchThre
at java.awt.EventDispatchThre
"AWT-EventQueue-2" prio=4 tid=0x02577AE0 nid=0x92c in Object.wait() [13a3f000..13a3fd8c]
at java.lang.Object.wait(Nati
at java.lang.Object.wait(Unkn
at java.awt.EventQueue.getNex
- locked <04F39300> (a java.awt.EventQueue)
at java.awt.EventDispatchThre
at java.awt.EventDispatchThre
at java.awt.EventDispatchThre
at java.awt.EventDispatchThre
at java.awt.EventDispatchThre
"thread applet-aicc_wrapper.class"
at java.lang.Object.wait(Nati
- waiting on <04F3FF30> (a sun.plugin.AppletViewer)
at java.lang.Object.wait(Unkn
at sun.applet.AppletPanel.get
- locked <04F3FF30> (a sun.plugin.AppletViewer)
at sun.applet.AppletPanel.run
at java.lang.Thread.run(Unkno
"AWT-EventQueue-0" prio=7 tid=0x02576520 nid=0x5f8 in Object.wait() [1353f000..1353fd8c]
at java.lang.Object.wait(Nati
at java.lang.Object.wait(Unkn
at java.awt.EventQueue.getNex
- locked <04EED188> (a java.awt.EventQueue)
at java.awt.EventDispatchThre
at java.awt.EventDispatchThre
at java.awt.EventDispatchThre
at java.awt.EventDispatchThre
at java.awt.EventDispatchThre
"Java2D Disposer" daemon prio=10 tid=0x024AA7C8 nid=0x9b0 in Object.wait() [1343f000..1343fd8c]
at java.lang.Object.wait(Nati
at java.lang.ref.ReferenceQue
- locked <04F401B8> (a java.lang.ref.ReferenceQue
at java.lang.ref.ReferenceQue
at sun.java2d.Disposer.run(Un
at java.lang.Thread.run(Unkno
"Cache Cleanup Thread" prio=4 tid=0x022917F8 nid=0x908 in Object.wait() [1333f000..1333fd8c]
at java.lang.Object.wait(Nati
- waiting on <04F24648> (a sun.plugin.cache.CleanupTh
at sun.plugin.cache.CleanupTh
- locked <04F24648> (a sun.plugin.cache.CleanupTh
"Main Console Writer" prio=7 tid=0x02288FD8 nid=0x8d8 in Object.wait() [1323f000..1323fd8c]
at java.lang.Object.wait(Nati
at java.lang.Object.wait(Unkn
at sun.plugin.MainConsoleWrit
- locked <04F04300> (a java.util.LinkedList)
at java.lang.Thread.run(Unkno
"AWT-Windows" daemon prio=7 tid=0x022869C0 nid=0x18c runnable [1313f000..1313fd8c]
at sun.awt.windows.WToolkit.e
at sun.awt.windows.WToolkit.r
at java.lang.Thread.run(Unkno
"AWT-Shutdown" prio=5 tid=0x022866A8 nid=0x770 in Object.wait() [1303f000..1303fd8c]
at java.lang.Object.wait(Nati
- waiting on <04F043C8> (a java.lang.Object)
at java.lang.Object.wait(Unkn
at sun.awt.AWTAutoShutdown.ru
- locked <04F043C8> (a java.lang.Object)
at java.lang.Thread.run(Unkno
"Signal Dispatcher" daemon prio=10 tid=0x021B6458 nid=0xd80 runnable [0..0]
"Finalizer" daemon prio=9 tid=0x0212FFF0 nid=0xe3c in Object.wait() [ea5f000..ea5fd8c]
at java.lang.Object.wait(Nati
at java.lang.ref.ReferenceQue
- locked <04EE3AA8> (a java.lang.ref.ReferenceQue
at java.lang.ref.ReferenceQue
at java.lang.ref.Finalizer$Fi
"Reference Handler" daemon prio=10 tid=0x0212ECD0 nid=0xc24 in Object.wait() [e95f000..e95fd8c]
at java.lang.Object.wait(Nati
at java.lang.Object.wait(Unkn
at java.lang.ref.Reference$Re
- locked <04EE3B10> (a java.lang.ref.Reference$Lo
"main" prio=5 tid=0x02127408 nid=0x248 runnable [0..12ea38]
"VM Thread" prio=5 tid=0x019BD3D0 nid=0xda8 runnable
"VM Periodic Task Thread" prio=10 tid=0x0205F470 nid=0xf14 waiting on condition
"Suspend Checker Thread" prio=10 tid=0x01A1BD40 nid=0xb88 runnable
--------------------------
Done.
ASKER
Here is a thread list dump if that helps....
Dump thread list ...
Group main,ac=11,agc=2,pri=10
main,5,alive
AWT-Shutdown,5,alive
AWT-Windows,6,alive,dameon
Java2D Disposer,10,alive,dameon
AWT-EventQueue-0,6,alive
Group Plugin Thread Group,ac=3,agc=0,pri=10
Main Console Writer,6,alive
AWT-EventQueue-1,6,alive
TimerQueue,5,alive,dameon
Group http://kn4152.srv.knowledgenet.corp/ICNDPREP/icndprep2_2553/shell/-threadGroup,ac=2,agc=0,pri=4
thread applet-aicc_wrapper.class, 4,alive
AWT-EventQueue-2,4,alive
Done.
Dump thread list ...
Group main,ac=11,agc=2,pri=10
main,5,alive
AWT-Shutdown,5,alive
AWT-Windows,6,alive,dameon
Java2D Disposer,10,alive,dameon
AWT-EventQueue-0,6,alive
Group Plugin Thread Group,ac=3,agc=0,pri=10
Main Console Writer,6,alive
AWT-EventQueue-1,6,alive
TimerQueue,5,alive,dameon
Group http://kn4152.srv.knowledgenet.corp/ICNDPREP/icndprep2_2553/shell/-threadGroup,ac=2,agc=0,pri=4
thread applet-aicc_wrapper.class,
AWT-EventQueue-2,4,alive
Done.
No what I'm after is a sytack trace of the point where the exception is thrown:
ex.printStackTrace();
ex.printStackTrace();
ASKER
you'll have to forgive me... i am abit of a fish out of water with java..
i dont really have any code in my applet that throws that expection... shall I post the source to the applet?
i dont really have any code in my applet that throws that expection... shall I post the source to the applet?
ASKER
I think i finally understand!
Take a look here..
Error: java.security.AccessContro lException : access denied (java.net.SocketPermission ipd.knowledgenet.corp resolve)
java.security.AccessContro lException : access denied (java.net.SocketPermission ipd.knowledgenet.corp resolve)
at java.security.AccessContro lContext.c heckPermis sion(Unkno wn Source)
at java.security.AccessContro ller.check Permission (Unknown Source)
at java.lang.SecurityManager. checkPermi ssion(Unkn own Source)
at java.lang.SecurityManager. checkConne ct(Unknown Source)
at sun.plugin.net.protocol.ht tp.HttpURL Connection .checkPerm ission(Unk nown Source)
at sun.plugin.net.protocol.ht tp.HttpURL Connection .connect(U nknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
at aicc_wrapper.cmiPost(aicc_ wrapper.ja va:186)
at sun.reflect.NativeMethodAc cessorImpl .invoke0(N ative Method)
at sun.reflect.NativeMethodAc cessorImpl .invoke(Un known Source)
at sun.reflect.DelegatingMeth odAccessor Impl.invok e(Unknown Source)
at java.lang.reflect.Method.i nvoke(Unkn own Source)
at sun.plugin.liveconnect.Pri vilegedCal lMethodAct ion.run(Un known Source)
at java.security.AccessContro ller.doPri vileged(Na tive Method)
at sun.plugin.liveconnect.Sec ureInvocat ion$2.run( Unknown Source)
at java.security.AccessContro ller.doPri vileged(Na tive Method)
at sun.plugin.liveconnect.Sec ureInvocat ion.CallMe thod(Unkno wn Source)
at sun.plugin.liveconnect.Sec ureInvocat ion.access $300(Unkno wn Source)
at sun.plugin.liveconnect.Sec ureInvocat ion$CallMe thodThread .run(Unkno wn Source)
Take a look here..
Error: java.security.AccessContro
java.security.AccessContro
at java.security.AccessContro
at java.security.AccessContro
at java.lang.SecurityManager.
at java.lang.SecurityManager.
at sun.plugin.net.protocol.ht
at sun.plugin.net.protocol.ht
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
at aicc_wrapper.cmiPost(aicc_
at sun.reflect.NativeMethodAc
at sun.reflect.NativeMethodAc
at sun.reflect.DelegatingMeth
at java.lang.reflect.Method.i
at sun.plugin.liveconnect.Pri
at java.security.AccessContro
at sun.plugin.liveconnect.Sec
at java.security.AccessContro
at sun.plugin.liveconnect.Sec
at sun.plugin.liveconnect.Sec
at sun.plugin.liveconnect.Sec
if its not too long
ASKER
here is the applets code...
Again, this works like a charm in IE 6...... just not NS 7.X
(freaking browser compatibility requirements!)
[code]
// AICC Function Wrapper -- KnowledgeNet, INC.
//
// Purpose: To handle communications between LMS and Courseware
// either across domains or within the same domain name space.
//
//
import java.applet.Applet;
import java.io.*;
import java.lang.*;
import java.net.*;
public class aicc_wrapper extends Applet
{
//Global variables
String mSessionID;
String mTargetURL;
public void start()
{
//TODO
}
public void stop()
{
//TODO
}
public void destroy()
{
//TODO
}
//Initialize variables
public void init()
{
mTargetURL = new String();
mSessionID = new String();
}
public aicc_wrapper()
{
//TODO
}
//initialize session id variable
public void cmiSetSessionID(String parsedId)
{
mSessionID = parsedId;
}
//Initialize target url variable
public void cmiSetURL(String parsedUrl)
{
mTargetURL = parsedUrl;
}
public String cmiPost(String formCommand, String aiccData)
{
try
{
//check target and session variables
if(mTargetURL.length() == 0 || mSessionID.length() == 0)
{
//target and session variables are empty.
//parse document URL to obtain these variables.
URL url = getDocumentBase();
String urlString = url.getFile();
String upperCaseUrlString = urlString.toUpperCase();
//find start location of the AICC_SID variable
//and parse it out.
//check for the uppercase version of the string to find the locaiton
//but use the normal version to parse out the data.
int i = upperCaseUrlString.indexOf ("AICC_SID ");
if(i > -1)
{
mSessionID = urlString.substring(i + 9);
if(mSessionID.indexOf("&") > -1)
{
mSessionID = mSessionID.substring(0, mSessionID.indexOf("&"));
}
}
//find start location of AICC_URL variable
//and parse it out.
i = upperCaseUrlString.indexOf ("AICC_URL ");
if(i > -1)
{
mTargetURL = urlString.substring(i + 9);
if(mTargetURL.indexOf("&") > -1)
{
mTargetURL = mTargetURL.substring(0, mTargetURL.indexOf("&"));
}
}
//not sure what is occuring here.
//looks like some sort of URL encoding?
String tempURL = new String("");
for(int k = 0; k < mTargetURL.length(); k++)
{
if(mTargetURL.charAt(k) == '+')
{
tempURL += 32;
}
else
{
if(mTargetURL.charAt(k) == '%')
{
int l = mTargetURL.charAt(k + 1);
if(l < 65)
l -= 48;
else
if(l < 80)
l -= 65;
else
l -= 97;
int i1 = mTargetURL.charAt(k + 2);
if(i1 < 65)
i1 -= 48;
else
if(i1 < 80)
i1 -= 55;
else
i1 -= 87;
tempURL += (char)(l * 16 + i1);
k += 2;
}
else
{
tempURL += mTargetURL.charAt(k);
}
}
}
mTargetURL = tempURL;
}
URL url1 = null;
URLConnection urlconnection = null;
DataInputStream datainputstream = null;
DataOutputStream dataoutputstream = null;
int j = 0;
byte abyte0[] = new byte[1024];
String aiccResults = "";
try
{
mTargetURL = "http://" + mTargetURL;
url1 = new URL(mTargetURL);
}
catch(MalformedURLExceptio n malformedurlexception)
{
System.out.println("Unable to create URL for CGI (" + mTargetURL + "): " + malformedurlexception);
}
try
{
urlconnection = url1.openConnection();
}
catch(IOException ioexception)
{
System.out.println("Unable to open URL connection: " + ioexception);
}
urlconnection.setDoOutput( true);
urlconnection.setDoInput(t rue);
urlconnection.setUseCaches (false);
urlconnection.setRequestPr operty("Co ntent-type ", "application/x-www-form-ur lencoded") ;
urlconnection.setAllowUser Interactio n(false);
try
{
dataoutputstream = new DataOutputStream(urlconnec tion.getOu tputStream ());
}
catch(IOException ioexception1)
{
System.out.println("Unable to create the output stream: " + ioexception1);
}
String formVariables = "command=" + formCommand + "&version=3.0" + "&session_id=" + URLEncoder.encode(mSession ID) + "&aicc_data=" + URLEncoder.encode(aiccData );
try
{
dataoutputstream.writeByte s(formVari ables);
dataoutputstream.flush();
dataoutputstream.close();
}
catch(IOException ioexception2)
{
System.out.println("Unable to write the data: " + ioexception2);
}
try
{
datainputstream = new DataInputStream(urlconnect ion.getInp utStream() );
}
catch(IOException ioexception3)
{
System.out.println("Unable to open HTTP connection to read: " + ioexception3);
//ioexception3.printStackT race();
}
try
{
while((j = datainputstream.read(abyte 0)) > 0)
aiccResults += new String(abyte0, 0, 0, j);
}
catch(IOException ioexception4)
{
System.out.println("Unable to read POST response: " + ioexception4);
}
finally
{
try
{
if(datainputstream != null)
datainputstream.close();
}
catch(IOException ioexception5)
{
System.out.println("Unable to close HTTP connection: " + ioexception5);
}
}
return aiccResults;
}
catch(Exception exception1)
{
System.out.println("Error: " + exception1);
exception1.printStackTrace ();
}
return "";
}
}
[/code]
Again, this works like a charm in IE 6...... just not NS 7.X
(freaking browser compatibility requirements!)
[code]
// AICC Function Wrapper -- KnowledgeNet, INC.
//
// Purpose: To handle communications between LMS and Courseware
// either across domains or within the same domain name space.
//
//
import java.applet.Applet;
import java.io.*;
import java.lang.*;
import java.net.*;
public class aicc_wrapper extends Applet
{
//Global variables
String mSessionID;
String mTargetURL;
public void start()
{
//TODO
}
public void stop()
{
//TODO
}
public void destroy()
{
//TODO
}
//Initialize variables
public void init()
{
mTargetURL = new String();
mSessionID = new String();
}
public aicc_wrapper()
{
//TODO
}
//initialize session id variable
public void cmiSetSessionID(String parsedId)
{
mSessionID = parsedId;
}
//Initialize target url variable
public void cmiSetURL(String parsedUrl)
{
mTargetURL = parsedUrl;
}
public String cmiPost(String formCommand, String aiccData)
{
try
{
//check target and session variables
if(mTargetURL.length() == 0 || mSessionID.length() == 0)
{
//target and session variables are empty.
//parse document URL to obtain these variables.
URL url = getDocumentBase();
String urlString = url.getFile();
String upperCaseUrlString = urlString.toUpperCase();
//find start location of the AICC_SID variable
//and parse it out.
//check for the uppercase version of the string to find the locaiton
//but use the normal version to parse out the data.
int i = upperCaseUrlString.indexOf
if(i > -1)
{
mSessionID = urlString.substring(i + 9);
if(mSessionID.indexOf("&")
{
mSessionID = mSessionID.substring(0, mSessionID.indexOf("&"));
}
}
//find start location of AICC_URL variable
//and parse it out.
i = upperCaseUrlString.indexOf
if(i > -1)
{
mTargetURL = urlString.substring(i + 9);
if(mTargetURL.indexOf("&")
{
mTargetURL = mTargetURL.substring(0, mTargetURL.indexOf("&"));
}
}
//not sure what is occuring here.
//looks like some sort of URL encoding?
String tempURL = new String("");
for(int k = 0; k < mTargetURL.length(); k++)
{
if(mTargetURL.charAt(k) == '+')
{
tempURL += 32;
}
else
{
if(mTargetURL.charAt(k) == '%')
{
int l = mTargetURL.charAt(k + 1);
if(l < 65)
l -= 48;
else
if(l < 80)
l -= 65;
else
l -= 97;
int i1 = mTargetURL.charAt(k + 2);
if(i1 < 65)
i1 -= 48;
else
if(i1 < 80)
i1 -= 55;
else
i1 -= 87;
tempURL += (char)(l * 16 + i1);
k += 2;
}
else
{
tempURL += mTargetURL.charAt(k);
}
}
}
mTargetURL = tempURL;
}
URL url1 = null;
URLConnection urlconnection = null;
DataInputStream datainputstream = null;
DataOutputStream dataoutputstream = null;
int j = 0;
byte abyte0[] = new byte[1024];
String aiccResults = "";
try
{
mTargetURL = "http://" + mTargetURL;
url1 = new URL(mTargetURL);
}
catch(MalformedURLExceptio
{
System.out.println("Unable
}
try
{
urlconnection = url1.openConnection();
}
catch(IOException ioexception)
{
System.out.println("Unable
}
urlconnection.setDoOutput(
urlconnection.setDoInput(t
urlconnection.setUseCaches
urlconnection.setRequestPr
urlconnection.setAllowUser
try
{
dataoutputstream = new DataOutputStream(urlconnec
}
catch(IOException ioexception1)
{
System.out.println("Unable
}
String formVariables = "command=" + formCommand + "&version=3.0" + "&session_id=" + URLEncoder.encode(mSession
try
{
dataoutputstream.writeByte
dataoutputstream.flush();
dataoutputstream.close();
}
catch(IOException ioexception2)
{
System.out.println("Unable
}
try
{
datainputstream = new DataInputStream(urlconnect
}
catch(IOException ioexception3)
{
System.out.println("Unable
//ioexception3.printStackT
}
try
{
while((j = datainputstream.read(abyte
aiccResults += new String(abyte0, 0, 0, j);
}
catch(IOException ioexception4)
{
System.out.println("Unable
}
finally
{
try
{
if(datainputstream != null)
datainputstream.close();
}
catch(IOException ioexception5)
{
System.out.println("Unable
}
}
return aiccResults;
}
catch(Exception exception1)
{
System.out.println("Error:
exception1.printStackTrace
}
return "";
}
}
[/code]
> catch(Exception exception1)
> {
> System.out.println("Error: " + exception1);
> exception1.printStackTrace ();
> }
You already appear to be printing out the stack trace. Does anything else appear in the console than what you posted above?
> {
> System.out.println("Error:
> exception1.printStackTrace
> }
You already appear to be printing out the stack trace. Does anything else appear in the console than what you posted above?
ASKER
Yea I just added that stackTrace based on your previous comment.
No nothing else appears in the console when I load the page and execute the function.
No nothing else appears in the console when I load the page and execute the function.
try exitting IE, and starting again. IE maybe running old cached class.
ASKER
IE actually is not the problem. Its Netscape 7.x. Have exited, clear the cache, rebooted etc... nothing is working but IE.
sorry meant to say NS :)
so you still aren't getting a stack trace in the console?
so you still aren't getting a stack trace in the console?
ASKER
No I am getting the stack trace: I posted this before the source code... you might have missed it.
Error: java.security.AccessContro lException : access denied (java.net.SocketPermission ipd.knowledgenet.corp resolve)
java.security.AccessContro lException : access denied (java.net.SocketPermission ipd.knowledgenet.corp resolve)
at java.security.AccessContro lContext.c heckPermis sion(Unkno wn Source)
at java.security.AccessContro ller.check Permission (Unknown Source)
at java.lang.SecurityManager. checkPermi ssion(Unkn own Source)
at java.lang.SecurityManager. checkConne ct(Unknown Source)
at sun.plugin.net.protocol.ht tp.HttpURL Connection .checkPerm ission(Unk nown Source)
at sun.plugin.net.protocol.ht tp.HttpURL Connection .connect(U nknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
at aicc_wrapper.cmiPost(aicc_ wrapper.ja va:186)
at sun.reflect.NativeMethodAc cessorImpl .invoke0(N ative Method)
at sun.reflect.NativeMethodAc cessorImpl .invoke(Un known Source)
at sun.reflect.DelegatingMeth odAccessor Impl.invok e(Unknown Source)
at java.lang.reflect.Method.i nvoke(Unkn own Source)
at sun.plugin.liveconnect.Pri vilegedCal lMethodAct ion.run(Un known Source)
at java.security.AccessContro ller.doPri vileged(Na tive Method)
at sun.plugin.liveconnect.Sec ureInvocat ion$2.run( Unknown Source)
at java.security.AccessContro ller.doPri vileged(Na tive Method)
at sun.plugin.liveconnect.Sec ureInvocat ion.CallMe thod(Unkno wn Source)
at sun.plugin.liveconnect.Sec ureInvocat ion.access $300(Unkno wn Source)
at sun.plugin.liveconnect.Sec ureInvocat ion$CallMe thodThread .run(Unkno wn Source)
Error: java.security.AccessContro
java.security.AccessContro
at java.security.AccessContro
at java.security.AccessContro
at java.lang.SecurityManager.
at java.lang.SecurityManager.
at sun.plugin.net.protocol.ht
at sun.plugin.net.protocol.ht
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
at aicc_wrapper.cmiPost(aicc_
at sun.reflect.NativeMethodAc
at sun.reflect.NativeMethodAc
at sun.reflect.DelegatingMeth
at java.lang.reflect.Method.i
at sun.plugin.liveconnect.Pri
at java.security.AccessContro
at sun.plugin.liveconnect.Sec
at java.security.AccessContro
at sun.plugin.liveconnect.Sec
at sun.plugin.liveconnect.Sec
at sun.plugin.liveconnect.Sec
Is your applet in a JSP file? Why not use the <jsp:plugin> instead of <applet>? It should handle the differences among the browsers.
Use this link as a starting point: http://java.sun.com/products/jsp/tags/syntaxref.fm12.html
Use this link as a starting point: http://java.sun.com/products/jsp/tags/syntaxref.fm12.html
is that method getting called by js?
if so I'd say its because NS considers your JS untrusted, try this test:
http://landons.freeservers.com/mozilla/TestApplet.html
http://landons.freeservers.com/mozilla/TestApplet.html
ASKER
I ran that test and I got the following in the java console:
Test begin - - Test end
Test begin - access denied (java.io.FilePermission C:\Test.fil write) - Test end
So then the question is, how do I make my applet trusted by the client? Do I need to get a certificate from a CA?
Test begin - - Test end
Test begin - access denied (java.io.FilePermission C:\Test.fil write) - Test end
So then the question is, how do I make my applet trusted by the client? Do I need to get a certificate from a CA?
Your applet is trusted, it is the JS that isn't.
You need to sign your JS, or execute the operation on a seperate (trusted) thread.
You need to sign your JS, or execute the operation on a seperate (trusted) thread.
ASKER
Interesting...
so you are saying that the embeded javascript on the HTML page is what is causeing the security violation?
How would I go about signing that??
so you are saying that the embeded javascript on the HTML page is what is causeing the security violation?
How would I go about signing that??
If javascript is invoking that method then yes.
Is that the case?
Is that the case?
ASKER
Below is the function on the HTML page that invokes the methods of the applet.
SOoooooo yes.. that IS the case.
How do I get around it?
Thanks,
Chris
function getParam(){
document.aicc_wrapper.cmiS etURL(unes cape(targe turl));
document.aicc_wrapper.cmiS etSessionI D(sessioni d);
var dataStr = "";
getParamResults = document.aicc_wrapper.cmiP ost("GetPa ram", dataStr );
alert(getParamResults.toSt ring());
}
SOoooooo yes.. that IS the case.
How do I get around it?
Thanks,
Chris
function getParam(){
document.aicc_wrapper.cmiS
document.aicc_wrapper.cmiS
var dataStr = "";
getParamResults = document.aicc_wrapper.cmiP
alert(getParamResults.toSt
}
Try queueing the request and processing it on a seperate thread.
ASKER
ok, at risk of sounding stupid..... how do I do that. :)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
from just spot reading that tutorial.... I can spawn a new thread in the same applet? (aka subclassing?)
or do i need to create an new applet, that the primary applet calls and sends the data to.
or do i need to create an new applet, that the primary applet calls and sends the data to.
spawn a thread in the same applet.
ASKER
I will work on that and report my findings here.
Thanks!
chris
Thanks!
chris