D
Darren
i have a signed pplet discussed previously for now it appears to have
stopped working properly. The codee hasn't changed but my web page its on
and my dns settings have mind you i can still see the host its trying to
connect from a wb page ping etc. Now when i run it locally i get
java.security.AccessControlException: access denied
(java.net.SocketPermission members.g7wap.me.uk resolve)
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.checkConnect(Unknown Source)
at java.net.InetAddress.getAllByName0(Unknown Source)
at java.net.InetAddress.getAllByName0(Unknown Source)
at java.net.InetAddress.getAllByName(Unknown Source)
at java.net.InetAddress.getByName(Unknown Source)
at java.net.InetSocketAddress.<init>(Unknown Source)
at uk.me.g7wap.helloserver.Helloserver.hello(Helloserver.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin.javascript.invoke.JSInvoke.invoke(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin.javascript.JSClassLoader.invoke(Unknown Source)
at sun.plugin.com.MethodDispatcher.invoke(Unknown Source)
at sun.plugin.com.DispatchImpl.invokeImpl(Unknown Source)
at sun.plugin.com.DispatchImpl$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin.com.DispatchImpl.invoke(Unknown Source)
I assumed that this was because i was running it locally. so i copied it and
the web page to my web site and i tried from there. I get
load: class uk.me.g7wap.helloserver.Helloserver.class not found.
java.lang.ClassNotFoundException: uk.me.g7wap.helloserver.Helloserver.class
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadCode(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: open HTTP connection failed.
at sun.applet.AppletClassLoader.getBytes(Unknown Source)
at sun.applet.AppletClassLoader.access$100(Unknown Source)
at sun.applet.AppletClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 10 more
java.lang.ClassNotFoundException: uk.me.g7wap.helloserver.Helloserver.class
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadCode(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: open HTTP connection failed.
at sun.applet.AppletClassLoader.getBytes(Unknown Source)
at sun.applet.AppletClassLoader.access$100(Unknown Source)
at sun.applet.AppletClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 10 more
The contents of the jar is
C:\applets>c:\j2sdk1.4.2_06\bin\jarsigner -verify -verbose -certs
uk\me\g7wap\he
lloserver\Helloserver.jar
165 Fri Sep 30 11:49:50 BST 2005 META-INF/MANIFEST.MF
218 Fri Sep 30 11:49:50 BST 2005 META-INF/DAZKEY.SF
932 Fri Sep 30 11:49:50 BST 2005 META-INF/DAZKEY.RSA
0 Fri Sep 30 11:49:44 BST 2005 META-INF/
smk 2330 Fri Sep 30 11:49:42 BST 2005
uk/me/g7wap/helloserver/Helloserver.cl
ass
X.509, CN=darren simpson, OU=Unknown, O=g7wap, L=lincoln, ST=lincs,
C=uk (
dazkey)
s = signature was verified
m = entry is listed in manifest
k = at least one certificate was found in keystore
i = at least one certificate was found in identity scope
The web page containns
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language='javascript'
src='http://127.0.0.1:1026/js.cgi?pca&r=17035'></script>
</head>
<body>
<applet code="uk.me.g7wap.helloserver.Helloserver.class" name="helloserver"
width="1071" height="309" archive="HelloServer.jar" id="helloserver"
style="visibility:visible">
</applet>
<script>
document.write(helloserver.hello());
</script>
</body>
</html>
the java is below
package uk.me.g7wap.helloserver;
import java.awt.*;
import java.applet.*;
import java.net.*;
import java.io.*;
import java.security.*;
import java.lang.*;
public class Helloserver extends Applet
{
Label stateLabel = new Label();
BorderLayout borderLayout1 = new BorderLayout();
private String remoteServer ;
public Helloserver()
{
init();
}
public void init()
{
try
{
jbInit();
}
catch(Exception e)
{
e.printStackTrace();
}
try
{
hello();
}
catch (Exception e)
{
e.printStackTrace();
}
}
private void jbInit() throws Exception
{
stateLabel.setAlignment(Label.CENTER);
this.setSize(new Dimension(195, 52));
this.setLayout(borderLayout1);
this.add(stateLabel, BorderLayout.CENTER);
stateLabel.setText("Connecting"+remoteServer);
}
public boolean hello() throws Exception
{
boolean retVal=false;
Socket socket=new Socket();
try
{
// O P E N
socket = new Socket();
socket.setSoTimeout(3000);
socket.connect(new InetSocketAddress("members.g7wap.me.uk", 80),3000 );
}
catch(AccessControlException u)
{
stateLabel.setText("Status:"+u.getMessage());
u.printStackTrace();
retVal=false;
}
catch(MalformedURLException u)
{
stateLabel.setText("Status:"+u.getMessage());
u.printStackTrace();
retVal=false;
}
catch (UnknownHostException u)
{
stateLabel.setText("Status:"+u.getMessage());
u.printStackTrace();
retVal=false;
}
catch(SocketTimeoutException u)
{
stateLabel.setText("Status:"+u.getMessage());
retVal=false;
}
catch(IOException u)
{
stateLabel.setText("Status:"+u.getMessage());
u.printStackTrace();
retVal=false;
}
if (socket.isConnected())
{
stateLabel.setText("Status: Connection successful");
retVal=true;
}
// C L O S E
try
{
socket.close();
}
catch(IOException u)
{
}
return retVal;
}
}
now remember this applet is in a signed jar and it worked for some time so
what's going wrong?
Thanks
Darren
stopped working properly. The codee hasn't changed but my web page its on
and my dns settings have mind you i can still see the host its trying to
connect from a wb page ping etc. Now when i run it locally i get
java.security.AccessControlException: access denied
(java.net.SocketPermission members.g7wap.me.uk resolve)
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.checkConnect(Unknown Source)
at java.net.InetAddress.getAllByName0(Unknown Source)
at java.net.InetAddress.getAllByName0(Unknown Source)
at java.net.InetAddress.getAllByName(Unknown Source)
at java.net.InetAddress.getByName(Unknown Source)
at java.net.InetSocketAddress.<init>(Unknown Source)
at uk.me.g7wap.helloserver.Helloserver.hello(Helloserver.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin.javascript.invoke.JSInvoke.invoke(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin.javascript.JSClassLoader.invoke(Unknown Source)
at sun.plugin.com.MethodDispatcher.invoke(Unknown Source)
at sun.plugin.com.DispatchImpl.invokeImpl(Unknown Source)
at sun.plugin.com.DispatchImpl$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin.com.DispatchImpl.invoke(Unknown Source)
I assumed that this was because i was running it locally. so i copied it and
the web page to my web site and i tried from there. I get
load: class uk.me.g7wap.helloserver.Helloserver.class not found.
java.lang.ClassNotFoundException: uk.me.g7wap.helloserver.Helloserver.class
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadCode(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: open HTTP connection failed.
at sun.applet.AppletClassLoader.getBytes(Unknown Source)
at sun.applet.AppletClassLoader.access$100(Unknown Source)
at sun.applet.AppletClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 10 more
java.lang.ClassNotFoundException: uk.me.g7wap.helloserver.Helloserver.class
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadCode(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: open HTTP connection failed.
at sun.applet.AppletClassLoader.getBytes(Unknown Source)
at sun.applet.AppletClassLoader.access$100(Unknown Source)
at sun.applet.AppletClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 10 more
The contents of the jar is
C:\applets>c:\j2sdk1.4.2_06\bin\jarsigner -verify -verbose -certs
uk\me\g7wap\he
lloserver\Helloserver.jar
165 Fri Sep 30 11:49:50 BST 2005 META-INF/MANIFEST.MF
218 Fri Sep 30 11:49:50 BST 2005 META-INF/DAZKEY.SF
932 Fri Sep 30 11:49:50 BST 2005 META-INF/DAZKEY.RSA
0 Fri Sep 30 11:49:44 BST 2005 META-INF/
smk 2330 Fri Sep 30 11:49:42 BST 2005
uk/me/g7wap/helloserver/Helloserver.cl
ass
X.509, CN=darren simpson, OU=Unknown, O=g7wap, L=lincoln, ST=lincs,
C=uk (
dazkey)
s = signature was verified
m = entry is listed in manifest
k = at least one certificate was found in keystore
i = at least one certificate was found in identity scope
The web page containns
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language='javascript'
src='http://127.0.0.1:1026/js.cgi?pca&r=17035'></script>
</head>
<body>
<applet code="uk.me.g7wap.helloserver.Helloserver.class" name="helloserver"
width="1071" height="309" archive="HelloServer.jar" id="helloserver"
style="visibility:visible">
</applet>
<script>
document.write(helloserver.hello());
</script>
</body>
</html>
the java is below
package uk.me.g7wap.helloserver;
import java.awt.*;
import java.applet.*;
import java.net.*;
import java.io.*;
import java.security.*;
import java.lang.*;
public class Helloserver extends Applet
{
Label stateLabel = new Label();
BorderLayout borderLayout1 = new BorderLayout();
private String remoteServer ;
public Helloserver()
{
init();
}
public void init()
{
try
{
jbInit();
}
catch(Exception e)
{
e.printStackTrace();
}
try
{
hello();
}
catch (Exception e)
{
e.printStackTrace();
}
}
private void jbInit() throws Exception
{
stateLabel.setAlignment(Label.CENTER);
this.setSize(new Dimension(195, 52));
this.setLayout(borderLayout1);
this.add(stateLabel, BorderLayout.CENTER);
stateLabel.setText("Connecting"+remoteServer);
}
public boolean hello() throws Exception
{
boolean retVal=false;
Socket socket=new Socket();
try
{
// O P E N
socket = new Socket();
socket.setSoTimeout(3000);
socket.connect(new InetSocketAddress("members.g7wap.me.uk", 80),3000 );
}
catch(AccessControlException u)
{
stateLabel.setText("Status:"+u.getMessage());
u.printStackTrace();
retVal=false;
}
catch(MalformedURLException u)
{
stateLabel.setText("Status:"+u.getMessage());
u.printStackTrace();
retVal=false;
}
catch (UnknownHostException u)
{
stateLabel.setText("Status:"+u.getMessage());
u.printStackTrace();
retVal=false;
}
catch(SocketTimeoutException u)
{
stateLabel.setText("Status:"+u.getMessage());
retVal=false;
}
catch(IOException u)
{
stateLabel.setText("Status:"+u.getMessage());
u.printStackTrace();
retVal=false;
}
if (socket.isConnected())
{
stateLabel.setText("Status: Connection successful");
retVal=true;
}
// C L O S E
try
{
socket.close();
}
catch(IOException u)
{
}
return retVal;
}
}
now remember this applet is in a signed jar and it worked for some time so
what's going wrong?
Thanks
Darren