Need help with java browser "Back" button

All:
I'm trying to make the "Back" button in my Java web browser work. Any help would be greatly appreciated. Here is my code:
import javax.swing.*;
import java.net.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.event.*;
import java.util.*;
import java.io.*;
import javax.swing.text.html.*;
import javax.swing.text.*;
public class Browser implements HyperlinkListener, ActionListener
String source = "http://www.google.com";
final String GO = "Go";
final String Back = "Back";
JEditorPane ep = new JEditorPane(); //a JEditorPane allows display of HTML & RTF
JToolBar tb = new JToolBar(); //a JToolBar sits above the JEditorPane & contains
JTextField tf = new JTextField(40); // the JTextField & go button
JLabel address = new JLabel(" Address: ");
JButton back = new JButton(Back);
JButton go = new JButton(GO);
BorderLayout bl = new BorderLayout();
JPanel panel = new JPanel(bl);
JFrame frame = new JFrame("Billy Wolfe's Browser");
protected Vector history;
public Browser()
openURL(source); //this method (defined below) opens a page with address source
ep.setEditable(false); //this makes the HTML viewable only in teh JEditorPane, ep
ep.addHyperlinkListener(this); //this adds a listener for clicking on links
JScrollPane scroll = new JScrollPane(ep); //this puts the ep inside a scroll pane
panel.add(scroll,BorderLayout.CENTER); //adds the scroll pane to center of panel
tf.setActionCommand(GO); //gives the ActionListener on tf a name for its ActionEvent
tf.setActionCommand(Back);
tf.addActionListener(this); //adds an ActionListener to the JTextField (so user can
go.addActionListener(this); //use "Enter Key")
tb.add(back); //this adds the back button to the JToolBar
tb.add(address); //this adds the Label "Address:" to the JToolBar
tb.add(tf); //this adds the JTextField to the JToolBar
tb.add(go); //this adds the go button to the JToolBar
panel.add(tb,BorderLayout.NORTH); //adds the JToolBar to the top (North) of panel
frame.setContentPane(panel);
frame.setSize(1000,900);
frame.setVisible(true);
}// end Browser()
public void openURL(String urlString)
String start = urlString.substring(0,4);
if(!start.equals("http")) //adds "http://" to the URL if needed
urlString = "http://"+urlString;
}//end if
try
URL url = new URL(urlString);
ep.setPage(url); //this sets the ep page to the URL page
tf.setText(urlString); //this sets the JTextField, tf, to the URL
catch (Exception e)
{ System.out.println("Can't open "+source+" "+e);
}//end try-catch
}//end openURL
public void hyperlinkUpdate(HyperlinkEvent he) //this allows linking
HyperlinkEvent.EventType type = he.getEventType();
if(type == HyperlinkEvent.EventType.ACTIVATED)
openURL(he.getURL().toExternalForm());
history.add(he.getURL().toExternalForm());
}//end hyperlinkUpdate()
public void actionPerformed(ActionEvent ae) //for the GO and BACK buttons
String command = ae.getActionCommand();
if(command.equals(GO))
openURL(tf.getText());
history.add(tf.getText());
//JOptionPane.showMessageDialog(null, "This is a test");
if(command.equals(Back))
try
String lastURL = (String)history.lastElement();
history.removeElement(lastURL);
lastURL = (String)history.lastElement();
// JOptionPane.showMessageDialog(null, lastURL);
ep.setPage(lastURL);
if (history.size() == 1)
back.setEnabled(false);
catch (Exception e)
System.out.println("ERROR: Trouble fetching URL");}
}//end actionPerformed()
}// end Browser class

