Auto Upgrade for Java EE enterprise applications - java

Our current process for upgrading the application is to undeploy the current version, and then deploy the newly created EAR process.
I have seen softwares which have an "auto update" functionality (such as Spring Tools Suite). The software downloads the updated files automatically and performs a self upgrade. There is no need to download the complete setup again and uninstall/install the application.
I just wanted to check if anything similar exists for Java EE web applications as well?

Many servers today support hot-deployment, where you deploy the app over the running one.
This of course still needs the functionality to pull the app from somewhere.
In JBoss 4 at least (and I think it is also available in 5), you can tell the deployment scanner to watch multiple directories, so it could monitor e.g. a shared drive and when you put the application there it would see it and pick it up.

The proper way to redeploy code at runtime is to use OSGi. This is a system created to allow automatic dependency resolution. It allows e.g. for you to keep running older code for existing connections, while using the new code for new connections.
It also allows you to link to newer versions of libraries, which are loaded automatically.
See https://docs.jboss.org/author/display/AS7/Helloworld+OSGi+quickstart for a nice quickstart for using OSGi with JBoss 7.

Related

How to Migrate WebSphere 6.1 to WebSphere 8.5

I am new to WebSphere. One of the project came to upgrade the existing IBM WebSphere application server 6.1 to WebSphere application server 8.5. Four custom EJB application is running on server. Please guide what the solution to migrate to 8.5 Application Server.
I've handled a few migrations and there are definitely some gotchas to watch out for:
If this is any more critical than a development system, there is a bit of planning you'll need to do. You'll have to bring over any config from the old environment, and you'll have to make sure your applications will work in the new environment.
For the former, WebSphere itself ships with the configuration migration tools, both as command line tools and as a wizard. If you're migrating between installs on the same machine, I would definitely recommend the wizard as it better explains the process and what each setting does. If the installs are on different systems, the command line tools can help with that, but the wizard cannot. The tools to use are both documented at this link although for some reason the article neglects to mention that the wizard is also called migration.sh or migration.bat
If you have a cell topology (a deployment manager managing some number of application servers) you'll migrate the deployment manager first and then the nodes. In that case, the old cell will be disabled, so make sure you take a full backup of the old environment so you can roll back if you have to. The specific procedure for migrating a cell has a good overall order of steps to take, but doesn't mention the wizard. You can replace the "create profile, backup, restore" cycle with the wizard, but the rest of the steps should remain the same.
If it's just a standalone application server, those can usually coexist at the same time so you may be able to keep the old one active while you set the new one up, but I don't think there are any established documentation on how to do that, so to be safe, backup, and plan for some downtime.
Another consideration will be the applications themselves. You will be moving to a new version of WebSphere which supports a new level of Java EE and runs on much newer Java SE, and there are often problems and incompatibilities that come up. For that, I recommend running the binary application scanner with your applications and environment specified and seeing what it reports. If there are any severe issues it flags, it may be worth investigating those before starting the migration to minimize downtime.
Already I can tell that using EJB on WebSphere 6.1, you'll need to make sure that you install the EJBDeploy tool with your WebSphere 8.5 install. It will be automatically used during application deployment. Without that, it's pretty likely the applications won't work because their old EJBs won't deploy. Because of this, I believe you still need to use Java 7 unless you install this fix to get it to run on Java 8. I do not recommend running on Java 6 because that is going out of service by Oracle within a year or so.
So, to summarize:
Use the binary application scanner to see if there are any immediate compatibility issues to start addressing in the applications themselves
Make sure you have the EJBDeploy tool installed along with WebSphere 8.5
Use the migration wizard or command line tools to bring over your configuration and deploy your applications
#Jarid's answer documents everything available relating to WebSphere migration, and is also a good resource.
WebSphere provides an official migration toolkit to assist with the migration process: https://www.ibm.com/developerworks/library/mw-1701-was-migration/index.html

Implementing a JavaFX application auto update feature

I'm about to write a new cross platform application, and I choosed JavaFX, mainly because of its rich UI libraries (both standard and third party) and it native data binding feature. My application will be deployed via native packaging, both because the lack of PPAPI Java plugin (Chrome will discontinue NPAPI in Chrome 42, which is in beta now) that would prevent an user with Chrome to use WebStart, and because a more "classic" user experience, so WebStart and automatic updates are off the table.
The scenario would be the following:
Application starts and checks for updates
If updates are found, download them and put them in a temporary folder
At application shutdown, write the newly downloaded JAR files over the old ones
Automatically restart the updated application
However, a few question arises in my mind (initially these two, but I could be updating this question as soon as I have more):
Is it safe to do so? Am I risking that somehow the JVM gets crazy if I overwrite some of the JARs already used in the application lifecycle?
I'm struggling to find a way to automatically restart my JavaFX application. Is it even possible?
Thanks everyone for your help.
Take a look at GetDown or UpdateFX. It implements a bootstrap downloader that checks for updates, downloads them and starts your Application as soon it is updated
I've recently created update4j which works with Java 9's module system and meets your requirements.
Perhaps you can try install4j though it's paid. The main feature here that I love the most is the auto update and the way you can configure the installer in an easy way (create Linux - deb,rpm installer, Mac and window installer) and can even package the required jdk version to run your app (this means your users do not need to have that java version installed first before using your app)
Though, it might seem a bit overkill foe your needs

