• Post Reply Bookmark Topic Watch Topic
  • New Topic

Handle a ServerSocket in an EJB3-powered webapp  RSS feed

Per Lindberg
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a webapp (using GlassFish) that uses EJB3/JPA for persistence. It also has to serve some external devices that can connect via TCP.

What is The Right Way to do this?

I have been experimenting with a separate TCP server thread, started from a ContextListener:

However, it seems that it's not possible to inject an EJB Local Interface (with @EJB FooLocal fooLocal;)
in the tread code (my RequestThread class), and setting it up with JNDI lookup is perhaps not The Right
Thing either, it seems that I won't get the neat transaction wrapping of calls to my stateless EJBs,
since they're not managed by the container. A TcpServlet similar to HttpServlet would be neat, but
I don't think there are such animals.

So... what's The Right Thing to do?

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!