Here it is. I need to be able to click the Back button and view the previous URL.
import javax.swing.*;
import java.net.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.event.*;
import java.util.*;
import java.io.*;
import javax.swing.text.html.*;
import javax.swing.text.*;
public class Browser implements HyperlinkListener, ActionListener
String source = "http://www.google.com";
final String GO = "Go";
final String Back = "Back";
JEditorPane ep = new JEditorPane(); //a JEditorPane allows display of HTML & RTF
JToolBar tb = new JToolBar(); //a JToolBar sits above the JEditorPane & contains
JTextField tf = new JTextField(40); // the JTextField & go button
JLabel address = new JLabel(" Address: ");
JButton back = new JButton(Back);
JButton go = new JButton(GO);
BorderLayout bl = new BorderLayout();
JPanel panel = new JPanel(bl);
JFrame frame = new JFrame("Billy Wolfe's Browser");
protected Vector history;
public Browser()
openURL(source); //this method (defined below) opens a page with address source
ep.setEditable(false); //this makes the HTML viewable only in teh JEditorPane, ep
ep.addHyperlinkListener(this); //this adds a listener for clicking on links
JScrollPane scroll = new JScrollPane(ep); //this puts the ep inside a scroll pane
panel.add(scroll,BorderLayout.CENTER); //adds the scroll pane to center of panel
tf.setActionCommand(GO); //gives the ActionListener on tf a name for its ActionEvent
tf.setActionCommand(Back);
tf.addActionListener(this); //adds an ActionListener to the JTextField (so user can
go.addActionListener(this); //use "Enter Key")
tb.add(back); //this adds the back button to the JToolBar
tb.add(address); //this adds the Label "Address:" to the JToolBar
tb.add(tf); //this adds the JTextField to the JToolBar
tb.add(go); //this adds the go button to the JToolBar
panel.add(tb,BorderLayout.NORTH); //adds the JToolBar to the top (North) of panel
frame.setContentPane(panel);
frame.setSize(1000,900);
frame.setVisible(true);
}// end Browser()
public void openURL(String urlString)
String start = urlString.substring(0,4);
if(!start.equals("http")) //adds "http://" to the URL if needed
urlString = "http://"+urlString;
}//end if
try
URL url = new URL(urlString);
ep.setPage(url); //this sets the ep page to the URL page
tf.setText(urlString); //this sets the JTextField, tf, to the URL
catch (Exception e)
{ System.out.println("Can't open "+source+" "+e);
}//end try-catch
}//end openURL
public void hyperlinkUpdate(HyperlinkEvent he) //this allows linking
HyperlinkEvent.EventType type = he.getEventType();
if(type == HyperlinkEvent.EventType.ACTIVATED)
openURL(he.getURL().toExternalForm());
history.add(he.getURL().toExternalForm());
}//end hyperlinkUpdate()
public void actionPerformed(ActionEvent ae) //for the GO and BACK buttons
String command = ae.getActionCommand();
if(command.equals(GO))
openURL(tf.getText());
history.add(tf.getText());
//JOptionPane.showMessageDialog(null, "This is a test");
if(command.equals(Back))
try
String lastURL = (String)history.lastElement();
history.removeElement(lastURL);
lastURL = (String)history.lastElement();
// JOptionPane.showMessageDialog(null, lastURL);
ep.setPage(lastURL);
if (history.size() == 1)
back.setEnabled(false);
catch (Exception e)
System.out.println("ERROR: Trouble fetching URL");}
}//end actionPerformed()
}// end Browser class

