Applet-Servlet or RMI - which is better

We are in the process of developing a swing-applet based system that requires regular interaction with multiple databases residing on more than one database server.
The options available before us, as we evaluate are:
a. Use "signed" applets ( as this is going to be essentially an intra-net application) and use JDBC connection to connect to more than one database ( which reside on servers other than the web server).
b. Use applet - servlet communication - basically, the servlet would establish connection to the databases, directly or through EJB, retrieve necessary database information and pass on the objects to the applet - the front end GUI would be controlled by the applet.
c. Use RMI
We would like to have your perspective of the three options, with your experience in this line.
The questions that come to us are:
a. If the system is essentially an intra-net application, is it okay to design with "signed" applet mechanism - how far is this method common in the market and acceptable to the clients? Is it true that the signed applet would be able to establish connection to various "identified servers" that are allowed permissions in the security file?
b. Between applet-servlet and RMI, which is a better method? What should be the factors that need to be considered? Is RMI being widely used or should we be thinking in terms of EJB, eventhough the current project is purely a Java based solution.
Your input is highly appreciated - thanking in advance for any suggestions and inputs that you may provide.
Thanks
Dixie

Dixie,
1) IMHO signed applets are not widely used, but you can use
ordinary applets, which are accessing other resources through
redirector servlet on server side - I mean ordinary applets
are prohibited to establish connect to other than it's own server.
So you will be forced to have special servlet on your server,
which have access to other resources on other servers - this is a
way how to avoid applets limitation.
2) RMI is a heavy solution, because all parameters/objects should
be serialized over net and if network connection is unreliable
working with system will be just a nighmare.
3) If you think that your network connection is unreliable, you can use HTTP protocol between client and server instead of RMI. In this case
you will have following benefits:
i) You can still use all of powerness of thick client
ii) Network unreliability will be defeated
iii) Sometime if you would like to port your application to a thin
client it will be done much more easier than in case of RMI
4) If you would like to use thin client your only problem will
be poorness of UI - if you can go with it - go ahead! Otherwise
use thick client with RMI or HTTP depending on quality of network.
Paul

