r/learnjava • • Aug 14 '20

What's the difference between web application and enterprise application? What applications can I make in JavaEE that does not use web applications or websites?

Upon reading, I learned that web application executes in a web container such as Tomcat while enterprise is in the EJB server with extra functionality which also communicates to the web container.

However, I am still confused. I can create a website using JavaEE than jsp&servlets. Then why used JavaEE over web applications? Let's say, I will create an eCommerce site using JavaEE. The web container will be my view and all the logic behind it will be put in an EJB server. Even though, I can use JSP and servlet or put everything (view and logic) inside the web container I still choose JavaEE. Then what are the benefits if I used JavaEE than JSP?

What else can I make in the JavaEE that is not a website or desktop application communicating to an enterprise server?

I'm sorry. I just can't seem to understand. Please anyone give me a very clear explanation.

48 Upvotes

12 comments sorted by

19

u/Nephyst Aug 14 '20 edited Aug 14 '20

A lot of the examples you use are honestly outdated and not really used much anymore.

JSPs are used for server side rendering of HTML. This was important when computers were slow, but today it's massively more common to use something like react or angular to render HTML on the front end.

EJBs are also dead. They were overly complex and solved a problem no one really had while adding a ton of extra issues. They were generally horrible to work with. Today it's much simpler to just use REST APIs to accomplish the same thing.

Unless you are trying to get a job supporting legacy applications there isn't much reason to learn j2ee. I think the parts that are still relevant (jdbc/jpa) are also in j2se.

3

u/sbhandari Aug 14 '20

Can you give some reason on assuming EJBs are dead? I understand up to EJB 2 , it was pain but the later versions are were easy and convinient. It is certainly easy to go with alternatives like spring but I have hard time believing EJB can be cnsidered dead already. After Jakarta handover, it has definitely slow down in their progress but I dont think it will be dead anytime soon.

7

u/Nephyst Aug 14 '20 edited Aug 14 '20

Yeah, maybe it's just my experience. I've worked at a number of major tech companies with mature Java development cultures and it's been over 10 years since I've even heard anyone mention JSPs or EJBs.

I feel slightly traumatized by how horrible it was to work with the earlier versions of EJBs. I think that has prevented me from looking into what's changed in the newer versions.

I'm an experienced Java dev, but I'm here to learn just as much as I am to help. If you have more context, where do you see them being used today?

2

u/Homerlncognito Aug 15 '20

The project I'm working on uses them. I guess we could call the entire thing legacy tech since it uses Java 6 and majority of FE is written in AngularJS. It's an internal application used by a bank.

1

u/Nephyst Aug 15 '20

Yeahhh, Java 6 is almost 15 years old now. The newer versions are backwards compatible, any reason you don't upgrade?

2

u/Homerlncognito Aug 15 '20

They aren't fully backwards compatible. Using old code with newer versions can result in issues that are only revealed during runtime, so we would have to retest the entire application and fix all the bugs. The question is what would we get for doing all that? I don't think you can make a solid business case for these sorts of upgrades in most situations.

1

u/Nephyst Aug 15 '20

Interesting. I would be concerned about security issues with using such an old version, but I do understand the concern with modifying something critical like banking.

7

u/MrGooglr Aug 14 '20

Enterprise application is also a web application which follows EE standard. An Enterprise web application is more than just serving frontend pages and executing server side logic. With Enterprise web applications, we try to achieve most performance specific changes. Database pooling and in memory data grids just works better in EE environment than in normal web container. You’re right that EE server internally contains the web container (servlet and jsp container), but if we are going to build a web application that want to use all the EE specifications it’s better to opt for EE application methodology for better overall performance.

3

u/natnit555 Aug 14 '20 edited Aug 14 '20

From here:

https://en.wikipedia.org/wiki/Enterprise_software -> https://www.perlmonks.org/?node_id=504043

I'm citing the definition there:

Look again at that middle quote. Does anyone recognize that? It's from the Perl 5 Enterprise Environment (p5ee) documentation. I didn't realize its source as I was reading it. Curiously, p5ee actually laid out a definition of what it considers "enterprise software" to be.

Availability - the assurance that a service/resource is always accessible

Scalability - the ability to support the required quality of service as the load increases

Reliability - the assurance of the integrity and consistency of the application and all of its transactions. The ability to provide a required reliability service level depends on the close coordination of the hardware, networking, operating system, storage subsystem, application framework, and application software.

Security - the ability to allow access to application functions and data to some users and deny them to others

Interoperability - the ability of the system to share data with external systems and interface to external systems.

Leveragability - the ability that stored data, programmed logic, and other system resources available anywhere in the enterprise should be accessible from everywhere in the enterprise

Maintainability - the ability to correct flaws in the existing functionality without impacting other components/systems

Extensibility - the ability to add/modify functionality without impacting existing functionality

Manageability - the ability to manage the system in order to ensure the continued health of a system with respect to scalability, reliability, availability, performance, and security.

Portability - the ability of the software to run on a variety of hardware and operating system configurations

Accessibility - the ability to access system functions through different user agents and in different human languages

That's why the same simple create/update/delete page that probably only few lines in python Flask framework, but once you pull whole bunch requirements of Enterprise Software as mentioned above, it gets fairly complex, and you'll need these kind of "container" (JavaEE). These requirements are what the JavaEE covers. And that's why it is huge.

Sorry if the eplanation is very imprecise.

What applications can I make in JavaEE that does not use web applications or websites?

An example is middleware application that process messages in asynchronous fashion (https://en.wikipedia.org/wiki/Jakarta_Messaging)

1

u/[deleted] Aug 14 '20

I assume you are using web container as a synonym for servlet container.

You can have services communicate from one server to another.

As an example:

Think about a weather service that calls two other sepatate services: the temperature forecast service and the rain forecast service, and combines both responses into 1.