SocketTimeoutException:Read timed out after client connect t
catherinelo Aug 20, 2005 12:30 PMI have a JMS client that connect to server. When I started the JMS client, the client managed to connect to server. And once connection was established, the client instantly send a message to server to record down the client startup time.
Server log shows that client startup time was recorded(in the server log : 2005-08-19 23:04:51,453 INFO [ErrorLogControllerBean] error log created successfully).
But after 2 mins, I got this java.net.socketTimeoutException:Read timed out in the server side.
Client log shows socket timeout exception. JMS client has to reconnect to server.
Why does this happen? How can I solve this problem?
Please help, thanks.
JMS client connection code
public void createConnection() throws NamingException, JMSException { InitialContext iniCtx = new InitialContext(properties); Object tmp = iniCtx.lookup("ConnectionFactory"); cf = (ConnectionFactory)tmp; errorQueue = (Queue) iniCtx.lookup("queue/ErrorQueue"); connection = cf.createConnection(); connection.setExceptionListener(exListener); connection.start(); }
JMS client sendMessage code
public void sendMessage(Serializable serializable, short queueType) { try { if (connection != null) { if (serializable != null) { Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageProducer producer = = session.createProducer(errorQueue); ObjectMessage objMsg = session.createObjectMessage(serializable); producer.send(objMsg); session.close(); } else { logger.warn("SessionDetails is null"); } } else { logger.error("connection is null"); } } catch (Exception ex) { logger.error(ex.getMessage(), ex); } }
Here is the server log
2005-08-19 23:04:50,906 DEBUG [org.jboss.mq.il.uil2.SocketManager] Begin ReadTask.run
2005-08-19 23:04:50,906 DEBUG [org.jboss.mq.il.uil2.SocketManager] Begin WriteTask.run
2005-08-19 23:04:50,906 DEBUG [org.jboss.mq.il.uil2.SocketManager] Created ObjectOutputStream
2005-08-19 23:04:51,046 DEBUG [org.jboss.mq.il.uil2.SocketManager] Created ObjectInputStream
2005-08-19 23:04:51,062 WARN [org.jboss.resource.security.ConfiguredIdentityLoginModule] Creating LoginModule with no configured password!
2005-08-19 23:04:51,093 DEBUG [org.jboss.mq.il.uil2.ServerSocketManagerHandler] Setting up the UILClientIL Connection
2005-08-19 23:04:51,093 DEBUG [org.jboss.mq.il.uil2.ServerSocketManagerHandler] The UILClientIL Connection is set up
2005-08-19 23:04:51,421 INFO [ErrorLogControllerBean] Create error log for stationId = 5
2005-08-19 23:04:51,437 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.Station#findByPrimaryKey] Executing SQL: SELECT t0_Station.StationId FROM Station t0_Station WHERE t0_Station.StationId=?
2005-08-19 23:04:51,437 DEBUG [org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory] Using properties: {user=jboss, password=--hidden--}
2005-08-19 23:04:51,453 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCMySQLCreateCommand.ErrorLog] Executing SQL: INSERT INTO ErrorLog (ClassName, Level, Message, Exception, ErrorDate, StationId) VALUES (?, ?, ?, ?, ?, ?)
2005-08-19 23:04:51,453 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.Station] Executing SQL: SELECT Name, Description, Status, DeployDate, LastStartupDate, Rate, Currency, LastUsedDate, LocationId, AdContentId FROM Station WHERE (StationId=?)
2005-08-19 23:04:51,453 INFO [ErrorLogControllerBean] error log created successfully
2005-08-19 23:04:51,453 DEBUG [org.jboss.ejb.StatelessSessionContainer] Useless invocation of remove() for stateless session bean
2005-08-19 23:04:51,453 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.ErrorLog] Executing SQL: UPDATE ErrorLog SET StationId=? WHERE ErrorId=?
2005-08-19 23:06:51,953 DEBUG [org.jboss.mq.il.uil2.ServerSocketManagerHandler] Exiting on IOE
java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
at org.jboss.util.stream.NotifyingBufferedInputStream.read(NotifyingBufferedInputStream.java:67)
at java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java:2133)
at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(ObjectInputStream.java:2313)
at java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStream.java:2380)
at java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream.java:2452)
at java.io.ObjectInputStream$BlockDataInputStream.readByte(ObjectInputStream.java:2601)
at java.io.ObjectInputStream.readByte(ObjectInputStream.java:845)
at org.jboss.mq.il.uil2.SocketManager$ReadTask.run(SocketManager.java:285)
at java.lang.Thread.run(Thread.java:534)
2005-08-19 23:06:51,953 DEBUG [org.jboss.mq.il.uil2.SocketManager] End ReadTask.run
2005-08-19 23:06:51,953 DEBUG [org.jboss.mq.il.uil2.SocketManager] End WriteTask.run
2005-08-19 23:06:55,421 DEBUG [org.jboss.resource.connectionmanager.IdleRemover] run: IdleRemover notifying pools, interval: 450000
2005-08-19 23:07:01,843 DEBUG [org.jboss.mq.il.uil2.SocketManager] Begin ReadTask.run
2005-08-19 23:07:01,843 DEBUG [org.jboss.mq.il.uil2.SocketManager] Begin WriteTask.run
2005-08-19 23:07:01,843 DEBUG [org.jboss.mq.il.uil2.SocketManager] Created ObjectOutputStream
2005-08-19 23:07:01,843 DEBUG [org.jboss.mq.il.uil2.SocketManager] Created ObjectInputStream
2005-08-19 23:07:01,859 DEBUG [org.jboss.mq.il.uil2.ServerSocketManagerHandler] Setting up the UILClientIL Connection
2005-08-19 23:07:01,859 DEBUG [org.jboss.mq.il.uil2.ServerSocketManagerHandler] The UILClientIL Connection is set up