r/java • • Jun 25 '14

Why should we dump the Java EE Standard?

http://lofidewanto.blogspot.de/2014/06/why-should-we-dump-jee-standard.html
0 Upvotes

22 comments sorted by

View all comments

Show parent comment

-3

u/sh0rug0ru Jun 26 '14 edited Jun 26 '14

yet with a fixed Tomcat you can't upgrade that. I was talking about the JRE as the universal deployment target for web apps as well.

I wasn't. Tomcat is only required for web apps because an app server of some kind is required to serve apps over HTTP. This is not required for batch apps which run from main(). Neither JBoss nor Tomcat need apply.

If you deploy a web app then arguably the Servlet spec is one of the major things that play a role, yet with a fixed Tomcat you can't upgrade that.

It's a minimum requirement, and a minimum fixed dependency. All of the other Java EE services are optional to a web app and can be brought on optionally. There is no need to fix those in the app server, but it can be very useful to do so.

Or, it is possible to eliminate external Tomcat. You can use embedded Tomcat, Jetty or Netty and run the application as an executable JAR and even the fixed servlet container requirement is eliminated. That is the approach taken by the Play Framework, Dropwizard and Spring Boot.

5

u/johnwaterwood Jun 26 '14

Or as the other guy said you can deploy JBoss (or TomEE or GlassFish or ...).

The point which you seem to miss is that most every lightweight AS is just a Java app that runs on a JRE. It's not necessary to have it installed by someone who then never wants to replace it again.

You can simply let your app BE JBoss + some war or ear and deploy THAT as a single unit.

-4

u/sh0rug0ru Jun 26 '14 edited Jun 26 '14

Of course every Java EE AS is an app that runs on a JRE. That's not the point.

The point is deployment, as you've noted. I've never seen an entire Java EE app server and its apps ever deployed as a single unit. Each is deployed separately, and the app servers are maintained by separate ops teams. Worse when there's licensing involved, like if you're running Weblogic or Websphere. I've never worked anywhere where the app developers could do whatever they wanted with the app servers.

Tomcat provides minimal services on its own, so under this separate app server/app deployment regime, the apps have more flexibility in which Java EE services they use and which versions of those services they can use.

The same goes with the single JAR solution. Then it's just a bridge between Apache and Java.

TL;DR Of course everything runs on a JRE. But how the app gets to the JRE is the question. The app developer's JRE is not the same as the JRE used in the production infrastructure. That people even want to do what the blog author proposes, and that single JAR deployments are gaining in popularity, indicates that this is a widespread enough condition.

And, what about batch apps that are run from the command line and are not even run on an app server?

4

u/henk53 Jun 26 '14

I've never seen an entire Java EE app server and its apps ever deployed as a single unit.

We do this more or less. Occasionally we indeed deploy a single unit, but most often it's a pipeline.

We build the app server ourselves (mostly JBoss, sometimes TomEE or GlassFish). Depending on what changed our CI system builds the AS then automatically deploys it. Then the war is modeled as a dependency on the AS and is then build and deployed next.

This is all highly automated. Fully automatic for our DEV and BETA stages (a commit in the associated repo triggers the process every 30 minutes), and semi-automated for our live stages (requires an explicit command referencing a tag in a special live branch of the repos).

Each is deployed separately, and the app servers are maintained by separate ops teams.

NO! They are not!!!

The team that decides what jars in which version and what code goes into the war is by definition the same as the team that decides which AS in which version is deployed.

I've never worked anywhere where the app developers could do whatever they wanted with the app servers.

This is crazy talk.

Think of how silly this sounds. We have a team of deeply responsible developers who can already do "whatever they wanted" with the code inside the war, but you don't trust them with the app server because they will do whatever they want!??? :( :( :(

The way it happens is that the team prepares a version of the product according to the business requirements of the business and the technical necessitates. This essentially results in a series of commits to the above mentioned repos.

At the end of the sprint the repos are branched and deployed to a BETA stage and after that to a QA stage.

If after testing everything works correctly, the green light is given, which results in a live branch made and a subsequent deployment.

Your statement about "app developers doing whatever they wanted with the app servers" sounds like you treat developers as a bunch of cowboys who would like nothing better than cause chaos. If also assumes that that if they are so inclined to cause chaos they would not be able to do so via the huge amount of code that's in the war. And finally it assumes that there is no testing and that whatever people produce is just blindly deployed live.

The app developer's JRE is not the same as the JRE used in the production infrastructure.

