Trying to produce a java chat server

Would like produce a working client/server chat system, as basic as possible but able to listen and talk to each other. Any chat servers how-to examples I've come across never seem to work.
Would like to understand why applets don't work when I open the web page but do work when I view using the appletviewer. I use Internet Explorer 4 i think, java version 1.3.0_02
would you understand at least part of this error which appears when I run a chat server
exception:com.ms.security.SecurityExceptionEx[Client.<int>]:cannot access "194.81.104.26":5660
(the error is all one line no spaces)
the following code is one of the programs I've been working on and I receive the above error, appletviewer doesn't work so i think that means something is wrong with the code, client side as the server side works well, it listens etc
// Client side
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;
public class Client extends Panel implements Runnable
// Components for the visual display of the chat windows
private TextField tf = new TextField();
private TextArea ta = new TextArea();
// The socket connecting us to the server
private Socket socket;
// The streams we communicate to the server; these come
// from the socket
private DataOutputStream dout;
private DataInputStream din;
// Constructor
public Client( String host,int port ) {
// Set up the screen
setLayout( new BorderLayout() );
add( "North", tf );
add( "Center", ta );
// Receive messages when someone types a line
// and hits return, using an anonymous class as
// a callback
tf.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent e ) {
processMessage( e.getActionCommand() );
// Connect to the server
try {
// Initiate the connection
socket = new Socket( host, port );
// Recieved a connection
System.out.println( "connected to "+socket );
// Create DataInput/Output streams
din = new DataInputStream( socket.getInputStream() );
dout = new DataOutputStream( socket.getOutputStream() );
// Start a background thread for receiving messages
new Thread( this ).start();
} catch( IOException ie ) { System.out.println( ie ); }
// Called when the user types something
private void processMessage( String message ) {
try {
// Send it to the server
dout.writeUTF( message );
// Clear out text input field
tf.setText( "" );
} catch( IOException ie ) { System.out.println( ie ); }
// Background thread runs this: show messages from other window
public void run() {
try {
// Receive messages one-by-one, forever
while (true) {
// Get the next message
String message = din.readUTF();
// Print it to our text window
ta.append( message+"\n" );
} catch( IOException ie ) { System.out.println( ie ); }
// ClientApplet
import java.applet.*;
import java.awt.*;
import java.io.*;
import java.net.*;
public class ClientApplet extends Applet
public void init() {
//String host = getParameter( "host" );
     String host="194.81.104.26";
     //int port = Integer.parseInt( getParameter( "port" ) );
     int port =5660;
setLayout( new BorderLayout() );
add( "Center", new Client( host, port ) );
// server
import java.io.*;
import java.net.*;
import java.util.*;
public class Server
// The ServerSocket is used for accepting new connections
private ServerSocket ss;
// A mapping from sockets to DataOutputStreams. This will
// help us avoid having to create a DataOutputStream each time
// we want to write to a stream.
private Hashtable outputStreams = new Hashtable();
// Constructor and while-accept loop all in one.
public Server( int port ) throws IOException {
// listening
listen( port );
private void listen( int port ) throws IOException {
// Create the ServerSocket
ss = new ServerSocket( port);
// ServerSocket is listening
System.out.println( "Listening on "+ss );
// Keep accepting connections forever
while (true) {
// The next incoming connection
Socket s = ss.accept();
// Connection
System.out.println( "Connection from "+s );
// Create a DataOutputStream for writing data to the
// other side
DataOutputStream dout = new DataOutputStream( s.getOutputStream() );
// Save this stream so we don't need to make it again
outputStreams.put( s, dout );
// Create a new thread for this connection, and then forget
// about it
new ServerThread( this, s );
// Get an enumeration of all the OutputStreams, one for each client
// connected to us
Enumeration getOutputStreams() {
return outputStreams.elements();
// Send a message to all clients (utility routine)
void sendToAll( String message ) {
// We synchronise on this because another thread might be
// calling removeConnection()
synchronized( outputStreams ) {
// For each client ...
for (Enumeration e = getOutputStreams(); e.hasMoreElements(); ) {
// ... get the output stream ...
DataOutputStream dout = (DataOutputStream)e.nextElement();
// ... and send the message
try {
dout.writeUTF( message );
} catch( IOException ie ) { System.out.println( ie ); }
// Remove a socket, and it's corresponding output stream, from our
// list. This is usually called by a connection thread that has
// discovered that the connectin to the client is dead.
void removeConnection( Socket s ) {
// Synchronise so sendToAll() is okay while it walks
// down the list of all output streams
synchronized( outputStreams ) {
// Removing connection
System.out.println( "Removing connection to "+s );
// Remove it from our hashtable/list
outputStreams.remove( s );
// Make sure it's closed
try {
s.close();
} catch( IOException ie ) {
System.out.println( "Error closing "+s );
ie.printStackTrace();
// Main routine
// Usage: java Server <port>
static public void main( String args[] ) throws Exception {
// Get the port # from the command line
int port = Integer.parseInt( args[0] );
     //int port = 5000;
// Create a Server object, which will automatically begin
// accepting connections.
new Server( port);
// ServerThread
import java.io.*;
import java.net.*;
public class ServerThread extends Thread
// The Server that spawned
private Server server;
// The Socket connected to our client
private Socket socket;
// Constructor.
public ServerThread( Server server, Socket socket ) {
// Save the parameters
this.server = server;
this.socket = socket;
// Start up the thread
start();
// This runs in a separate thread when start() is called in the
// constructor.
public void run() {
try {
// Create a DataInputStream for communication; the client
// is using a DataOutputStream to write to us
DataInputStream din = new DataInputStream( socket.getInputStream() );
// Over and over, forever ...
while (true) {
// ... read the next message ...
String message = din.readUTF();
// ... sending printed to screen ...
System.out.println( "Sending "+message );
// ... and have the server send it to all clients
server.sendToAll( message );
} catch( EOFException ie ) {
// This doesn't need an error message
} catch( IOException ie ) {
// This needs an error message
ie.printStackTrace();
} finally {
// The connection is closed for one reason or another,
// so have the server dealing with it
server.removeConnection( socket );
<body bgcolor="#FFFFFF">
<applet code="ClientApplet" width=600 height=400>
<param name=host value="127.0.0.1">
<param name=port value="5660">
[Chat applet]
</applet>
</body>

Hi!
Go to
http://www.freecode.com/projects/jchat-java2clientserverchatmodule/
probably u will het the answer..
Jove

Similar Messages

  • Need some help on JAVA CHAT SERVER

    i need some info about java chat server. Please any one who have developed give me the details about the logic and process flow.

    Have you read any of these?
    http://search.java.sun.com/search/java/index.jsp?qp=&nh=10&qt=%2B%22chat+server%22&col=javaforums

  • Java Chat, server/client*x

    Hey,
    I'm trying to make a chat and I've made the server and client, and the server can accept several clients. Only; they communicate client-server, and not client-server-client (if you get what I mean) like I want them to, pretty obviously, since its a chat. I'm still very new to this, heres my code anyhow:
    Server
    import java.net.*;
    import java.io.*;
    public class OJChatServer{
         public static void main(String[] args) throws IOException{
              int port=2556;
              boolean listening = true;
              ServerSocket cServerSocket = null;
              try{
                   cServerSocket = new ServerSocket(port);
                   System.out.println("Server started; Waiting for client(s) to connect.");
              } catch(IOException e){
                   System.err.println("Could not listen on port: "+port);
                   System.exit(1);
              while(listening){
                   try{
                        new handleClient(cServerSocket.accept()).start();
                   } catch(IOException e){
                        System.err.println("Accept has failed");
                        System.exit(1);
              cServerSocket.close();
         static class handleClient extends Thread{
              private Socket clientSocket = null;
              private PrintWriter send;
              private BufferedReader recieve;
              private String inputString, outputString;
              private String clientName = "";
              public handleClient(Socket acceptedSocket){
                   //super("handleClient");
                   this.clientSocket = acceptedSocket;
              public void run(){
                   try{
                        recieve = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
                        send = new PrintWriter(clientSocket.getOutputStream(), true);
                        inputString = recieve.readLine();
                        clientName = inputString;
                        System.out.println("Client \""+clientName+"\" has connected. ("+clientSocket+")");
                        while(inputString != null){
                             outputString = processInput(inputString);
                        //     outputString = send.readLine();
                             send.println(outputString);
                             if(inputString.equalsIgnoreCase("Quit")||inputString.equalsIgnoreCase("/Quit")) break;
                             inputString = recieve.readLine();
                        System.out.println("Client \""+clientName+"\" has disconnected. ("+clientSocket+")");
                   send.close();
                   recieve.close();
                   clientSocket.close();
                   } catch(IOException e){
                        //e.printStackTrace();
                        System.out.println("Client \""+clientName+"\" has disconnected. ("+clientSocket+")");
              }//run()
              static String processInput(String theInput){
                   String theOutput = "From server. Test";
                   return theOutput;
         }//handleClient
    }//OJChatServer---------------------------------------------------------------------------------------------
    Client
    import java.net.*;
    import java.io.*;
    public class OJChatClient{
         public static void main(String[] args) throws IOException{
              String nickname = "Guest";
              String host = "localhost";
              int port = 2556;
              Socket cClientSocket = null;
              PrintWriter send = null;
              BufferedReader recieve = null;
              BufferedReader stdIn = null;
              String fromServer, fromUser;
              System.out.println("Welcome to Ove's Java Chat!\nFor help and commands type: /help");
              nickname = KeyboardReader.readString("Enter nickname: ");
              System.out.println("Connecting to host...");
              try{
                   cClientSocket = new Socket(host, port);
                   send = new PrintWriter(cClientSocket.getOutputStream(), true);
                   System.out.println("Connection established.");
              } catch(UnknownHostException e){
                   System.err.println("Unknown host: "+host);
                   System.exit(1);
              } catch(IOException e){
                   System.err.println("Couldn't get I/O for connection: "+host+"\nRequested host may not exist or server is not started");
                   System.exit(1);
              send.println(nickname);
              stdIn = new BufferedReader(new InputStreamReader(System.in));
              recieve = new BufferedReader(new InputStreamReader(cClientSocket.getInputStream()));
              while((fromServer = recieve.readLine())!=null){
                   System.out.println("Server: "+fromServer);
                   fromUser = stdIn.readLine();
                   if(fromUser!=null){
                        //System.out.println(nickname+": "+fromUser);
                        send.println(fromUser);
                   if(fromUser.equalsIgnoreCase("Quit")||fromUser.equalsIgnoreCase("/Quit")) break;
              System.out.println("Closing connection...");
              send.close();
              recieve.close();
              stdIn.close();
              cClientSocket.close();
              System.out.println("Connection terminated.");
              System.out.println("Goodbye and happy christmas!");
    }I want to make it graphical too, but I want to make it work like it should, before i tackle trying Swing out. This code isn't completely complete yet, as you can see. It doesn't handle the clients messages correctly yet.
    What I want to know is how i should send a message from a client to all the other Sockets on the server.

    It compiles, but it gives an error when the client connects.
    import java.net.*;
    import java.io.*;
    public class OJChatServer4{
         static Socket[] clientSockets = new Socket[100];
         static int socketCounter = 0;
         public static void main(String[] args) throws IOException{
              int port=2556;
              boolean listening = true;
              ServerSocket cServerSocket = null;
              try{
                   cServerSocket = new ServerSocket(port);
                   System.out.println("Server started; Waiting for client(s) to connect.");
              } catch(IOException e){
                   System.err.println("Could not listen on port: "+port);
                   System.exit(1);
              while(listening){
                   try{
                        clientSockets[socketCounter] = cServerSocket.accept();
                        new handleClient(clientSockets[socketCounter]).start();
                        socketCounter++;
                   } catch(IOException e){
                        System.err.println("Accept has failed");
                        System.exit(1);
              cServerSocket.close();
         static class handleClient extends Thread{
              private Socket clientSocket = null;
              public static PrintWriter send;
              private BufferedReader recieve;
              private String inputString, outputString;
              private String clientName = "";
              public handleClient(Socket acceptedSocket){
                   //super("handleClient");
                   this.clientSocket = acceptedSocket;
              public void run(){
                   try{
                        recieve = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
                        send = new PrintWriter(clientSocket.getOutputStream(), true);
                        inputString = recieve.readLine();
                        clientName = inputString;
                        System.out.println("Client \""+clientName+"\" has connected. ("+clientSocket+")");
                        while(inputString != null){
                             //outputString =
                             processInput(inputString);
                        //     outputString = send.readLine();
                             send.println(outputString);
                             if(inputString.equalsIgnoreCase("Quit")||inputString.equalsIgnoreCase("/Quit")) break;
                             inputString = recieve.readLine();
                        System.out.println("Client \""+clientName+"\" has disconnected. ("+clientSocket+")");
                   send.close();
                   recieve.close();
                   clientSocket.close();
                   } catch(IOException e){
                        //e.printStackTrace();
                        System.out.println("Client \""+clientName+"\" has disconnected. ("+clientSocket+")");
              }//run()
              static void processInput(String theInput) throws IOException{
                   //String theOutput = "Test From server.";
                   PrintWriter sendToAll;
                   sendToAll = new PrintWriter(clientSockets[socketCounter].getOutputStream(), true);
                   for(int i=0;i<socketCounter;i++){
                        sendToAll.println(theInput);
                   //return theOutput;
         }//handleClient
    }//OJChatServer

  • Java chat server . . . help!

    i do macromedia flash and well i downloaded this chat flash java chat. now i know nothing about java, and i do have the sdk and java runtimes. as well as the program bluej. now the guy eho made this chat talks about putting up a server and modifing ports and the like. heres a link of what it says:
    http://guardians_of_vox.tripod.com/readme.txt
    now can anyone tell me what to do or what to get, cause i am a total n00b at this.

    Do you have any specific problems? What have you done? What is not working?

  • Java Chat (Server, Client Socket Connection)

    Assignment:
    The assignment is to deliver two source codes that can run a Server (1) and Clients (2) in order to create a simpel chat program. The server has to wait and check an IP (localhost) + Port, and the client has to connect to that port and create a socket connection. The only thing that should be done is create a new socket connection for each client... and when a client sends a message, the message should be delivered to all clients connected to the server.
    Problem...
    However I can read an edit Java, it's difficult for me to write it. I allready found many turturials about socket connections on the internet, and tried to edit those, but they don't really do what I want unless I really write new shit. Is there a way you guys can help me with this, or that you find a really good website that fits my question?

    According to me ,
    take string variable 'str'
    Take some class ,I think u already taken.....
    Scoket scoket = new Socket(IP,port);
    OutputStream out;
    IInputStream in;
    in = socket.getInputStream();
    out = socket.getOutputStream();
    If sends the msg then use
    out.writeObject(str);
    This line sends data to the other user
    msg resivce from client then use
    str = in.readInput();
    & this str set to the any objects out put .
    Such as TextField.setText(str);
    //Server.class
    import java.io.EOFException;
    import java.io.IOException;
    import java.io.ObjectInputStream;
    import java.io.ObjectOutputStream;
    import java.net.ServerSocket;
    import java.net.Socket;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.event.ActionListener;
    import javax.swing.*;
    public class Server extends JFrame
              private JTextField enterdField;
              private JTextArea displayArea;
              private ObjectOutputStream output;
              private ObjectInputStream input;
              private ServerSocket server;
              private Socket connection;
              private int counter=1;
              public Server()
                        super("Server");
                        enterdField = new JTextField();
                        enterdField.setEditable(false);
                        enterdField.addActionListener(
                             new ActionListener()
                                       public void actionPerformed(ActionEvent event)
                                                 sendData(event.getActionCommand());
                                                 //System.out.println(event.getActionCommand());
                                                 enterdField.setText("");
                   add(enterdField,BorderLayout.NORTH);
                   displayArea = new JTextArea();
                   add(new JScrollPane(displayArea),BorderLayout.CENTER);
                   setSize(300,150);
                   setVisible(true);
              public void runServer()
                        try
                                  server = new ServerSocket(12345,100);
                                  while(true)
                                            try
                                                      waitForConnection();
                                                      getStreams();
                                                      processConnection();
                                            catch(EOFException eofexception)
                                                      displayMessage("\nServer terminated connection");
                                            finally
                                                      closeConnection();
                                                      counter++;
                        catch(IOException ioException)
                                  ioException.printStackTrace();
              private void waitForConnection() throws IOException
                        displayMessage("Waiting for connection");
                        connection = server.accept();
                        //System.out.println(server.accept());
                        System.out.println(connection.getInetAddress());//Server Address and Hostname.
                        displayMessage("Connection"+counter +"received from :"+connection.getInetAddress().getHostName());
              private void getStreams() throws IOException
                        System.out.println("Start getStream");
                        output = new ObjectOutputStream(connection.getOutputStream());
                        output.flush();
                        input = new ObjectInputStream(connection.getInputStream());
                        displayMessage("\nGot I/O stream\n");
              private void processConnection() throws IOException //Read data from Client for Server.
                        String message="Connection sucessful To Client";
                        sendData(message);
                        int i=0;
                        setTextFieldEditable(true);
                        do
                                  try
                                            message =(String) input.readObject();//For Client
                                            System.out.println("Input from :"+message);//From Client
                                            displayMessage("\n" + message);
                                            System.out.println("\n" + i++);
                                  catch(ClassNotFoundException classnotfoundexception)
                                            displayMessage("\nUnknown object type recived");
                        while(!message.equals("CLIENT>>>TERMINATE"));
              private void closeConnection()
                        displayMessage("\nTeminating connection");
                        setTextFieldEditable(false);
                        try
                                  output.close();
                                  input.close();
                                  connection.close();
                        catch(IOException ioException)
                                  ioException.printStackTrace();
              private void sendData(String message)//Write data to the Client from the Server.
                        try
                                  output.writeObject("SERVER>>>"+message);//For Client side.
                                  System.out.println(message);
                                  output.flush();
                                  displayMessage("\nSERVER>>>"+message);//On server side.
                        catch(IOException ioException)
                                  displayMessage("\nError writing object");
              private void displayMessage(final String messageToDisplay)
                        SwingUtilities.invokeLater(
                             new Runnable()
                                  public void run()
                                            displayArea.append(messageToDisplay);
              private void setTextFieldEditable(final boolean editable)
                        SwingUtilities.invokeLater(
                             new Runnable()
                                  public void run()
                                            enterdField.setEditable(editable);
              public static void main(String q[])
                        Server app = new Server();
                        app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                        app.runServer();
    //Client.class
    import java.io.EOFException;
    import java.io.IOException;
    import java.io.ObjectInputStream;
    import java.io.ObjectOutputStream;
    import java.net.InetAddress;
    import java.net.Socket;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.event.ActionListener;
    import javax.swing.*;
    public class Client extends JFrame
         private JTextField enterField;
         private JTextArea displayArea;
         private ObjectOutputStream output;
         private ObjectInputStream input;
         private String message="";
         private String chatServer;
         private Socket client;
         public Client (String host)
                   super("Client");
                   chatServer=host;
                   enterField = new JTextField();
                   enterField.setEditable(false);
                   enterField.addActionListener(
                        new ActionListener()
                                  public void actionPerformed(ActionEvent event)
                                            sendData(event.getActionCommand());
                                            enterField.setText("");
                        add(enterField,BorderLayout.NORTH);
                        displayArea = new JTextArea();
                        add(new JScrollPane(displayArea),BorderLayout.CENTER);
                        setSize(300,150);
                        setVisible(true);
         public void runclient()
                   try
                             connectToServer();
                             getStreams();
                             processConnection();
                   catch(EOFException eofException)
                             displayMessage("\nClient treminated connection");
                   catch(IOException ioException)
                             ioException.printStackTrace();
                   finally
                             closeConnection();
         private void connectToServer() throws IOException
                   displayMessage("Attempting connection\n");
                   client = new Socket(InetAddress.getByName(chatServer),12345);
                   displayMessage("Connect to:"+client.getInetAddress().getHostName());
         private void getStreams() throws IOException
                   output = new ObjectOutputStream(client.getOutputStream());
                   output.flush();
                   input = new ObjectInputStream(client.getInputStream());
                   //Thread t = new Thread(this,"Thread");
                   //t.start();
                   displayMessage("\nGot I/O stream\n");
         private void processConnection( ) throws IOException
                   setTextFieldEditable(true);
                   do
                             try
                                       message=(String)input.readObject();
                                       displayMessage("\n"+message);
                             catch(ClassNotFoundException classnotfoundexception)
                                       displayMessage("\nUnknown object type received");
                   while(!message.equals("SERVER>>>TERMINATE"));
         private void closeConnection()
                   displayMessage("\n Closing connection");
                   setTextFieldEditable(false);
                   try
                             output.close();
                             input.close();
                             client.close();
                   catch(IOException ioException)
                             ioException.printStackTrace();
         private void sendData(String message)
                   try
                             output.writeObject("CLIENT>>>"+message);
                             //System.out.println(message);
                             output.flush();
                             displayMessage("\nCLIENT>>>"+message);
                   catch(IOException ioException)
                             displayArea.append("\n Error writing object");
         private void displayMessage(final String MessageToDisplay)
                   SwingUtilities.invokeLater(
                        new Runnable()
                                  public void run()
                                            displayArea.append(MessageToDisplay);
         private void setTextFieldEditable(final boolean editable)
                   SwingUtilities.invokeLater(
                        new Runnable()
                                  public void run()
                                            enterField.setEditable(editable);
         public static void main(String q[])
                   Client app;
                   if(q.length==0)
                             app = new Client("127.0.0.1");
                   else
                             app = new Client(q[0]);
                   app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                   app.runclient();
    Use this example .....
    Give me reply.My method is correct or not
    All the best

  • Installation Problem Sun Java App Server 8.2 PE

    Hello! every body Please help me to get out of this Monster :(
    For last 2 day i m trying to install Sun Java Application Server 8.2 PE. Installing & uninstalling Dozens of time.
    The Installation halted at *51% at Uncompressing sun-as-jsr88-dm.jar*
    I have searched the SDN forums at done every thing provided on the forum but in vain. So please help me i m using Win XP SP2

    `Hello!!!
    Any body there!!
    Such a big forum any body please help me i want to install the server.

  • Error in installing sun java directory server

    dear ,
    i am trying to install sun java directiry server from sun java enterprise server using command line ( ./installer ), but this error reported to me when i issue the installer command .
    # ./installer
    Error occurred during initialization of VM java/lang/NoClassDefFoundError: java/lang/Object
    Error occurred during initialization of VM
    java/lang/NoClassDefFoundError: java/lang/Object
    Thanks in Advance,
    Basem

    Sorry for the delay in response.
    It could be a patch issue. Have you read http://docs.sun.com/app/docs/doc/820-2210/gduwe?a=view
    Have you checked if the problem exists in Web Server 7.0 update 3 as well?
    Can you send more details like :
    isainfo -v
    file /home/sjws7.0/lib/libadminsecurity.so
    ldd /home/sjws7.0/lib/libadminsecurity.so

  • Error when deploy Java Proxy Server EAR to PI

    We are trying to deploy our Java Proxy Server EAR to PI using Visual Administrator. However, it gives the following error:
    Deploy of the ear has errors :
    java.rmi.RemoteException: Cannot deploy application sap.com/TestBatch
    Reason: Errors while compiling:
    .... .java:91 illegal escape character
    if (method.equals("U0024descriptor")) { ....
    We have tried to deploy the same EAR to another PI system and it works fine. As a result, we think we might have missed something when installing or configuring this PI but don't have a clue where to start. We have also tried deploying using SDM but also didn't succeed.

    Hi Pikad !
    I understand that it the very same EAR deployed with no hassle in another PI, here it should work ok, but I think you should check the backslash you are using. If you need to use the backslash character, you must use ("
    U0024descriptor") or change the U to \u0024 for the dollar sign.
    Check:
    Regards,
    Matias.

  • PB With Java Embedded Server! Pls Help

    I'm trying to install the Java Embedded Server Framework and I did it like this! I extracted setup.class into g:\jes2.0. My jdk is installed in "G:\winnt\jdk\bin".
    I add "g:\jes2.0" to my environment variable based on the help file
    "Make sure your CLASSPATH environment variable contains . (the current directory) at the beginning of the list."
    Is this correct?
    Then when I type this in the Command Prompt, this happens :
    G:\>cd jes2.0
    G:\jes2.0>java setup
    Exception in thread "main" java.lang.NullPointerException
    at java.io.RandomAccessFile.open(Native Method)
    at java.io.RandomAccessFile.<init>(RandomAccessFile.java:98)
    at setup.loadOffsetTable(ArchiveClassLoader.java:344)
    at setup.instantiateArchiveReader(ArchiveClassLoader.java:155)
    at setup.<init>(ArchiveClassLoader.java:136)
    at setup.main(ArchiveClassLoader.java:1079)

    [omnigunk],
    May we suggest that you post your question under the topic 'Embedded Server' of "Consumer and Commerce" section. This section is dedicated to discussions on Java Embedded Server and thus you might get the correct audience to assist you with your problem.
    HTH.
    Allen Lai
    Developer Technical Support
    SUN Microsystems
    http://www.sun.com/developer/support/

  • Dynamically changing java.rmi.server.hostname

    Hi all,
    I am trying to change the java.rmi.server.hostname value dynamically to force my rmi stubs to be exposed on a particular ip
    The java app is started with a default value of 172.30.30.200 for the java.rmi.server.hostname attribute using the -D parameter. Before the binding is done, I set the value of the java.rmi.server.hostname in the system properties to localhost and then call the rebind (code snippet below).
    After this, if I use a jndi browser, I do not see the entries for the localhost. However, I see the entries for 172.30.30.200.
    The release notes for 1.4.2 and 1.5.0 indicate that this attribute can be changed dynamically; does not say how though.
    http://java.sun.com/j2se/1.4/docs/guide/rmi/relnotes.html
    Can anyone give me an idea as to what is happenning.
    Thanks a lot for your help
    Properties currentProperties = System.
    String ipAddr = "localhost";
    currentProperties.put("java.rmi.server.hostname", ipAddr);
    System.setProperties(currentProperties);
    UnicastRemoteObject.exportObject(this);
    InitialContext ctx=new InitialContext();
    ctx.rebind(getObjectName().toString(), this);

    java.rmi.server.hostname should be set to whatever hostname or IP address the client should use when trying to connect to the server. It only needs to be set in JVMs which export remote objects, i.e. in server JVMs.

  • Java Chat Servers???

    I hope this isn't an inappropriate query for this forum. I'm looking for a Java Chat Server and was told that Sun/Java provides a free, open source implementation but haven't been able to find it. I've also looked at some of the commercial offerings such as Volano and RealChat. Would anyone like to offer advice on the best options?
    Thanks for any help.

    I've coded my own very basic version but it would be
    much cheaper for my company to buy one than to try
    and do a full-blown, commercial-grade, fully
    de-bugged implementation from scratch or demos, for
    me at least ;-)I'm sure it would be cheaper. I'm sure that chat servers are extremely common, too. By the way, where does Java come into your picture? I don't see any benefit to having a chat server that happened to be written in Java.

  • Trying to access the java script files via jar file in WEB SERVER

    hi all,
    I am trying to access the java script files via jar file ,which is present in Apache webserver in order to minimise the number of hits to app server.some thing like cache ...
    in jsp the code goes like this...
         <script type="text/javascript"  archive="http://localhost:14000/dojo.jar!" src="dojo.jar/parser.js" " ></script>{code}
    But i am not able to access the js file which is put in jar file present in the  webserver.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hi,
    You can use DWR (Direct Web remoting) for that. It is easy AJAX for java. ou can directly call the java script function from java class and also java class from javaScripts..
    Regards,
    Hardik

  • M trying to open a java web site its not opening and server goes to java website...??

    m trying to open a java web site its not opening and server goes to java web sites ...........???

    Java is not available for iOS devices, so the site you are trying to access won't work.

  • Java Chatting hosting and server principles...

    I am developing a chat system for my web site...
    There wiil be three components:
    1. Chat Applet
    2. Chat Server
    3. Client Application(s) - Swing - (my computer)
    The server "chat server" should always be online as long as the web site is being present, though the server will not be on the same machine as the web server.
    Should I use an application server, and do I have to?
    What would your opinions and suggestions and preferences be on this matter?

    You may need to keep the chat server on the same computer as the web server, since applets can only connect to the web server from which they were loaded. Unless you want to mess with applet signing.
    Are firewalls an issue? I.e. can you tell all your customers to open a port in their firewalls to connect to the chat server? In some organizations that can be a showstopper. Consider HTTP-based data transfer. The downside is that it'll require polling by the applet to get new messages from the server. Servlet "/chat/send" where the applet HTTP POSTs to send a message, "/chat/getnew?timestamp=12938901230" to get new messages posted by others, "/chat/setpreference?name=logging&value=yesplease" for setting preferences. Reasonably easily adaptable to a non-applet HTML version also.
    Another trick that gets through most firewalls: run the web server on port 80 (HTTP) and the server on 443 (HTTPS) on the same computer. Ugly but usually works. HTTP with servlets is still easier.
    Re application server: I'd just write a standalone application myself. Open a ServerSocket, get incoming connections, create a thread per connection (or use NIO if you have more than, say, 100 simultaneous connections).

  • Java chat console not appearing

    hi there. please help. i am trying to use java chat console but cannot get it to work. i have tried everthing that the chat site tech asks of me, but still no luck. anyone else had this problem PLEASE let me know how u solved it.
    many thanks

    This isn't really a Java programming question... it's more a "something's disconfigured on someone's computer" question... but, just for fun, here are the things you need to check:
    Does your browser have a Java plug-in installed? Is the version of the Java plug-in compatible with the Java chat version the server is using? Do you have Java enabled in your browser? Do you have this problem with other Java applets from other sites, or only this one?
    I'd recommend upgrading your JVM (or downgrading it, if the site is really that broken), checking your browser settings, and possibly testing with another browser.
    Sincerely,
    Dylan

Maybe you are looking for

  • Setting conversationID while invoking web service.

    Hello, I've developed a WLI process which I want to access as web service. I'm using conversation as explained in "How Do I: Tell Developers of Non-WebLogic Workshop Clients How to Participate in Conversations?" http://e-docs.bea.com/workshop/docs81/

  • SOAP Response conatins no quots, no opening or closing tags.

    Hello All, I have developed WebService and I have deployed it on a server, and I have developed client that speak with the WebService via the JDeveloper generated EmbeddedIntegrationWebServiceStub and everything goes greatly when the WebService and t

  • How to know whether or not it's LTE on 2100 and 2600 MHz. Unlocked Z30 purchase.

    I'm eager to know if the Z30 is good with the 2100 and 2600MHz bands. LTE-good. I read Crackberry.com discussion threads.  It seems that some phones (versions) don't do LTE on some bands. E.g. Z30 version STA100-5 -- band 17 -- isn't LTE. This can be

  • Dynamic CRM 2015 Social Listening.

    Hi, I need to configure and use the Social Listening feature with the trial dynamics CRM 2015. When i go to administration section and try to configure the social listening in the drop down i am getting none so i am not able to configure it. Kindly h

  • Windows System Image Manager doesn't see any ISO image

    I am training for the 70-680 and am trying to create an answer file in Windows System Image Manager.  When I click "File" and try to select an ISO image, none of my ISO files appear although I can see the rest of the files in the share.  What am I mi