Similar Messages

  • I need help with a browser problem

    I am was given a new iMac G3 (from 2001) which was really never used.I have not yet had any serious problems with it, but really could use some help with a browser problem.
    I have 4 different web browsers that needs the macro media flash player update. The browsers I use are internet explorer, iCab, Netscape, and the original Mozilla Firefox.
    It would be of great appreciation for the readers of this post to answer my question.
    I am also having the problem with installing the plug - ins for the browsers. Thank You For Taking the Time To read This!

    Hi, rynodino -
    As Tom has suggested, plugins need to be installed in the Plug-Ins folder for the browser.
    Typically each browser will have its own Plug-Ins folder, usually located in the same folder containing the browser itself. In order for each of several browsers to access the same plugins, the plugins must be replicated and placed in each of the Plug-Ins folders for each of the browsers. The easy way to do that is to hold down the Option key while dragging a plugin to the new location - a copy (not an alias) of the plugin will be generated at the location it is dragged to.
    Most plugins will display a Netscape icon regardless of where they are located - this is normal.
    It is not unusual for the installer for a plugin to default its install to the Plug-Ins folder for Internet Explorer. So be it. Just replicate the new plugin to the other Plug-Ins folders as needed.
    Note that some plugin installs will involve more than one item. For those, be sure to replicate all items for it. Using labels can help identify what is new, what has been most recently added, in a Plug-Ins folder.

  • Need help with java J2Se 5.0 upgrade 2

    Having problems with Java when playing on Pogo, the Vaults of Atlantis. When loading, I am getting a message that says that I need to remove and download again, java. That it is not working correctly. I did that yesterday, 05/27/05 and am still experiencing the problem but only after signing off from Pogo and AOL and then trying to sign back on again later in the day. I have to shutdown my computer and bring it back up again and then I can load the Vaults of Atlantis. I have noticed that when I do sign-off from Pogo and AOL, that my java cup stays on in my deskbar. Is that supposed to be normal or is it supposed to disappear? If it is supposed to disappear, what can I do to fix that problem?
    Please, can anyone help?

    Go here http://www.java.com/en/ and click "Download Now".
    If that has problems, click the "Manual Download" link and download the "Windows (Offline Installation)".
    If there are problems, review the Help information to resolve.

  • Need help with Java programming installation question

    Sorry for my lack of knowledge about Java programming, but:....
    A while back I thought I had updated my Java Runtime Environment programming. But I now apparently have two programs installed, perhaps through my not handling the installation properly. Those are:
    J2SE Runtime Environment 5.0 update 5.0 (a 118MB file)
    and:
    Java 2 Runtime Environment, SE v 1.4.2_05 (a 108MB file)
    Do I need both of these installed? If not, which should I uninstall?
    Or, should I just leave it alone, and not worry about it?
    Yeah, I don't have much in the way of technical knowledge...
    Any help or advice would be appreciated. Thank you.
    Bob VanHorst

    Thanks for the feedback. I think I'll do just that. Once in a while I have a problem with Java not bringing up a webcam shot, but when that happens, it seems to be more website based than a general condition.

  • Need help with java

    ok so i have a midterm and need help this question that is gonna be on the midterm. i dont know how to do it and its worth 16 marks!!!! here it is
    the UW Orchestra wants to produce a CD containing all the pieces of music
    from its upcoming concert. In order to do that, it needs to calculate the total length of time for the
    CD. In addition, the conductor wishes to know which piece of music has the longest duration.
    Sample output for the program.
    The Swan (3.88)
    The Bee (0.98)
    Claire de Lune (6.02)
    Liebesfreund (3.38)
    Ragtime (3.48)
    The total time for the CD is 18.74 minutes.
    The longest piece is Claire de Lune.
    Do not include the HTML that is required to embed the program into a Web page (that is, show
    only what you would write between <script> and </script> tags).
    [4 marks] In the following space, define a function, Print, that takes two parameters, Title and
    Length, and outputs a line of text such that Title appears in italics, followed by Length in
    parentheses. The function also returns the value of Length.
    For example, Print("My World",30) will output the line
    My World (30)
    and return the value 30.
    Put your JavaScript program for the remainder of this question in the space provided on the next
    two pages.
    [9 marks]. For each piece of music, your program should input the title of the piece and the
    duration (in minutes) for that piece, and it should output a line showing those values using the
    Print function just defined. After all pieces have been listed, the program should output the
    total length of time for the CD, adding in 0.25 minutes between each piece of music (which is
    needed on the CD to separate the pieces).
    [3 marks] The program should also output the name of the piece that has the longest playing
    time.
    Use reasonable variable names, indentation and good programming style. Documentation and
    comments are not required, but you may add them to explain any assumptions you might want to
    make. You need not check that the input is valid, and you may assume that no two pieces have the
    same duration.
    can anyone help me out! i would be indebt of ur kindness if u can help me out!

    This forum is for Java, not JavaScript. The two have nothing to do with each other.
    And anyway, this is your studying, so you should try to do it, put forth your best effort, and ask specific questions (on the proper fourm).

  • Need Help with Transporting Playlists Back to I-Tunes

    If anyone can help with this issue, I would really appreciate it. Here's my situation:
    After many long hours organizing my playlists on I-Tunes, my pc malfunctioned and I needed a complete software overhaul. Therefore, I have had to reinstall all software programs on my computer...including I-Tunes. Due to these procedures, I have lost all of my playlists on I-Tunes.
    I did manage to save all of my songs to an external hard drive, and I have copied them back to my I-Tunes library (albeit without any playlists). What I would like to be able to do is transfer the organized playlists from my ipod back to I-Tunes to avoid a massive reorganization project.
    I should point out that hardly any of my music has come from buying songs on I-Tunes so the "Transfer Purchases" option does not seem a viable option.
    Thanks so much to anyone who can offer suggestions.

    Aside from the method I already mentioned in this thread, there is Yamipod. This is a free program that transfers music from iPod back to the computer. However, it does not transfer playcounts/ratings etc.
    Other free programs are Pod Player, SharePod and Floola.

  • Help with making a back button

    hi
    in a game im making i have a start menu that then when you click play goes to the game after playing the game, when you die a game over screen appears with a play again button in it i want to put a back button to go to the first frame.
    the way this is set up is that the game over menue is a movie clip with the play again button in it i want to have a back movie clip to make it go to the first frame
    gotoAndStop(1) dosent seem to work or mabye i am doing it wrong
    this my game class file as the game over menu does not have a class file:
    package com.alienattack{
              import flash.display.MovieClip;
              import flash.events.Event;
              import flash.utils.Timer;
              import flash.text.TextField;
              import flash.text.TextFormat;
              import flash.display.Stage;
              public class Game extends MovieClip          {
                        static var ship:MovieClip;
                        static var enemyShipTimer:Timer;
                        static var scoreText:TextField;
                        static var score:Number;
                        static var healthMeter:HealthMeter;
                        static var enemyHealthMeter:EnemyHealthMeter;
                        static var gameOverMenu:GameOverMenu;
                        static var powerUpTimer:Timer;
                        static var miniBossTimer:Timer;
                        static var RocketShipTimer:Timer;
                        var bossCountdown:Number;
                        static var Bombtimer:Timer;
                        private var _stage:Stage;
                        static var backgroundMusic = new BackgroundMusic();
                        var Bullet;
                        public function Game(){
                                     this.addEventListener(Event.ADDED_TO_STAGE,init);
                        function init(e:Event):void{
                                  _stage=stage;
                                  KeyClass.initialize(stage);
                                  stage.focus = this;
                                  ship = new Ship();
                                  ship.x = 300;
                                  ship.y = 150;
                                  _stage.addChild(ship);
                                  enemyShipTimer = new Timer(2000);
                                  enemyShipTimer.addEventListener("timer", sendEnemy);
                                  enemyShipTimer.start();
                                  RocketShipTimer = new Timer(3500);
                                  RocketShipTimer.addEventListener("timer", sendEnemyRocket);
                                  RocketShipTimer.start();
                                  resetScore();
                                  gameOverMenu = new GameOverMenu();
                                  gameOverMenu.x = 0;
                                  gameOverMenu.y = 0;
                                  addChild(gameOverMenu);
                                  gameOverMenu.visible = false;
    gameOverMenu.playAgainButton.addEventListener("mouseDown", newGame); (this is where i think the play again button is but how would i make it so it when to the first frame)
                backgroundMusic.play(0,1000);
                        static function gameOver()
                                  gameOverMenu.visible = true;
                                  enemyShipTimer.stop();
                                  miniBossTimer.stop();
                                  RocketShipTimer.stop();
                                  Bombtimer.stop();
                                  powerUpTimer.stop();
                                  for (var i in EnemyShip.list)
                                            EnemyShip.list[i].kill();
                        function newGame(e:Event)
                                  gameOverMenu.visible = false;
                                  ship.visible = true;
                                  ship.x = 300;
                                  ship.y = 150;
                                  ship.takeDamage(-ship.maxHealth);
                                  ship.addEventListener("enterFrame", ship.move);
                                  resetScore();
                                  enemyShipTimer.start();
                                  miniBossTimer.start();
                                  RocketShipTimer.start();
                                  Bombtimer.start();
                                  powerUpTimer.start();

    hi
    i make a new function back and change the new game to back but the screen does not go to the first frame
    gameOverMenu.backbutton.addEventListener("mouseDown", back);
    function back(e:Event)
                                  gotoAndStop(1);
    any help?

  • Need help with Java always get error

    hey guys need help
    this the problem i get :
    I go to certain websites and I get this error with firefox.
    This Site requires that JavaScript be enabled.
    It is enabled.
    This is the one of the errors in java script console with firefox.
    Error: [Exception... "'Component does not have requested interface' when calling method: [nsIInterfaceRequestor::getInterface]" nsresult: "0x80004002 (NS_NOINTERFACE)" location: "<unknown>" data: no]
    I have installed the java script from there home site and did a test and says everything is fine. Any ideas?
    please help

    Hi 49ers,
    Sorry not to have any real idea of how to help you out here, but this is a Java forum, not JavaScript.
    Some Firefox expert may stumble across your post and be able to offer some advice (I hope they do) but this isn't really the best place to post such questions.
    Try here: http://www.webdeveloper.com/forum/forumdisplay.php?s=&forumid=3
    Good luck!
    Chris.

  • Need help with java will even pay

    I need extreme help. I just don't have time lately to write these programs and I have fallen extremely behind. Basically all I need is to pass this class and right now until I can get some more help I just can't make the deadlines. If someone could help me I will pay you just like a tutor.
    Requirements for Lab.
    You will need to develop a variety of classes for this lab. Specifically, you need to create:
    +1. a "PersonGUI" class that displays fields for a person's: firstName, lastName, identificationNum, and sex.+
    +2. a "StudentGUI" class that provides Java components for the entry of: classification (freshman, sophomore, junior, senior, or graduate student), and Checkboxes for (a student being in the Honor's program and/or in the ROTC).+
    +3. a "FacultyGUI" class that provides Java components for the entry of: rank (instructor, assistant, associate, or full professor), years of service, and salary.+
    +4. a "Statistics" class that, when instantiated, creates an object containing an instance variable for each of the the statistical values outlined below. (Each of these instance variables should be declared to be "private".)+
    Your main Lab6 class should provide a means for the user to:
    +1. Specify the kind of personal data to be entered (Student or Faculty), and+
    +2. Then, depending on the choice made, appropriate fields should be displayed to allow the user to input appropriate information for the type of personal data being entered, and+
    +3. Controls that support the following functionality:+
    * a "CANCEL" control that will terminate any operation currently being performed and return the user to the "Startup" window.
    * a "SAVE" control that will cause the just entered data to be harvested from the graphical user interface and the appropriate statistics to be updated. Note: this function may NOT be performed if any of the student or faculty member data fields have not been filled in.
    * a "RESET" control that will erase all information recorded to date (i.e., all summary variables are reset to zero).
    * a "CLEAR" control that will erase all fields for the personal data currently being entered.
    * and a "DISPLAY TOTALS" control that will display, when pressed, the following data:
    +1. For students:+
    +1. total number of students entered so far,+
    +2. number who are male and number who are female,+
    +3. number of freshmen, sophomores, juniors, seniors, and graduate students,+
    +4. number of students who are in the Honor's program and number who are in the ROTC.+
    +2. For faculty:+
    +1. total number of faculty entered so far,+
    +2. number who are male and number who are female,+
    +3. the name and salary of the highest paid faculty member on campus.+
    Your program should validate numeric data to the extent:
    +1. no numeric field (id number, years of service, or salary) may be left blank by the user. If done so, the user should be alerted to enter a numeric value.+
    +2. when the user enters a "years of service" value for a faculty member - the value entered should be verified to be a valid integer value in the range 1 to 50. If the data entered is outside the valid range or is not a valid integer - your program should reject the value and prompt the user that invalid data has been entered and that a new value is necessary.+
    +3. when a faculty salary is entered, verify that it is a floating-point value in the range $35,000 to $200,000. Handle invalid data as described above.+
    +4. Similarly, if an invalid integer value is entered for the identification number, the value should be rejected and the user prompted to reenter.+
    +5. Information should not be saved, nor should statistical values be updated, until all numeric data has been validated.+
    Note -- You will be graded on appropriate use of instance vs. local variables, use of methods, and passing parameters and returning appropriate values.
    +1. The 'Statistics" class MUST provide "mutator" and "accessor" methods that are required to access values or to modify the values of any variable. REMEMBER ALL VARIABLES ARE DECLARED TO BE "private"!!+
    +2. You should implement methods to verify the data, as detailed above. The methods should return boolean values indicating whether the data is acceptable or not.+

    Sorry to hear about your problems - lack of time, having fallen behind, imminent failure etc - but none of these are Java problems.
    This site deals with Java problems: compiler or runtime behaviour that people can't understand. If you have problems of that sort (and especially if solving those problems would help with the problems you did describe) then post them.
    Otherwise you would seem to be in the wrong place.

  • Need Help with Java Desktop CP Icon

    I just formatted and reinstalled Windows XP Home SP2 and installed the JRE 1.5.0.02. I usually see an icon in my Control Panel but it only appears in the Administrator's CP which I can reach in Safe Mode of course, but it would be easier to deal with if it appeared somewhere on my desktop/taskbar or CP (I am also an Admin). In Safe Mode I made sure that the right settings were made for displaying, but it doesn't.
    I know precious little about Java so I need help here.

    This forum is dedicated to Sun's Java Desktop System, an alternative desktop operating environment. Try reposting here:
    http://forum.java.sun.com/forum.jspa?forumID=54

  • Need help with Java Script to perform a calculation in Adobe Acrobat Pro 9 form

    I have a form (test) that I am creating in Adobe Acrobat Pro 9.
    I need help creating custom Java Script so I can get the desired answer.
    1) There are several questions in each group that require a numerical answer between 0-4
    2) There is a total field set up to sum the answers from all above questions
    3) The final "score" takes the answer from Step 2 above and divides by the total possible answer
    Any help on what Java Script I need to complete this would be greatly appreciated!
    I've attached a "spreadsheet" that shows it in more detail as well as what formulas I used in Excel to get the desired end result.
    Thanks in advance.

    Have you tried the "The field is the average of:"?

  • Need help with Java fonts (broken in 10.4.9)

    Hi, folks,
    There was a post late last year (maybe October?) that explained how to fix a problem with Java fonts. (OK...I know NOTHING, but I am able to follow directions!)
    I play games on Yahoo.com (Literati and Word Racer) that now have unreadable fonts since I upgraded 3 days ago. I seem to remember last year's fix had something to do with disabling fonts. I just can't remember what to do and have spent an hour looking for the post.
    If you can find it - or tell me what to do - I'd appreciate it. Remember, I need really specific directions.
    Thanks.
    iMac duo core   Mac OS X (10.4.9)  

    I am able to set up a new account and work but even after deleting all preferences the problem persists in my admin account.
    I'll try to look for any font corruption and clear font cache but having to reinstall the OS is a real drag. Not sure why PS should corrupt the OS, itself.
    Any chance I can uninstall and remove PS then install again?

  • Need Help With: java.io StreamCorruptedException invalid stream header

    All:
    1. For some time I have tried to correct an error: "java.io StreamCorruptedException invalid stream header" , reoccuring in Jasper Reports source code.
    2. Based upon requirements, The Program packages variables into a HashMap, and creates a "BLOB" object which is inserted into an Oracle database. At a later point, the BLOB object is retrieved, and the "BLOB" contents are read into a byte array. The next occurring task is to retrieve data from the receiving byte array and reconstitute the original HashMap object.
    THIS IS WHEN THE PROGRAM FAILS !!!!!
    3. I can verify the number of bytes going in/out of the "BLOB" object as being the same count. I have tried different approaches listed on diverse sites w/o success. My Source Code Follows:
    // I tried to include only germane source code.
    // THIS SECTION GETS THE BLOB OBJECT AND PUTS IT INTO A BYTE //ARRAY
    rs = ps.executeQuery();
    if (rs.next())
    BLOB myblob =((OracleResultSet)rs).getBLOB("JASPERDATA");
    int chunkSize = myblob.getChunkSize();
    System.out.println("Incomming DATA size is ........." + chunkSize);
    textbuffer = new byte[chunkSize];
    int bytesRead;
    InputStream myis = myblob.getBinaryStream();
    OutputStream myout = myblob.getBinaryOutputStream();
    while((bytesRead = myis.read(textbuffer) )!= -1)
    myout.write(textbuffer);
    myout.flush();
    "" //code not germane to Discussion
              return (textbuffer); //Returns Byte Array
    // I tried to include only germane source code.
    byte [] textbuffer = adb.getBLOBFromQueue(dataFile); // Get Byte Array from above.
    int textbufferLength = textbuffer.length;
              HashMap localParamValueMap = null;
              Object in = new ObjectInputStream(new ByteArrayInputStream(textbuffer ));
              localParamValueMap = (HashMap) ((ObjectInputStream) in).readObject(); // THIS IS THE PROBLEM AREA EXCEPTION OCCURS AT "readObject"
    // ERROR RECEIVED IN TOMCAT
    //ERROR CALLSTACK
    java.io.StreamCorruptedException: invalid stream header
         at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:737)
         at java.io.ObjectInputStream.<init>(ObjectInputStream.java:253)
         at com.entservlet.DisplayJasperReports.doGet(DisplayJasperReports.java:72)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:163)

    Be sure that you are not seeing a secondary problem.
    In my case, with serialized objects back to the client, the client will see this expection when any of the following occurs:
    1) The server has timed out the session and instead of sending back an object, the object stream is seeing the login page.
    2) An error is occured somewhere inside of the jsp code and instead of getting a the expected serailized object in the stream, I'm getting the 500 status page...
    So...
    In your case you are going from one server to tomcat but I wouldn't be surprised if something similar is going on.
    -Dennis

  • Need Help with Java Homework

    This is my first post here, seeking some help with my java homework. I am required to create a program to write out a receipt for a pizza company: name of company, total number of pizzas, costs (including tax etc), and print out the receipt after taking an order from the customer.
    This is a beginner's java class and my book isn't very good at explaining (mainly because it says "will be discussed in ch 14" when we're in ch 1-3 and it's an essential part of the program).
    But anyways, if anyone is up right now, would be helpful for some help. I have a general idea of what I wanna do, but the program so far is very messy and incomplete and having trouble getting it to look nice and proper.

    well there were two ways of doing this, im only 2 weeks new in java so bear with me.....I was gonna set 3 classes, one appclass, one order form, and one receipt. I was told you can combine the order and receipt in 1 class, but I thought doing 3 woudl be better to help me learn more...anyways, I haven't worked on the appclass yet, but for the order I have a very messy set of codes. I know that it's wrong but it's a start, im looking for any input cause the book does not explain very much.
    For the order class, I will be doing showinputdialog boxes for how many pizzas, the sizes, and the toppings. Here is what I have so far ( i know it is VERY messy and disorganized but I am a bit lost in where I should go next):
    * @author AlexNguyen
    * To take the order with number of pizzas and toppings
    package project2;
    import javax.swing.JOptionPane;
    public class Order {
         public int NumberOfPizzas;
         public char Pepperoni;
         public char Sausage;
         public char Cheese;
         public Order(int n) {
         NumberOfPizzas = n;
         JOptionPane.showInputDialog("Enter Number of Pizzas"));
    String ptype; {
         public void start();
         public void takeOrder();
         public void writeReceipt();
              public void takeOrder();
              ptype = Topping
    public String selectPizza(char P, char S, char C) {
         Pepperoni = P;
         Sausage = S;
         Cheese = C;
    public void numPizza(int numberOfPizzas) {
         num = numberOfPizzas;
    JOptionPane.showInputDialog("Topping for Pizza?");
    JOptionPane.showInputDialog("Pizza Size?");
    JOptionPane.showInputDialog("Number of Pizzas?");
    }

  • New @ RMI need help with  java.rmi.UnmarshalException: error unmarshalling

    Hi @ all out there,
    I'm new with Java RMI and have to write a EventSystem for an college project where clients can subscribe to a topic and get notified when someone publishes a message to the subscribed topic.
    At server-side I have a class called EventSystem that provides methods for subscribing and unsubscribing from topics, and also for posting messages (for publishers).
    To subscribe i thought that the client must specify the topic and also itself ( means that a client calls in this way: obj.subscribe("mytopic", this).
    The EventSystem handles a list of all clients, and whenever a new message is posted it goes trough all clients and invokes the handleMessage(String msg) method that all Clients have to provide.
    On my local machine without RMi this concept works just great.
    I now tried to get it working using RMI , but I get the following Exception when starting the client (the server starts fine) :
    Looking up for rmiregistry at 138.232.248.22:1099
    Subscriber exception:
    java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
            java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
            java.io.InvalidClassException: SubscriberImpl; SubscriberImpl; class invalid for deserialization
            at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:336)
            at sun.rmi.transport.Transport$1.run(Transport.java:159)
            at java.security.AccessController.doPrivileged(Native Method)
            at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
            at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
            at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
            at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
            at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
            at java.lang.Thread.run(Thread.java:619)
            at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
            at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
            at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
            at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:178)
            at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132)
            at $Proxy0.subscribe(Unknown Source)
            at SubscriberImpl.main(SubscriberImpl.java:48)
    Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
            java.io.InvalidClassException: SubscriberImpl; SubscriberImpl; class invalid for deserialization
            at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:293)
            at sun.rmi.transport.Transport$1.run(Transport.java:159)
            at java.security.AccessController.doPrivileged(Native Method)
            at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
            at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
            at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
            at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
            at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
            at java.lang.Thread.run(Thread.java:619)
    Caused by: java.io.InvalidClassException: SubscriberImpl; SubscriberImpl; class invalid for deserialization
            at java.io.ObjectStreamClass.checkDeserialize(ObjectStreamClass.java:713)
            at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1733)
            at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
            at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
            at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:306)
            at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:290)
            ... 9 more
    Caused by: java.io.InvalidClassException: SubscriberImpl; class invalid for deserialization
            at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:587)
            at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1583)
            at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
            at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
            ... 13 moreI googled now for 2 hours but can't resolve the problem alone. As far as I can understand I have to serialize Objects that I want to send to the server, right?
    So how can i do this? I've never used serialization till now.
    any ideas how to solve this problem?
    greets from italy and sorry for my very weak english
    bd_italy

    A class has been modified after deployment. Stop the Registry, clean, recompile, and redeploy.

Maybe you are looking for

  • How to start two or more tasks at the same time?

    Hi all,   I have few tasks setup to send analog and digital output to different channel with buffer and given sampling rate. I need to precisely control the timing of samples output to each channel. But if I start the task in labwindows     DAQmxStar

  • Multiple XI systems on one host - problems

    Hi, We have a problem when installing a second XI system on the same host. Symptoms are that the J2EE engine of the first running installation does not work anymore, all java related items either hang or do not start. The abap stack runs as normal. W

  • Help On Adding Multiple Album Art

    For example, let's say I have the album "Murray's Revenge" I want to add an album art from amazon... but it seems like I have to do this individually for each song in the album. How do you add the one album art for multiple songs?

  • Upgrading from 10.3.9 to latest OS?

    I am currently using OS 10.3.9 and would like to upgrade to the latest version possible. I have 933MHz PowerPC G4 2MB L3 cache, 512MB SDRAM. And running 10.3.9. as i just got the new iphone4, and this wouldn't connect with itune or any other programm

  • File transfer of larger size through serial port

    Hi I need to transfer files of larger size may be around 20Kb through serial port. Can some one suggest some idea or can provide any sample VI for achieving this. i guess we cannot send the complete file at a stretch, so we may need to form some pack