3 Replies Latest reply on Jul 15, 2013 11:24 AM by Kristian Ferkic

    JBoss 7.1.1 Hot-Deployment Issue

    Kristian Ferkic Newbie




      our JBoss (7.1.1) had some very strange issues after a hot-deployment.



      We use a hibernate interceptor for setting the right database-schema for every query. We use this to separate customer data (every customer has its own schema).

      When a customer makes a request against the server, the customer-name (also the schema name) is saved in the SecurityContextAssociation:







      The hibernate-interceptor uses the SecurityContextAssociation to get the customers schema-name and to replace the placeholder-schama (configured in the persistence.xml) for every query. We also have some native queries where we build the sql-queries by our own (without the interceptor), but we also use the SecurityContextAssociation to determine the database-schema. This mechanism worked for a long time. In the past we've alos used the same mechanism with a JBoss 4.2.3. We have never had any problems with it.



      Now we had a small update on our application. And we've decided to do a hot-deployment on the productive server. So, we've just replaced the old ear-file with the new one in the jboss deployments folder. After the ear has been "successfully" deployed, all this schema replacement stuff were messed up. One user has written the other in its schema. The strange thing is, that the queries were partially correct. So, in one ejb-transaction with multiple jpa-queries, some of the queries had the right schema set by the interceptor, but some had a completly wrong schema. The wrong schemas came from customers which were also working on the server at the same time. The same happend with the "self-build" native queries, where we have used the SecurityContextAssociation to get the schema to use. I suppose that somehow the ejb-context were messed up.



      We have then restarted JBoss and now it seems that everything is alright again.



      Though I'm wondering why and how could this happen? What could went wrong with the deployment to make the ejb-context completly inconsistent? Has anyone had similar problems, or is this possibly a known issue?

        • 1. Re: JBoss 7.1.1 Hot-Deployment Issue
          Wolf-Dieter Fink Master

          Hi Kristian,

          is it possible to check whether this will be the same in EAP6.1.0 (maybe Alpha or Final) or WildFly (upstream) because there are several fixes between 7.1.1 and now.

          • 2. Re: JBoss 7.1.1 Hot-Deployment Issue
            Kristian Ferkic Newbie

            Hi Wolf-Dieter,



            thanks for your response.

            I don't think we can change the application server on the productive system. Although, it would be interesting to compare them against each others. The problem here is, that I don't realy know how to reproduce this behaviour. We usually hot-deploy the application on our development machines (out of eclipse). And this works fine. We never had such problems. Do you have any ideas how I could force this?



            But its not realy about the hot-deployment. We can do without it. What bothers me is, that even if I'm pretty sure that this have happend because of the hot-deployment, I can't be 100% sure that it won't happen even without hot-deploying something on the server. Actually, I would be quite relieved if I would know that this is a bug in the hot-deployment and that it can't otherwise happen.

            • 3. Re: JBoss 7.1.1 Hot-Deployment Issue
              Kristian Ferkic Newbie

              I've just checked the logs again. Now that this has happend also with the native queries is not true (maybe it was just a coincidence). But I was thinking that it might be the interceptor who made this problems?

              Do you think that this is possible?