Java client socket readers
I'm running a cluster of 3 WL 6.0 servers and when I do a JNDI lookup to run methods
on a remote interface stub on the client side it gives me the following:
<Apr 26, 2001 2:16:34 PM MST> <Warning> <JavaSocketMuxer> <There are: '3' active
sockets, but the maximum number of socket readers allowed by theconfiguration
i
s: '2', you may want alter your configuration.>
I re-ran my client with the two following properties:
-Dweblogic.system.executeThreadCount=5
-Dweblogic.system.percentSocketReaders=60
it still gives me the exception. How do I get this to work properly so I have
as many socket readers as servers?
Thanks in advance.
Thanks,
I had understood this wrong, I was configuring on the server, not the client
application,
it's all working well now.
Cheers
Sioux
"Kumar Allamraju" <[email protected]> wrote in message
news:[email protected]...
> i.e. if percentSocketReaders = 50, and execute Threadcount is 20, 50% of
20 = x?
>
> you will get x percentSocketReaders. You might want to tune this value ,
> according to the above
> formula.
>
>
> Sioux France wrote:
>
> > Hi,
> > I'm getting these errors too. I've enabled native IO, upped the number
of
> > Threads to 20 and the percentage of readers to 50% but I still get the
error
> > about 3 active sockets when I am only allowed 2 in a cluster of 3
servers.
> > Did you resolve this?
> > Thanks
> > Sioux
> >
> > "Kumar Allamraju" <[email protected]> wrote in message
> > news:[email protected]...
> > > The following syntax was correct in 510. , not in 60 anymore.
> > > I would suggest you to increase the execute Thread count & percent
socket
> > readers from
> > > console.
> > >
> > > or else set the following from the command line.
> > > -Dweblogic.ThreadPoolPercentSocketReaders
& -Dweblogic.ThreadPoolSize..
> > (i'm not 100%
> > > sure)
> > > --
> > > Kumar
> > >
> > > "W. Wen" wrote:
> > >
> > > > I'm running a cluster of 3 WL 6.0 servers and when I do a JNDI
lookup to
> > run methods
> > > > on a remote interface stub on the client side it gives me the
following:
> > > >
> > > > <Apr 26, 2001 2:16:34 PM MST> <Warning> <JavaSocketMuxer> <There
are:
> > '3' active
> > > > sockets, but the maximum number of socket readers allowed by
> > theconfiguration
> > > > i
> > > > s: '2', you may want alter your configuration.>
> > > >
> > > > I re-ran my client with the two following properties:
> > > >
> > > > -Dweblogic.system.executeThreadCount=5
> > > > -Dweblogic.system.percentSocketReaders=60
> > > >
> > > > it still gives me the exception. How do I get this to work properly
so I
> > have
> > > > as many socket readers as servers?
> > > >
> > > > Thanks in advance.
> > >
>
Similar Messages
-
Increasing Weblogic client Socket Readers etc
How can you increase the number of socket readers on a client
application which
uses JMS, EJB and talks to multiple WLAS servers.
I get the following message
Muxer> <There are: '3' active sockets, but the maximum number of socket
readers allowed by theconfiguration is: '2', you may want alter your
configuration.>
But I cant find out how to increase the socket readers or better yet can
I use the native IO for Solaris and NT clients??Hi,
You can control the number of threads and the precent of socket readers
through the properties: weblogic.ThreadPoolSize and
weblogic.ThreadPoolPercentSocketReaders. You would have to pass them to the
jvm machine at startup for example:
-Dweblogic.ThreadPoolSize=10 -Dweblogic.ThreadPoolPercentSocketReaders=50
Guy
"Larry Presswood" <[email protected]> wrote in message
news:[email protected]..
How can you increase the number of socket readers on a client
application which
uses JMS, EJB and talks to multiple WLAS servers.
I get the following message
Muxer> <There are: '3' active sockets, but the maximum number of socket
readers allowed by theconfiguration is: '2', you may want alter your
configuration.>
But I cant find out how to increase the socket readers or better yet can
I use the native IO for Solaris and NT clients?? -
Error in the Socket Communication between Java Client and VC++ Server
In my application, using Java Client to do socket bi-communication with VC++ Server, which is done by somebody else.
The error is after the application properly running one or two days, the VC++ Server cannot receive the messages passed by java Client, but at Java client, everything is the same, although using CheckError() after every print(), there is no exception thrown.
The JVM is jdk1.3.1, platform is Win2k Server.
The outputstream is PrintWriter().
Please help me to settle down this problem. Thanks in advance.I read some thread in the forum, and found somebody had the similar problem with me. Just want to know how to settle this problem.
In the client/server program. Client is a JAVA program and Server a
VC++ program. The connection works, and the problem appears after some time. The Client sends a lots of requests to Serverm, the server seems receive nothing. But at the same time, the server is able to send messages to Client. The Client also can get the messages and handle them. Don't understand why there this problem and why it appears when it wants.
The client is a Win2k platorm with JDK1.3.1 and the server is also a Win2K platform with VC++ 6.0.
In the Client, using:
inputFromServer = new BufferedReader(new InputStreamReader(socket.getInputStream()));
outputToServer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())),true);
Hope can get your help. -
Increasing max number of socket readers on client
How can you increase the number of socket readers on a client
application which
uses JMS, EJB and talks to multiple WLAS servers.
I get the following message
Muxer> <There are: '3' active sockets, but the maximum number of socket
readers allowed by theconfiguration is: '2', you may want alter your
configuration.>
But I cant find out how to increase the socket readers or better yet can
I use the native IO for Solaris and NT clients??
Try to use the WebItem Parameter "MAX_TEXT_LINES":
<object>
<param name="OWNER" value="SAP_BW"/>
<param name="CMD" value="GET_ITEM"/>
<param name="NAME" value="DOCUMENT_1"/>
<param name="ITEM_CLASS" value="CL_RSR_WWW_ITEM_DOC"/>
<param name="DATA_PROVIDER" value="DATAPROVIDER_1"/>
<b><param name="MAX_TEXT_LINES" value="50"/></b>
ITEM: DOCUMENT_1
</object> -
Increasing socket readers in client program
I am trying to connect to multiple Weblogic servers from a single client at
the same time and get the following message:
<Sep 14, 2001 10:21:15 AM CDT> <Warning> <JavaSocketMuxer> <There are: '3'
active
sockets, but the maximum number of socket readers allowed by
theconfiguration is
: '2', you may want alter your configuration.>
How do I change the configuration in my client so I can have more the two
connections.
Thanks,
Jim Andersonjava -Dweblogic.ThreadPoolSize=15 -Dweblogic.ThreadPoolPercentSocketReaders= 75
(means 75% of ThreadPoolSize)
-classpath %classpath%;. etc...
James Anderson wrote:
I am trying to connect to multiple Weblogic servers from a single client at
the same time and get the following message:
<Sep 14, 2001 10:21:15 AM CDT> <Warning> <JavaSocketMuxer> <There are: '3'
active
sockets, but the maximum number of socket readers allowed by
theconfiguration is
: '2', you may want alter your configuration.>
How do I change the configuration in my client so I can have more the two
connections.
Thanks,
Jim Anderson -
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 -
Socket Communication between java client and c++ server
HI,
In my project,I want to do the following:
1.Sending datas from client to server.
2.Getting the response from server to client.
I written the client in java.but the server is in c++.
Is it possible to communicate with the server using java codings itself?
Im able to send the data from my java client to the server.
but unable to get back the datas from server to client.
Can anyone tell me how to do this?
thanks a lothi
thanks for ur reply.
I didnt get any error msg while getting the back the datas.
Actually i divided my application into two parts.
My application will act as both server and client.
server ll get the browser request and send to the client and the client will send that data to the c++ server.
Im able to do that.and unable to get the data from server.
Didnt get any error.
can u tell me how to make an application to act as both client and server.
I think im wrong in that part.
thanks a lot -
Currently using WebLogic 6.1 SP2 on Win NT 4.0 with jdk 1.3.1. 2 servers in a cluster.
The following message is seen.
<ExecuteThread: '10' for queue: 'default'> <> <> <000000> <There are: '7' active
sockets, but the maximum number of socket readers allowed by the configuration
is: '6', you may want to alter your configuration.>
How do we ensure our configuration is correct? Whenever this message is seen and
the servers need to start. If we do not restart them, after a while they will
hang and we need to restart them. Is there any way to resolve this issue? Thanks.Hi,
Thanks for your info on Native IO.
There is a JVM error message thrown when we are trying to do the thread dump.
From the JDK website, we realise it is a bug for jdk 1.3.1. Thanks.
Regards,
Ai Ling
Arunabh Hazarika <[email protected]> wrote:
When native i/o is used, there are a fixed number of threads that are
dedicated to reading
incoming requests from clients. These threads are non-blocking i.e. they
do not block
waiting for data to arrive at a socket. When using Java i/o, the threads
block waiting for
data to arrive at a socket. In this case, if the number of sockets opened
is greater than
the number of threads available to read them, data on the remaining sockets
will remain
unread, until a thread becomes available to read it and response time
will increase. This is
basically what the message means.
It is not surprising that performance has degraded by turning off native
i/o. The message is
not the problem - turning off native i/o is.
I do not recall there being a problem with taking thread dumps with JDK
1.3.1 - what
indicates that the thread dump is not complete?
Arunabh
apple wrote:
Hi Arunabh,
Is this message critical? As we encounter this message, the server'sperformance
is very slow. Without this message, the access to the server is muchfaster. We
will like to know whether we can ignore this message or this messagehas any implication
to our servers.
As for your proposal to enable the native io and take thread dump,we have already
done that. But due to our jdk version used, we are not able to getthe full thread
dump.
Thanks.
Regards,
apple
Arunabh Hazarika <[email protected]> wrote:
To answer your second message first, yes, this message comes when
native
i/o is
disabled. For the first problem, I am not sure how disabling nativeio
would help
resolve a server hang - Please take a thread dump when the serverhangs
with native
i/o enabled and post it here.
Thanks,
Arunabh
apple wrote:
Hi Arunabh,
Our application server will use up the threads very fast and not
releasing
them
after usage, causing our servers to hang once we enable native io.Thus we have
no choice but to disable the native io. Is there any resolution
for
this? Is it
due to we disable native io which cause the following message to
appear?
<ExecuteThread: '10' for queue: 'default'> <> <> <000000> <Thereare:
'7' active
sockets, but the maximum number of socket readers allowed by the
configuration
is: '6', you may want to alter your configuration.>
Thanks for your prompt reply.
Regards,
Apple
Arunabh Hazarika <[email protected]> wrote:
It looks like you have native io disabled. Is there a reason why?
Arunabh
apple wrote:
Currently using WebLogic 6.1 SP2 on Win NT 4.0 with jdk 1.3.1.
2
servers
in a cluster.
The following message is seen.
<ExecuteThread: '10' for queue: 'default'> <> <> <000000> <There
are:
'7' active
sockets, but the maximum number of socket readers allowed by
the
configuration
is: '6', you may want to alter your configuration.>
How do we ensure our configuration is correct? Whenever this
message
is seen and
the servers need to start. If we do not restart them, after a
while
they will
hang and we need to restart them. Is there any way to resolve
this
issue? Thanks. -
Connecting Java client to SSL server with existing certificates
I am currently trying to connect my Java client to an existing server application
written in C++. I have been provided the needed certificates (root.pem, server.pem,
and client.pem). My code simply creates a SSLSocket and then attempts to read
from it. Something goes wrong during the handshake process and I get a SSLHandshakeException. The certificates have been added to the keystore
I am using, and I do not know any other action to take.
Here is the debug output:
setting up default SSLSocketFactory
use default SunJSSE impl class: com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl
class com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl is loaded
keyStore is :
keyStore type is : jks
keyStore provider is :
init keystore
init keymanager of type SunX509
trustStore is: keystore.jks
trustStore type is : jks
trustStore provider is :
init truststore
adding as trusted cert:
Subject: [email protected], CN=Employee, OU=test, O=company-USA, L=City, ST=AL, C=US
Issuer: [email protected], CN=company Employee, OU=test, O="company, Inc.", L=City, ST=AL, C=US
Algorithm: RSA; Serial number: 0xb40b909f74d167aa
Valid from Tue Sep 12 09:42:01 CDT 2006 until Thu Oct 12 09:42:01 CDT 2006
adding as trusted cert:
Subject: [email protected], CN=Employee, OU=test, O="company, Inc.", L=City, ST=AL, C=US
Issuer: [email protected], CN=ISAC Employee, OU=test, O="company, Inc.", L=City, ST=AL, C=US
Algorithm: RSA; Serial number: 0xb40b909f74d167ab
Valid from Tue Sep 12 09:49:12 CDT 2006 until Thu Oct 12 09:49:12 CDT 2006
adding as trusted cert:
Subject: [email protected], CN=company Employee, OU=test, O="company, Inc.", L=City, ST=AL, C=US
Issuer: [email protected], CN=company, OU=test, O="company, Inc.", L=City, ST=AL, C=US
Algorithm: RSA; Serial number: 0xf6e3ada87dc4004f
Valid from Tue Sep 12 09:40:32 CDT 2006 until Thu Oct 12 09:40:32 CDT 2006
init context
trigger seeding of SecureRandom
done seeding SecureRandom
instantiated an instance of class com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl
SSL socket created
%% No cached client session
*** ClientHello, TLSv1
RandomCookie: GMT: 1158089181 bytes = { 138, 112, 170, 91, 246, 86, 216, 146, 160, 188, 243, 154, 238, 132, 33, 219, 251, 3, 93, 25, 191, 247, 41, 14, 99, 135, 130, 23 }
Session ID: {}
Cipher Suites: [SSL_RSA_WITH_RC4_128_MD5, SSL_RSA_WITH_RC4_128_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_256_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA, SSL_RSA_WITH_DES_CBC_SHA, SSL_DHE_RSA_WITH_DES_CBC_SHA, SSL_DHE_DSS_WITH_DES_CBC_SHA, SSL_RSA_EXPORT_WITH_RC4_40_MD5, SSL_RSA_EXPORT_WITH_DES40_CBC_SHA, SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA, SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA]
Compression Methods: { 0 }
[write] MD5 and SHA1 hashes: len = 79
0000: 01 00 00 4B 03 01 45 07 0A DD 8A 70 AA 5B F6 56 ...K..E....p.[.V
0010: D8 92 A0 BC F3 9A EE 84 21 DB FB 03 5D 19 BF F7 ........!...]...
0020: 29 0E 63 87 82 17 00 00 24 00 04 00 05 00 2F 00 ).c.....$...../.
0030: 35 00 33 00 39 00 32 00 38 00 0A 00 16 00 13 00 5.3.9.2.8.......
0040: 09 00 15 00 12 00 03 00 08 00 14 00 11 01 00 ...............
Client Thread, WRITE: TLSv1 Handshake, length = 79
[write] MD5 and SHA1 hashes: len = 107
0000: 01 03 01 00 42 00 00 00 20 00 00 04 01 00 80 00 ....B... .......
0010: 00 05 00 00 2F 00 00 35 00 00 33 00 00 39 00 00 ..../..5..3..9..
0020: 32 00 00 38 00 00 0A 07 00 C0 00 00 16 00 00 13 2..8............
0030: 00 00 09 06 00 40 00 00 15 00 00 12 00 00 03 02 .....@..........
0040: 00 80 00 00 08 00 00 14 00 00 11 45 07 0A DD 8A ...........E....
0050: 70 AA 5B F6 56 D8 92 A0 BC F3 9A EE 84 21 DB FB p.[.V........!..
0060: 03 5D 19 BF F7 29 0E 63 87 82 17 .]...).c...
Client Thread, WRITE: SSLv2 client hello message, length = 107
[Raw write]: length = 109
0000: 80 6B 01 03 01 00 42 00 00 00 20 00 00 04 01 00 .k....B... .....
0010: 80 00 00 05 00 00 2F 00 00 35 00 00 33 00 00 39 ....../..5..3..9
0020: 00 00 32 00 00 38 00 00 0A 07 00 C0 00 00 16 00 ..2..8..........
0030: 00 13 00 00 09 06 00 40 00 00 15 00 00 12 00 00 .......@........
0040: 03 02 00 80 00 00 08 00 00 14 00 00 11 45 07 0A .............E..
0050: DD 8A 70 AA 5B F6 56 D8 92 A0 BC F3 9A EE 84 21 ..p.[.V........!
0060: DB FB 03 5D 19 BF F7 29 0E 63 87 82 17 ...]...).c...
Client Thread, received EOFException: error
Client Thread, handling exception: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
Client Thread, SEND TLSv1 ALERT: fatal, description = handshake_failure
Client Thread, WRITE: TLSv1 Alert, length = 2
[Raw write]: length = 7
0000: 15 03 01 00 02 02 28 ......(
Client Thread, called closeSocket()
Error: Remote host closed connection during handshake
Thread-4, handling exception: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake(I am the original poster of this message, I had to create a new username though).
The original problem had to do with incompatibilities with the protocol and/or cipher suites
used. Now, the client and server perform most of the handshake process, but something
goes wrong as the server requests the client certificate. In other words, the server requires
mutual authentication, but for some reason it seems like my JSSE client won't send over
it's client certificate. I don't get any type of bad certificate exceptions, so I'm not sure
where the source of the error lies.
Updated output:
setting up default SSLSocketFactory
use default SunJSSE impl class: com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl
class com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl is loaded
keyStore is : keystore
keyStore type is : jks
keyStore provider is :
init keystore
init keymanager of type SunX509
trustStore is: truststore
trustStore type is : jks
trustStore provider is :
init truststore
adding as trusted cert:
Subject: [email protected], CN=Employee, OU=default, O="default Inc.", L=default, ST=AL, C=US
Issuer: [email protected], CN=default Employee, OU=default, O="default, Inc.", L=default, ST=AL, C=US
Algorithm: RSA; Serial number: 0xb40b909f74d167ab
Valid from Tue Sep 12 09:49:12 CDT 2006 until Thu Oct 12 09:49:12 CDT 2006
adding as trusted cert:
Subject: [email protected], CN=default-Server, OU=HawkEye, O=default, L=default, ST=AL, C=US
Issuer: [email protected], CN=default Employee, OU=default, O="default, Inc.", L=default, ST=AL, C=US
Algorithm: RSA; Serial number: 0xb40b909f74d167ac
Valid from Tue Sep 12 14:42:28 CDT 2006 until Thu Oct 12 14:42:28 CDT 2006
adding as trusted cert:
Subject: [email protected], CN=default Employee, OU=default, O="default, Inc.", L=default, ST=AL, C=US
Issuer: [email protected], CN=default Employee, OU=default, O="default, Inc.", L=default, ST=AL, C=US
Algorithm: RSA; Serial number: 0xf6e3ada87dc4004f
Valid from Tue Sep 12 09:40:32 CDT 2006 until Thu Oct 12 09:40:32 CDT 2006
init context
trigger seeding of SecureRandom
done seeding SecureRandom
instantiated an instance of class com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl
%% No cached client session
*** ClientHello, TLSv1
RandomCookie: GMT: 1158242806 bytes = { 71, 195, 185, 44, 86, 96, 14, 11, 171, 76, 105, 135, 136, 114, 53, 54, 137, 75, 202, 254, 112, 208, 240, 91, 199, 246, 175, 207 }
Session ID: {}
Cipher Suites: [SSL_RSA_WITH_RC4_128_MD5, SSL_RSA_WITH_RC4_128_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_256_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA, SSL_RSA_WITH_DES_CBC_SHA, SSL_DHE_RSA_WITH_DES_CBC_SHA, SSL_DHE_DSS_WITH_DES_CBC_SHA, SSL_RSA_EXPORT_WITH_RC4_40_MD5, SSL_RSA_EXPORT_WITH_DES40_CBC_SHA, SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA, SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA]
Compression Methods: { 0 }
Client Thread, WRITE: TLSv1 Handshake, length = 79
Client Thread, READ: TLSv1 Handshake, length = 74
*** ServerHello, TLSv1
RandomCookie: GMT: 1158242807 bytes = { 63, 93, 48, 73, 98, 251, 160, 215, 61, 110, 246, 12, 5, 209, 95, 194, 152, 193, 0, 181, 135, 26, 150, 174, 52, 92, 56, 250 }
Session ID: {83, 31, 134, 30, 76, 200, 183, 120, 7, 94, 26, 65, 186, 91, 197, 25, 10, 193, 94, 220, 198, 250, 162, 153, 6, 89, 12, 250, 66, 105, 249, 211}
Cipher Suite: TLS_RSA_WITH_AES_128_CBC_SHA
Compression Method: 0
%% Created: [Session-1, TLS_RSA_WITH_AES_128_CBC_SHA]
** TLS_RSA_WITH_AES_128_CBC_SHA
Client Thread, READ: TLSv1 Handshake, length = 1903
*** Certificate chain
chain [0] = [
Version: V3
Subject: [email protected], CN=Employee, OU=default, O="default, Inc.", L=default, ST=AL, C=US
Signature Algorithm: SHA1withRSA, OID = 1.2.840.113549.1.1.5
Key: Sun RSA public key, 1024 bits
modulus: 164546130673614659100546464587508805401937082626997447139358150641653094778762702643605529386963945060462618417820295217144739538713137107756847225226998964727905246706969036839701385553183842454061172884072035749790213037240682893878786969498404371282074360019097248835858617183835587887295684928062301303789
public exponent: 65537
Validity: [From: Tue Sep 12 09:49:12 CDT 2006,
To: Thu Oct 12 09:49:12 CDT 2006]
Issuer: [email protected], CN=default Employee, OU=default, O="default, Inc.", L=default, ST=AL, C=US
SerialNumber: [ b40b909f 74d167ab]
Certificate Extensions: 4
[1]: ObjectId: 2.16.840.1.113730.1.13 Criticality=false
Extension unknown: DER encoded OCTET string =
0000: 04 1F 16 1D 4F 70 65 6E 53 53 4C 20 47 65 6E 65 ....OpenSSL Gene
0010: 72 61 74 65 64 20 43 65 72 74 69 66 69 63 61 74 rated Certificat
0020: 65 e
[2]: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: C8 EA 02 93 42 9E 44 D1 55 7D 2D 32 4B 9B 1C 6D ....B.D.U.-2K..m
0010: 63 6B 73 82 cks.
[3]: ObjectId: 2.5.29.35 Criticality=false
AuthorityKeyIdentifier [
KeyIdentifier [
0000: 2C BC 66 DC 06 BA 62 79 3B 1A 20 92 E0 81 71 A0 ,.f...by;. ...q.
0010: 0D 05 3C 95 ..<.
[[email protected], CN=default Employee, OU=default, O="default, Inc.", L=default, ST=AL, C=US]
SerialNumber: [ f6e3ada8 7dc4004f]
[4]: ObjectId: 2.5.29.19 Criticality=false
BasicConstraints:[
CA:false
PathLen: undefined
Algorithm: [SHA1withRSA]
Signature:
0000: BF 60 5A 67 3E E6 F0 92 4F E4 81 6D 71 0A 2E E8 .`Zg>...O..mq...
0010: F3 59 A1 87 7B D1 3A 7A CB FF D6 39 63 79 B6 82 .Y....:z...9cy..
0020: 2A 22 D0 46 51 30 6B 2A 61 6B A0 4C F0 3B CE 5B *".FQ0k*ak.L.;.[
0030: 9C 1D 46 CB D7 C2 B2 23 E2 A5 06 CD 12 F8 A9 CB ..F....#........
0040: B5 A2 43 B1 06 4C 42 B5 67 F2 DF 50 6B BC 8A 5E ..C..LB.g..Pk..^
0050: 95 0D F3 2A 73 A8 5A C8 55 77 D7 36 74 16 9E 05 ...*s.Z.Uw.6t...
0060: 85 C6 DC 3C 44 D3 06 5E 47 0C 1F 80 40 30 C7 D8 ...<D..^G...@0..
0070: 8C 27 FF B9 0C 71 EB D4 31 5C 1F 15 A1 23 6F A2 .'...q..1\...#o.
chain [1] = [
Version: V3
Subject: [email protected], CN=default Employee, OU=default, O="default, Inc.", L=default, ST=AL, C=US
Signature Algorithm: SHA1withRSA, OID = 1.2.840.113549.1.1.5
Key: Sun RSA public key, 1024 bits
modulus: 140862286957037297158683104484469503810921697537964422595574798580128510755934413463045842414762254029728885690233847950678735782281077619629628663140568366247472189890316085560712610474766899389736269383565795688749374256479726939861138704211990111677657317335172626254520371267441364353295155431963634875809
public exponent: 65537
Validity: [From: Tue Sep 12 09:40:32 CDT 2006,
To: Thu Oct 12 09:40:32 CDT 2006]
Issuer: [email protected], CN=default Employee, OU=default, O="default, Inc.", L=default, ST=AL, C=US
SerialNumber: [ f6e3ada8 7dc4004f]
Certificate Extensions: 3
[1]: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: 2C BC 66 DC 06 BA 62 79 3B 1A 20 92 E0 81 71 A0 ,.f...by;. ...q.
0010: 0D 05 3C 95 ..<.
[2]: ObjectId: 2.5.29.35 Criticality=false
AuthorityKeyIdentifier [
KeyIdentifier [
0000: 2C BC 66 DC 06 BA 62 79 3B 1A 20 92 E0 81 71 A0 ,.f...by;. ...q.
0010: 0D 05 3C 95 ..<.
[[email protected], CN=default Employee, OU=default, O="default, Inc.", L=default, ST=AL, C=US]
SerialNumber: [ f6e3ada8 7dc4004f]
[3]: ObjectId: 2.5.29.19 Criticality=false
BasicConstraints:[
CA:true
PathLen:2147483647
Algorithm: [SHA1withRSA]
Signature:
0000: AB 84 38 1F 7B 71 D8 87 FF 24 DB C2 7E DC D0 0B ..8..q...$......
0010: 60 60 14 A8 F8 D5 46 AD 6B FC 33 90 6F 43 08 17 ``....F.k.3.oC..
0020: AE 2B EE 6C 2B 29 85 E2 A6 67 EE 5D A4 61 F3 9E .+.l+)...g.].a..
0030: E7 CA B1 27 F9 11 36 ED 93 05 7B E1 20 90 57 B5 ...'..6..... .W.
0040: C6 F9 8A 9D 50 CD B3 4A 54 DC 1B 52 EC EA 7A 0B ....P..JT..R..z.
0050: B6 E6 95 FD DD 80 BE 66 F0 77 F4 E7 9A 8A A3 EF .......f.w......
0060: 9B 68 57 0C 9C 4B 4C C0 24 C5 34 16 D3 8E 45 27 .hW..KL.$.4...E'
0070: CA 23 F1 E0 C5 5E FB FB AA 1C 21 6E CB 5B 57 D9 .#...^....!n.[W.
Found trusted certificate:
Version: V3
Subject: [email protected], CN=Employee, OU=default, O="default, Inc.", L=default, ST=AL, C=US
Signature Algorithm: SHA1withRSA, OID = 1.2.840.113549.1.1.5
Key: Sun RSA public key, 1024 bits
modulus: 164546130673614659100546464587508805401937082626997447139358150641653094778762702643605529386963945060462618417820295217144739538713137107756847225226998964727905246706969036839701385553183842454061172884072035749790213037240682893878786969498404371282074360019097248835858617183835587887295684928062301303789
public exponent: 65537
Validity: [From: Tue Sep 12 09:49:12 CDT 2006,
To: Thu Oct 12 09:49:12 CDT 2006]
Issuer: [email protected], CN=default Employee, OU=default, O="default, Inc.", L=default, ST=AL, C=US
SerialNumber: [ b40b909f 74d167ab]
Certificate Extensions: 4
[1]: ObjectId: 2.16.840.1.113730.1.13 Criticality=false
Extension unknown: DER encoded OCTET string =
0000: 04 1F 16 1D 4F 70 65 6E 53 53 4C 20 47 65 6E 65 ....OpenSSL Gene
0010: 72 61 74 65 64 20 43 65 72 74 69 66 69 63 61 74 rated Certificat
0020: 65 e
[2]: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: C8 EA 02 93 42 9E 44 D1 55 7D 2D 32 4B 9B 1C 6D ....B.D.U.-2K..m
0010: 63 6B 73 82 cks.
[3]: ObjectId: 2.5.29.35 Criticality=false
AuthorityKeyIdentifier [
KeyIdentifier [
0000: 2C BC 66 DC 06 BA 62 79 3B 1A 20 92 E0 81 71 A0 ,.f...by;. ...q.
0010: 0D 05 3C 95 ..<.
[[email protected], CN=default Employee, OU=default, O="default, Inc.", L=default, ST=AL, C=US]
SerialNumber: [ f6e3ada8 7dc4004f]
[4]: ObjectId: 2.5.29.19 Criticality=false
BasicConstraints:[
CA:false
PathLen: undefined
Algorithm: [SHA1withRSA]
Signature:
0000: BF 60 5A 67 3E E6 F0 92 4F E4 81 6D 71 0A 2E E8 .`Zg>...O..mq...
0010: F3 59 A1 87 7B D1 3A 7A CB FF D6 39 63 79 B6 82 .Y....:z...9cy..
0020: 2A 22 D0 46 51 30 6B 2A 61 6B A0 4C F0 3B CE 5B *".FQ0k*ak.L.;.[
0030: 9C 1D 46 CB D7 C2 B2 23 E2 A5 06 CD 12 F8 A9 CB ..F....#........
0040: B5 A2 43 B1 06 4C 42 B5 67 F2 DF 50 6B BC 8A 5E ..C..LB.g..Pk..^
0050: 95 0D F3 2A 73 A8 5A C8 55 77 D7 36 74 16 9E 05 ...*s.Z.Uw.6t...
0060: 85 C6 DC 3C 44 D3 06 5E 47 0C 1F 80 40 30 C7 D8 ...<D..^G...@0..
0070: 8C 27 FF B9 0C 71 EB D4 31 5C 1F 15 A1 23 6F A2 .'...q..1\...#o.
Client Thread, READ: TLSv1 Handshake, length = 13
*** CertificateRequest
Cert Types: RSA, DSS,
Cert Authorities:
*** ServerHelloDone
*** Certificate chain
*** ClientKeyExchange, RSA PreMasterSecret, TLSv1
Random Secret: { 3, 1, 27, 159, 38, 131, 132, 24, 47, 148, 161, 90, 7, 39, 189, 28, 178, 156, 20, 151, 220, 192, 239, 182, 115, 234, 99, 225, 68, 250, 199, 173, 96, 181, 78, 180, 238, 37, 243, 72, 19, 91, 249, 11, 49, 83, 1, 150 }
Client Thread, WRITE: TLSv1 Handshake, length = 141
SESSION KEYGEN:
PreMaster Secret:
0000: 03 01 1B 9F 26 83 84 18 2F 94 A1 5A 07 27 BD 1C ....&.../..Z.'..
0010: B2 9C 14 97 DC C0 EF B6 73 EA 63 E1 44 FA C7 AD ........s.c.D...
0020: 60 B5 4E B4 EE 25 F3 48 13 5B F9 0B 31 53 01 96 `.N..%.H.[..1S..
CONNECTION KEYGEN:
Client Nonce:
0000: 45 09 62 F6 47 C3 B9 2C 56 60 0E 0B AB 4C 69 87 E.b.G..,V`...Li.
0010: 88 72 35 36 89 4B CA FE 70 D0 F0 5B C7 F6 AF CF .r56.K..p..[....
Server Nonce:
0000: 45 09 62 F7 3F 5D 30 49 62 FB A0 D7 3D 6E F6 0C E.b.?]0Ib...=n..
0010: 05 D1 5F C2 98 C1 00 B5 87 1A 96 AE 34 5C 38 FA .._.........4\8.
Master Secret:
0000: 0E 63 38 16 86 A1 84 72 33 2C D7 07 D7 C3 AC E0 .c8....r3,......
0010: AD 5B CD 3B 2E 2A 02 91 1E FE 17 97 4E 3B 56 C3 .[.;.*......N;V.
0020: 5D 0F 7A 99 90 0D 3D 4E 5F 39 C5 EB 6E AD DA 71 ].z...=N_9..n..q
Client MAC write Secret:
0000: 99 32 FA 60 0B 88 36 CD 88 02 D5 4A CA D2 A6 49 .2.`..6....J...I
0010: 69 60 42 B6 i`B.
Server MAC write Secret:
0000: 43 3F 85 72 FB 6D 28 1C BA 1E 8A 26 56 DE 18 FB C?.r.m(....&V...
0010: 01 83 20 7F .. .
Client write key:
0000: 6F 58 29 AB B3 8C F5 75 3C 70 04 DF 9D 01 43 F5 oX)....u<p....C.
Server write key:
0000: 4A D7 E9 63 53 32 78 DF E0 99 89 60 A4 1A 3C E7 J..cS2x....`..<.
Client write IV:
0000: 24 FB 0E 12 AB D2 70 6D 80 B1 B2 BC 78 1A 55 88 $.....pm....x.U.
Server write IV:
0000: E4 75 62 25 46 95 0F 7A 44 16 E2 39 38 AD 29 CD .ub%F..zD..98.).
HawkEye Client Thread, WRITE: TLSv1 Change Cipher Spec, length = 1
*** Finished
verify_data: { 98, 254, 245, 75, 252, 23, 91, 164, 67, 197, 69, 44 }
Client Thread, WRITE: TLSv1 Handshake, length = 48
Client Thread, READ: TLSv1 Alert, length = 2
Client Thread, RECV TLSv1 ALERT: fatal, handshake_failure
Client Thread, called closeSocket()
Client Thread, handling exception: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
Error: Received fatal alert: handshake_failure
Thread-4, handling exception: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure -
Error while running EJB from java client on JBOSS
Hi
As i am new to EJB i have created a helloworld application in ejb which is working fine when i try to call it from servlet but when i try to invoke the same ejb from java client (i.e from diff jvm) on jboss i got the following error:
javax.naming.CommunicationException: Could not obtain connection to any of these urls: localhost:1099 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out] [Root exception is javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused]]]
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1399)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:579)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at com.gl.TestClient.main(TestClient.java:39)
Caused by: javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused]]
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:254)
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1370)
... 4 more
Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused]
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:228)
... 5 more
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at java.net.Socket.connect(Socket.java:469)
at java.net.Socket.<init>(Socket.java:366)
at java.net.Socket.<init>(Socket.java:266)
at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:69)
at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:62)
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:224)
... 5 more
Following is my code:
Home Interface:
package com.gl;
import javax.ejb.CreateException;
public interface testHome extends EJBHome {
String JNDI_NAME = "testBean";
public test create()
throws java.rmi.RemoteException,CreateException;
Remote Interface:
package com.gl;
import java.rmi.RemoteException;
import javax.ejb.EJBObject;
public interface test extends EJBObject {
public String welcomeMessage() throws RemoteException;
Bean:
package com.gl;
import java.rmi.RemoteException;
import javax.ejb.EJBException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
public class testbean implements SessionBean {
public void ejbActivate() throws EJBException, RemoteException {
// TODO Auto-generated method stub
public void ejbPassivate() throws EJBException, RemoteException {
// TODO Auto-generated method stub
public void ejbRemove() throws EJBException, RemoteException {
// TODO Auto-generated method stub
public void setSessionContext(SessionContext arg0) throws EJBException,
RemoteException {
// TODO Auto-generated method stub
public void ejbCreate(){}
public String welcomeMessage(){
return "Welcome to the World of EJB";
ejb-jar.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar>
<enterprise-beans>
<session>
<ejb-name>testBean</ejb-name>
<home>com.gl.testHome</home>
<remote>com.gl.test</remote>
<ejb-class>com.gl.testbean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>
jboss.xml:
<?xml version='1.0' ?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.2//EN" "http://www.jboss.org/j2ee/dtd/jboss_3_2.dtd">
<jboss>
<enterprise-beans>
<entity>
<ejb-name>testBean</ejb-name>
<jndi-name>testBean</jndi-name>
</entity>
</enterprise-beans>
</jboss>
Client code:
package com.gl;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
public class TestClient {
public static void main(String[] args) throws Exception{
try{
/* Properties props=new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
props.put(Context.PROVIDER_URL, "jnp://localhost:1099");
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
props.put(Context.PROVIDER_URL, "localhost:1099");
System.out.println("Properties ok");
//env.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.jboss.naming.HttpNamingContextFactory");
//env.put(Context.PROVIDER_URL,"http://localhost:8080");
//env.put(Context.SECURITY_PRINCIPAL, "");
//env.put(Context.SECURITY_CREDENTIALS, "");
Context ctx=new InitialContext(props);
System.out.println("context ok");
//testHome home = (testHome)ctx.lookup("testBean");
Object obj = ctx.lookup ("testBean");
System.out.println("ojb = " + obj);
testHome ejbHome = (testHome)PortableRemoteObject.narrow(obj,testHome.class);
test ejbObject = ejbHome.create();
String message = ejbObject.welcomeMessage();
System.out.println("home ok");
System.out.println("remote ok");
System.out.println(message);
catch(Exception e){e.printStackTrace();}
I am able to successfully deployed my ejb on JBOSS but i m getting above error when i am trying to invoke ejb from java client.
kindly suggest me something to solve this issue.
Regards
Gagan
Edited by: Gagan2914 on Aug 26, 2008 3:28 AMIs it a remote lookup? Then maybe this will help:
[http://wiki.jboss.org/wiki/JBoss42FAQ]
- Roy -
Need to communicate c server on linux & java client on windows
Hi!! I am new to socket programing in both C and Java.
From let I downloaded some client server example for c and java and tried that to link !! (I allways learn this way , and I need to do that little urget )
though cient server in linux is working perfectly fine and same for java. But problem is when I tried to communicate C server on linux and java client on windows, I end up with getting some junk characters. Though they are connected successfully.
Here goes code for java client:
package whatever;
import java.io.*;
import java.net.*;
public class Requester{
Socket requestSocket;
ObjectOutputStream out;
ObjectInputStream in;
String message;
Requester(){}
void run()
try{
//1. creating a socket to connect to the server
requestSocket = new Socket("192.168.72.128", 2006);
System.out.println("Connected to localhost in port 2004");
//2. get Input and Output streams
out = new ObjectOutputStream(requestSocket.getOutputStream());
out.flush();
in = new ObjectInputStream(requestSocket.getInputStream());
System.out.println("above do");
//3: Communicating with the server
do{
try{
System.out.println("in do");
//message = (String)in.readObject();
System.out.println("in try");
//System.out.println("server>" + message);
System.out.println("server>" + "message");
sendMessage("Hi my server");
message = "bye";
sendMessage(message);
System.out.println("try completed");
catch(Exception e){
e.printStackTrace();
}while(!message.equals("bye"));
catch(UnknownHostException unknownHost){
System.err.println("You are trying to connect to an unknown host!");
catch(IOException ioException){
ioException.printStackTrace();
finally{
//4: Closing connection
try{
in.close();
out.close();
requestSocket.close();
catch(IOException ioException){
ioException.printStackTrace();
void sendMessage(String msg)
try{
String stringToConvert= "hello world";
byte[] theByteArray = stringToConvert.getBytes();
System.out.println(theByteArray.length);
out.writeObject(theByteArray);
out.flush();
System.out.println("client>" + msg);
catch(IOException ioException){
ioException.printStackTrace();
catch(Exception ex){
ex.printStackTrace();
public static void main(String args[])
Requester client = new Requester();
client.run();
And for C server
/ server
#include <stdio.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <netinet/in.h>
#define MAXPENDING 5 /* Max connection requests */
#define BUFFSIZE 32
void Die(char *mess) { perror(mess); exit(1); }
void HandleClient(int sock) {
char buffer[BUFFSIZE];
int received = -1;
/* Receive message */
if ((received = recv(sock, buffer, BUFFSIZE, 0)) < 0) {
Die("Failed to receive initial bytes from client");
/* Send bytes and check for more incoming data in loop */
while (received > 0) {
/* Send back received data */
if (send(sock, buffer, received, 0) != received) {
Die("Failed to send bytes to client");
// fprintf("%s",buffer);
fprintf(stdout, "message Recieved: %s\n", buffer);
//Die("was not able to echo socket message");
/* Check for more data */
if ((received = recv(sock, buffer, BUFFSIZE, 0)) < 0) {
Die("Failed to receive additional bytes from client");
close(sock);
// A TCP ECHO SERVER
int main(int argc, char *argv[]) {
int serversock, clientsock;
struct sockaddr_in echoserver, echoclient;
if (argc != 2) {
fprintf(stderr, "USAGE: echoserver <port>\n");
exit(1);
/* Create the TCP socket */
if ((serversock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) {
Die("Failed to create socket");
/* Construct the server sockaddr_in structure */
memset(&echoserver, 0, sizeof(echoserver)); /* Clear struct */
echoserver.sin_family = AF_INET; /* Internet/IP */
echoserver.sin_addr.s_addr = htonl(INADDR_ANY); /* Incoming addr */
echoserver.sin_port = htons(atoi(argv[1])); /* server port */
// A TCP ECHO SERVER ENDS
// A TCP ECHO SERVER BINDING AND LISTNING
/* Bind the server socket */
if (bind(serversock, (struct sockaddr *) &echoserver, sizeof(echoserver)) < 0) {
Die("Failed to bind the server socket");
/* Listen on the server socket */
if (listen(serversock, MAXPENDING) < 0) {
Die("Failed to listen on server socket");
// A TCP ECHO SERVER BINDING AND LISTNING
// SOCKET FACTORY
/* Run until cancelled */
while (1) {
unsigned int clientlen = sizeof(echoclient);
/* Wait for client connection */
if ((clientsock =
accept(serversock, (struct sockaddr *) &echoclient, &clientlen)) < 0) {
Die("Failed to accept client connection");
fprintf(stdout, "Client connected: %s\n", inet_ntoa(echoclient.sin_addr));
HandleClient(clientsock);
// SOCKET FACTORY ENDSI know that it is not C forum but I found no better place to post it
Thankskajbj wrote:
ManMohanVyas wrote:
hii!! just trying to make it a little more explinatory
1) what I am trying to accomplish by the above code is: - just need to echo/print from the Server , message send by the Client. I know code is not that good but should be able to perform this basic operation( according to me ).You are wrong. I told you that it won't work as long as you are using ObjectOutputStream and ObjectInputStream. You shouldn't write objects.
2) Message sent by the client is "hello world"(hard coded).No, it's not. You are writing a serialized byte array.
3) what I am getting at the client end is "*message recieved: ur*" (before that It shows the Ip of client machine)
It should print "hello world ".See above.
You are having a problem, and I have told you what the problem is.hey I dont know what went wrong but . I posted all this just next to my first post ...before you posted !!
And hard coded byte array includes "hello world"...may be I am not able to explain properly. -
Identifying Execute Queue Threads as Socket Readers
Hi All,
Preface: I am trying to identify at any given instance the percentage of
socket reader threads that are in use - this will help me to identify when
all threads are in use and unable to service user requests. Thus my goal is
to identify threads that are socket readers and whether they are active or
idle.
Through JMX I can obtain an instance of each
weblogic.management.runtime.ExecuteThread, which lists the same information
that you see in the console if you drill down to the thread level, for
example:
mydomain> Servers> myserver> Active Execute Queues> default> Execute Threads
That information includes:
- thread number
- total requests
- last request
- current request
- transaction
- user
- is the thread idle?
Now my question is from this information can you identify which of these
threads are being used as socket readers?
Here are some excerpts from my JMX calls:
Name: ExecuteThread: '0' for queue: 'default'
Execute Queue Runtime Name: default
Current Request: null
Last Request: Http Request: /bookstore/en/authors/showauthors.jsp
User: null
Is Idle?: true
Name: ExecuteThread: '15' for queue: 'default'
Execute Queue Runtime Name:default
Current Request: null
Last Request: Scheduled Trigger
User: null
Is Idle?: true
Name: ExecuteThread: '26' for queue: 'default'
Execute Queue Runtime Name:default
Current Request: null
Last Request: ListenRequest for a new connection on: 'Socket
addr=127.0.0.1,port=2061,localport=7001]'
User: null
Is Idle?: true
Name: ExecuteThread: '59' for queue: 'default'
Execute Queue Runtime Name:default
Current Request: Socket Reader Request
Last Request:
weblogic.transaction.internal.ServerCoordinatorDescriptor$2@138786
User: null
Is Idle?: false
It would appear that the "ListenRequest" last request would identify a
socket reader, only I have 60 threads in my default execute queue with 70%
dedicated to socket readers and the number of threads that say their last
request was "ListenRequest ..." is only 5.. Furthermore there is only one
"Socket Reader Request" identified thread.
Are threads identified as socket readers permanently or constantly reused
for whatever purpose is required (with a cap of use based off of the socket
reader perspective)?
Thanks in advance for your help!
SteveHi Achhi,
Socket Reader Threads are the Threads which are responsible for reading the incoming request data. We can divide the Socket reader threads in two categories:
Pure Java Socket Reqders: The pure-Java socket reader implementation, where the socket reader threads continually poll all opened sockets to determine whether they contain data to be read, even if the sockets have no data to read. (From Performance Point This is Not Good that the Sockets will be in Opened Mode even if there is no Data to read)
Native Socket Readers: (These are the Dafault Socket Readers) The native IP socket reader provided by the host machine's operating system, where the socket reader threads target only active sockets that contain data to be read. Native socket readers never poll sockets because they are immediately notified when a socket needs to be serviced. For Better Performance You should always prefer using Native Socket Readers.
To Enable Native Socket Readers You can Login to AdminConsole--->Servers ---><SERVER_NAME>--->configuration (Tab)--->Tuning (SubTab)---> "Enable Native IO" (This checkbox must be checked)
Still If you want to use the Java Socket Readers .... still you can improve the performance of socket communication by configuring the proper number of socket reader threads for each server instance. For best performance, the number of socket reader threads in WebLogic Server should equal the potential maximum number of opened sockets.
Thanks
Jay SenSharma
http://weblogic-wonders.com/weblogic (WebLogic Wonders Are here) -
Identifying Execute Threads as Socket Readers
Hi All,
Preface: I am trying to identify at any given instance the percentage of
socket reader threads that are in use - this will help me to identify when
all threads are in use and unable to service user requests. Thus my goal is
to identify threads that are socket readers and whether they are active or
idle.
Through JMX I can obtain an instance of each
weblogic.management.runtime.ExecuteThread, which lists the same information
that you see in the console if you drill down to the thread level, for
example:
mydomain> Servers> myserver> Active Execute Queues> default> Execute Threads
That information includes:
- thread number
- total requests
- last request
- current request
- transaction
- user
- is the thread idle?
Now my question is from this information can you identify which of these
threads are being used as socket readers?
Here are some excerpts from my JMX calls:
Name: ExecuteThread: '0' for queue: 'default'
Execute Queue Runtime Name: default
Current Request: null
Last Request: Http Request: /bookstore/en/authors/showauthors.jsp
User: null
Is Idle?: true
Name: ExecuteThread: '15' for queue: 'default'
Execute Queue Runtime Name:default
Current Request: null
Last Request: Scheduled Trigger
User: null
Is Idle?: true
Name: ExecuteThread: '26' for queue: 'default'
Execute Queue Runtime Name:default
Current Request: null
Last Request: ListenRequest for a new connection on: 'Socket
addr=127.0.0.1,port=2061,localport=7001]'
User: null
Is Idle?: true
Name: ExecuteThread: '59' for queue: 'default'
Execute Queue Runtime Name:default
Current Request: Socket Reader Request
Last Request:
weblogic.transaction.internal.ServerCoordinatorDescriptor$2@138786
User: null
Is Idle?: false
It would appear that the "ListenRequest" last request would identify a
socket reader, only I have 60 threads in my default execute queue with 70%
dedicated to socket readers and the number of threads that say their last
request was "ListenRequest ..." is only 5.. Furthermore there is only one
"Socket Reader Request" identified thread.
Are threads identified as socket readers permanently or constantly reused
for whatever purpose is required (with a cap of use based off of the socket
reader perspective)?
Thanks in advance for your help!
SteveHi Achhi,
Socket Reader Threads are the Threads which are responsible for reading the incoming request data. We can divide the Socket reader threads in two categories:
Pure Java Socket Reqders: The pure-Java socket reader implementation, where the socket reader threads continually poll all opened sockets to determine whether they contain data to be read, even if the sockets have no data to read. (From Performance Point This is Not Good that the Sockets will be in Opened Mode even if there is no Data to read)
Native Socket Readers: (These are the Dafault Socket Readers) The native IP socket reader provided by the host machine's operating system, where the socket reader threads target only active sockets that contain data to be read. Native socket readers never poll sockets because they are immediately notified when a socket needs to be serviced. For Better Performance You should always prefer using Native Socket Readers.
To Enable Native Socket Readers You can Login to AdminConsole--->Servers ---><SERVER_NAME>--->configuration (Tab)--->Tuning (SubTab)---> "Enable Native IO" (This checkbox must be checked)
Still If you want to use the Java Socket Readers .... still you can improve the performance of socket communication by configuring the proper number of socket reader threads for each server instance. For best performance, the number of socket reader threads in WebLogic Server should equal the potential maximum number of opened sockets.
Thanks
Jay SenSharma
http://weblogic-wonders.com/weblogic (WebLogic Wonders Are here) -
What does mean by Socket Readers?
How it improves the performance of Application by configuring percentage of threads as socket readers?
Can someone please answer my questions?Hi Achhi,
Socket Reader Threads are the Threads which are responsible for reading the incoming request data. We can divide the Socket reader threads in two categories:
Pure Java Socket Reqders: The pure-Java socket reader implementation, where the socket reader threads continually poll all opened sockets to determine whether they contain data to be read, even if the sockets have no data to read. (From Performance Point This is Not Good that the Sockets will be in Opened Mode even if there is no Data to read)
Native Socket Readers: (These are the Dafault Socket Readers) The native IP socket reader provided by the host machine's operating system, where the socket reader threads target only active sockets that contain data to be read. Native socket readers never poll sockets because they are immediately notified when a socket needs to be serviced. For Better Performance You should always prefer using Native Socket Readers.
To Enable Native Socket Readers You can Login to AdminConsole--->Servers ---><SERVER_NAME>--->configuration (Tab)--->Tuning (SubTab)---> "Enable Native IO" (This checkbox must be checked)
Still If you want to use the Java Socket Readers .... still you can improve the performance of socket communication by configuring the proper number of socket reader threads for each server instance. For best performance, the number of socket reader threads in WebLogic Server should equal the potential maximum number of opened sockets.
Thanks
Jay SenSharma
http://weblogic-wonders.com/weblogic (WebLogic Wonders Are here) -
Related to Network program using Java Client and C server
I am little bit experience in java technology. I need an urgent help as I have to submit a document related to C server and Java client. But while searching in net i cant get a proper guidance for C server as many errors thrown in sys/socket.h and other new header files. Can any one help me out for giving source code for C Server. so that i can further involve in that document. Please help me out. i am really helpless by the way the C server thrown error. after finishing that C server only i can concentrate on Java client...
Hai Josah,
Thanks for your reply.. I have gone through many sockets server program in C but the real proble is the header file they include like
socket.h and in.h etc.. they also provide these header files but if we compile in turboC they inturn require some other header files. I dont get the full hierarchy of C server program. I found some help in Java programming Archive about C Server and java client. As i am new to C i cant get the full header files for the server.c if i complete taht only i can proceed to java client. If u can redirect me for any good C sites also i can be thankful for u forever..please
Maybe you are looking for
-
The chapter about php_db4 in the BDB documentation need to be updated
Hi all, I think the chapter about php_db4 in the BerkeleyDB documentation should be updated. The first sentence "A PHP 4 extension for this release of Berkeley DB..." gave me the concept that the extension can be ONLY run with PHP 4. I've got the ide
-
Hi, There is already an report to print the order by co02 transaction now the report should be added with the functionality 1) Fetch data (basic data ->additional data from MM03) 2) the fetched value to be concatenated with the some prefix and passe
-
Nokia 500 belle updates please?
if i was not mistaken, symbian anna or should we say symbian ^3 phones should be able to get belle updates on q4 of 2011 but it was postponed and was moved on q1 2012 which is january to be specific, with great courage ang faith to nokia, we users wa
-
UIX 2.1.20: Detecting current FACET in UIT / UIX
Hello, I have a custom UIX control implemented as UIT. This control should change its appearance on the page depending on which facet is currently being used. My plan was to have 2 different controls in our UIT and conditionally switch them ON and OF
-
Running Flash Player and Flex on HPUX and AIX
Hi Issue: HPUX 11iv2 PARISC and Itanium and AIX 5.1 and 5.2 (PPC) are not listed in the systemj requirements of Flash Player. And So affects the Flex SDK Applications? Does this mean these OS are NOT Supported currently and FLEX applications cannot r