The moose likes Servlets and the fly likes web application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "web application" Watch "web application" New topic

web application

ham rah

Joined: Mar 15, 2005
Posts: 6
i have made client in swing
and the server is in servlet deployed on tomcat 5.5
so how can i communicate from swing to servlet
that should be non-http
and secondly can i use remote ejb calls
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

This is a nice tutorial.

Tomcat is not an EJB container so you will not be able to make EJB calls to it.

Servlets (out of the box anyway) are primarily designed for HTTP calls but as that article shows HTTP doesn't have to mean html. You can post and receive serialized java objects.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Thomas Hubschman
Ranch Hand

Joined: Sep 25, 2002
Posts: 88
Why can you not use HTTP?

Just to clarify Ben's response. You can call a remote EJB from a servlet. You can also call a remote EJB directly from you swing code.

However your EJB requires an application server like JBoss or WebLogic.

If you are going to use EJBs then you have no real reason to call servlets. Call the EJB directly from your swing controller.

This also fixes your problem of using HTTP as your communications to the EJB will use RMI. However you should make sure those ports are open on any firewall you may be using. I've been burned by that in the past when I didn't "own" the firewall.

[ March 17, 2005: Message edited by: Thomas Hubschman ]

SCJP '02, SCWCD '02, SCJD '08, SCSNB '09, SCEA '10
I agree. Here's the link:
subject: web application
It's not a secret anymore!