Hey! something I know! (Doesn't happen very often.)
The easy way to do this is to use the code base...
(class some applet class)
// the machine we _can_ talk to
String itsServerBase;
public void init()
{
try
{
itsServerBase = "http://" + getCodeBase().getHost();
}
catch (Exception e)
{
// will use this if we're running as an application
itsServerBase = "http://mystandaloneserver.com";
}
}
(and then later....)
String xmlrpcURL = itsServerBase + xmlrpcPath;
-Jim
> -----Original Message-----
> From: Scott Duclos [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, March 13, 2002 11:18 AM
> To: [EMAIL PROTECTED]
> Subject: Re: AccessControlException in applet
>
>
> Anton,
>
> Sorry if I stated the obvious before. Heres another
> possibility for it not
> working. Taken from the sun faq on java applets.
>
> --------------------------------------------------------------
> --------------
> ------------------------------
> How can an applet open a network connection to its
> originating host? Be sure to name the originating host
> exactly as it was specified when the applet was loaded into
> the browser.
>
> That is, if you load an HTML page using the URL
>
> http://foo.state.edu/~me/appletPage.html
>
> then your applet will be able to connect to its host only by
> using the name foo.state.edu. Using the IP address for
> foo.state.edu won't work, and using a "shorthand" form of the
> host name, like foo.state instead of foo.state.edu, won't work.
> --------------------------------------------------------------
> --------------
> -------------------------------
>
> Do you think that this is the problem?
>
> Scott Duclos
>
>
> ----- Original Message -----
> From: "Anton Litvinenko" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, March 13, 2002 10:30 AM
> Subject: Re: AccessControlException in applet
>
>
> > HEllo!
> >
> > yes, xmlrpc server runs on the same machine that my applet
> loads from.
> >
> > is there any other possibilities except Signing the applet???
> >
> > Anton.
> >
> > On Wed, 13 Mar 2002, Scott Duclos wrote:
> >
> > > Hi Anton.
> > >
> > > Is the xmlrpc server on the same machine that your loading the
> > > applet
> from?
> > > I believe that the only sockets that are allowed from within an
> > > applet
> are
> > > ones
> > > that connect to the originating server that the applet was
> > > downloaded
> from.
> > > If this is not the case, then you will have to create a
> jar achieve
> > > for
> your
> > > applet
> > > and sign it. This will allow the client user to state whether or
> > > not to
> let
> > > your applet
> > > run in an unrestricted jvm, one without a security manager.
> > >
> > > I can't tell you how to do this. I have never created a signed
> > > applet before, but I'm sure there are plenty of sites out
> there that
> > > do a step-by-step walk thru.
> > >
> > > Hope this helps you find a solution.
> > > Scott Duclos
> > >
> > >
> > > ----- Original Message -----
> > > From: "Anton Litvinenko" <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Wednesday, March 13, 2002 9:59 AM
> > > Subject: AccessControlException in applet
> > >
> > >
> > > > Hello,
> > > >
> > > > I am trying to run applet, that connects to Server and tries to
> execute
> > > > methods via xmlrpc.
> > > >
> > > > The connecion establishes, but when applet tries to
> call a method
> > > > a java.security.AccessControlException appears....
> > > >
> > > > please help me to solve this problem
> > > >
> > > > Exception TRace:
> > > > java.security.AccessControlException: access denied
> > > > (java.lang.RuntimePermission accessClassInPackage.sun.misc) at
> > > >
> java.security.AccessControlContext.checkPermission(Unknown Source)
> > > > at
> java.security.AccessController.checkPermission(Unknown Source)
> > > > at java.lang.SecurityManager.checkPermission(Unknown Source) at
> > > > java.lang.SecurityManager.checkPackageAccess(Unknown Source) at
> > > > sun.applet.AppletSecurity.checkPackageAccess(Unknown Source) at
> > > > sun.applet.AppletClassLoader.loadClass(Unknown Source) at
> > > > java.lang.ClassLoader.loadClass(Unknown Source) at
> > > > java.lang.ClassLoader.loadClassInternal(Unknown Source) at
> > >
> org.apache.xmlrpc.applet.SimpleXmlRpcClient.execute(SimpleXmlR
> pcClient.java)
> > > > at
> > > > org.apache.xmlrpc.applet.XmlRpcApplet.execute(XmlRpcApplet.java)
> > > > at xmlrpc.init(xmlrpc.java:29)
> > > > at sun.applet.AppletPanel.run(Unknown Source)
> > > > at java.lang.Thread.run(Unknown Source)
> > > >
> > > > Applet Code:
> > > >
> > > > public void init() {
> > > > try {
> > > > jbInit();
> > > > System.out.println("client init ");
> > > > initClient(6666);
> > > > Vector params = new Vector ();
> > > > params.addElement ("Hello World");
> > > > // this method returns a string
> System.out.println("executin
> > > > the query");
> > > > String result = (String) execute ("echo", params);
> > > > System.out.println(result);
> > > > textField1.setText("result");
> > > >
> > > > }
> > > > catch(Exception e) {
> > > > e.printStackTrace();
> > > > }
> > > > }
> > > >
> > > >
> > > >
> > > > sincerely Yours,
> > > > ANTON Litvinenko.
> > > >
> > > >
> > > >
> > >
> >
> > Lugupidamisega,
> > ANTON Litvinenko.
> >
> >
> >
>
>