Crying out to the gurus at SUN

I posted this on 19th June, I haven抰 got any reply yet. I never had such problems with security a few years ago. I didn抰 have other choices than to cry out to the gurus at Sun. Note that I have also tried granting permissions, etc., in server.policy file. It didn抰 budge. Please help me.

My applet is not able to open a socket on its own host.

The applet is being served by a JSP (developed using Sun Creator2) from my laptop behind a DHCP broadband router at (say) 125.238.104.132 at my residence. I have a URL 搒amsub.no-ip.biz?that redirects port 80 calls to 29080 where my application runs. All required router rules/mapping were done and the JSPs run perfectly fine. In one of the pages, I have inserted an applet inside an escape disabled statictext field as follows:

<applet code="AppClient.class" width=540 height=440></applet>

The applet code and the test server code are shown below for your analysis. Note that, when run on the same machine (substituting the url address with 搇ocalhost?for running at home), the applet works fine. The commented lines will show other failed tests. The error reported at the java console was: null pointer at line 56

Could someone help me please. Thanx. MarySam

The applet code

1import java.util.*;

2import java.awt.*;

3import java.applet.*;

4import java.text.*;

5import javax.swing.*;

6import com.sun.java.swing.plaf.windows.*;

7import java.awt.event.*;

8import java.net.*;

9

10public class AppClient extends Applet {

11JInternalFrame jif;

12JTextArea jta1, jta2;

13Socket kkSocket = null;

14

15public void init() {

16try {

17LookAndFeel lf = new WindowsLookAndFeel();

18UIManager.setLookAndFeel(lf);

19kkSocket = new Socket("125.238.104.132", 4444);

//kkSocket = new Socket("samsub.no-ip.biz", 4444);

//kkSocket = new Socket("125.238.104.132:29080", 4444);

//kkSocket = new Socket("samsub.no-ip.biz:29080", 4444);

20} catch(Exception e) {}

21

22setLayout(null);

23setBackground(Color.black);

24jif = new JInternalFrame();

25jif.setLocation(20,20);

26jif.setSize(500,400);

27Container con1 = jif.getContentPane();

28con1.setLayout(null);

29

30jta1 = new JTextArea();

31JScrollPane jcp1 = new JScrollPane(jta1);

32jcp1.setBounds(10,10,410,100);

33con1.add(jcp1);

34

35jta2 = new JTextArea();

36JScrollPane jcp2 = new JScrollPane(jta2);

37jcp2.setBounds(10,115,470,245);

38con1.add(jcp2);

39

40JButton jb = new JButton("Go");

41jb.setBounds(425,10,60,30);

42jb.addActionListener(this);

43con1.add(jb);

44

45JLabel jlb = new JLabel();

46jlb.setOpaque(true);

47jlb.setBackground(Color.gray);

48jlb.setForeground(Color.white);

49jlb.setBounds(425,50,60,30);

50con1.add(jlb);

51

52

53jif.setVisible(true);

54add(jif);

55//jta2.setText(getCodeBase().toString());

56jta2.setText(kkSocket.getInetAddress().toString());

57

58}

59

60public void start() {}

61

62public void stop() {}

63

64

65}

66

67

The test server Code

1import java.net.*;

2import java.io.*;

3

4public class MyServer {

5public static void main(String[] args) throws IOException {

6

7ServerSocket serverSocket = null;

8try {

9serverSocket = new ServerSocket(4444);

10} catch (IOException e) {

11System.err.println("Could not listen on port: 4444.");

12System.exit(1);

13}

14

15Socket clientSocket = null;

16try {

17clientSocket = serverSocket.accept();

18System.out.println(clientSocket.getInetAddress().toString());

19} catch (IOException e) {

20System.err.println("Accept failed.");

21System.exit(1);

22}

23

24clientSocket.close();

25serverSocket.close();

26}

27}

28

29

[4126 byte] By [marysama] at [2007-11-27 8:30:50]
# 1
Hi,Making changes in server.policy alone wont help. Try running the policy tool and create a java.policy file and set the permissions to ALL pertaining to this application...if you hadn't done that before
TheCarribeanKida at 2007-7-12 20:26:03 > top of Java-index,Development Tools,Java Tools...
# 2

I have tried everything under the sun/Sun available for applets, nothing seem to work. In the name of security, Sun perhaps has messed up with applets. No wonder many programmers have dumped trying applets. It is confirmed by the fact of not getting any response despite so many viewers.

marysam

marysama at 2007-7-12 20:26:03 > top of Java-index,Development Tools,Java Tools...