Axis Webservice writing to BerkeleyDB XMl killing Tomcat

View: New views
1 Messages — Rating Filter:   Alert me  

Axis Webservice writing to BerkeleyDB XMl killing Tomcat

by Rupert Woodman :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

 
Hi,
 
I have written a webservice which writes to a Berkeley DB.
However, it regularly kills Tomcat (which isn't ideal).
 
I have some XML in a string:
 
<test name="suite2-test1" deliveryid="99" id="1">
  <sub1 attr1="val1"/>
  <sub2 attr2="val2"/>
</test>
 
I pass it to a method:
    
public boolean writeXmlFromString(String strContainerName, String strDocKey, String strXmlDocData) throws XmlException
{
    XmlDocument xdTestXml = xmManager.createDocument();
        
    xdTestXml.setContent(strXmlDocData);
        
    return write(strContainerName, strDocKey, xdTestXml);
}

   
which pulls the container out of a hash of containers
 
private boolean write(String strContainerName, String strXmlKey, XmlDocument xdTestData) throws XmlException
{
    String strKey = strContainerName;
 
    if (!hashWriteContainers.containsKey(strKey)) {
        ContainerAccess caContainer = new ContainerAccess(strContainerName, xmManager);
        hashWriteContainers.put(strKey, caContainer);
    }
 
    ContainerAccess caWriteTo = (ContainerAccess)hashWriteContainers.get(strKey);
        
    return caWriteTo.write(strXmlKey, xdTestData);
//    return true;
}
(if I replace the return line in the mthod above with the return true, I get no issues).
And the method which does the actual write is as below (I'm using a semaphore to ensure only one write will happen at once).
 
private boolean write(String strDocKey, XmlDocument xdTestXml) throws XmlException
{
    boolean boolRetVal = true;
 
    try {
        semWriteAccess.acquire();
 
        // Do write
        XmlTransaction xtTrans = xmManager.createTransaction();
 
        XmlUpdateContext xucUpdate = xmManager.createUpdateContext();
 
        xcContainer.putDocument(xtTrans, strDocKey, xdTestXml.getContentAsXmlInputStream(), xucUpdate);
 
        xtTrans.commit();
    } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        boolRetVal = false;
    } finally {
        semWriteAccess.release();
    }
 
    return boolRetVal;
}
 
I have all the Berkeley logging turned on which goes to the tomcat window, but as soon as tomcat crashes, the window (and log messages) are lost, which is unfortunate.
It would seem to me to be an issue with BerkeleyDB (even if this is caused by me doing something wrong), because making the change documented above makes the problem go away.
 
I'm not really sure where to go from here - should I report this as a bug, or is there some more investigation work I can do to track this down more?
I have the dump which Windows does, if that is of any use.
 
Many thanks
 
-----
Rupert Woodman