Problem on distributed computing with java..?

My problem is:
I have one server and three clients.Firstly 3 clients sends data simultaneously to the server and should be accessed by the server at the same instant.
Server does some calculations using this data and should broadcast the results to clients.The clients after sending the data to server are engaged with their own work.After the completion of their work they should receive the data sent by the server.
Please suggest the solution.
And also which package/methods should I use for broadcasting Data to clients....

Sockets and threads?

Similar Messages

  • Set Date Time Computer with Java in Linux OS

    Dear All,
    How to set date time computer with Java in linux OS?
    Rgds,
    Theo

    There is no API for this you'd have to run an external command using Process.exec.
    This is the wrong forum for general Java "how to" questions.

  • Problem unzipping larger files with Java

    When I extract small zip files with java it works fine. If I extract large zip files I get errors. Can anyone help me out please?
    import java.io.*;
    import java.util.*;
    import java.net.*;
    import java.util.zip.*;
    public class  updategrabtest
         public static String filename = "";
         //public static String filesave = "";
        public static boolean DLtest = false, DBtest = false;
         // update
         public static void main(String[] args)
              System.out.println("Downloading small zip");
              download("small.zip"); // a few k
              System.out.println("Extracting small zip");
              extract("small.zip");
              System.out.println("Downloading large zip");
              download("large.zip"); // 1 meg
              System.out.println("Extracting large zip");
              extract("large.zip");
              System.out.println("Finished.");
              // update database
              boolean maindb = false; //database wasnt updated
         // download
         public static void download (String filesave)
              try
                   java.io.BufferedInputStream in = new java.io.BufferedInputStream(new
                   java.net.URL("http://saveourmacs.com/update/" + filesave).openStream());
                   java.io.FileOutputStream fos = new java.io.FileOutputStream(filesave);
                   java.io.BufferedOutputStream bout = new BufferedOutputStream(fos,1024);
                   byte data[] = new byte[1024];
                   while(in.read(data,0,1024)>=0)
                        bout.write(data);
                   bout.close();
                   in.close();
              catch (Exception e)
                   System.out.println ("Error writing to file");
                   //System.exit(-1);
         // extract
         public static void extract(String filez)
              filename = filez;
            try
                updategrab list = new updategrab( );
                list.getZipFiles();
            catch (Exception e)
                e.printStackTrace();
         // extract (part 2)
        public static void getZipFiles()
            try
                //String destinationname = ".\\temp\\";
                String destinationname = ".\\";
                byte[] buf = new byte[1024]; //1k
                ZipInputStream zipinputstream = null;
                ZipEntry zipentry;
                zipinputstream = new ZipInputStream(
                    new FileInputStream(filename));
                zipentry = zipinputstream.getNextEntry();
                   while (zipentry != null)
                    //for each entry to be extracted
                    String entryName = zipentry.getName();
                    System.out.println("entryname "+entryName);
                    int n;
                    FileOutputStream fileoutputstream;
                    File newFile = new File(entryName);
                    String directory = newFile.getParent();
                    if(directory == null)
                        if(newFile.isDirectory())
                            break;
                    fileoutputstream = new FileOutputStream(
                       destinationname+entryName);            
                    while ((n = zipinputstream.read(buf, 0, 1024)) > -1)
                        fileoutputstream.write(buf, 0, n);
                    fileoutputstream.close();
                    zipinputstream.closeEntry();
                    zipentry = zipinputstream.getNextEntry();
                }//while
                zipinputstream.close();
            catch (Exception e)
                e.printStackTrace();
    }

    In addition to the other advice, also change every instance of..
    kingryanj wrote:
              catch (Exception e)
                   System.out.println ("Error writing to file");
                   //System.exit(-1);
    ..to..
    catch (Exception e)
    e.printStackTrace();
    }I am a big fan of the stacktrace.

  • Problem while distribute software via Java Web Start

    Hi,
    I use JWS to distribute my software to the clients. I use apache 2.2 as webserver.
    My Problem:
    When i put a update a jar on the webserver, the clients have to start JWS twice to get the new file.
    First i thought it is a problem with the webserver. So i have restarted the apache after i�ve put the new jar. ... without success.
    Are there any settings in JWS which take affect?
    Any ideas?
    Tom

    The default behavior is to timeout if checking for an update takes too much time.
    You can add the jnlp element:
    <update check="always"/>
    and updates will always happen on the forst launch (when client is using Java Web Start 1.6.0 or later, update element will be ignored by earlier versions)
    see: http://java.sun.com/javase/6/docs/technotes/guides/javaws/developersguide/syntax.html#security
    /Andy

  • Problem installing program running with Java

    When i start to run a program appear a window witj following message: "preparing to run java virtual machine"..after that appear next small window with installshield wizard. When make a transition between this small windows to start to install the program, nothing happens it is he does not make this transition.
    I already download the new version without results.
    Do have any ideia what could be the problem.?
    Thanks
    Jorge

    Which JRE is bundle inside your application ?
    Is it International or US only ??
    I have a reason to believe that US version is
    throwing NullPointerException when installing it
    on windows 2000 server
    When you starting the installer, The installer is unpacking the JRE - so check which directory it expanded and than Try running java.exe from the JRE that was installed.
    Maybe its currupted, You dont need to run any code
    even if your run java.exe without anything the
    exception is thrown
    If exception is thrown try the international version of JRE

  • Problems using deployJava.js with Java 7

    I found problems which vary by browser to the following script in an HTML page on Windows 7:
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
    <body>
    Launch me!!!
    <script src="http://www.java.com/js/deployJava.js"></script>
    <script>
    deployJava.setInstallerType("kernel");
    deployJava.createWebStartLaunchButton("yourAppHere.jnlp", '1.7.0');
    </script>
    </body>
    </html>
    The problem shows itself when Java 7 is not yet installed. Note: There is no need to have an actual "yourAppHere.jnlp", since the problems surface prior that being a requirement.
    Firefox 8.0:
    When the Launch button is clicked on Firefox, a brief dialog with a progress bar appear showing a small download. At completion, a Security Warning dialog appears:
    "This Java installer did not come from Sun...". The publisher is shown as Oracle America, Inc.
    The install proceeds as normal if the user overides the warning (though eventually missing a real jnlp will catch up with you). I do not know for sure but suspect the problem is with deployJava.js. One fixing this might also want to consider the implications MacOSX port when it is up and ready.
    IE 9.0.3:
    This browser is a total failure. The initial download dialog progresses to the end, then remains & the session is hung. The dialog is modal, so the only escape other than the power button is killing it via Task Manager.
    I am pretty sure these are bugs, but thought would see if others can reproduce Just save html to a file on desktop & double-click. Have these already been reported? Are there other tests that would be good? It has been years since I reported a Java bug, are there directions?
    Edited by: user3055980 on Nov 13, 2011 11:36 AM

    Before un-installing anything except the 1.7.0 JRE from a previous test, I did a search deployJava1.dll, I found 5. All show File Version 6.0.290.11 on the details tab of the properties dialog. That is not to say they are all the same file. I installed a 64 bit JDK, and apparently a 32 bit JRE. I do not remember exactly how I did that. Using the Process Explorer & clicking on the binoculars to find deployJava.dll, it shows that one being used is in C:\Windows\SysWOW64. I am really starting to hate having a JRE built into a JDK. Here is the list:
    1- 513KB 11/7/2011 C:\Program Files\Java\jre6\bin
    2- 513KB 11/7/2011 C:\Window\System32
    3- 513KB 11/7/2011 C:\Program Files\Java\jdk1.6.0_29\jre\bin
    4- 461KB 10/3/2011 C:\Program Files (x86)\Java\jre6\bin
    5- 461KB 10/3/2011 C:\Windows\SysWOW64
    FYI, checks for npDeployJava1.dll were consistent with above, though some were in a new_plugin sub dir. Also, FireFox is x86, not amd64.
    Removing the JDK6 Update 29 (64-bit) knocked out #3.
    Removing Java(TM) 6 Update 29 (64-bit) knocked out #1.
    Removing Java(TM) 6 Update 29 knocked out # 4.
    That leaves 2 & 5 still in place (Did not find any let over npDeployJava1.dll's). Nuked them manaully.
    Still found a references to deployJava1.dll in registry, which were ripped out @
    HKEY_CLASSES_ROOT\CLSID\{CAFEEFAC-DEC7-0000-0000-ABCDEFFEDCBA}\InprocServer32
    HKEY_CLASSES_ROOT\CLSID\{CAFEEFAC-DEC7-0000-0001-ABCDEFFEDCBA}\InprocServer32
    This registry pattern seemed to be repeated, just kept deleting.
    Have a clean system, and am now retrying the tests, BUT IT TRIES TO RUN jre-6u29-windows-i586-iftw-k.exe INSTEAD! I actually followed through for IE & 1.6 is what gets installed NOT 1.7. This is by far the worst. The other stuff might just be because of that stupid JRE instead the JDK. Double checked both the html & JNLP they are still asking for 1.7. Is this a bug or somehow intentional?

  • Problem in Distributed transaction with Oracle 8.1.7 and Weblogic 7.0

              Hi,
              I am using two unmanaged weblogic 7.0 servers and oracle 8.1.7 enterprise edition.
              I am using oracle.jdbc.xa.client.OracleXADataSource for creating connection pool
              in weblogic. The pool gets created fine but when connection it is getting used
              it throws up following error.
              java.sql.SQLException: ORA-02044: transaction manager login denied: transaction
              in progress
              ORA-06512: at "SYS.JAVA_XA", line 0
              ORA-06512: at line 1
              at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
              at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
              at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
              at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
              at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:822)
              at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:1446)
              at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1371)
              at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1900)
              at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:363)
              at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:407)
              at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:171)
              at weblogic.jdbc.jta.VendorXAResource.start(VendorXAResource.java:41)
              at weblogic.jdbc.jta.DataSource.start(DataSource.java:569)
              I don't know what is causing this problem.Please send me the pointers.
              Regards,
              Vikash
              

    ID is a NUMBER and id.toString() is not a number, for
    example it ca be a null reference.
    well we tryed also this version :
    ps.setLong(1, id.longValue());
    moreover the exception wasn't thrown for the value of id :56 but was thrown for the value of id : 88. Hence I think it is a case of something other than my code.
    michal

  • Hi I have a geometry problem.Can anyone help with java code

    Hi I have a non simple polygon . My job is to make it a simple. for that First I need to find the intersecting lines say line AB intersects line CD. If so then I must replace AB & CD with AC & BD or AD or BC which ever keeps the polygon closed . So can anyone help me out with this code
    import java.io.*;
    import java.awt.*;
    import java.awt.geom.*;
    import java.awt.image.*;
    import javax.swing.*;
    public class Simple{
    static int POINTWID = 4; // size of points
    // the x and y arrays hold the coordinates
    // the B array is the order of the points in the polygon
    // You want to fill the C array with the simple polygon
    static double x[] = new double[200];
    static double y[] = new double[200];
    static int B[] = new int[200]; // the permutation matrix
    static int C[] = new int[200]; // the one that becomes simple
    static SimpleFrame myFrame;
    static int numPoints = 3;
    public static void main(String args[]) {
    makePolygons();
    // Create the frame to draw on
    myFrame = new SimpleFrame();
    myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    myFrame.setSize(600, 600);
    myFrame.setVisible(true);
    public static void makePolygons(){
    // Build an array of random points in the unit square
    for(int i = 0; i < numPoints; i++){
    x[i] = Math.random();
    y[i] = Math.random();// Sample program
    B[i] = i; // default permutation
    // Create the simple polygon
    createSimplePolygon();
    * This is the only function you need to mess with
    public static void createSimplePolygon(){
    // Initialize the C[] array with the identity permutation
    for(int i = 0; i < numPoints; i++)
    C[i] = i;
    // Bubble sort the points from left to right
    for(int i = 0; i < numPoints; i++)
    for(int j = 0; j < numPoints - 1; j++)
    if(x[C[j]] > x[C[j+1]]){
    int temp = C[j];
    C[j] = C[j+1];
    C[j+1] = temp;
    public static class SimpleFrame extends JFrame{
    public static JSlider numPointsSlider;
    public SimpleFrame()
    super("Create you own Simple Polygon");
    Container content = getContentPane();
    content.setLayout(new java.awt.BorderLayout());
    JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.setPreferredSize (new java.awt.Dimension(300, 400));
    tabbedPane.addTab("Scrambled", new ScrambledPanel());
    tabbedPane.addTab("Simple", new SimplePanel());
    content.add(tabbedPane, java.awt.BorderLayout.CENTER);
    // Slider for the number of points
    numPointsSlider = new JSlider (javax.swing.SwingConstants.HORIZONTAL,
    3, 100, 11);
    numPointsSlider.addChangeListener (new javax.swing.event.ChangeListener () {
    public void stateChanged (javax.swing.event.ChangeEvent evt) {
    numPointsSliderStateChanged (evt);
    content.add(numPointsSlider, java.awt.BorderLayout.SOUTH);
    private void numPointsSliderStateChanged (javax.swing.event.ChangeEvent evt) {
    numPoints = numPointsSlider.getValue();
    makePolygons();
    repaint();
    public static class ScrambledPanel extends JPanel{           
    public void paintComponent(Graphics g){
    super.paintComponent(g);
    Graphics2D g2 = (Graphics2D) g;
    // First set the scaling to fit the window
    Dimension size = getSize();
    int Xwid = (int) (0.95 * size.width);
    int Ywid = (int) (0.95 * size.height);
    // First draw the segments
    g2.setColor(Color.red);
    for(int i = 0; i < numPoints; i++)
    g2.drawLine((int) (Xwid * x[B[i]]),
    (int) (Ywid * y[B[i]]),
    (int) (Xwid * x[B[(i+1) % numPoints]]),
    (int)(Ywid * y[B[(i+1) % numPoints]]));
    // Now draw the points
    for(int i = 0; i < numPoints; i++){
    g2.fillRect((int) (Xwid * x) - POINTWID,
    (int) (Ywid * y[i]) - POINTWID,
    2*POINTWID + 1, 2*POINTWID + 1);
    public static class SimplePanel extends JPanel{
    public void paintComponent(Graphics g){
    super.paintComponent(g);
    Graphics2D g2 = (Graphics2D) g;
    // First set the scaling to fit the window
    Dimension size = getSize();
    int Xwid = (int) (0.95 * size.width);
    int Ywid = (int) (0.95 * size.height);
    // First draw the segments
    g2.setColor(Color.red);
    for(int i = 0; i < numPoints; i++)
    g2.drawLine((int) (Xwid * x[C[i]]),
    (int) (Ywid * y[C[i]]),
    (int) (Xwid * x[C[(i+1) % numPoints]]),
    (int)(Ywid * y[C[(i+1) % numPoints]]));
    // Now draw the points
    for(int i = 0; i < numPoints; i++){
    g2.fillRect((int) (Xwid * x[i]) - POINTWID,
    (int) (Ywid * y[i]) - POINTWID,
    2*POINTWID + 1, 2*POINTWID + 1);

    Hi I am sorry I could explain you properly . Ok
    My program gives me a polygon(as you can see when u
    run this program)But the polygon is a non simple
    polygon.So to make this polygon we must remove all
    the crossings betweeen edges in the polygon.The
    algorithm which i gave will remove all the crossings
    and make the polygon simple.You did not give an algorithm!
    SO my job is to take the
    existing code and implement the algorithm for this
    program in the Createsimpelpolygon() function. For
    this First the program must find whether two edges
    cross if they cross then swap the vertices like
    replace AB & CD with AC & BD or AD & BC.Which ever
    keeps the polygon closed . Still not entirely clear to me. You cannot just go and replace vertexes from a polygon: that way you'll end up with a different polygon.
    So as we go on we find the
    many crossings and iterate the algorithm on all the
    crossings until we get simple polygon.Like I said: I don't really understand what it is you're after. You did not respond to my suggestions, so I gather it is not what you're after?
    What about Polygon Tessellation (Google for it)? Perhaps that's what you want.
    Also, why do you not create a (or use java.awt's) Point class and a Polygon class which holds a java.util.Set of Point's? Your current code looks rather messy.

  • Disconnected Distributed Computing in Java

    Hi, the organization I work for is heavily into JSP/Servlet applications. However, there are a large number of computers which have very slow network links, so they want to find some technology in which we can develop applications which are disconnected, then do a mass synchronization with a Servlet every hour or evening etc.
    Is there a Java technology which:
    1. application source is centralized and downloadable to client
    2. allow for disconnected use of the application
    3. synchronize with the server when the application becomes connected with the server
    thanks
    Don

    Jini, is for application to application communication over hetrogenous networks and object protocols. It does not manage distribution of application or synchronization of application data for limited connection applications.
    Don

  • Problems securing WSRP portlet with Java keystore

    Hi.
    I am following the tutorial in the webcenter developer guide to secure my WSRP (jsr-168) portlet using WS-security.
    I have set-up my Java keystore for the producer and consumer with a trial CA certificate from verisign.
    The producer.jks looks like this:
    Keystore type: jks
    Keystore provider: SUN
    Your keystore contains 1 entry
    consumer, Apr 19, 2007, trustedCertEntry,
    Certificate fingerprint (MD5): 09:0E:0B:B9:62:A7:87:E8:A1:6F:10:A3:2D:75:12:2D
    The producer store contains one alias, namely consumer.
    I have copied the producer.cer and jks to a sub-dir of the application directory in the embedded Oracle webcenter OC4J server dir:
    C:\jdevs\jdev10132\jdev\extensions\oracle.adfp.seededoc4j.10.1.3.2.0\j2ee\home\applications\webcenter-advanced\jks
    In the EM console I want to configure the keystore (application-scoped) and signature settings for the WSRP markup service. However, after I specify the right keystore settings and alias for the signature (consumer) and click on ok I get the error message that the alias consumer does not exists in the keystore...
    Am I missing a crucial step here or am I doing something wrong.
    Hope you can help me
    Kind regards
    -Tom

    Hello
    I am not sure to see what could be the issue...
    Do you have a simple portlet not secured in the provider ? And does this one works ?
    If not you probably have a issue with the Registration URL, is this URL is correct ? Does the Portal middle tier can access the provider server ? (proxy, FW, ... can be installed between the portal and the provider and do not allow the portal to call this provider)
    Regards
    Tugdual Grall

  • Mediasmart software problem loading onto computer with new hard drive and operating system

    My computer recently crashed and I had to buy a new hard drive and operating system.  None of the programs from the old hard drive were saved.  The computer is  an HP Pavilion dv7-3165dx Entertainment Notebook and I have Windows 7 Professional (64x) as the operating system.  Tried to download Mediasmart from the HP Web page to play DVD and Blu-Ray Discs.  The programs downloaded but will not install.  Any suggestions?

    waynesworld57 wrote:
    My computer recently crashed and I had to buy a new hard drive and operating system.  None of the programs from the old hard drive were saved.  The computer is  an HP Pavilion dv7-3165dx Entertainment Notebook and I have Windows 7 Professional (64x) as the operating system.  Tried to download Mediasmart from the HP Web page to play DVD and Blu-Ray Discs.  The programs downloaded but will not install.  Any suggestions?
    Hi,
    It looks like it's a common issue: http://h30434.www3.hp.com/t5/TX-TM-Series-Notebooks-Reply-Only/HP-Mediasmart-Software-package-for-Wi...
    Try VLC as a multimedia player: http://www.videolan.org/vlc/download-windows.html
    Dv6-7000 /Full HD/Core i5-3360M/GF 650M/Corsair 8GB/Intel 7260AC/Samsung Pro 256GB
    Testing - HP 15-p000
    HP Touchpad provided by HP
    Currently on Debian Wheeze
    *Please, help other users with the same issue by marking your solved topics as "Accept as Solution"*

  • Having problem setting system property with java -D name = value

    I want some clarification. Consider the statement below
    java -Djava.rmi.server.codebase=file:/c:\public_html\classes/
    -Djava.rmi.server.hostname=xyz.com
    -Djava.security.policy=java.policy engine.ComputeEngine
    1. Is the syntax right for specifying a file directory as codebase?
    -Djava.rmi.server.codebase=file:/c:\public_html\classes/
    2. What does this hostname property imply? Does this mean that the program which is started can be accesed by xyz.com?
    -Djava.rmi.server.hostname=xyz.com

    Kurt,
    I modified some of my directory structure as shown below and tried to execute. But I have got the same error again. Could you tell how to correct this error?
    Under c:\home\ann\public_html\classes directory, I have the Following:
    Sub-directory compute [Contains Compute.class and Task.class File]
    Sub-directory engine [Contains ComputeEngine_Skel.class and ComputeEngine_Stub.class Files]
    Sub-directory Meta-inf [Contains Manifest.mf file]
    File compute.jar
    Under c:\home\ann\src directory, I have the following:
    Sub-directory engine [Contains ComputeEngine.java, ComputeEngine.class]
    File java.policy
    Under c:\home\jones\public_html\classes directory, I have the Following:
    Sub-directory client [Contains Pi.class File]
    Current working directory is c:\home\ann\src
    The output from echo %CLASSPATH% was c:\home\ann\src; c:\home\ann\public_html\classes\compute.jar
    When executing the command:
    java -Djava.rmi.server.codebase=file:/c:\home\ann\public_html\classes
    -Djava.rmi.server.hostname=bwing2
    -Djava.security.policy=java.policy engine.ComputeEngine
    I am getting the error,
    ComputeEngine Exception: Stub class not found: engine.ComputeEngine_Stub; nested exception
    is : java.lang.ClassNotFoundException: engine.ComputeEngine_Stub
    java.rmi.StubNotFoundException: Stub class not found:
    Sridhar

  • Distributing JRE with Java Swing Game

    I am developing some game using java swing. With the games I
    need to ship JRE because each user does not have JRE..
    So is there any other other solution.

    I forgot the name, but there is a very nice Installer tool that allows you to bundle your program with a JRE. Search the news groups.

  • Have a problem using flex ui with Java application

    Hi, I have a built a Flex UI for a java project. The UI has
    some forms which use a servlet for POST and data populated from
    servlet. I have used HTTP service to make the calls. I have built
    my application i.e UI in Flex Builder and when I run my application
    from flex builder everything works fine i.e data populated
    correctly..
    But when I open the projects folder and run the html file
    generated the Http Service does not happen. Can anybody tell me why
    is this so?? . Moreover I want use this UI for my already existing
    java project. So what all files (i,e. html, mxml, swf) will be
    required to be copied to my java project for the UI to work ..
    .Thanks in advance...

    well, that's because Flex Builder is tell Flash player to
    trust stuff in the bin folder:
    http://viconflex.blogspot.com/2008/08/why-no-sandbox-violation-running-from.html
    ATTA

  • Problem faced Using Swig with Java

    Hi,
    I have been using SWIG-1.3.29 to Wrap C into Java.I hava interface file ie "example.i" and java File
    "main.java". Now i set the path
         JAVA_INCLUE
         C:\Program Files\Java\jdk1.5.0_01\include;
         JAVA_BIN
         C:\Program Files\Java\jdk1.5.0_01\bin;
    and set java.library.path=.;D:\........\example.i;%path%;
         1.Now In Command Prompt
              Swig -java -example.i
         2. Swig makes "example.java", "example_wrap.c","exampleJNI.java".
         3.Compile the java file
         4.After Compilation i try to run the java program ,the following exception is occuring.
              java.lang.UnsatisfiedLinkError: no example in java.library.path
              at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
              at java.lang.Runtime.loadLibrary0(Runtime.java:822)
              at java.lang.System.loadLibrary(System.java:992)
              at main.main(main.java:10)     
    If i hava missed any steps please tell me.

    one more thread?

Maybe you are looking for