0

We are currently developing a web application for college and we would like some advice from a more experienced developer.

We have a backend using Hibernate to operate on a MySQL database. Another project is the web UI that uses the API delivered by the backend (registering user, fetching data associated with certain profiles etc.). We use the JSF framework (RichFaces) for the UI. Everything is built using Maven.

The technology we can't decide on is for the communication between UI and logic modules. The first option is to use ApacheCXF to provide SOAP webservices that UI can be a client of. The second option is to use EJBs to invoke backend methods from the UI module.

What approach is more widely-used? As far as we read on the Web, using EJB is faster than SOAP webservices. On the other hand, we don't have any experience with EJBs using Tomcat (we would prefer using Tomcat since it seems to be a cheaper option, however we don't know what we would have to do in order to use EJBs with Tomcat). Additionally, working with webservices since the beginning will allow us to add support for different platforms (for example, Android).

Another aspect which we are discussing is about how should the application be deployed. The alternatives we have considered right now are:

  1. Deploy it as a single WAR project (which would solve the problem we have about communicating the UI with the backend of our application).
  2. Deploy two WAR projects in the same server using webservices for communication between the projects. (We have a prototype using this approach deployed on a Tomcat server)
  3. Deploy a WAR project and EJB project.
  4. Deploy an EAR project which would contain the references to the WAR and EJB projects. (We have a prototype using this approach deployed on a Glassfish server)

The project right now is starting, so we will only be handling a couple hundreds of users right now. However, if the project succeeds we would need to deal with a couple million of users.

Any advice would be appreciated. Thanks.

Edit: So any advice about how the project should be deployed? Is it necessary to use EAR? Is there any advantage if we deploy the project as an EAR module?

Edit 2: We found the advice we needed on this thread: Deploying java applications (Tomcat/Glassfish)

Community
  • 1
  • 1
user2100776
  • 81
  • 1
  • 9

3 Answers3

0

we use ApacheCXF at work and its has SOAP and Restful. Reliable and relatively easy to setup. I am not sure why you want to use glassfish maybe it's preference but you can implement your projects in eclipse too. It's really that is up to you and your team and the requirements and skill sets your team may have to build and support, that a side CXF webservice+apache + eclipse with maybe two war files would be a good path.

grepit
  • 21,260
  • 6
  • 105
  • 81
0

First things first. I would avoid using Web Services if there's no need for it. If you feel that you might need to call this system from external programs and platforms, then go for it. Even then, I would only use the web service interface for external integration, and still have an internal EJB implementation.

EJBs are awesome for enterprise applications. I would highly recommend that you look into that. They provide support for EJB Pooling, Transactions, Aspect oriented programming, Security, Stateful sessions, Java Messaging, JNDI etc. And you can inject them directly inside a Managed Bean (JSF). You said that you will eventually handle millions of users, so I assume that you will want your application to run as fast as possible, I don't think SOAP web services will be a good fit. Remember that SOAP web services encode messages as text, so if your application will be sending binary files etc, then you'll suffer significant performance issues.

As far as deployment goes I would go with an EAR, or a WAR for the JSF and and EAR backend. you can use Injection to pull the classes you need, even remotely, from multiple web applications and other EAR apps.

I'm not sure why you say Tomcat is Cheaper. Glassfish open source edition is a fully functioning JavaEE6 Server and its free. JBoss is also JavaEE compliant and is free. both of them are used in lots of production environments. I find glassfish to be much more user friendly, and would recommend it to EJB noobs :)

I also started with Tomcat, but now I don't use it at all. why use the servlet container only, when you can have the whole shabang? hope this helps.

greenkode
  • 4,001
  • 1
  • 26
  • 29
  • We were talking about the cost of getting a hosting service or cloud service to deploy our application. Reading another thread from stackoverflow, another user recommended Jelastic if you needed a glassfish server. After skimming through the pricing section, it seems that having a glassfish server will consume more resources (thus being more expensive). – user2100776 Feb 24 '13 at 21:45
  • You have to understand that tomcat is just a servlet container. I'm sure there are some tomcat diehards out there, but I'll be sceptical about using tomcat outside a dev environment. tomcat might seem lighter by default, but what happens when you start deploying large EJB style apps? might not be as fast as it seems. You can use the Spring framework, which provides all the features of javaee, however it just copies a whole lot of jars into tomcat which Glassfish provides by default. – greenkode Feb 25 '13 at 08:54
0

I wouldn't use web services in this case. You can use managed beans as controllers. Put the logic into EJBs, views into rich faces and control the flow using managed beans.

If you use maven you can generate a project with the structure of EAR (war for web module and jar for ejbs). I don't remember the name of an archetype but you can find it easily.

g-t
  • 1,455
  • 12
  • 17