error => Another user has modfied the document

X-Application Version: 3.1.3, 3.1.2, 3.1.1
Tamino Version : 3.1.1
Platform : NT, Win2k, Solaris, …
WebContainer : Tomcat 3.3
JDK Version : 1.3.1

I am updating a document in Tamino through X-Application. I keep getting this error :
Another user has modfied the document “/Invoice[@ino:id=‘367’]”.

Do you have any ideas what causes this error and what I can do to avoid it?

For the moment I am the only user of the application, so I know that there is nobody else modifying the documents.

Best regards
eagle

[This message was edited by Christian Freytag on 17 Oct 2002 at 15:02.]

Hello,

this exception is thrown by X-Application’s Store Layer if it detects that the timestamp of document has changed.

Since you wrote that you are the only user of your application, it is a strange behavior.

There could be two reasons:

(1) The text for this message is wrong. Could you remove the error.jsp of your page. Then , the stacktrace is shown by default and we can check if the error is based on an update conflict.

(2) You are using two session and modify the same document, but are not aware that you are using different sessions. A session is created if you start a Internet Browser and address your application. Do you work with multiple browser windows?


If you have the stacktrace, please post it to this topic for I get more details about this error.

Many thanks,
Christian.

Hello Christian,
Here comes the stack trace.
And concerning your question about multiple windows - I use javascript to create frames in Internet Explorer.

Internal Servlet Error:

javax.servlet.ServletException: Update Conflict: Another user has modfied the document “/InvoiceRB[@ino:id=‘367’]”.
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:460)
at jsp.sublinesView_1._jspService(sublinesView_1.java:674)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:574)
at org.apache.tomcat.core.Handler.invoke(Handler.java:322)
at org.apache.tomcat.core.Handler.service(Handler.java:235)
at org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:485)
at org.apache.tomcat.facade.RequestDispatcherImpl.doForward(RequestDispatcherImpl.java:272)
at org.apache.tomcat.facade.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:174)
at is.visa.invoice.event.EventHandlerBase._dispatch(EventHandlerBase.java:41)
at is.visa.invoice.event.EventHandlerBase.forward(EventHandlerBase.java:29)
at is.visa.invoice.Controller.doPost(Controller.java:91)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:574)
at org.apache.tomcat.core.Handler.invoke(Handler.java:322)
at org.apache.tomcat.core.Handler.service(Handler.java:235)
at org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:485)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:917)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:833)
at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:176)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:494)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:516)
at java.lang.Thread.run(Thread.java:536)
Root cause:
XJspException:
id = 163 arg[0] = /InvoiceRB[@ino:id=‘367’]
at com.softwareag.xtools.xapplication.store.TaminoStore.update(TaminoStore.java:1095)
at com.softwareag.xtools.xapplication.businessdocument.SingleBusinessDocument.updateDocument(SingleBusinessDocument.java:913)
at com.softwareag.xtools.xapplication.businessdocument.state.Modifiable.quasiCommit(Modifiable.java:85)
at com.softwareag.xtools.xapplication.businessdocument.SingleBusinessDocument.commitAll(SingleBusinessDocument.java:1098)
at com.softwareag.xtools.xapplication.businessdocument.BusinessDocumentWorkspace.commitAll(BusinessDocumentWorkspace.java:364)
at com.softwareag.xtools.xapplication.plugin.StandardWorkspacePlugin.commitDocumentList(StandardWorkspacePlugin.java:244)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.softwareag.xtools.xapplication.plugin.Action.invoke(Action.java:180)
at com.softwareag.xtools.xapplication.plugin.Dispatcher.execute(Dispatcher.java:158)
at com.softwareag.xtools.xapplication.jsp.SessionContext.processWorkspaceAction(SessionContext.java:389)
at com.softwareag.xtools.xapplication.jsp.taglib.ModuleTag.processDocumentAction(ModuleTag.java:503)
at com.softwareag.xtools.xapplication.jsp.taglib.ModuleTag.doStartTagCore(ModuleTag.java:117)
at com.softwareag.xtools.xapplication.jsp.JspTag.doStartTag(JspTag.java:142)
at jsp.sublinesView_1._jspService(sublinesView_1.java:175)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:574)
at org.apache.tomcat.core.Handler.invoke(Handler.java:322)
at org.apache.tomcat.core.Handler.service(Handler.java:235)
at org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:485)
at org.apache.tomcat.facade.RequestDispatcherImpl.doForward(RequestDispatcherImpl.java:272)
at org.apache.tomcat.facade.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:174)
at is.visa.invoice.event.EventHandlerBase._dispatch(EventHandlerBase.java:41)
at is.visa.invoice.event.EventHandlerBase.forward(EventHandlerBase.java:29)
at is.visa.invoice.Controller.doPost(Controller.java:91)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:574)
at org.apache.tomcat.core.Handler.invoke(Handler.java:322)
at org.apache.tomcat.core.Handler.service(Handler.java:235)
at org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:485)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:917)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:833)
at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:176)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:494)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:516)
at java.lang.Thread.run(Thread.java:536)

