Win a copy of Transfer Learning for Natural Language Processing (MEAP) this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

call applet problem

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, i have a problem when call applet in my page,
in the java console always displays the error:
com.ms.security.SecurityExceptionEx[Unknown]: cannot access "www.samsungmobile.com.cn":80
at com/ms/security/permissions/NetIOPermission.check
at com/ms/security/PolicyEngine.deepCheck
at com/ms/security/PolicyEngine.checkPermission
at com/ms/net/wininet/WininetURLConnection.checkSecurity
at com/ms/net/wininet/WininetURLConnection.connect
at CallPage.callPage

can anyone please tell me about that?Thanks a lot!
 
tim chen
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And my IE VM version is
Microsoft (R) VM for Java, 5.0 Release 5.0.0.3805
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like you are attempting to connect to a different server than the one the applet is served from.
This is not allowed by the applet security model.
 
tim chen
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, David
Thanks for your reply!But i don't get it still, how can my program request another server's applet, i have specified the URL in my host file .
 
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Tim,
In order for your applet to perform I/O using IE JVM you will need to sign your applet.
Click on the following link to read all about it.
http://java.sun.com/products/jdk/1.1/docs/guide/security/index.html
Regards,
Manfred.
 
tim chen
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply!But it still can not work. below is my source code:
CallPage.java
import java.applet.Applet;
import java.awt.Color;
import java.awt.Component;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
public class CallPage extends Applet
{
public CallPage()
{
}

public static String callPage(String s)
{
String s1 = "";
try
{
URL url = new URL(s);
URLConnection urlconnection = url.openConnection();
urlconnection.setDoOutput(true);
urlconnection.connect();
InputStream inputstream = urlconnection.getInputStream();
byte byte0 = -1;
do
{
byte abyte0[] = new byte[1000];
int j = inputstream.read(abyte0);
if(j == -1)
break;
String s2 = new String(abyte0);
s1 = s1 + s2;
} while(true);
inputstream.close();
}
catch(Exception exception)
{
exception.printStackTrace();
return "";
}
int i = 0;
i = s1.indexOf("|eof|");
if(i >= 0)
s1 = s1.substring(0, i);
return s1;
}
public void init()
{
try
{
int i = Integer.parseInt(getParameter("red"));
int j = Integer.parseInt(getParameter("green"));
int k = Integer.parseInt(getParameter("blue"));
setBackground(new Color(i, j, k));
}
catch(Exception exception)
{
setBackground(new Color(100, 100, 100));
}
}
}
and i call the applet in a.jsp for test
<%
String aa= "test";
%>
<html>
<body>
<%=aa%>
</body>
<jsp lugin type="applet"
CODE=CallPage.class
CODEBASE="<%=Const.url_root%>classes"
name="CallPageApplet"
class="CallPageApplet"
WIDTH=0 HEIGHT=0 HSPACE=0 VSPACE=0 ALIGN=top>
<jsp arams>
<jsp aram name=red value="0" />
<jsp aram name=green value="0" />
<jsp aram name=blue value="0" />
</jsp arams>
<jsp:fallback>
<p>Unable to load applet</p>
</jsp:fallback>
</jsp lugin>
</html>

and i browser in IE, it always display "Unable to load applet"
is there something wrong with my source? who can tell me please?
 
I am going down to the lab. Do NOT let anyone in. Not even this tiny ad:
ScroogeXHTML 8.7 - RTF to HTML5 and XHTML converter
https://coderanch.com/t/730700/ScroogeXHTML-RTF-HTML-XHTML-converter
    Bookmark Topic Watch Topic
  • New Topic