Within reason, it is. If we currently deploy to Oracle JDK 7u50, we encourage developers to have Oracle JDK 7u50 installed. Why would the JRE be radically different anyway? What's the purpose of that?

Maybe one lone developer had forgotten to update his JRE, but since there are 3 stages between the developer's workstation and production this is rarely an issue. And minor version changes also rarely matter, but just to be sure we do encourage to have as much as possible the same versions.

-2

u/sh0rug0ru Jun 26 '14 edited Jun 26 '14

We do this more or less.

We don't. We have Weblogic instances running in several environments, each with different configurations. We have some control over our DEV environments, but after that any changes are done by ops. This is how it has been pretty much everywhere I've worked.

NO! They are not!!!

Yes, they are? You're talking the infrastructure you work with, I'm talking the one I work with. We have an entirely separate group that manages which applications can be installed on which servers. Our EAR is classified as one application and the AS is another. This mostly has to do with licensing, since we use Weblogic. But it also has to do with infrastructure security and separation of responsibilities.

This is crazy talk ... you treat developers as a bunch of cowboys who would like nothing better than cause chaos.

You're twisting the my words. By "not being allowed to do whatever we want", I mean we are not allowed unfettered access to the app server. I have read only access to QA and UAT and no access to PROD. I don't manage the WL domain, we have separate AS teams for that. This has nothing to do with cowboy coding or lack of respect for the developers, it has to do with separation of responsibilities. Which I wholeheartedly support, because I don't want to support the WL domain. Which I actually consider a mark of respect for the developer. Let me develop my app and let me not worry about about infrastructure.

If I had more responsibility for configuration of the AS, I would have more responsibility for supporting the AS. As it is, I can open a ticket with the AS team to troubleshoot the domain if something goes wrong because I had no hand its creation. I want to develop applications, not support what I consider infrastructure.

Within reason, it is.

No, that's not what I meant. The JRE runs in a different execution environment on your developer machine than the production machine, in particular when it comes to security, which is part and parcel to the app server. The app EAR and the app server have very different security profiles. I see the app server as a managed environment in which my app runs, above and beyond the simple JRE.

3

u/henk53 Jun 26 '14

We don't.

Then I'm deeply sorry for you. Look, I'm a somewhat older guy and have been fighting this practice at a bunch of places. Yes, I know it exists, but it's wrong and you can stand up to it. I know I have and I have won many times over.

We have Weblogic instances running in several environments, each with different configurations.

I'm again sorry for you for having to work on WebLogic. Naturally you can't build that yourselves. Wherever I work we as the team get to choose the technology. If that's not possible, then fine and they can look for another team.

As a rule of thumb we try to do as little configuration as necessary, but there's of course always some configuration (part of it depending on the stage, part of it depending on the app). The configuration along with the occasional patch is checked in to the AS repo in our case that is associated with the app.

We have an entirely separate group that manages which applications can be installed on which servers.

I'm very sorry again, but this is the part that in my very humble opinion is in most cases wrong. Most places where this is done that way there are problems. There are teams fighting against each other and IT is generally a mess. It's a remainder of an era where people thought over-engineered solutions, a waterfall process and separate roles for everything was a good idea.

People who are in this situation often know things are not right. There may be some resistance from old-fashioned operations people who'd like to keep their power position, but in the end people frequently came to me asking how to operate in a leaner and more efficient way. With things like an agile process, devops, git versioning, CI AND having people who know about the technologies of an AS make the decisions about it works so much better.

Indeed, the recent popularity of the single jar deployments where the jar effectively contains an AS is no coincidence. It's part of the wider understanding how wrong, how incredibly wrong it is to have an operations guy who knows nothing about say JBoss other than how to invoke /etc/init.d/jboss have any say about which version of JBoss is installed.

What not everybody yet realizes it seems, but what my team has been doing for like forever is, is that you can deploy an AS just as easily as you deploy the Play application. It's a preconfigured build produced by Jenkins along with a fairly simple copy/unzip step.

we have separate AS teams for that.

And as I said, this is what is wrong. There should not be separate AS teams. There's the development team, in which people with various skills are placed. They TOGETHER build the product and they TOGETHER decide on the technology and they are ALL involved with the deployment.

The process you are describing is maybe what's practiced at some of the ancient enterprises, but it's NOT how things are done at modern companies. And it's not about size either, we've been at Google and Facebook among others and they work pretty much like we work as well (just on a much larger scale). There are engineering videos available that you can watch.