Similar Messages

  • Applet-Servlet with RMI or HTTP? : for a web based network monitoring tool.

    Hi,
    I need help to make a decision to choose an implementation technique for a tool that I am creating.
    I am creating a utility to display a table of RX and TX bandwidth information in real time from a network device X
    onto a client's web browser.
    I have a JTable based applet to display bandwidth information. However I am running this as a standalone applet. I want
    to create a web based solution (applet/servlet model) to make life easier for the end user.
    As for displaying the bandwidth information, I am using Runtime.exec() function to remote execute commands using ssh/rsh.
    This not only seems to impose a lot of process and network latency overhead, but also seems impractical from a
    security point of view, hence I need a real client/server model to have efficient and secure serialized data transfer across
    the network (through HTTP etc) between the client's web browser and X.
    X has a web server running on it. It essentially is a Linux box (CentOS). I can create a JNLP definition to launch an applet
    from X onto a remote client's web browser. The real problem is: what is the most efficient way to go about the
    servlet implementation? Is it wise to use HTTP get/post? or RMI is the way to go?
    Also I'd appreciate suggestion on any different approaches than what I have in mind above.
    Thanks,
    Rajiv

    Thanks for your time, but I cannot make a front-end in C. It has to be in JSP (or in ASP but I haven't tried yet to program in VBA).
    So that is why I am asking what is the best way of attaching a JSP front-end to the given API.
    PS: Why should I code a .dll to provide a JNI interface for the api? Isn't the JNI interface capable of doing such?

  • Which is better - Applet or JSP?

    I am creating an appilcation. It basically will use a database to allow users to enter new records or edit existing ones. I'm taking over this project from another person, who started it as an applet but didn't get too far. I'm looking at what is better - applet or plain jsp pages. What are the pluses and minues of each?

    Which is better, apples or oranges?
    The are probably no disadvantages to JSP except that you need a JSP server. The main disadvantage to applets is you almost certainly need the users to have the Java Plugin to run it. If they don't, they have to get and install it. JSP doesn't need any of that.

  • Applet Servlet communication compiles but does not communicate

    Hi,
    I have a applet which has a button named A. By clicking the button, the applet passes the letter A to the servlet. The servlet in turn accesses an Oracle database and retrieves the name corresponding to letter A from a table (name is Andy in the present case). The servlet interacts with the databse via a simple stored procedure and uses its output parameter to display the name Andy back in the applet.
    Both the applet and servlet codes have compiled fine(servlet code compiled with -classpath option to servlet jar using a TOMCAT). However, on clicking button A in the applet, I do not get the name Andy.
    Any help/suggestion in resolution of this is highly appreciated. Thanks in advance.
    HTML CODE:
    <html>
    <center>
    <applet code = "NameApplet.class" width = "600" height = "400">
    </applet>
    </center>
    </html>
    STORED PROCEDURE CODE:
    procedure get_letter_description(
    ac_letter IN CHAR,
    as_letter_description OUT VARCHAR2) IS
    BEGIN
    SELECT letter_description INTO as_letter_description FROM letter WHERE letter =
    ac_letter;
    EXCEPTION
    WHEN no_data_found THEN as_letter_description := 'No description available';
    END get_letter_description;
    APPLET CODE:
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import java.util.*;
    import java.io.*;
    import java.net.*;
    public class NameApplet extends Applet implements ActionListener
    private TextField text;
    private Button button1;
    private String webServerStr = null;
    private String hostName = "localhost";
         private int port = 8080;
    private String servletPath = "/examples/servlet/NameServlet?letter=";
    private String letter;
    public void init()
         button1 = new Button("A");
    button1.addActionListener(this);
    add(button1);
              text = new TextField(20);
         add(text);
    // get the host name and port of the applet's web server
              URL hostURL = getCodeBase();
         hostName = hostURL.getHost();
    port = hostURL.getPort();
              webServerStr = "http://" + hostName + ":" + port + servletPath;
    public void actionPerformed(ActionEvent e)
         if (e.getSource() == button1)
         letter = "" + 'A';
    private String getName(String letter){
    String name = "" ;
    try {
              URL u = new URL(webServerStr + letter);
              Object content = u.getContent();
    name = content.toString();
         } catch (Exception e) {
         System.err.println("Error in getting name");
    return name;
    SERVLET CODE:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;
    import java.sql.*;
    import java.util.Properties;
    public class NameAppletServlet extends HttpServlet {
    private static Connection conn = null;
    private static final char DEFAULT_CHAR = 'A';
    private static final char MIN_CHAR = 'A';
    private static final char MAX_CHAR = 'G';
    private static final String PROCEDURE_CALL
    = "{call get_letter_description(?, ?)}";
    protected void doGet( HttpServletRequest request,
    HttpServletResponse response )
    throws ServletException, IOException
    handleHttpRequest(request, response);
    protected void doPost( HttpServletRequest request,
    HttpServletResponse response )
    throws ServletException, IOException
    handleHttpRequest(request, response);
    protected void handleHttpRequest( HttpServletRequest request,
    HttpServletResponse response )
    throws ServletException, IOException
    String phrase = null;
    char letter = getLetter(request, DEFAULT_CHAR);
    if (letter >= MIN_CHAR && letter <= MAX_CHAR) {
    try {
    name = getName(conn, letter);
    } catch (SQLException se) {
    String msg = "Unable to retrieve name from database.";
    name = msg;
    } else {
    String msg = "Invalid letter '" + letter + "' requested.";
    //throw new ServletException(msg);
    phrase = msg;
    response.setContentType("text/plain");
    PrintWriter out = response.getWriter();
    out.println(name);
    private String getName(Connection conn, char letter)
    throws SQLException
    CallableStatement cstmt = conn.prepareCall(PROCEDURE_CALL);
    cstmt.setString(1, String.valueOf(letter));
    cstmt.registerOutParameter(2, Types.VARCHAR);
    cstmt.execute();
    String name = cstmt.getString(2);
    cstmt.close();
    return name;
    private char getLetter(HttpServletRequest request, char defaultLetter) {
    char letter = defaultLetter;
    String letterString = request.getParameter("letter");
    if (letterString!=null) {
    letter = letterString.charAt(0);
    return letter;
    public void init(ServletConfig conf) throws ServletException {
    super.init(conf);
    String dbPropertyFile = getInitParameter("db.property.file");
    try {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    conn = DriverManager.getConnection(
    "jdbc:oracle:thin:myserver:1521:CDD",
    "scott",
    "tiger");
    } catch (IOException ioe) {
    throw new ServletException(
    "Unable to init ReinforcementServlet: " + ioe.toString());
    } catch (ClassNotFoundException cnfe) {
    throw new ServletException(
    "Unable to init ReinforcementServlet. Could not find driver: "
    + cnfe.toString());
    } catch (SQLException se) {
    throw new ServletException(
    "Unable to init ReinforcementServlet. Error establishing"
    + " database connection: " + se.toString());
    }

    Hi,
    I am not able to understand by which method you are doing Applet-Servlet commuincation.
    If you want to use Object Serialization method, plz.get the details from following URL.
    http://www.j-nine.com/pubs/applet2servlet/
    Ajay

  • Is there a good advanced review on applet-servlet communication

    I am working on a web application and unfortunately experiencing a lot of trouble trying to use an applet as front end which interacts with a couple of servlets running on Tomcat. I need to get data from one servlet and send data to another.
    There is a lot of messages posted in this and other forums about how to do this, but none of them got a response pointing to a useful advanced reference on this subject. I have reviewed some of the references given, but couldn't find a thorough detailed advanced reference on applet-servlet communication. For this I mean an exhaustive explanation of the mechanism of communication and when and when is neccesary to use each of the multiple configuration possibilities regarding content-type, message-length, request-method, connection settings, and so on.
    Would anybody be so kind to show me the right direction? As I read the (literally) hundreds of messages posted on this topic, I see this info as widely useful. Most of the topic tracks ends on void or with painful no-way sentences, and maybe many people is avoiding Java technology on web application because of this problem (development delays can abort a project).

    This sample chapter in Java developers' guide to Servlets and Jsp focuses on Applet-Servlet communication, is a pretty good one, and is free :
    http://www.javaranch.com/bunkhouse/samps/2809ch12.pdf
    As to an exhaustive & complete guide that covers absolutely everything, I may be wrong but I doubt you'll find anything like that...unless there is a book somewhere dedicated to the subject.

  • How to configure applet/servlet in Tomcat?

    I'm building a web application which is going to be deployed in Tomcat. I have an applet(called MYAPPLET here) which "calls" a servlet(called MYSERVLET here). I cannot figure out how to configure the whole thing.
    /test is my docbase. In /test I made a directory "applet classes" and a directory "servlet". The applet tag I use in the HTML file looks like this:
    <applet
    code="MYAPPLET.class"
    codebase="http://localhost:8080/test/applet classes/"
    <!-- Tell the applet where its peer is located -->
    <param
    name="servlet"
    value="http://localhost:8080/test/servlet/MYSERVLET" />
    </applet>
    Now, when opening the page, the applet can be found but Tomcat gives an error 404 saying that it can not find the servlet. On the other hand, If I make an entry in my web.xml (with url mapping
    <url-pattern>/test </url-pattern> or <url-pattern>/test/servlet </url-pattern>, depending on where I put MYSERVLET)
    for the servlet mentioned above and I put the MYSERVLET in either the WEB-INF/classes directory or in /test/servlet Tomcat gives an error 403. It refuses to connect to the servlet!
    Please can anyone help me. THanx in advance
    debeumers

    You are configuring Tomcat and if you have further questions then post new questions in the forum "Java Servlet Technology".
    Given that your servlet url is "localhost:8080/test/servlet/MyServlet"
    This assumes -
    1) You have created a web application called "test". You have a directory called "test" under- $CATALINA_HOME/webapps
    2) Your html files, jsp files, and subdirectory "applet-classes" (Note - do Not use spaces when naming directories) exist in this top level directory of your web app. If you choose to place your applet classes in this subdir then the codebase can be "applet-classes" - omitting the "/" means this directory is located relative to the current directory of the html file. (No jar files? No archive param then..)
    3) You have a class file called "MyServlet" located - $CATALINA_HOME/webapps/test/WEB-INF/classes
    Some versions of Tomcat require you to uncomment out the area of the Mapping for the Invoker Servlet element in $CAT_HOME/conf/web.xml.
    <servlet-name>invoker</servlet-name>
    <url-mapping>/servlet/*</url-mapping>
    Once this is done, you need not create a directory called "servlet" anywhere in your structure. It is the url mapping.
    You will want to apply url-patterns and mappings to your application specific web.xml (This is located in - $C_H/webapps/test/WEB-INF) when it comes time to deploy the app, but that is not required for testing and development. You need not make changes to the app specific web.xml at this time just to get the servlet to run.
    And finally I suggest you read a book on this subject...

  • Applet-servlet communication, object serialization, problem

    hi,
    I encountered a problem with tomcat 5.5. Grazing the whole web i didn't find any solution (some guys are having the same problem but they also got no useful hint up to now). The problem is as follows:
    I try to build an applet-servlet communication using serialized objects. In my test scenario i write a serialized standard java object (e.g. a String object) onto the ObjectOutputStream of the applet/test-application (it doesn't matters wheter to use the first or the latter one for test cases) and the doPost method of the servlet reads the object from the ObjectInputStream. That works fine. But if i use customized objects (which should also work fine) the same code produces an classnotfound exception. When i try to read and cast the object:
    TestMessage e = (TestMessage)objin.readObject();
    java.lang.ClassNotFoundException: TestMessage
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1359)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1205)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    ...That seems strange to me, because if i instantiate an object of the same customized class (TestMessage) in the servlet code, the webappclassloader doesn't have any problems loading and handling the class and the code works fine!
    The class is located in the web-inf/classes directory of the application. I've already tried to put the class (with and without the package structure) into the common/classes and server/classes directory, but the exception stays the same (I've also tried to build a jar and put it in the appropriate lib directories).
    I've also tried to catch a Throwable object in order to get information on the cause. But i get a "null" value (the docu says, that this will may be caused by an unknown error).
    I've also inspected the log files intensively. But they gave me no hint. Until now I've spend a lot of time on searching and messing around but i always get this classnotfound exception.
    I hope this is the right place to post this problem and i hope that there is anyone out there who can give me some hint on solving this problem.
    Kindly regards,
    Daniel

    hi, thanks for the reply,
    all my classes are in the web-inf/classes of the web-app and have an appropriate package structure. thus the TestMessage class is inside a package.
    i tried some names for the testclass but it didn't matter. the exception stays the same. I also tried to put the jar in the common/lib but the problem stays.
    Well the problem with loaded classes: As i mentioned in the post above i can instantiate an object of TestMessage in the code without any problems (so the classloader of my webapp should know the class!!)
    only when reading from the objectinputstream the classloader doesn't seem to know the class?? maybe theres a parent classloader resposible for that and doesn't know the class?
    strange behaviour...
    p.s. sending the same object from the servlet to the client works well
    regards
    daniel
    Message was edited by:
    theazazel

  • Which is better, Double Buffering 1, or Double Buffering 2??

    Hi,
    I came across a book that uses a completely different approach to double buffering. I use this method:
    private Graphics dbg;
    private Image dbImage;
    public void update() {
      if (dbImage == null) {
        dbImage = createImage(this.getSize().width, this.getSize().height);
        dbg = dbImage.getGraphics();
      dbg.setColor(this.getBackground());
      dbg.fillRect(0, 0, this.getSize().width, this.getSize().height);
      dbg.setColor(this.getForeground());
      paint(dbg);
      g.drawImage(dbImage, 0, 0, this);
    }that was my method for double buffering, and this is the books method:
    import java.awt.*;
    public class DB extends Canvas {
         private Image[] backing = new Image[2];
         private int imageToDraw = 0;
         private int imageNotDraw = 1;
         public void update(Graphics g) {
              paint(g);
         public synchronized void paint(Graphics g) {
              g.drawImage(backing[imageToDraw], 0, 0, this);
         public void addNotify() {
              super.addNotify();
              backing[0] = createImage(400, 400);
              backing[1] = createImage(400, 400);
              setSize(400, 400);
              new Thread(
                   new Runnable() {
                        private int direction = 1;
                        private int position = 0;
                        public void run() {
                             while (true) {
                                  try {
                                       Thread.sleep(10);
                                  }catch (InterruptedException ex) {
                                  Graphics g = backing[imageNotDraw].getGraphics();
                                  g.clearRect(0, 0, 400, 400);
                                                    g.setColor(Color.black);
                                  g.drawOval(position, 200 - position, 400 - (2 * position), 72 * position);
                                  synchronized (DB.this) {
                                       int temp = imageNotDraw;
                                       imageNotDraw = imageToDraw;
                                       imageToDraw = temp;
                                  position += direction;
                                  if (position > 199) {
                                       direction = -1;
                                  }else if (position < 1) {
                                       direction = 1;
                                  repaint();
              ).start();
         public static void main(String args[]) {
              Frame f = new Frame("Double Buffering");
              f.add(new DB(), BorderLayout.CENTER);
              f.pack();
              f.show();
    }which is better? I noticed smoother animation with the later method.
    Is there no difference? Or is it just a figment of my imagination??

    To be fair if you download an applet all the class files are stored in your .jpi_cache, and depending on how that game requests its graphics sometimes they are stored there to, so really if you have to download an applet game twice, blame the programmer (I've probably got that dead wrong :B ).
    But, what's wrong with Jars. They offer so much more.
    No offence meant by this Malohkan but if you can't organize your downloaded files the internet must really be a landmine for you :)
    Personally I'd be happy if I never seen another applet again, it seems java is tied to this legacy, and to the average computer user it seems that is all java is capable of.
    Admitidly there are some very funky applets out here using lots of way over my head funky pixel tricks, but they would look so much better running full screen and offline.

  • How to show progress - Applet - Servlet

    Hi,
    I am new to applet-servlet communication. I have to show the progress at the applet front-end using a JProgressBar for a task being done at the servlet end. I request the gurus on the forum to post any example code for the above situation.

    Hi,
    U will have to use the SwingWorker to popup the JProgressBar, but in here i dont think u will be getting any input from servlet giving the job completed, if u are using jdk1.4.1 u can use
    setIndeterminate(true);
    I am attaching 2 methods below which i use to display the JProgressBar
    Method long task is where i actually call the servlet and in method buildData i create the URLConnection etc
    //appletData must implement Serializable
    public void buildData(Object appletData)throws Exception
    //define servlet name here
    ObjectInputStream inputFromServlet = null;
    URL          studentDBservlet = new URL("MyServlet");
    URLConnection servletConnection = studentDBservlet.openConnection();
    servletConnection.setDoInput(true);
    servletConnection.setDoOutput(true);
    servletConnection.setUseCaches(false);
    servletConnection.setRequestProperty("Content-Type", "application/octet-stream");
    ObjectOutputStream outputToServlet =
              new ObjectOutputStream(servletConnection.getOutputStream());
         // serialize the object
         if (!SwingUtilities.isEventDispatchThread())
              outputToServlet.writeObject(input);
              outputToServlet.flush();
              outputToServlet.close();
              inputFromServlet = new ObjectInputStream(servletConnection.getInputStream());
         else
              inputFromServlet = longTask(servletConnection, outputToServlet, appletData);
    private ObjectInputStream longTask(final URLConnection servletConnection,
                        final ObjectOutputStream outputToServlet,
                        final Object appletData)
         final JDialog dialog = new JDialog(PlanApplet.appletFrame, "Please Wait", true);
    isProcess = true;
         MapsPanel panel = new MapsPanel();
         panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
         //MapsLabel label = new MapsLabel("Work in process....");
    //label.setFont(Constant.bigFont);
         //label.setPreferredSize(new Dimension(230, 40));
         JProgressBar progressBar = new JProgressBar();
         progressBar.setIndeterminate(true);
         progressBar.setPreferredSize(new Dimension(140, 30));
    // final JugglerLabel jugLabel = new JugglerLabel();
    // jugLabel.startAnimation();
    // panel.setPreferredSize(new Dimension(175, 175));
         MapsPanel progressPanel = new MapsPanel(new FlowLayout(FlowLayout.CENTER, 5, 5));
         progressPanel.setPreferredSize(new Dimension(140, 80));
    progressPanel.add(progressBar);
    //     progressPanel.add(jugLabel);
    //     panel.add(Box.createVerticalStrut(5));
         //panel.add(label);
         panel.add(Box.createVerticalStrut(15));
         panel.add(progressPanel);
         panel.add(Box.createVerticalStrut(15));
         dialog.setSize(150, 115);
         dialog.setResizable(false);
    //     dialog.getContentPane().add(jugLabel);
    dialog.getContentPane().add(panel);
    dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
    dialog.setLocation(ScreenSize.getDialogLocation(dialog));
    //      final javax.swing.Timer popupTimer = new javax.swing.Timer(2000, new TimerListener(dialog));
         final SwingWorker worker = new SwingWorker()
         public Object construct()
              try
              PlanApplet.applet.setCursor(new Cursor(Cursor.WAIT_CURSOR));
              outputToServlet.writeObject(appletData);
              outputToServlet.flush();
              outputToServlet.close();
              return new ObjectInputStream(servletConnection.getInputStream());
              catch (Exception exc)
              return null;
         public void finished()
    // jugLabel.stopAnimation();
              dialog.dispose();
    Toolkit.getDefaultToolkit().beep();
    isProcess = false;
              LogWriter.out("the long process is finished", LogWriter.BASIC);
         worker.start();
    // popupTimer.start();
         //System.out.println("Process complete");
         dialog.show();
    // while(isProcess)
         return (ObjectInputStream) worker.getValue();

  • Applet-Servlet communication (Serialization)

    I need to pass certain objects from server side to the client applet. My applet is embedded in the jsp. Just before calling the applet, Im able to pass the string parameters via jsp <param>tag. Now I need to pass an object which is of a class type. I resorted to serialization. When i try to serialize the object in jsp and try to deserialize it in the applet I get this exception "java.io.StreamCorruptedException: invalid stream header".The jdk versions of applet and servlet are the same. Classes are serializable. But yet am not able to find out the reason for this annoying exception. Please help!

    Thanks for your reply.
    Iam calling the writeObject on an object, writing it to ObjectOutputStream and Iam using ObjectInputStream at the applet side to readObject which is serialized! Iam making use of HttpURLConnection only. Let me cut & paste a part of my applet & JSP code here.
    APPLET:
    =======
    HttpURLConnection jspConnection = null;
              String urlString = ServerAdd+"/xyz/abc.jsp";
              try{
                   URL url = new URL(urlString);
                   jspConnection = (HttpURLConnection)url.openConnection();
              }catch(Exception e){
                   e.printStackTrace();
              jspConnection.setDoInput(true);
              jspConnection.setDoOutput(true);
              jspConnection.setUseCaches(false);
              jspConnection.setDefaultUseCaches(false);
              jspConnection.setUseCaches(false);
              jspConnection.setDefaultUseCaches(false);
              jspConnection.setRequestProperty("Content-Type", "application/octet-stream");
    try{
    System.out.println("Getting inputstream from servlet...");
                   ObjectInputStream inputFromServlet = new ObjectInputStream(jspConnection.getInputStream());
                   System.out.println("Getting bpiPackage from servlet...");
                   bpiPackage = (BPIPackage)inputFromServlet.readObject();
                   inputFromServlet.close();
                   jspConnection.getInputStream().close();
                   jspConnection.disconnect();
                   jspConnection = null;
                   System.out.println("Data transmission from servlet complete...");
              }catch(MalformedURLException e){
                   System.out.println(e);
              }catch(IOException e){
                   System.out.println(e);
              }catch(ClassNotFoundException e){
                   System.out.println(e);
    StreamCorruptedException is thrown here
    ObjectInputStream inputFromServlet = new ObjectInputStream(jspConnection.getInputStream());
    JSP side:
    ========
    BPIPackage pkg = (BPIPackage)session.getAttribute("pkg");
         try{
              System.out.println("Sending package object to applet...");
              ObjectOutputStream outputToApplet = new ObjectOutputStream(response.getOutputStream());
         System.out.println("Writing package object...");
         outputToApplet.writeObject(pkg);
         outputToApplet.flush();
         outputToApplet.close();
         System.out.println("Data transmission to applet complete...");
         }catch (IOException e){
              e.printStackTrace();
    This exception occurs only when applet tries to deserialize data passed from JSP. There is no problem in the connection because there is no exception thrown when the reverse happens (ie.serializing in the applet and deserializing in the JSP using the same jspConnection)
    I hope the code makes my problem clear to you.
    In your reply I did not get this:
    "writing it to a ByteArrrayOutputStream, and taking those bytes, and base64 encoding them, sticking the value in an applet param.
    Then the applet is getting the applet param, and building a ByteArrayInputStream from it, and calling readObject on it.Could you elaborate more?

  • EOF exception during applet - servlet communication

    I am developing a system for the US Gov't. This system currently
              utilizes several applets which access corresponding servlets on
              WebLogic. Seemingly, things went wrong for no apparent reason this
              morning. When, trying to run our applets, WebLogic throws an exception:
              "Caught EOFException in the stream header" These exceptions occur
              everytime the servlet would open the input stream from the applet. What
              makes things mind-boggling is that these applets/servlets were working
              this morning, and suddenly now give these exceptions. The code for both
              the applets and servlets has not been touched in weeks. Furthermore, i
              tested even further by running WebLogic locally and running the applets
              in our IDE (as applications) and the same results occur. I am running
              WebLogic 5.1 SP6 on both the remote and local system and am utilizing
              JDK 1.3 on both as well. The server is running on WinNT SP6 and locally
              is Win2000 Pro SP1. These applets are critical to the entire system and
              i am just totally baffled as to why something that was working fine one
              day ago should all of the sudden spit up errors and exceptions.
              If anyone can give me some insight as to what is going on, please let me
              know.
              Thank you,
              Randy Strobel
              [email protected]
              

    Randy,
              I don't know of any particular reasons why WebLogic would suddenly affect an
              application in the manner that you describe. Start by figuring out where
              the message comes from:
              > "Caught EOFException in the stream header"
              I assume that is in WebLogic's code, not yours? Figure out as close as
              possible who is detecting this error condition. If it is in WebLogic's
              code, you can ask support at BEA to tell you what it is complaining about
              (i.e. what it is expecting to read).
              You will have to post the exception trace here and it would help to see the
              code that is causing the exception.
              Cameron Purdy
              Tangosol, Inc.
              http://www.tangosol.com
              +1.617.623.5782
              WebLogic Consulting Available
              "Randy Strobel" <[email protected]> wrote in message
              news:[email protected]...
              > I am developing a system for the US Gov't. This system currently
              > utilizes several applets which access corresponding servlets on
              > WebLogic. Seemingly, things went wrong for no apparent reason this
              > morning. When, trying to run our applets, WebLogic throws an exception:
              > "Caught EOFException in the stream header" These exceptions occur
              > everytime the servlet would open the input stream from the applet. What
              > makes things mind-boggling is that these applets/servlets were working
              > this morning, and suddenly now give these exceptions. The code for both
              > the applets and servlets has not been touched in weeks. Furthermore, i
              > tested even further by running WebLogic locally and running the applets
              > in our IDE (as applications) and the same results occur. I am running
              > WebLogic 5.1 SP6 on both the remote and local system and am utilizing
              > JDK 1.3 on both as well. The server is running on WinNT SP6 and locally
              > is Win2000 Pro SP1. These applets are critical to the entire system and
              > i am just totally baffled as to why something that was working fine one
              > day ago should all of the sudden spit up errors and exceptions.
              >
              > If anyone can give me some insight as to what is going on, please let me
              > know.
              > Thank you,
              > Randy Strobel
              > [email protected]
              >
              >
              

  • Communication Applet - Servlet

    Hello,
    I'm trying to do a communication Applet - Servlet.
    When i'm typing in my browser internet explorer
    http://pcsm1:8080/servlet/MyServlet
    My servlet is invoqued perfectly and i see the good message in the prompt ms-dos (cf MS-DOS PROMPT : MESSAGE OF THE SERVLET!)
    But when i'm trying with my applet, i have a security exception : cannot access "pcsm1":8080
    SERVLET :
    public class MyServlet extends HttpServlet
    public void init(ServletConfig config)
    System.out.println("Servlet Init");
    public void doGet(HttpServletRequest request,HttpServletResponse response)
    ObjectOutputStream outputToApplet;
    long data=69;
    try
    outputToApplet = new ObjectOutputStream (response.getOutputStream());               System.out.println("Sending data to applet...");
    outputToApplet.writeLong(data);
    outputToApplet.flush();
    outputToApplet.close();
    System.out.println("Data transmission complete.");
    catch (IOException e)
    public void doPost(HttpServletRequest request,HttpServletResponse response)
    APPLET :
    public class MyApplet extends Applet
    public void init()
    try
    URL url = new URL("http://pcsm1:8080/servlet/MyServlet");
    or
    URL url = new URL(getCodeBase(),"http://pcsm1:8080/servlet/MyServlet");
    URLConnection servletConnection = url.openConnection();
    servletConnection.setDoInput(true);
    servletConnection.setDoOutput(true);
    servletConnection.setUseCaches (false);
    servletConnection.setDefaultUseCaches (false);
    servletConnection.setRequestProperty("Content-type","application/octet-stream");
    ObjectInputStream inputFromServlet = new ObjectInputStream(servletConnection.getInputStream());
    data = inputFromServlet.readLong();
    inputFromServlet.close();
    catch (Exception e)
    MS-DOS PROMPT : MESSAGE OF THE SERVLET
    when caller is internet explorer
    C:\Servlet\bin>servletrunner -d "c:\servlet\bin"
    servletrunner starting with settings:
    port = 8080
    backlog = 50
    max handlers = 100
    timeout = 5000
    servlet dir = c:\servlet\bin
    document dir = .\examples
    servlet propfile = c:\servlet\bin\servlet.properties
    Servlet Init
    Sending data to applet...
    Data transmission complete.
    What can i do to avoid my security exception problem?
    Very thanks...

    Are MyServlet and the HTML page hosting MyApplet being served from the same server (i.e., pcsm1:8080)? If not, this is a violation of one of the security constraints placed on unsigned applets.
    If the above scenario is the case, there are three options to overcome:
    1) Create a signed applet
    2) Move the HTML/Applet to the same server as the Servlet
    3) On the server serving the HTML/Applet, create a "proxy" servlet to which the applet can connect and which will in turn contact MyServlet (through HttpURLConnection)

  • Problem in Applet Servlet communication in cluster

              Our new production server has been configured with
              clusters very recently.The application is running fine if and only if one instance
              of weblogic is running.The application has two applets that communicate through a
              servlet and the servlet is hosted by both the WL servers in the cluster.
              Please consider the following scenario :
              1. JSP#1(having embedded tag for Applet#1) is served by, say, WLInstance#1.
              2. JSP#2(having embedded tag for Applet#2) is served by, say, WLInstance#2.
              3. Applet#1 is loaded by BrowserInstance#1.
              4. Applet#2 is loaded by BrowserInstance#2.
              The way I understand applet-servlet communication is as follows :
              The servlets are invoked through the url-pattern specified in web.xml - if the applet
              is making use of a certain url-pattern that is mapped to servlet, then the call from
              that applet will
              eventually invoke a servlet on any of the two instances till a session is established,
              at which point all subsequent requests from the same browser window/frame will go
              to the servlet hosted on the instance where the http session was created.
              (Please correct me, if I am wrong.)
              So, Applet#1 will always talk to the servlet hosted by WLInstance#1 and Applet#2
              will always talk to the servlet hosted by WLInstance#2.
              In our case, the servlet is maintaining data structures to store all the messages
              sent by diffterent instances of Applets.
              The applets periodically polls the messages from those data structures.Once the messages
              are polled, those are deleted from
              the data structures.
              As there are two different instances of the servlet, Applet#1 never gets messages
              posted by Applet#2.
              Is there a way to make this data structure global to both the servlet instances?
              Thanks and best regards,
              Subir Das
              

              "Subir Das" <[email protected]> wrote:
              >So, Applet#1 will always talk to the servlet hosted by WLInstance#1 and
              >Applet#2
              >will always talk to the servlet hosted by WLInstance#2.
              This statement is not entirely true.
              Suppose WLInstance#1 were to be brought down (for whatever reason), Applet#1 will
              then talk to servlet hosted by WLInstance#2.
              Server pinning could be modified by different load balancing algorithms, configurable
              via containers (or hardware).
              So don't count on which servlet instance your applet is going to be served by.
              Instead consider to give a second look into the design of the servlet data structure
              (object):
              1.Read from data store, if it has been persisted.
              2.If the data is client related then consider sticking the data into session, which
              would then replicate to other WL instances.
              3.Stateless EJB in a cluster ? Don' know much about this(yet).
              My 2 cents..Good luck.
              Rama
              

  • How to do Applet/Servlet permanent interactive connection

    Hi, I'm modifying an Instant Messaging Application originally implemented under the Applet client/standalone-server scheme that I'm implementing now under the Applet/Servlet scheme using HTTP Tunneling with Object Serialization. But this yet don't work correctly because the connection's flows are closed ever after a Servlet's response to a client request (in this moment are close the connection's flows). I'm using flows of type ObjectInputStream and ObjectOutputStream using Object Serialization with HTTP Tunneling.
    this is part of the connection code in the servlet side:
    public void doGet (HttpServletRequest request, HttpServletResponse response) throws
    ServletException, IOException{
    doPost( request, response);
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws
    ServletException, IOException{
    is = new ObjectInputStream(
    new BufferedInputStream(request.getInputStream()));
    try{  
    response.setStatus(HttpServletResponse.SC_OK);
    out = new ObjectOutputStream (
    new BufferedOutputStream (response.getOutputStream ()));
    out.writeObject("OK");
    out.flush();
    // Send the input and output flows to the Thread the Handle the client Connection
    newUser(is, out);
    } catch(Exception ex){
    System.err.println("Exc1: "+ex.toString());
    ex.printStackTrace();
    Run Method to read client request:
    public void run() {
    SocketData sd;
    while ((sd = readObject()) != null) {                               
    sd.performAction(this);
    close();
    After a servlet response in the readObject() method the input flow is closed in the reader request of clients and the connection between the applet (client) and servlet is lost.
    How to can implement a smarter HTTP Tunneling with permanent interactive connection beetween the Applet and Servlet such as in the Applet /server Standalone connection using TCP/IP Socket connection.
    Is possible the use of TCP/IP Sockets in the implementation of HTTP Tunneling with Object Serialization in the Applet/Servlet permanent interactive communication scheme?
    some links or code samples?
    Please show me the ligth.
    Thanks greatly a smarter help.

    I'm not sure that I fully understand your problem, but HTTP is a stateless protocol. That means request-response pairs are completely separated from each other.
    You should ask yourself if you really need to use HTTP and a servlet or if a raw TCP/IP communication would be a better approach to your problem.

  • Which is better to use: BEx query or Web Application as an iView in portal?

    Hi gurus!
    Are there any experienced opinions, which is better - publish a BEx query in portal or publish a BEx Web Application in portal? Is it easier to alter the layout attributes etc. if I create a BEx Web Application first before publishing?
    What is the way of fixing for example filter item height if I publish BEx query in portal - is there a Web Application that it uses anyhow which I can fix? Or can I use in that case iView -properties in portal?
    Thankful for advice
    Sari

    ok, means i can use jsp:useBean tag for all my
    classes that are not actually bean. so it will be
    instantiated at run time and provide efficiency .No. Jsp:useBean is used for java bean components.
    >
    but when should i use import statement in my jsp and
    it happen at translation time so will it create any
    type of burden for my code if i import multiple
    classes.For non-java beans, you need to import the classes, period.
    It's not a burden, it's a necessity.

Maybe you are looking for