2 Replies Latest reply on Jan 1, 2004 2:09 PM by mgmartin

    Calling Message.setStringProperty inside war breaks System.p

    mgmartin Newbie

      This is a jre issue.
      If the list works but the get does not, I don't see how it can anything to do with jboss.

      I'm surprised it even lets you do anything with system properties
      from inside an applet?

      Regards,
      Adrian

        • 1. Re: Calling Message.setStringProperty inside war breaks Syst
          Adrian Brock Master

          This is a jre issue.
          If the list works but the get does not, I don't see how it can anything to do with jboss.

          I'm surprised it even lets you do anything with system properties
          from inside an applet?

          Regards,
          Adrian

          • 2. Re: Calling Message.setStringProperty inside war breaks Syst
            mgmartin Newbie

            The list doesn't work. It's filled with garbage on the end. Here is another test case without me calling getProperties. A simple applet to connect to a topic, then create a JTable.

            /*
             * test.java
             *
             * Created on December 23, 2003, 7:36 PM
             */
            
            
            
            import java.util.Properties;
            
            import javax.jms.*;
            import javax.naming.Context;
            import javax.naming.InitialContext;
            import javax.swing.JApplet;
            
            
            /**
             *
             * @author michael
             */
            public class test extends JApplet {
            
             /** Initializes the applet test */
             public void init() {
            
             try {
             TopicConnection conn = null;
             TopicSession session = null;
             Topic topic = null;
            
             StringBuffer buf = new StringBuffer();
            
             Properties p = new Properties();
             p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
             p.put(Context.PROVIDER_URL, "jnp://oblivion:1099");
             p.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
            
             InitialContext ctx = new InitialContext(p);
             TopicConnectionFactory tcf=
             (TopicConnectionFactory)ctx.lookup("UILConnectionFactory");
            
             conn = tcf.createTopicConnection();
             session = conn.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
            
             topic = (Topic)ctx.lookup("topic/testTopic");
            
             TopicPublisher pub = session.createPublisher(topic);
             conn.start();
             Message m = session.createTextMessage();
             m.setStringProperty("MsgType", "NewLog");
             }
             catch (Exception e) {
             //jTextArea1.append("** Error " + e.toString());
             e.printStackTrace();
             }
             initComponents();
            
             }
            
             /** This method is called from within the init() method to
             * initialize the form.
             * WARNING: Do NOT modify this code. The content of this method is
             * always regenerated by the Form Editor.
             */
             private void initComponents() {
             jButton1 = new javax.swing.JButton();
             jScrollPane1 = new javax.swing.JScrollPane();
             jSplitPane1 = new javax.swing.JSplitPane();
             jPanel1 = new javax.swing.JPanel();
             jTable1 = new javax.swing.JTable();
             jScrollPane2 = new javax.swing.JScrollPane();
             jTextArea1 = new javax.swing.JTextArea();
            
             jButton1.setText("jButton1");
             jButton1.addActionListener(new java.awt.event.ActionListener() {
             public void actionPerformed(java.awt.event.ActionEvent evt) {
             jButton1ActionPerformed(evt);
             }
             });
            
             getContentPane().add(jButton1, java.awt.BorderLayout.SOUTH);
            
             jSplitPane1.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
             jSplitPane1.setResizeWeight(0.9);
             jPanel1.setLayout(new javax.swing.BoxLayout(jPanel1, javax.swing.BoxLayout.Y_AXIS));
            
             jTable1.setModel(new javax.swing.table.DefaultTableModel(
             new Object [][] {
             {null, null, null, null},
             {null, null, null, null},
             {null, null, null, null},
             {null, null, null, null}
             },
             new String [] {
             "Title 1", "Title 2", "Title 3", "Title 4"
             }
             ));
             jPanel1.add(jTable1);
            
             jSplitPane1.setLeftComponent(jPanel1);
            
             jScrollPane2.setViewportView(jTextArea1);
            
             jSplitPane1.setRightComponent(jScrollPane2);
            
             jScrollPane1.setViewportView(jSplitPane1);
            
             getContentPane().add(jScrollPane1, java.awt.BorderLayout.CENTER);
            
             }
            
             private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
             // Add your handling code here:
             try {
             //test_pub t = new test_pub();
             //jTextArea1.setText(t.setup());
             }
             catch (Exception e) {
             e.printStackTrace();
             }
            
             }
            
            
             // Variables declaration - do not modify
             private javax.swing.JButton jButton1;
             private javax.swing.JPanel jPanel1;
             private javax.swing.JScrollPane jScrollPane1;
             private javax.swing.JScrollPane jScrollPane2;
             private javax.swing.JSplitPane jSplitPane1;
             private javax.swing.JTable jTable1;
             private javax.swing.JTextArea jTextArea1;
             // End of variables declaration
            
            }
            


            Everything runs fine unless the call to m.setStringProperty("MsgType", "NewLog"); is executed. If it is executed and running inside a WAR file, the applet throws out this stack trace when creating the JTable. I think the JRE is executing a call to get a system property as I was trying to show in my first example.


            java.lang.NullPointerException
            at java.io.UnixFileSystem.resolve(UnixFileSystem.java:92)
            at java.io.UnixFileSystem.resolve(UnixFileSystem.java:118)
            at java.io.File.getAbsolutePath(File.java:459)
            at java.io.File.getAbsoluteFile(File.java:475)
            at java.io.File.toURI(File.java:607)
            at java.awt.datatransfer.SystemFlavorMap$1.run(SystemFlavorMap.java:171)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.awt.datatransfer.SystemFlavorMap.<init>(SystemFlavorMap.java:160)
            at java.awt.datatransfer.SystemFlavorMap.getDefaultFlavorMap(SystemFlavorMap.java:147)
            at java.awt.dnd.DropTarget.<init>(DropTarget.java:805)
            at java.awt.dnd.DropTarget.<init>(DropTarget.java:131)
            at javax.swing.TransferHandler$SwingDropTarget.<init>(TransferHandler.java:531)
            at javax.swing.JComponent.setTransferHandler(JComponent.java:2742)
            at javax.swing.plaf.basic.BasicTableUI.installDefaults(BasicTableUI.java:661)
            at javax.swing.plaf.basic.BasicTableUI.installUI(BasicTableUI.java:618)
            at javax.swing.JComponent.setUI(JComponent.java:449)
            at javax.swing.JTable.setUI(JTable.java:2621)
            at javax.swing.JTable.updateUI(JTable.java:2672)
            at javax.swing.JTable.<init>(JTable.java:371)
            at javax.swing.JTable.<init>(JTable.java:295)
            at test.initComponents(test.java:70)
            at test.init(test.java:56)
            at sun.applet.AppletPanel.run(AppletPanel.java:353)
            at java.lang.Thread.run(Thread.java:534)


            I have turned on all permissions in the .java.policy file.

            --Michael