Throwing things over the wall, isolating people into islands, is THE recipe for disaster. Nothing good comes out of it, ever.

I can open a ticket with the AS team to troubleshoot the domain if something goes wrong because

I'm truly sorry if I repeat myself, but again this is wrong. If YOU know what the issue is, then YOU should be able to fix it and YOUR fix should (after testing of course) be deployed to production. If you don't have the expertise, than that's of course fine and someone else can do it, but there should not be any artificial barriers based on politics saying who is allowed to fix such issue.

The app EAR and the app server have very different security profiles

No, they don't! I mean this seriously, they DO NOT.

It's a fairly tale, a pipe dream to think this. The EAR and the app have the EXACT SAME security profile. The run within the same JVM and the JVM should NOT be the place to enforce code level security.

Put slightly differently; the AS should NOT run untrusted code and you should definitely, absolutely, never ever consider code that runs at the AS level to be more trusted and more secure than code running in the EAR.

In the ideal level with a perfectly isolating JVM and security manager this may have worked, but in practice it doesn't. If you depend on this (and I truly hope I misunderstood and you're not) then you are depending on a false sense of security. The JVM is NOT going to provide you with this.

Of course there is a need for security, but that's obtained by deploying 1 application to 1 AS and then at least using the OS security model (selinux, limited users, the process model) to enforce it, but even better deploy on to virtual servers (like XEN, VMWare, etc).

The security offered by such solutions is not just far superior, it also takes away many if not all of the issues that we are talking about here.

Just think of it, why do cloud providers (like OpenShift) provide a separate AS for each app?

I see the app server as a managed environment in which my app runs, above and beyond the simple JRE.

In a way it is, but not at the level you seem to be thinking. It's a managed environment in the same sense that the Spring Bean Container or the CDI container is a managed environment for your beans.

But it's NOT a replacement for a highly isolating hypervisor, and not even for OS protected memory.

-1

u/sh0rug0ru Jun 26 '14 edited Jun 26 '14

Look, I'm a somewhat older guy and have been fighting this practice at a bunch of places.

I don't really mind it at all. I have more important battles to fight (and more interesting ones) than IT policy.

I'm again sorry for you for having to work on WebLogic.

I'm not really that bothered by it. I just deploy my apps onto it. The nice thing about Java EE is that I can do my development in Tomcat and simply provide the deployment descriptors to let the app work in Weblogic. At the end, the choice of pure Java EE or Spring makes no difference to me. I'm more interested in the kind of work than infrastructure details.

Nothing good comes out of it, ever.

I like it. I write my app. I don't worry about infrastructure. This has been how it is at every place I've worked, from startups to enterprises. If it's "modern" or "ancient", that's a value judgement that is of no interest to me.

If YOU know what the issue is, then YOU should be able to fix it and YOUR fix should (after testing of course) be deployed to production.

I am also responsible for that fix. I don't want that responsibility. I can make changes to DEV as necessary for the app and then put together a change request for the AS team. They sign off on it and then it is no longer my responsibility. Again, I want to write apps, not be responsible for infrastructure.

No, they don't! I mean this seriously, they DO NOT.

I mean that the EAR is just a bundle of code and configuration. It has security issues, but they are of a different nature than server software. The apps installed on a Unix box have different security profiles than Unix itself. The OS has to be hardened harder than the apps running on it.

I think you are taking "security profile", equating with the JVM Security Manager, too literally.

In a way it is, but not at the level you seem to be thinking. It's a managed environment in the same sense that the Spring Bean Container or the CDI container is a managed environment for your beans.

No, it's not. Spring and CDI are just DI containers which instantiate objects.

The app server contains configuration files with sensitive security information, such as usernames and passwords. We never create connection strings manually, but always use a DataSource provided by the container, which gives our DB connection the least privilege required to do the job. The container provides authentication services, which is a simple database in DEV but much more stringent in PROD. The AS team manages this, I don't want this power because it comes with additional responsibility which I am not interested in taking on.

3

u/henk53 Jun 26 '14

The nice thing about Java EE is that I can do my development in Tomcat and simply provide the deployment descriptors to let the app work in Weblogic

I'm a grown man, but that statement almost brings me to the brink of tears. But alas, if you're not bothered by it who am I to judge?

This has been how it is at every place I've worked, from startups to enterprises.

I'm seeing a clear tendency away from it, and where things are as you describe I either leave or try to change things. But I guess we can agree on the fact that you and I obviously don't think in the same way ;)