Is there any other way to do a Hotswap without using Java IDE?

The Application is Running on Tomcat Server using java.I dont want to stop the Server everytime there is a Java change. The build System is heavily reliant on Shell Scripts, so i cannot use any Java IDE to do normal HotSwap.
Now, Is there any otherway i can Hot swap the file?
I have used JRebel for this purpose on several java projects. It can reduce redeploy times considerable.
One way would be to use the Tomcat Management Web User Interface. You can easily script commands to the WebUI using curl.
There are also Ant tasks for Tomcat management operations.
Reference:
http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html
Examples:
Tomcat 7 tomcat-users manager-script example for /deploy
Tomcat manager remote deploy script
If you are looking for some kind of graceful update of your applications, you can take a look at Tomcat's Parallel deployment. With that option, you can update application without stopping current open sessions. The server will start new sessions on the new application versions while older one wont be renewed on the older.
What you are looking for is a Development Mode which allows you to swap the Application at runtime with a new version. This is usually useful for development while not practiced in the production, hence it is called "development mode".
See How to Install Apache Tomcat for Development Mode.
More on this also in Restart tomcat when a class file is changed?.
See the Documentation, search for reloadable:
reloadable
Set to true if you want Catalina to monitor classes in /WEB-INF/classes/ and /WEB-INF/lib for changes, and automatically reload the web application if a change is detected. This feature is very useful during application development, but it requires significant runtime overhead and is not recommended for use on deployed production applications. That's why the default setting for this attribute is false. You can use the Manager web application, however, to trigger reloads of deployed applications on demand.

Distributing java web applications

We have a java application hosted on JBoss with a Posgres DB, and we've traditionally been selling it as an appliance (full server with application installed). Now, we need to allow clients to be able to download and install it on their servers. What is the best way to approach this? Ideally, I'd like it to be a one packaged installation file that they can run and it checks for dependencies, deploys the war file, executes the postgres sql to setup the database and start up jboss.
JBoss and Postgres will be installed by the client prior to installation.
The simplest way is to use a bash script for Linux and possible bat/cmd files for Windows, though that is not ideal. Are there any libraries available to accomplish something like this?
install4j can be used to let users install applications. The installation package will contain everything needed (application, JBoss, postgres). Furthermore, it has ant and maven tasks, too, and you can even allow the users to do some basic configuration on-the-fly.
The latest version of JBoss is OSGi based. Have you consider to use this solution ?
If JBoss and Postgres are already preinstalled and configured by users as they wish then it would be very difficult to make a silver-bullet automatic installer that takes into account and correctly handles whatever incompatibilities it can face in real life.
Maybe a detailed install instruction would be enough. Especially for advanced users. For the others - bundle some diagnoctic scripts in case they face problem.
Also consider using liquibase to do automatic database initialization and migration on application's startup. This would greatly simplify the rest of install procedure: just check deps, make datasource and deploy app.

JBoss, Tomcat or Glassfish for Bonita Open Solution 5.4?

I'm currently trying to implement BOS 5.4 in one of my projects. Unfortunately I'm quite new with Java-based applications.
It is my understanding that you could implement BOS 5.4 either in JBoss, Glassfish or Apache Tomcat. There are a lot of documentation available online but I cannot determine which one to use. What is the recommended setup for a BOS installation?
Here's the setup that we are planning:
Bonita Open Solution 5.4
CAS for user authentication
MySQL for database
Integration with Liferay Portal
I think you can use any server (which you counted), but if version of server does not matter for you, you can download JBoss 5.1 or Tomcat 6.0.29 with already installed BOS:
Download BPM software and documentation page, go to the Bundles item.
using bundles can save you time for installation (I don't know how easy it is, never did), as well as you won't deal with conflicts (e.g. if current release does not work well with JBoss 6 because of its newer Hibernate or something else). Well, as I wrote, if server version does not matter, then go with bundle (imho). If your project already uses any server, then you could try to setup BOS there...
One more issue: if you don't need application container (like JBoss), then go with Tomcat, it is lightweight web server, it will be booted faster and needs less resources. If Tomcat is not enough for you, then JBoss is your choice. At least from what you wrote, I don't see anything that demands JBoss...
GlassFish Server offers built-in high availability, command line and GUI management interfaces (no XML editing), with commercial support available - or you can use the open source builds. It is also very well documented:
http://www.oracle.com/technetwork/middleware/glassfish/documentation/index.html

Categories

Resources