Discussions

General J2EE: Implementing a socket server using J2EE

  1. Implementing a socket server using J2EE (3 messages)

    Hi,

    we have numerous client applications that transmit data to a server via a socket. We want to use J2EE on the server side, but EJB's cannot listen on sockets.

    If we implement a small java app to listen on the socket, we can then drop the data into a JMS queue for processing by a message driven bean. But this leaves us with a nasty single point of failure running *outside* the appserver.

    Can anyone suggest a solution for us that would move the socket listener "inside" the appserver? Assume for the moment that our clients must use a socket to talk to the server.

    thanks

    Dale

    Threaded Messages (3)

  2. Implementing a socket server using J2EE[ Go to top ]

    I think a Resource Adaptor is the answer for you. You can code RA to listen to a specific port for your client and dispatch the message to JMS for your EJB.
  3. a servlet?[ Go to top ]

    I assume you already served your problem but I found this post just as I was doing some internet research because we've got a similar requirement.

    what we tried is to use a servlet which starts listening on a port at its first init() call and stops listening on destry() - this generates not the overhead of having to use JMS. I'm not sure if it violates the spec in a way. Our j2ee-app runs on a single machine...
  4. Servlet as Socket Listener[ Go to top ]

    Hans, we have a similar requirement.Did you go ahead and use the servlet as a socket server? what problems did you face? would you recommend it ?