4 Replies Latest reply: Feb 24, 2011 8:21 AM by 756043 RSS

    Error container.putDocument


      I have a problem with the method putDocument in a container.

      The part of the program where I execute it is like this

      File containerFile = new File(manager.ENVIRONMENT_PATH, BdbxmlManager.CONTAINER_MESSAGE);
      XmlContainer container = manager.getXmlManager().openContainer(containerFile.getCanonicalPath());
      try {
           XMLElement textFormat = new XMLElement("<text>"+textMessage+"</text>");
           System.out.println("Starting... ");
           container.putDocument(transaction, "26368.xml", textFormat.toString() );
           System.out.println("Ending... ");
      } catch (Exception e) {
           System.out.println("Excepcion caught");

      The program stops at the line container.putDocument(transaction, "26368.xml", textFormat.toString() );
      and it do nothing. The text in catch or in finally is never printed.

      There are about 26000 documents in the container. Could it be a problem? Has the document got a very large name?

      Thank you
        • 1. Re: Error container.putDocument

          I guess that you provided only pieces of your code.
          Anyway, most likely the problem is that you don't open a container with a transactional support. You should do something like:
                  XmlContainerConfig containerConfig = new XmlContainerConfig();
                  container = manager.openContainer(CONTAINER_NAME, containerConfig);
          Also you should commit or abort any transaction.

          Let me know if you have further questions/problems

          • 2. Re: Error container.putDocument
            Yes, I already set transactional environment. I has to be another problem.. But I don't have any idea.

            • 3. Re: Error container.putDocument
              Setting a transactional environment is not enough, you should set a transactional container as I pointed out -- I couldn't see it from your code snippet.
              If it doesn't help, could you post the whole piece of code?

              • 4. Re: Error container.putDocument
                Ok, I didn't realize that setting environment transactional it's not enough.
                I 'll try setting container too.

                Thank you