I have deployed a web service with Jax-ws that use a database for storing some state. I have packaged everything inside a EAR application and deployed it with Glassfish. I want to deploy multiple copies of this application on the same server (and then the same physical machine) but Glassfish does not allow it. Each application need to have a different WS endpoint (that is different url and/or port) and a different database so that each web service mantains its own state.
I tried deploying my application on different virtual servers and so different http listeners. So I got my application responding to different urls. Unfortunately the application is the same and so it is my database.
Can anyone help me?
I don’t think glassfish will forbid deploying the same app more than once, if it has a different name.
The problem probably comes from the way the differentiating date is provisioned. The usual approach is to read these properties (for example – the database connection string, username, password) from an external source:
However, you’d need a way to look for different files on the file system depending on the deployment. You can read the (web) context name on startup (from
ServletContext) and look for: