Tool for managing multiple Java web container instances? - java

I'm looking for a Java Web Container (like jetty and tomcat) or a tool in which I can create/remove server instances through a management console.
The problem is that my organization needs to create different instances of a test server for quality control testing (against different database configurations). Currently, I'm having to manually copy a Tomcat "catalina_base" template directory and make any changes needed for the test being run. It would be nice to have a unified interface where I could click a button to create a new instance (and click another to remove it).
Edit 1
Must be able to run on Windows Server 2003.
Edit 2
I'm getting a lot of answers that have to do with build, so I'm going to add some extra information about the application. The application is a standard Java EE web application that is built using an ANT script. We use a container managed JNDI DataSource for connecting to the database. Our procedures, which are hold overs from 20+ years ago, have dictated that every new database change needs to be in a new schema.
So say a customer reports that our application is displaying a calculation wrong - the first thing we do is create a new database schema, then we run the create script for all of the database objects, and lastly copy the data from production for testing to that new schema. When we've fixed the bug (either application side or database side), our quality control person, needs the fixed application and the schema within the DataSource changed to that of the new "test environment". When they've completed their testing, we stage the code to be included in the next scheduled release.
The catch is, this process is multiplied by a number of developers and a number of concurrent bugs fixed and features added. Currently, there are over 20+ Tomcat instances managing different versions of the application and database objects. I'm constantly having to create new Tomcat instances and remove old ones, as features are added and quality control has completed.

it sounds like what you really need is a build a deployment tool like Continuum

You can do so with jetty.You can create your own Java Class with the specified configuration as an embedded server and run it from the prompt or through some web interface.
you can check this out
http://docs.codehaus.org/display/JETTY/Embedding+Jetty

Have you thought about a configuration management tool like Chef?

It sounds like you should just update your application's build script to be able to accept different parameters for things like "use test1.properties for database settings" or "use prod2.properties", and then deploy that rebuilt application.

Related

What is a better way to change variable in runtime server?

We maintain our server once a week.
Sometimes, the customer wishes that we change some settings which is already cached in server.
My colleague always write some JSP code to change these settings which are stored in the memory.
Is it a good method to use this kind of methodology?
If our project is not a Web container, which tools can help me?
Usually, in my experience, the server configuration is not stored only in memory of server:
What happens that after a configuration change, the server has been restarted / just went down for some system reason?
What happens if you have more than one instance of the same server to work on (a cluster of servers in other words)?
So, usually, people opt for various "externalized configuration" options that can range from "file-based" configuration + redeploy the whole cluster upon each configuration change, to configuration management servers (like Consul, etc.d, etc). There are also some solutions that came from (and used in) a java world: Apache Zookeeper, Spring cloud config server to name a few, there are others. In addition, sometimes, it's convenient to store the configurations in a database.
Now to your question: If your project is not a web container and you don't care that configuration will "disappear" after a server restart and you're not running a distributed cluster of servers, then, using JSP indeed doesn't seem appropriate in this case.
Maybe you should take a look at JMX - Java management extensions, that have a built-in solution so that you probably will be able to get rid of a web container (which seems to be not used by your team anyway other than for JSP modifications that you've described).
You basically need in memory cache, there are multiple solutions found in answers which include creating your own implementation or using existing java library. You can also get data from database and add cache over the database layer.

How to manage shared bootstrap data accross multiple projects

I have 3 web-projects that use the same database and same models. These systems require partly the same bootstrap data in the database in order to run properly. All Systems share library code that will read the data from database and update it according to the bootstrap data in the code (add new, remove unused, update changed). Every application will perform this when they start and most of the time nothing needs to be done since the data is already correct. This data is also used by some of the integration tests.
The problem is that when some of the common data needs to be changed, then all 3 applications needs to be re-deployed with the new bootstrap data because otherwise they will bootstrap with the old data in case they are restarted (server reboots for example).
I'm looking for the best way to manage shared bootstrap data for multiple projects.
You could create a plugin that contains a service that does what you need and include the plugin in all projects. Then simply call the plugin service within each bootstrap.

Exporting a Java project that uses PostgreSQL

I couldn't find an answer to this question. How can I export a Java project that makes use of a PostgreSQL database?
I want to use the same database on another computer. Do I need to export the database itself with the project? How can this be done?
What should the connection URL be, so that the database is accessible on another computer?
I'm using JDBC, and I'm on Windows.
Thanks in advance.
EDIT: Wouldn't I also need to dynamically retrieve the username and password on the other computer, instead of using the specific username and password I have on my computer in PostgreSQL?
It really depends on what you want to achieve.
Shared database between hosts
Do you want the application on both computers to use the same database, so that changes made by one are seen on the other? If so, you need to configure each copy of the application to connect to the same database instance on one of the machines. This is usually done by changing the JDBC URL. You'll need to configure PostgreSQL on the machine that'll be the database server so it allows connections from the other hosts, ensure they can talk to each other over TCP/IP, etc.
Fresh DB on each host
Do you want each install to have a separate instance of the database, so changes made on one have no effect on the other, and where each instance starts out with a blank, empty database (or one with only static contents like lookup tables)? If so, you should generally define the database using SQL scripts, then have the application run the SQL scripts when first installed on a machine. If you've defined the database by hand so far, you can use pg_dump to create a SQL script that you can use as the basis for this, but I really advise you to look into tools like Liquibase for schema management instead.
"Fork" current state
Do you want each instance of the application on a machine to have an independent database, so changes made on one have no effect on other instances on other machines, but where the starting state of an install is what was in the database on the other host? If so, you need to dump and reload the database alongside the application, using pg_dump -Fc and pg_restore. You can automate this within your application / build system using tools like ProcessBuilder, or do it manually.
There's no generic, canned way to do this. It'll require you to define an application deployment procedure, maybe produce an installer, etc.

deploy a java/mysql application

I created a java swing application using a MySQL database.
So I want to create an installer for the application so as it could be installed and runned on every pc having JRE installed.
After some researches, I found a way to achieve this using Launch4j and Inno Setup Compiler after generating the jar file.
The problem is that I don't know how to integrate the mysql database so as the application can be seen as a whole.
Thanks in advance
It is more a comment that anything, but I need the extra space/formatting:
A MySQL install is not something I would do automatically for a user because:
a) You are creating services that the user may not know how to manage. You are installing a program that will open ports, that may need security updates, etc. If your final user has no IT background to properly manage that, it is clearly a security issue.
b) Maybe the user prefers another configuration. OTOH, if the user knows what he is doing, maybe he already has a MySQL install. He may prefer just to run your DB inside the MySQL that is already installed, because it is properly configured (including backups), it is in redundant hardware, whatever.
If you need a small, embedded database with your product, switch to Derby or Hypersonic.
If your product requires a full MySQL install, just provide (and document) a way for an IT operator do the installation by itself (give the SQL scripts to create and populate the database together with the code, specify how to configure the DB parameters in your application).

Tools for managing configuration of multiple web applications

We have several Spring MVC and Metro based applications which communicates with each other. Their settings are currently stored in multiple property files, that are made available to apps via PropertyPlaceholderConfigurer. This is not convenient because configuration is scattered and some parts of it is duplicated among servers. Currently we are going to create another webapp which is known to every other app and which keeps this whole configuration and provides an interface that allows to request these properties as key-values pairs. Is there any out-of-the box solution of this kind? Or, probably, is there a better way for solving this problem?
Do you need hot configuration, or just on startup?
If its just on startup, I would do it by some kind of version control system like svn.
So when app starts, it makes a call to svn to get the latest config.

Categories

Resources