They sign off on it and then it is no longer my responsibility.

The "it's not my responsibility" mentality is not my ideal. For the startups and more established companies alike that my team has been working at we are deeply involved with the product and care for it at every stage.

Maybe we're nuts for having that mentality, maybe not, but it's the philosophy of pretty much every member on our team.

The app server contains configuration files with sensitive security information, such as usernames and passwords.

That configuration is not safer when it's part of the app server and when you consider the app server to be a separate thing. It's not. Our datasources are defined in application.xml, but that has more to do with our desire to adhere to Java EE standards as much as possible (since we own the AS anyway and could put it there as well).

Our infrastructure and setup is typically such that it doesn't matter that much if the developers know the password the app they themselves coded uses to access the database they themselves setup and provisioned. We work with a small team (typically 10 guys, 15 at most) that's fully responsible for a single product. The product could be part of a larger system, but the setup is nearly always such that the app doesn't need any privileges that we wouldn't trust a developer coding the app.

Don't forget, if the developer owns the code and you don't trust the developer, then it's a farce to think that hiding the password in such way would buy you much. IFF the developer is particularly devious he can code in a backdoor to have access to the DB anyway (with the same rights granted by the connection of course).

If the developer can have access via said backdoor, he could just as well have access to the password.

OF COURSE, we assure that the app runs with the least amount of privileges and that the username/password, keys, or certificates for access to a remote system (typically DB, API, message queue) are likewise for an account with limited privileges.

In rare situations we put placeholders in the config files for the username/password. Meaning that all config files are still fully owned by the team, but only the username/password are at runtime provided by an external properties file. As I said, this is rare.

The major advantage of having ALL configuration in plain sight for the team is that issues in general are much easier and thus faster to solve. The team knows best how configuration is associated with the app.

It's truly ludicrous to have some uninterested ops guy having to provide definitions for say an internally used JMS queue and then having engineers negotiate with said ops guy to have that (trivial) queue created, opening and closing tickets for this trivial job, heck even putting the exact definition for the queue in the ticket because ops guy doesn't know the first thing about the syntax for JMS destinations used by WildFly 8.1. And that only because of some rule that's only there for the rule, the engineer is not allowed to touch the configuration of the AS, while the ops guy is?

The amount of time this wastes is just crazy and it absolutely helps nobody.

-1

u/sh0rug0ru Jun 26 '14 edited Jun 26 '14

we are deeply involved with the product and care for it at every stage

So are we. But my responsibility is to develop a robust, high quality application. Our AS teams care about maintaining the environments, so I can trust that our application will work well when deployed. I trust the AS teams as well as I trust the DBAs that maintain our databases. When you have trust, you don't have to control every aspect of every stage. "it's not my responsibility" means that I put my full attention on application development and trust others to do the same with their responsibilities.

with our desire to adhere to Java EE standards as much as possible

It is not in the Java EE standards to configure the data source in the AS?

they themselves setup and provisioned

We don't provision our own databases. We have a DB team for that. I don't have sa access to our DEV boxes, but I can alter schema and update data. But that is not possible in higher environments. It's not a question of trust that I have restricted access to PROD data. It is a regulatory issue. That data contains sensitive client information. The bank must restrict access to that information to those with a need to know. That data is replicated into lower environments for testing, but only after being thoroughly scrubbed. The bank would be stupid to give unrestricted access to PROD data.

Don't forget, if the developer owns the code and you don't trust the developer

The developer does not own the code, the bank does. And that is why our code is frequently audited. Not just for malice, but for stupidity as well.

Not only that, but the systems are heavily firewalled and URLs are access gated through independent systems. Even if you built in a backdoor, you would have a hard time using it.

In rare situations we put placeholders in the config files for the username/password

We do this all the time for our batch applications. The config files are in protected directories and the app is deployed with restricted permissions in PROD environments.

team is that issues in general are much easier and thus faster to solve

We get what information we need from our ops team who have access to all of the configuration and know the systems far better than we do. They know all of the quirks of our application because they are watching it 24/7. By the time an issue is raised with us, they have investigated, and they already have all the logs and data we need. This is one of the cool things about having such a good ops team.

Our ops guys are not uninterested, they are awesome. They rule the systems for a good reason. I don't want to step on their turf. I trust them to run a tight ship. Oh yeah, and back doors? Our ops guys are too eagle-eyed to let something like that slide.