Best regards
eagle

Hello,

so we can exclude (1). The timestamp does not equal the timestamp within Tamino.

To find out the reason for the problem, can you give me more details about your application:

- are you using own Plugins
- are you using a generated application

and the scenario when this error occurs

- e.g. search document, list documents in browse page, select single document, display document, modify document, commit document.

Thanks,
Christian.

I search for a document by using directcommand.

I use plugin to modify the data.

This update conflict occurs only when I commit after calling the plugin, but does not happen if I commit the document without using the plugin.

If you want more details about the plugin then look at the topic :
<can <xapp:elementaction type=“insertafter”> insert more than one element?>

Which you helped me with.

Let me know if you need further information.

Best regards
eagle

Hello,

if you modify the document within your Plugin could you add the following lines of code at the beginning of your Plugin method.

public static void nyPluginMethod(BusinessDocument doc, ...) {
    if (doc.getState() == BusinessDocument.READ) {
        doc.modify();
    }
    ...
}



This could solve your problem because documents which are created from a ‘query’ (action or directcommand with type=“query”) have invalid timestamps. The timestamp is correctly set when the document changes its internal state from ‘READ’ to ‘MODIFIABLE’.

If this code does not change the behavior, please make a print out the timestamp of your document within your plugin.

println(“timestamp of document '” + doc.getDocumentId() + "’ : " + doc.timestamp);

Then, I have to analyze this problem.

Bye,
Christian.

Hello

Since this is my first plugin I am a little bit confused how to do this.

My plugin method is defined as follows:

public static void insertInvoiceDetailAfter(Element invoiceRBDetail) {


}

The method is defined as an elementAction.
How do I get access to the BusinessDocument?
Do I have to send it as a parameter to the method? And if so can you give me an example how to do that?

Best regards
eagle

Hello,

just add to the plugin definition that the document context is required for your plugin.

(1) within your xapplication.xml:

<element ...>
   <action name="..." 
           method="...insertInvoiceDetailAfter">
      <arg>document</arg>
   </action>
   ...
</element>
</pre><BR><BR>(2) within your Plugin method<BR><pre class="ip-ubbcode-code-pre">

public static void insertInvoiceDetailAfter(Element invoiceRBDetail, BusinessDocument doc) {
  ...

}



Bye,
Christian.

Hello Christian,

The modification to the plugin worked. So I don’t get this error anymore.

Thanks a lot.

Best regards
eagle

Hello,

yes, good point. Without the knowhow of X-Application’s internals, it would be impossible to detect the reason for the error.

Even if the internal knowhow is available, it is not easy to find out the reason for this behavior.

For the next version, we have to make a hint within the documentation if we find not a better solution for the update check than the explicit invocation of the ‘modify’ method.

Bye,
Christian.