Am 24.08.2012 05:01, schrieb Andrew Yinger:
i believe this issue was identified before, but i occasionally see a
server-side exception that starts off like:
errorCode=user.query.invalid message=#exported Sorry, can't access,
query syntax of
....
XmlBlasterException errorCode=[resource.configuration]
serverSideException=true location=[XmlNotPortable]
message=[#exported Can't process XPath expression .....
it was first suggested that this was a parsing issue -- a possible xml
parser library conflict. (i have verified that i do *not* have any
extraneous xml parsing libs in my 'java\lib\endorsed' directory.)
later, a user noticed that a similar error was happening during unit
testing, and that it was a bug on the server:
The issues are:
1. The null check (method_newXPath == null) is outside the
synchronization block. Thread A and thread B could both pass through
the null check at the same time. Thread A will create the xpath
objects while B waits. Then thread B will go through and recreate
xpath objects while A is using them.
2. XPathFactory is, in general, not thread-safe (see
http://java.sun.com/javase/6/docs/api/javax/xml/xpath/XPathFactory.html),
and a method on that object is invoked outside the synchro block.
In the current code it looks like this:
Object xpath = null;
synchronized(XmlNotPortable.class) {
if (method_newXPath == null) {
clazz_XPathFactory =
java.lang.Class.forName("javax.xml.xpath.XPathFactory");
Class[] paramCls = new Class[0];
Object[] params = new Object[0];
java.lang.reflect.Method method = clazz_XPathFactory.getMethod("newInstance",
paramCls);
instance_XPathFactory = method.invoke(clazz_XPathFactory,
params);
method_newXPath = clazz_XPathFactory.getMethod("newXPath",
paramCls);
clazz_XPath =
java.lang.Class.forName("javax.xml.xpath.XPath");
Class clazz_XPathConstants =
java.lang.Class.forName("javax.xml.xpath.XPathConstants");
clazz_QName =
java.lang.Class.forName("javax.xml.namespace.QName");
java.lang.reflect.Field field =
clazz_XPathConstants.getDeclaredField("NODESET");
field_NODESET = field.get(null);
paramCls_StringDocument = new Class[] {
java.lang.String.class,
java.lang.Object.class, //
org.w3c.dom.Document.class,
clazz_QName };
}
xpath = method_newXPath.invoke(instance_XPathFactory, new
Object[0]);
}
so it seems to be correctly synchronized, or do I overlook your issue?
Thank you
Marcel
has this bug been fixed? if so, what version should i be using now?
(i am currently using xmlBlaster version 1.6.2 2007-12-03
'Openroads'.)
a response to this ongoing issue would be greatly appreciated, as it
is impacting our automated unit tests.
thanks,
andrew yinger