NullPointerException, need help

I have a problem when I run my program. The error message is:
Java.lang.NullPointerException at LangtonsAnt.LangtonsAnt.main(LangtonsAnt.java:11)
As far as I know means a NullPointerException that the programs tries to access an opject which is not there. Unfortunatly I have not the faintest idea what I'm doing wrong...
package LangtonsAnt;
public class LangtonsAnt{   
public static void main(String[] args){ 
       Grid newGrid = new Grid();
       newGrid.initGrid();
       System.out.println(newGrid.grid[5][5].white); 
package LangtonsAnt;
public class Grid {
    private static final int sizeOfGrid = 100; 
    static Tiles [][] grid;
    public void initGrid(){   
        Tiles[][] grid = new Tiles[sizeOfGrid][sizeOfGrid];
        for(int loop1 = 0; loop1 < sizeOfGrid; loop1++){
            for(int loop2 = 0; loop2 < sizeOfGrid; loop2++){ 
               grid[loop1][loop2] = new Tiles();
               grid[loop1][loop2].white = true;
}

These are the easiest errors to find. The JVM has told you the exact source file and line number at which it occurs. Turn on line number display in your editor, go to line 11, and examine every reference you see. Put in System.out.println() statements to print out the references and see which one is null.
In this case it's not too difficult to see. You sure did write this code in an odd way. You call a Grid default constructor and then an initGrid method right after that which takes no arguments. Isn't initializing a Grid the constructor's job? I could see why you'd have a separate init method if you passed arguments that could change the Grid, but you don't.
You declare a static Tiles 2D array (another mystery), and then in the initGrid you declare a second, local Tiles 2D array of the same name. The local variable is initialized while the static instance of the same name remains null. When you leave the initGrid method the local variable is garbage collected and the static var remains null.
I think you meant it to look like this:
package LangtonsAnt;
public class LangtonsAnt
    public static void main(String[] args)
       Grid newGrid = new Grid();
       newGrid.initGrid();
       System.out.println(newGrid.grid[5][5].white);
class Grid
    private static final int sizeOfGrid = 100;
    static Tiles [][] grid;
    public void initGrid(){
        Grid.grid = new Tiles[sizeOfGrid][sizeOfGrid];
        for(int loop1 = 0; loop1 < sizeOfGrid; loop1++){
            for(int loop2 = 0; loop2 < sizeOfGrid; loop2++){
               grid[loop1][loop2] = new Tiles();
               grid[loop1][loop2].white = true;
}I'd recommend that you write it more like this:
package langstonsant; // follow the Sun coding standards.
public class Grid
    public static final int DEFAULT_GRID_SIZE = 100;
    private Tiles [][] grid;  // NOTE: not static.
    public Grid() { this(DEFAULT_GRID_SIZE); }
    public Grid(int sizeOfGrid)
        if (sizeOfGrid <= 0)
            throw new IllegalArgumentException("Grid size must be greater than zero");
        this.grid = new Tiles[sizeOfGrid][sizeOfGrid];
        for(int loop1 = 0; loop1 < sizeOfGrid; loop1++)
            for(int loop2 = 0; loop2 < sizeOfGrid; loop2++)
               this.grid[loop1][loop2] = new Tiles();
               this.grid[loop1][loop2].white = true;

Similar Messages

  • I need help with the Quote applet.

    Hey all,
    I need help with the Quote applet. I downloaded it and encoded it in the following html code:
    <html>
    <head>
    <title>Part 2</title>
    </head>
    <body>
    <applet      codebase="/demo/quote/classes" code="/demo/quote/JavaQuote.class"
    width="300" height="125" >
    <param      name="bgcolor"      value="ffffff">
    <param      name="bheight"      value="10">
    <param      name="bwidth"      value="10">
    <param      name="delay"      value="1000">
    <param      name="fontname"      value="TimesRoman">
    <param      name="fontsize"      value="14">
    <param      name="link"      value="http://java.sun.com/events/jibe/index.html">
    <param      name="number"      value="3">
    <param      name="quote0"      value="Living next to you is in some ways like sleeping with an elephant. No matter how friendly and even-tempered is the beast, one is affected by every twitch and grunt.|- Pierre Elliot Trudeau|000000|ffffff|7">
    <param      name="quote1"      value="Simplicity is key. Our customers need no special technology to enjoy our services. Because of Java, just about the entire world can come to PlayStar.|- PlayStar Corporation|000000|ffffff|7">
    <param      name="quote2"      value="The ubiquity of the Internet is virtually wasted without a platform which allows applications to utilize the reach of Internet to write ubiquitous applications! That's where Java comes into the picture for us.|- NetAccent|000000|ffffff|7">
    <param      name="space"      value="20">
    </applet>
    </body>
    </html>When I previewed it in Netscape Navigator, a box with a red X appeared, and this appeared in the console when I opened it:
    load: class /demo/quote/JavaQuote.class not found.
    java.lang.ClassNotFoundException: .demo.quote.JavaQuote.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.FileNotFoundException: \demo\quote\JavaQuote\class.class (The system cannot find the path specified)
         at java.io.FileInputStream.open(Native Method)
         at java.io.FileInputStream.<init>(Unknown Source)
         at java.io.FileInputStream.<init>(Unknown Source)
         at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
         at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
         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
    Exception in thread "Thread-4" java.lang.NullPointerException
         at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
         at sun.plugin.AppletViewer.showAppletException(Unknown Source)
         at sun.applet.AppletPanel.runLoader(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    java.lang.NullPointerException
         at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
         at sun.plugin.AppletViewer.showAppletStatus(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)What went wrong? and how can I make it run correct?
    Thanks,
    Nathan Pinno

    JavaQuote.class is not where your HTML says it is. That is at the relative URL "/demo/quote/".

  • Assignment Due TODAY - NEED HELP

    My program is below and I have already setup a Client Server Connection for a hangman game, but I need help sending and displaying the options selected by the user. PLEASE HELP
    import java.io.*;
    import java.net.*;
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    public class ClientApp extends JFrame
        // Declarations used in program
        private Socket server;
        ObjectOutputStream out;
        ObjectInputStream in;
        int length = 0; // Length of word received by Server
        String guess;
        String lines;
        String secret;
        int chances = 0; // Count to Hold no of chances by user
        int categorySelected ;
        // GUI Declarations
        private JButton btnMovies;
        private JButton btnSport;
        private JButton btnExit, btnNew;
        private JButton a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;
        private JLabel lblWelcome, lblCategory , lblChances;
        private JPanel pan1, pan2, pan3, pan4, pan5, pan6, pan7, pan8, pan9, pan10;
        private JTextArea answer;
        private JTextField txtCategory, txtChances;
       // CONSTRUCTOR
        public ClientApp()
            setLayout(new FlowLayout());
            pan1 = new JPanel();
            pan3 = new JPanel();
            pan2 = new JPanel();
            lblWelcome = new JLabel("Welcome to Hangman.\n\n Please select a category.");
            pan1.add(lblWelcome);
            btnMovies = new JButton("Movie Titles");
            pan3.add(btnMovies);
            btnSport = new JButton("Sport");
            pan3.add(btnSport);
            btnNew = new JButton("New Game");
            pan3.add(btnNew);
            btnExit = new JButton("Exit");
            pan2.add(btnExit);
            pan9 = new JPanel();
            txtCategory = new JTextField(10);
            pan9.add(txtCategory);
            pan8 = new JPanel();
            answer = new JTextArea(3,30);
            answer.setEditable(false);
            pan8.add(answer);
            add(pan1);
            add(pan3);
            add(pan2);
            add(pan9);
            add(pan8);
            btnExit.addActionListener(
                new ActionListener()
                    public void actionPerformed(ActionEvent event)
                        System.exit(0);
            btnMovies.addActionListener(
                new ActionListener()
                    public void actionPerformed(ActionEvent event)
                       enableButtons();
                       btnSport.setEnabled(false);
                       btnNew.setEnabled(true);
                       txtCategory.setText("Movies");
                       categorySelected = 0;
                       processClient();
            btnSport.addActionListener(
                new ActionListener()
                    public void actionPerformed(ActionEvent event)
                       enableButtons();
                       btnMovies.setEnabled(false);
                       btnSport.setEnabled(false);
                       btnNew.setEnabled(true);
                       txtCategory.setText("Actors Names");
                       categorySelected = 1;
                       processClient();
            btnNew.addActionListener(
                new ActionListener()
                    public void actionPerformed(ActionEvent event)
                        enableButtons();
                        btnSport.setEnabled(true);
                        btnMovies.setEnabled(true);
                        btnNew.setEnabled(false);
                        chances = 0;
                        communicate();
            buttons();
            disableButtons();
            btnNew.setEnabled(false);
            // Attempt to establish connection to server
            try
                // Create socket
                server = new Socket("localhost", 8008);
            catch (IOException ioe)
                System.out.println("IOException: " + ioe.getMessage());
        // Method to add Alphabetic Buttons to GUI
        public void buttons()
                pan4 = new JPanel();
                pan5 = new JPanel();
                pan6 = new JPanel();
                pan7 = new JPanel();
             a = new JButton("A");
             b = new JButton("B");
             c = new JButton("C");
             d = new JButton("D");
             e = new JButton("E");
             f = new JButton("F");
             g = new JButton("G");
             h = new JButton("H");
             i = new JButton("I");
             j = new JButton("J");
             k = new JButton("K");
             l = new JButton("L");
             m = new JButton("M");
             n = new JButton("N");
             o = new JButton("O");
             p = new JButton("P");
             q = new JButton("Q");
             r = new JButton("R");
             s = new JButton("S");
             t = new JButton("T");
             u = new JButton("U");
             v = new JButton("V");
             w = new JButton("W");
             x = new JButton("X");
             y = new JButton("Y");
             z = new JButton("Z");
            pan4.add(a);
            pan4.add(b);
            pan4.add(c);
            pan4.add(d);
            pan4.add(e);
            pan4.add(f);
            pan5.add(g);
            pan5.add(h);
            pan5.add(i);
            pan5.add(j);
            pan5.add(k);
            pan5.add(l);
            pan6.add(m);
            pan6.add(n);
            pan6.add(o);
            pan6.add(p);
            pan6.add(q);
            pan6.add(r);
            pan7.add(s);
            pan7.add(t);
            pan7.add(u);
            pan7.add(v);
            pan7.add(w);
            pan7.add(x);
            pan7.add(y);
            pan7.add(z);
            add(pan4);
            add(pan5);
            add(pan6);
            add(pan7);
            // Button Handler for Alphabet
            ButtonHandler handler = new ButtonHandler();
           a.addActionListener(handler);
           b.addActionListener(handler);
           c.addActionListener(handler);
           d.addActionListener(handler);
           e.addActionListener(handler);
           f.addActionListener(handler);
           g.addActionListener(handler);
           h.addActionListener(handler);
           i.addActionListener(handler);
           j.addActionListener(handler);
           k.addActionListener(handler);
           l.addActionListener(handler);
           m.addActionListener(handler);
           n.addActionListener(handler);
           o.addActionListener(handler);
           p.addActionListener(handler);
           q.addActionListener(handler);
           r.addActionListener(handler);
           s.addActionListener(handler);
           t.addActionListener(handler);
           u.addActionListener(handler);
           v.addActionListener(handler);
           w.addActionListener(handler);
           x.addActionListener(handler);
           y.addActionListener(handler);
           z.addActionListener(handler);
       private class ButtonHandler implements ActionListener
        public void actionPerformed(ActionEvent ae)
                 if (ae.getSource()==a)
                            guess = "a";
                            a.setEnabled(false);
                            sendGuess();
                 if (ae.getSource()==b)
                           guess = "b";
                           b.setEnabled(false);
                           sendGuess();
                 if (ae.getSource()==c)
                             guess = "c";
                             c.setEnabled(false);
                             sendGuess();
                 if (ae.getSource()==d)
                             guess = "d";
                             d.setEnabled(false);
                             sendGuess();
                 if (ae.getSource()==e)
                             guess = "e";
                             e.setEnabled(false);
                             sendGuess();
                 if (ae.getSource()==f)
                             guess = "f";
                             f.setEnabled(false);
                             sendGuess();
                 if (ae.getSource()==g)
                             guess = "g";
                             g.setEnabled(false);
                             sendGuess();
                 if (ae.getSource()==h)
                             guess = "h";
                             h.setEnabled(false);
                             sendGuess();
                 if (ae.getSource()==i)
                             guess = "i";
                             i.setEnabled(false);
                             sendGuess();
                 if (ae.getSource()==j)
                             guess = "j";
                             j.setEnabled(false);
                             sendGuess();
                 if (ae.getSource()==k)
                             guess = "k";
                             k.setEnabled(false);
                             sendGuess();
                 if (ae.getSource()==l)
                             guess = "l";
                             l.setEnabled(false);
                             sendGuess();
                 if (ae.getSource()==m)
                             guess = "m";
                             m.setEnabled(false);
                             sendGuess();
                 if (ae.getSource()==n)
                             guess = "n";
                             n.setEnabled(false);
                             sendGuess();
                 if (ae.getSource()==o)
                             guess = "o";
                             o.setEnabled(false);
                             sendGuess();
                  if (ae.getSource()==p)
                             guess = "p";
                             p.setEnabled(false);
                             sendGuess();
                  if (ae.getSource()==q)
                             guess = "q";
                             q.setEnabled(false);
                             sendGuess();
                 if (ae.getSource()==r)
                             guess = "r";
                             r.setEnabled(false);
                             sendGuess();
                 if (ae.getSource()==s)
                             guess = "s";
                             s.setEnabled(false);
                             sendGuess();
                 if (ae.getSource()==t)
                             guess = "t";
                             t.setEnabled(false);
                             sendGuess();
                 if (ae.getSource()==u)
                             guess = "u";
                             u.setEnabled(false);
                             sendGuess();
                 if (ae.getSource()==v)
                             guess = "v";
                             v.setEnabled(false);
                             sendGuess();
                 if (ae.getSource()==w)
                             guess = "w";
                             w.setEnabled(false);
                             sendGuess();
                 if (ae.getSource()==x)
                             guess = "x";
                             x.setEnabled(false);
                             sendGuess();
                 if (ae.getSource()==y)
                             guess = "y";
                             y.setEnabled(false);
                             sendGuess();
                 if (ae.getSource()==z)
                             guess = "z";
                             z.setEnabled(false);
                             sendGuess();
            // Method to Disable the buttons          
            public void disableButtons()
                a.setEnabled(false);
                b.setEnabled(false);
                c.setEnabled(false);
                d.setEnabled(false);
                e.setEnabled(false);
                f.setEnabled(false);
                g.setEnabled(false);
                h.setEnabled(false);
                i.setEnabled(false);
                j.setEnabled(false);
                k.setEnabled(false);
                l.setEnabled(false);
                m.setEnabled(false);
                n.setEnabled(false);
                o.setEnabled(false);
                p.setEnabled(false);
                q.setEnabled(false);
                r.setEnabled(false);
                s.setEnabled(false);
                t.setEnabled(false);
                u.setEnabled(false);
                v.setEnabled(false);
                w.setEnabled(false);
                x.setEnabled(false);
                y.setEnabled(false);
                z.setEnabled(false);
            // Method to enable Buttons so user can Click on them
            public void enableButtons()
                a.setEnabled(true);
                b.setEnabled(true);
                c.setEnabled(true);
                d.setEnabled(true);
                e.setEnabled(true);
                f.setEnabled(true);
                g.setEnabled(true);
                h.setEnabled(true);
                i.setEnabled(true);
                j.setEnabled(true);
                k.setEnabled(true);
                l.setEnabled(true);
                m.setEnabled(true);
                n.setEnabled(true);
                o.setEnabled(true);
                p.setEnabled(true);
                q.setEnabled(true);
                r.setEnabled(true);
                s.setEnabled(true);
                t.setEnabled(true);
                u.setEnabled(true);
                v.setEnabled(true);
                w.setEnabled(true);
                x.setEnabled(true);
                y.setEnabled(true);
                z.setEnabled(true);
        public void communicate()
            // The connection has been established - now send/receive.
            try
                //  create channels
                out = new ObjectOutputStream(server.getOutputStream());
                out.flush();
                in = new ObjectInputStream(server.getInputStream());
            catch (IOException ioe)
                JOptionPane.showMessageDialog(null,"IO Exception: " + ioe.getMessage());
            catch (NullPointerException n)
                JOptionPane.showMessageDialog(null,"Error occured...");
        public void processClient()
            try
                // Tells server which category is selected by user
                out.writeObject(categorySelected);
                out.flush();
                secret = (String)in.readObject();
                length = (Integer)in.readObject();
                lines = "";
                for (int x=0;x < length;x++)
                    lines += " - ";
                answer.setText(lines);
                String ToDisplay=""; 
                  for (int q=0; q<secret.length;q++)
                   ToDisplay+=secret.length;
                   answer.setText(" " + ToDisplay); */
                  // String Correctin = (String)in.readObject();
                  // JOptionPane.showMessageDialog(null, Correctin );
            catch (IOException ioe)
                 JOptionPane.showMessageDialog(null, "IO Exception: " + ioe.getMessage());
            catch (ClassNotFoundException cnfe)
                JOptionPane.showMessageDialog(null, "Class not found..." );
        }//end method
        public void sendGuess()
            try
                // Sends the character guessed by user
                out.writeObject(guess);
                out.flush();
                // Chances incremented
                //chances = chances + 1;
                // Calcualates to see whether chances are up
                //if (chances >= 7)
                //    JOptionPane.showMessageDialog(null,"GAME OVER!! You used up all your chances...");
                 //   disableButtons();
            }//end try
            catch (IOException ioe)
                JOptionPane.showMessageDialog(null, ioe.getMessage());
            }//end catch
        }//end method
        public static void main(String[] args)
            ClientApp client = new ClientApp();
            client.communicate();
            client.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            client.setSize(500,300);
            client.setVisible(true);     
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import javax.swing.*;
    public class ServerApp
         String movies [] = {"shrek","titanic","disturbia","blade","scream"};
         String sport [] = {"tennis","golf","rugby","hockey","soccer","judo"};
         int inCategory; // Category Selected By User
         int selectw; // Random word selected in Array
         String secretword = "";
         int wordlength = 0;
         String guess;
         char letter;
         Random rand = new Random();
         String msg;
         ObjectOutputStream out;
         ObjectInputStream in;
         int chances;
        // Server socket
        private ServerSocket listener;
        // Client connection
        private Socket client;
        public ServerApp()
           // Create server socket
            try {
                listener = new ServerSocket(8008);
            catch (IOException ioe)
              JOptionPane.showMessageDialog(null,"IO Exception: " + ioe.getMessage());
        public void listen()
            // Start listening for client connections
            try
              client = listener.accept(); 
              System.out.println("Server started");       
              processClient();
            }//end try
            catch(IOException ioe)
                JOptionPane.showMessageDialog(null,"IO Exception: " + ioe.getMessage());
            }//end catch   
        public void processClient()
            try
                while(msg != "TERMINATE")
                   //input and output stream
                   out = new ObjectOutputStream(client.getOutputStream());
                   out.flush();
                   in = new ObjectInputStream(client.getInputStream());        
                   //Receiving a category
                   inCategory = (Integer)in.readObject();
                   chances = 7;
                   selectw = 0;
                   if (inCategory == 0)
                        selectw = rand.nextInt(5);
                        secretword = movies[selectw];
                        out.writeObject(secretword);
                        out.flush();
                    }//end if
                    if (inCategory == 1)
                        selectw = rand.nextInt(6);
                        secretword = sport[selectw];
                    }//end if
                        wordlength = secretword.length();
                        out.writeObject(wordlength);
                        out.flush();
                           for (int y=0;y < wordlength;y++)
                                guess = (String)in.readObject();
                                letter = guess.charAt(0);
                                  if(chances == 0)
                                      JOptionPane.showMessageDialog(null,"No more chances left");
                                   else
                                  if(letter == secretword.charAt(y))
                                    JOptionPane.showMessageDialog(null,"You chose a correct letter...");
                                else
                                    JOptionPane.showMessageDialog(null,"You chose a wrong letter...");
                                    chances--;
                        JOptionPane.showMessageDialog(null,"You won the game...");
                }//end while
                // Step 3:close down
                out.close();
                in.close();
                client.close();
                System.out.println("Server stopped");
            catch (IOException ioe)
                JOptionPane.showMessageDialog(null,"IO Exception: " + ioe.getMessage());
            catch (ClassNotFoundException cnfe)
                JOptionPane.showMessageDialog(null,"Class not found: " + cnfe.getMessage());
        public static void main(String[] args)
            // Create application
            ServerApp server = new ServerApp();
            // Start waiting for connections
            server.listen();
    }

    JAVAHELPNEEDED wrote:
    How do I save that amount of code?
    Can you HELP me or NOT??Depends what you mean. Will I write you any code? No. Will I tell you what to write? No. You can do it yourself, that's why it's called your homework. I will, though, give you a couple of tips on how to get started.
    1) Throw away what you've done
    2) Do a quick requirements analysis. That means, write down descriptive, plain English (or whatever language you think in) what the thing is supposed to do. "Be a hangman game" is too brief, but twenty pages of technical jargon is too much. Write a bit of a story about what the program must do. You now have the start of a design.
    3) Break down what has to be done into manageable chunks. Your first mistake (and most newbs) was trying to write one side of the game in a single class. Don't be afraid to write 20 classes, or 50, if that's what's needed. It'll be easier both now and in the long run
    4) Tackle each chunk one by one. Don't try and do it all at once, that never works. If you write the code one bit at a time, you'll inevitably write more modular code
    5) You'll probably screw it up. Don't worry. It happens. Try again
    6) Don't give up. Writing software is hard, there's no way around that, so deal with it
    7) Don't make the mistake of thinking the software is the GUI. It isn't (don't extend JFrame, hint hint)
    8) Good luck

  • Implementing web service Client? need help

    hi,
    i need to develop a funciton in java that takes WSDL address as a input. and using the web service address, start the web service programmatically from that function. the web service could be any.
    i need help and suggestion what to do in the area, how can i start this, as i am a new bie.
    thanks
    Farurkh

    I got the following error.
    But If I call it from a jsp page or a servlet. Nothing happend, Transaction is successful.
    java.lang.NullPointerException
         at org.apache.commons.discovery.resource.ClassLoaders.getAppLoaders(ClassLoaders.java:206)
         at org.apache.axis.AxisProperties.getClassLoaders(AxisProperties.java:118)
         at org.apache.axis.AxisProperties.getNameDiscoverer(AxisProperties.java:105)
         at org.apache.axis.AxisProperties.getResourceClassIterator(AxisProperties.java:112)
         at org.apache.axis.configuration.EngineConfigurationFactoryFinder$1.run(EngineConfigurationFactoryFinder.java:116)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.apache.axis.configuration.EngineConfigurationFactoryFinder.newFactory(EngineConfigurationFactoryFinder.java:113)
         at org.apache.axis.configuration.EngineConfigurationFactoryFinder.newFactory(EngineConfigurationFactoryFinder.java:160)
         at org.apache.axis.client.Service.getEngineConfiguration(Service.java:813)
         at org.apache.axis.client.Service.getAxisClient(Service.java:104)
         at org.apache.axis.client.Service.<init>(Service.java:113)
         at org.tempuri.wsdl.EFSnet2Locator.<init>(EFSnet2Locator.java:10)
         at com.ipharmacy.payment.Payment.main(Payment.java:12)

  • Need help with getResource() problem under weblogic 6.1

    Hey all,
              I've got a serious problem that I can't figure out. This should be really
              simple - but it's alluding me. I have an ear file with a number of servlets
              inside it. This ear file also contains a resource that my servlets want to
              read from. This resource is located (within the ear file) at:
              "/content/structure/a.txt". The file contains raw ascii.
              To have my serlvet read from this file, I thought it would be as simple as:
              URL content =
              servlet.getServletContext().getResource("/content/structure/a.txt");
              // pw is an instance of PrintWriter
              pw.print(content.getContent());
              However, when I execute the above I get the following exception:
              java.lang.NullPointerException
              at
              java.net.URLConnection.stripOffParameters(URLConnection.java:1011)
              at java.net.URLConnection.getContentHandler(URLConnection.java:979)
              at java.net.URLConnection.getContent(URLConnection.java:581)
              OK, so fine - I figure that I'm new to this. The documentation for the URL
              class tells me there is another way around this. It says that rather then
              calling getContent() directly, I can open a stream on the URL and read from
              that, like so:
              URL content =
              servlet.getServletContext().getResource("/content/structure/scenario2resourc
              es.txt");
              FileInputStream fis = content.openStream();
              but when I do this I get the following different exception:
              java.lang.ClassCastException: weblogic.utils.zip.SafeZipFileInputStream^M
              at Utility.writeFileToOutput(Utility.java:134)^M
              Apparently this thing is trying to return a web-logic-specific stream (which
              is incompatible with an FileInputStream) - which I don't want to use or
              learn about since I want my stuff to work under other webservers.
              Can anyone tell me what I'm doing wrong? This should be simple.
              -john
              John Hilgedick
              WisdomTools, Inc.
              [email protected]
              

    Wenjin,
              I appreciate your response. I tried treating it as a normal InputStream -
              but it didn't make any difference. Here's what I did:
              URL content =
              servlet.getServletContext().getResource("/content/structure/scenario2resourc
              es.txt");
              InputStream is = (InputStream)content.getContent();
              And here's the exception:
              java.lang.NullPointerException^M
              at
              java.net.URLConnection.stripOffParameters(URLConnection.java:1011)^M
              at
              java.net.URLConnection.getContentHandler(URLConnection.java:979)^M
              at java.net.URLConnection.getContent(URLConnection.java:554)^M
              at java.net.URL.getContent(URL.java:807)^M
              at Utility.writeFileToOutput(Utility.java:134)^M
              You can see that it is definitely breaking somewhere in getContent().
              If you have any other ideas, I'd appreciate hearing about them.
              -john
              ----- Original Message -----
              From: "Wenjin Zhang" <[email protected]>
              Newsgroups: weblogic.developer.interest.servlet
              Sent: Wednesday, November 20, 2002 5:03 PM
              Subject: Re: Need help with getResource() problem under weblogic 6.1
              >
              > The "/" in getServletContext().getResource("/content/structure/a.txt")
              means the
              > web (WAR) application root, not your EAR root.
              >
              > The ClassCastException is because that content.openStream() is not
              FileInputStream
              > and has nothing to do with Weblogic. You should treat it as normal
              InputStream.
              >
              >
              > "John Hilgedick" <[email protected]> wrote:
              > >Hey all,
              > >
              > >I've got a serious problem that I can't figure out. This should be
              really
              > >simple - but it's alluding me. I have an ear file with a number of
              servlets
              > >inside it. This ear file also contains a resource that my servlets want
              > >to
              > >read from. This resource is located (within the ear file) at:
              > >"/content/structure/a.txt". The file contains raw ascii.
              > >
              > >To have my serlvet read from this file, I thought it would be as simple
              > >as:
              > >
              > >URL content =
              > >servlet.getServletContext().getResource("/content/structure/a.txt");
              > >// pw is an instance of PrintWriter
              > >pw.print(content.getContent());
              > >
              > >However, when I execute the above I get the following exception:
              > >
              > >java.lang.NullPointerException
              > > at
              > >java.net.URLConnection.stripOffParameters(URLConnection.java:1011)
              > > at
              java.net.URLConnection.getContentHandler(URLConnection.java:979)
              > > at java.net.URLConnection.getContent(URLConnection.java:581)
              > >
              > >OK, so fine - I figure that I'm new to this. The documentation for the
              > >URL
              > >class tells me there is another way around this. It says that rather
              > >then
              > >calling getContent() directly, I can open a stream on the URL and read
              > >from
              > >that, like so:
              > >
              > >URL content =
              >
              >servlet.getServletContext().getResource("/content/structure/scenario2resour
              c
              > >es.txt");
              > >FileInputStream fis = content.openStream();
              > >
              > >but when I do this I get the following different exception:
              > >
              > >java.lang.ClassCastException: weblogic.utils.zip.SafeZipFileInputStream^M
              > > at Utility.writeFileToOutput(Utility.java:134)^M
              > >
              > >Apparently this thing is trying to return a web-logic-specific stream
              > >(which
              > >is incompatible with an FileInputStream) - which I don't want to use
              > >or
              > >learn about since I want my stuff to work under other webservers.
              > >
              > >Can anyone tell me what I'm doing wrong? This should be simple.
              > >
              > >-john
              > >
              > >
              > >--
              > >John Hilgedick
              > >WisdomTools, Inc.
              > >[email protected]
              > >
              > >
              >
              

  • Need help to develop Pythagoras theorem-

    Hi i need help to develop proofs 2,3,4
    of pythagoras theorems in java as demonstrations
    These are applets can anyone help me with it or give me an idea of how to go about developing it -
    the site is the following
    http://www.uni-koeln.de/ew-fak/Mathe/Projekte/VisuPro/pythagoras/pythagoras.html
    then double click on the screen to make it start

    Pardon my ASCII art, but I've always liked the following, simple, geometric proof:
         a                   b
    ---------------------------------------+
    |       |                                |
    a|   I   |              II                |
    |       |                                |
    ---------------------------------------+
    |       |                                |
    |       |                                |
    |       |                                |
    |       |                                |
    |       |                                |
    b|  IV   |              III               |
    |       |                                |
    |       |                                |
    |       |                                |
    |       |                                |
    |       |                                |
    |       |                                |
    ---------------------------------------+It almost goes without saying that I+II+III+IV == (a+b)^2, and II == IV == a*b,
    I == a*a and III == b*b, showing that (a+b)^2 == a^2+a*b+a*b+b^2.
    I hope the following sketch makes sense, stand back, ASCII art alert again:     a                   b
    ---------------------------------------+
    |               .             VI         |
    |     .                 .                |a
    | V                               .      |
    |                                        +
    |                                        |
    |   .                                    |
    b|                                     .  |
    |                                        |
    |                  IX                    |
    | .                                      |
    |                                    .   |b
    |                                        |
    +                                        |
    |      .                                 |
    a|               .                  . VII |
    |  VIII                   .              |
    ---------------------------------------+
                     a                    bThe total area equals (a+b)^2 again and equals the sum of the smaller areas:
    (a+b)^2 == V+VI+VII+VIII+IX. Let area IX be c^2 for whatever c may be.
    V+VII == VI+VIII == a*b, so a^2+b^2+2*ab= c^2+2*a*b; IOW a^2+b^2 == c^2
    Given this fundamental result, the others can easily be derived from this one,
    or did I answer a question you didn't ask?
    kind regards,
    Jos

  • I need help to find and open a job app that I exported, was able to fill out and sign and saved and now can't open it? What did I do wrong?

    I need help to find and open a job app that I exported, was able to fill out and sign and saved and now can't open it? What did I do wrong?

    What file format did you export it to?

  • Need help to open audios attached in a PDF file

    Hello
    I just need help. I have ordered a reviewer online that has audios and texts in a pdf file. I was told to download the latest adobe reader on my computer. I have done the same thing on my ipad mini. I am not so technical with regards to these things. Therefore I need help. I can access the audios on my computer but not on my ipad.
    I want to listen to audios with scripts or texts on them so i can listen to them when i am on the go. I was also informed that these files should work in any device. How come the audios doesnt work on my ipad.
    Please help me on what to do.
    Thanks

    Audio and video are not currently support on Adobe Reader. :-<
    You need to buy a PDF reader that supports them. My suggestion is PDF Expert from Readdle ($US 9.99)

  • Need help to open and look for file by name

    Hi,
            Im needing help to open a folder and look for a file (.txt) on this directory by his name ... The user ll type the partial name of file , and i need look for this file on the folder , and delete it ....
    How can i look for the file by his name ?
    Thx =)

    Hi ,
        Sry ,, let me explain again ... I ll set the name of the files in the follow order ... Name_Serial_date_chanel.sxc ..
    The user ll type the serial that he wants delete ...
    I already figured out what i need guys .. thx for the help ^^
    I used List Directory on advanced IO , to list all .. the Name is the same for all ... then i used Name_ concateneted with Serial(typed)* .. this command serial* ll list all serials equal the typed , in my case , ll exist only one , cuz its a count this serial .Then i pass the path to the delete , and its done !
    Thx ^^

  • I need help, my ipod touch is not recognized by windows as a harddisk

    i need help, my ipod touch is not recognized by windows like a memory card or a harddisk.
    i would like to transfer the files from pc to my ipod touch without useing itunes.
    as i see theres some people here that theires ipod touch are recongnzed as a digitl camra, mine is reconzied as nothing, some help plz.
    Message was edited by: B0Om

    B0Om wrote:
    ok but i still dont understed, only my itnes recongnize my ipod, when i go to " my cumputer, it dosent show up there, not even as a digital camra
    Your Touch is working correctly. Currently, without unsupported third party hacks, the Touch has NO disc mode. It will only show up in iTunes.
    how do i put programes and games in my ipod touch
    Right now, you don't. The SDK is scheduled to be released in Feburary. Then developers will be able to write programs that will be loadable.

  • Weird error message need help..

    SO.. i havent updated my itunes in a while because i keep getting this weird message.. it comes up when im almost done installing the newest/newer versions of itunes. it says
    "the feature you are trying to use is on a network resource that is unavailable" "click ok to try again or enter an alternate path to a folder containing the installation package 'iTunes.msi' in the box below"
    now when ever i choose a file from the browse box it replies with this message "the file 'xxx' is not a valid installation package for the product iTunes. try to find the installation package iTunes.msi in a folder from which you can install iTunes."
    no idea need help thanks
    ~~~lake
    Message was edited by: DarkxFlamexCaster
    Message was edited by: DarkxFlamexCaster

    +it comes up when im almost done installing the newest/newer versions of itunes. it says+ +"the feature you are trying to use is on a network resource that is unavailable" "click ok to try again or enter an alternate path to a folder containing the installation package 'iTunes.msi' in the box below"+
    With that one, let's try the following procedure.
    First, head into your Add/Remove programs and uninstall your QuickTime. If it goes, good. If it doesn't, we'll just attend to it when we attend to iTunes.
    Next, download and install the Windows Installer CleanUp utility:
    Description of the Windows Installer CleanUp Utility
    Now launch Windows Installer CleanUp ("Start > All Programs > Windows Install Clean Up"), find any iTunes and/or QuickTime entries in the list of programs in CleanUp, select those entries, and click “remove”.
    Next, we'll manually remove any leftover iTunes or QuickTime program files:
    (1) Open Local Disk (C:) in Computer or whichever disk programs are installed on.
    (2) Open the Program Files folder.
    (3) Right-click the iTunes folder and select Delete and choose Yes when asked to confirm the deletion.
    (4) Right-click the QuickTime folder and select Delete and choose Yes when asked to confirm the deletion. (Note: This folder may have already been deleted if QuickTime was successfully removed using Add/Remove Programs earlier.)
    (5) Delete the QuickTime and QuicktimeVR files located in the C:\Windows\system32\ folder. Click Continue if Windows needs confirmation or permission to continue. (Note: These files may have already been deleted if QuickTime was successfully removed using Add/Remove Programs earlier.)
    (6) Right-click on the Recycle Bin and on the shortcut menu, click Empty Recycle Bin.
    (7) Restart your computer.
    Now try another iTunes install. Does it go through properly now?

  • I got new hard driver for my MacBook I don't have the cd but I do have flash drive that has the software I need help because when I turn on my laptop it shows me a file with question mark how can I install the software from the flash driver?

    I got new hard driver for my MacBook I don't have the cd but I do have flash drive that has the software I need help because when I turn on my laptop it shows me a file with question mark how can I install the software from the flash driver?

    Hold down the Option key while you boot your Mac. Then, it should show you a selection of devices. Click your flash drive and it will boot from that.

  • Need help adobe bridge cc output module

    I need help. I have an assignment I'm held up on completing because the adobe cc bridge does not have the output modue I need. I followed the adobe instructions page to the letter. I copied and pasted the output module folder to the adobe bridge cc extensions folder in programs/commonfiles/adobe. The only thing is the instructions then say to paste the workspace file into the workspace folder located below the bridge extensions folder. I don't have a workspaces folder there or anywhere. I even tried must making one and adding the file to it, but no go. can someone PLEASE help me with this?    I have an assignment due like now that requires the use of the output modue.thanks!

    oh,my system is windows 8.1. sorry, lol.

  • Trying to create a Invoice based on Order need help Error -5002

    the dreaded -5002 error is haunting me too! and I could not find a matching solution for this in the forum....
    I need help quickly on this. I am trying to create invoices for some orders so the Base - Target relationship is retained. The orders I pick are all Open (DocStatus   = O and the lines are all Open LineStatus = O)
    here is my code
    oInvoice.Lines.BaseEntry = 48
    oInvoice.Lines.BaseLine = 0
    oInvoice.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders
    oInvoice.Lines.ItemCode = "A00001"
    oInvoice.Lines.ItemDescription = "IBM Infoprint 1312"
    'adding Line
    oInvoice.Lines.Add
    oInvoice.Lines.BaseEntry = 48
    oInvoice.Lines.BaseLine = 1
    oInvoice.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders
    oInvoice.Lines.ItemCode = "A00002"
    oInvoice.Lines.ItemDescription = "IBM Inforprint 1222"
    'adding Line
    oInvoice.Lines.Add
    lRetCode = oInvoice.Add
    If lRetCode <> 0 Then
        gObjCompany.GetLastError lErrCode, sErrMsg
        MsgBox (lErrCode & " " & sErrMsg)
    End If

    Indika,
    Only set your base types...
    (not items & description)
    oInvoice.Lines.BaseEntry = 48
    oInvoice.Lines.BaseLine = 0
    oInvoice.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders
    oInvoice.Lines.ItemCode = "A00001"
    oInvoice.Lines.ItemDescription = "IBM Infoprint 1312"
    'adding Line (to fill the second item line)
    ' the 1st line item is there by default
    oInvoice.Lines.Add
    oInvoice.Lines.BaseEntry = 48
    oInvoice.Lines.BaseLine = 1
    oInvoice.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders
    oInvoice.Lines.ItemCode = "A00002"
    oInvoice.Lines.ItemDescription = "IBM Inforprint 1222"
    'DO NOT Add THIS line
    ' (only if you want to add a 3rd line item)
    '''oInvoice.Lines.Add -> Don't add this
    lRetCode = oInvoice.Add
    If lRetCode <> 0 Then
        gObjCompany.GetLastError lErrCode, sErrMsg
        MsgBox (lErrCode & " " & sErrMsg)
    End If
    remember to add :
    oInvoice.CardCode = "your BP"
    oInvoice.DocDueDate = Now
    oInvoiceDoc.CardCode = txtDOCBPCode.Text

  • Installation of Photoshop update 13.1.2 for creative cloud fails with error code U44M1P7 I need help

    I need help installing update 13.1.2 for Photoshop creative cloud, installation fails with error code: U44M1P7. Could someone please help?

    Sorry to bother you.
    I could find the answer after searching previous posts about this language problem.
    Had to change my language in AAM profile and then download PS CS6 again ( english version ).
    Then open the actual Photoshop and in preferences > interface you can besides the Dutch also option for English.
    restart application and Voila.
    Greetz, Jeroen

Maybe you are looking for

  • Running a Bat file from a stored procedure

    This is part II of Re: Need to run bat file from application express I thought I would open a new thread I thought I had this fiqured out but it still doesn't work 1) I granted CREATE EXTERNAL JOB to my user 2) startup the OracleJobScheduler Service

  • Removing a movieClip from another movieClip

    Hey,  How do I make visible a movie clip in the main movie from another movie clip when it loads? Not using addchild since the movie clip is on stage. thanks in advance...mesa Main timeline ---- a simple timeline with two movie clips named aMovie bMo

  • My balance not showing up in itunes store.

    I just logged into Itunes and the itunes store. Usally it shows how much balance I have on my prepaid cards left. But it no longer shows it. The computer I have is autherized and i know I have a balance left.

  • Launch a WorkFlow when AdminRole assigned

    How can I launch a custom workflow when a user has an AdminRole assigned to them? Or, is there a general way of launching workflows when user's are updated? I thought about modifying the Update User workflow but I wonder if there's a cleaner way...

  • ITunes and Vista Windows on new computer

    I just bought a new computer which has Vista installed - my old computer (Windows XP) had my ITunes on it. I have been trying to install ITunes on this Vista (Home Premium) computer and it will not install, I get this message when I try to install it