4 Replies Latest reply on Aug 18, 2005 6:14 PM by sys user

    Problem with hot deployment of datasource.

    tbech Newbie

      I have problem with hot deployment of datasource.
      I just touch file - no content change.
      Datasource is redeployed.
      Trying to make a query and exteption is frown:
      javax.ejb.FinderException: Find failed: org.jboss.util.NestedSQLException: You are trying to use a connection factory that has been shut down: ManagedConnectionFactory is null.; - nested throwable: (javax.resource.ResourceException: You are trying to use a connection factory that has been shut down: ManagedConnectionFactory is null.)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractQueryCommand.execute(JDBCAbstractQueryCommand.java:223)

      TRACE log on org.jboss.resource gives no clue.



        • 1. Re: Problem with hot deployment of datasource.
          tbech Newbie

          Some more info. JBOss 3.2.6. I tried to debug and found that:
          exception is frown in TXConnectionManager:

          public Object allocateConnection(ManagedConnectionFactory mcf,
          ConnectionRequestInfo cri)
          throws ResourceException
          {
          if (poolingStrategy == null)
          throw new ResourceException("You are trying to use a connection factory that has been shut down: ManagedConnectionFactory is null.");


          Why poolingStrategy is null?

          Answer:
          I found that the object TXConnectionManager which is called is the first one which was ever contructed by JBoss (on startup). Any further changing of datasource.xml stops previous TXConnectionManager (which does poolingStrategy = null - see stopService) and creates and starts new one. But finder/QL still sees the previous TXConnectionManager.

          More important is that I have also in the code some BMP (take datasource by jndi, getConntection). As you can suspect it WORKS. So hot deployment of datasource works for BMP, doesn't work for CMP. Is there a special tag to tell that CMP should reflect the changes of datasource?

          Can you commit that it ever worked for CMP beans? Any clue how to go on?

          • 2. WE NEED THE ABILITY TO MODERATE THE FORUMS EFFECTIVELY
            Adrian Brock Master

            This is officially my last post (for non bug related questions) until the portal developers
            provide a mechanism to weed out these posts by lazy users.

            The FAQ is there for a reason.....
            http://www.jboss.org/wiki/Wiki.jsp?page=DynamicallyChangeADatasourceWithRestartingOrRedeployingApplicationsDependentOnIt

            • 3. Re: Problem with hot deployment of datasource.
              tbech Newbie

              Adrian, I don't undestand your possition.
              I'm not 'lazy user', before making post I check forum and wiki for half a day. And as you have seen I tried to debug and UNDERSTAND what is going on after redeploying of DS.

              Also several other people have seen my post - no answer, so seems that noone is aware of the problem !!! Or JBoss have bad help-community.

              Wiki is great way of publishing workaround - but as many other EJB servers provide such BASIC functionality, why not to mention in User Guide, or simply implement it in the box. You will always deal with such questions, as the users don't need to know detailes of internals of JBoss to achieve BASIC funtionality.

              Now technical part:
              I've seen this Wiki page, but it didn't seem to me as solution. Reading the header:
              The goal is to dynamically change the datasource, for example,
              * for entity beans at runtime.
              * The service implements javax.sql.DataSource interface and is bound in the JNDI.
              * The target datasource can be changed with setTargetName(String jndiName) passing in
              * the JNDI name of the target datasource.


              I understand that this mbean is for changing dynamicaly the underlying jndi name for Entity Bean, so ignored as something else. Also keep in mind that I was still thinking that it is basic functionality and I forgot to set something in descriptor or datasource configuration.

              And thanks for help

              • 4. Re: Problem with hot deployment of datasource.
                sys user Master

                Hi all.

                I just wanted to add that I _also_ see this problem with my current jboss: 3.2.5.

                Also, I didn't find anywhere anything about this problem.

                If someone could point me to some directions...

                I also noted that this seems to be fixed in 4.0.2. I don't know if this was preivously fixed, I only tested 4.0.2 today and tried that.

                I hope it helps.