Hi everyone. I'm doing a project at the moment for college where I will be making an IM applet that can send text to others using the same applet. I'm having real trouble in getting the applet to be able to send any data through a socket. Now, I understand that that Applets need to be signed to be able to do this and I have done just that but my signed applet will not run. After sayign that I wish to run it, the console gives the following.... java.lang.SecurityException: class "SecondApplet$1"'s signer information does not match signer information of other classes in the same package at java.lang.ClassLoader.checkCerts(Unknown Source) at java.lang.ClassLoader.preDefineClass(Unknown Source) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) at SecondApplet.init(SecondApplet.java:50) at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Exception: java.lang.SecurityException: class "SecondApplet$1"'s signer information does not match signer information of other classes in the same package java.lang.SecurityException: class "SecondApplet$1"'s signer information does not match signer information of other classes in the same package at java.lang.ClassLoader.checkCerts(Unknown Source) at java.lang.ClassLoader.preDefineClass(Unknown Source) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) at SecondApplet.init(SecondApplet.java:50) at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Exception: java.lang.SecurityException: class "SecondApplet$1"'s signer information does not match signer information of other classes in the same package java.lang.SecurityException: class "SecondApplet$1"'s signer information does not match signer information of other classes in the same package at java.lang.ClassLoader.checkCerts(Unknown Source) at java.lang.ClassLoader.preDefineClass(Unknown Source) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) at SecondApplet.init(SecondApplet.java:50) at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Exception: java.lang.SecurityException: class "SecondApplet$1"'s signer information does not match signer information of other classes in the same package Code (markup): The code I'm using is as follows. I know it's messy as hell but it's just to get the grips of what I'm doing. import java.awt.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.applet.*; import java.net.*; import java.io.*; public class SecondApplet extends JApplet { private Container content; //content window private JTextArea ta; //text area for the scroll pane private JScrollPane sbrText; //scroll pane private JTextField messageBox; //the message box for writing what is to be sent private JButton btnSend; //the sending button private ServerSocket srvr; //a server socket private Socket skt; //a normal socket for the server-socket private PrintWriter out; //for writing to the socket public void sendData() //method to send data through the socket { } public void init() { content = getContentPane(); //the content window content.setBackground(Color.gray); content.setLayout(new FlowLayout()); ta = new JTextArea("", 5, 35); //text area for incoming and out going text ta.setLineWrap(true); sbrText = new JScrollPane(ta); sbrText.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); //ensure the scroll bar is always there messageBox = new JTextField(20); //create a new text field to input a message btnSend = new JButton("Send"); //button to send text btnSend.addActionListener //adding an action listener, occour when the send button is pressed ( new ActionListener() { public void actionPerformed(ActionEvent e) { try { Socket skt = new Socket("localhost", 1234); BufferedReader in = new BufferedReader(new InputStreamReader(skt.getInputStream())); System.out.print("Received string: '"); while (!in.ready()) {} System.out.println(in.readLine()); // Read one line and output it System.out.print("'\n"); in.close(); } catch(Exception E) { System.out.print("Whoops! It didn't work!\n"); } } } ); content.add(sbrText); //add scroll window to the page content.add(messageBox); //add message box to the window content.add(btnSend); } } Code (markup): I'm trying to run this and connect to a simple server program.... import java.lang.*; import java.io.*; import java.net.*; class Server { public static void main(String args[]) { String data = "Toobie ornaught toobie"; try { ServerSocket srvr = new ServerSocket(1234); Socket skt = srvr.accept(); System.out.println("working"); System.out.print("Server has connected!\n"); PrintWriter out = new PrintWriter(skt.getOutputStream(), true); System.out.print("Sending string: '" + data + "'\n"); out.print(data); out.close(); skt.close(); srvr.close(); } catch(Exception e) { System.out.print("Whoops! It didn't work!\n"); } } } Code (markup): I'm totally beat as to why this won't work. I've made this work fine in an application but for soem reason, the applet won't work. My questions are; why does the signed applet nor run and and if it did, would my code be able to connect to the server at all? I would greatly appreciate any help as I have been at this for a week with no results. If I can get applets talking then I can power away on the rest of the project. A big thanks in advance .
Thanks for the replies, but I've decided to forget the applet idea and run this as a nice, humble application.