You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-users@xml.apache.org by Julie McCabe <ju...@qub.ac.uk> on 2005/09/02 17:45:58 UTC

xupdate update fails but query using xpath succeeds?

Hello,

Im trying to execute a xupdate to change the value of an element in an 
document.

String updateXml = "<xupdate:modifications version=\"1.0\""
                        + " xmlns:xupdate=\"http://www.xmldb.org/xupdate\">"
                        + "<xupdate:update 
select=\"/domain/service[@key='PLAYOUT']/memberVariable[name='channel'] \">" 
+ "channel1"
            + "</xupdate:update>"
            + "</xupdate:modifications>";

            Collection collection = con.getCollection();
            XUpdateQueryService updateService = (XUpdateQueryService)
                collection.getService("XUpdateQueryService", "1.0");
            updateService.updateResource("PO-NI-01", updateXml);

The exception thrown is @ the server ...
1168620 [http-8080-Processor23] WARN  
org.apache.xindice.core.xupdate.XUpdateQueryResolver  - ignored exception
java.lang.NullPointerException
        at org.xmldb.xupdate.lexus.commands.UpdateCommand.execute(Unknown 
Source)
        at 
org.apache.xindice.core.xupdate.XUpdateImpl.execute(XUpdateImpl.java:116)
        at 
org.apache.xindice.core.xupdate.XUpdateQueryResolver$XUpdateQuery.execute(XUpdateQueryResolver.java:142)
        at 
org.apache.xindice.core.xupdate.XUpdateQueryResolver.query(XUpdateQueryResolver.java:84)
        at 
org.apache.xindice.core.query.QueryEngine.query(QueryEngine.java:122)
        at 
org.apache.xindice.core.Collection.queryDocument(Collection.java:1242)
        at org.apache.xindice.server.rpc.messages.Query.execute(Query.java:58)
        at 
org.apache.xindice.server.rpc.RPCMessageInterface.run(RPCMessageInterface.java:48)
        at sun.reflect.GeneratedMethodAccessor137.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.apache.xmlrpc.Invoker.execute(XmlRpcServer.java)
        at 
org.apache.xmlrpc.XmlRpcServer$Worker.executeInternal(XmlRpcServer.java)
        at org.apache.xmlrpc.XmlRpcServer$Worker.execute(XmlRpcServer.java)
        at org.apache.xmlrpc.XmlRpcServer.execute(XmlRpcServer.java)
        at org.apache.xmlrpc.XmlRpcServer.execute(XmlRpcServer.java)
        at 
org.apache.xindice.server.XindiceServlet.doPost(XindiceServlet.java:90)
....................

>From the client it appears as if the update is successfull!  Ive tested the 
select part of the xupdate query and it returns a document segement as 
expected - I tested this with ....

Collection collection = con.getCollection();
            XPathQueryService queryService = (XPathQueryService) 
                collection.getService("XPathQueryService", "1.0");
            ResourceSet resourceSet = queryService.query(queryXml);


Any ideas on this matter are greatly appreciated, as it doesnt make sense to 
me :)

Configuration: xindice 1.1b4, tomcat 5.0.30, jdk 1.5, os RH 9.0.

Regards,
Julie.



Re: xupdate update fails but query using xpath succeeds?

Posted by Julie McCabe <ju...@qub.ac.uk>.
Hi,

I managed to fix this, the problem was my xpath query it should be

<xupdate:modifications version="1.0"
> xmlns:xupdate="http://www.xmldb.org/xupdate"><xupdate:update
> select="/domain/service[@key='PLAYOUT_SCHEDULER']/memberVariable[name='chan
>nel']/name">channel1</xupdate:update> </xupdate:modifications

Thanks for the help.

Regards,
Julie.


On Monday 05 Sep 2005 12:24, Julie McCabe wrote:
> Hello,
>
> Thanks for your response, however the document does exist in the collection
> and it is returned by the following code:
>
> String result = null;
> Collection collection = con.getCollection();
> XMLResource resource = (XMLResource) collection.getResource("PO-NI-01");
> if (resource != null)
> {
>       result = (String) resource.getContent();
> }
>
> I tried applying the query to the whole collection as you suggested, I got
> the same error message on the server but also got a client side exception
> of a vendor specific orgin which maps to
>
> FaultCodes.QRY_COMPILATION_ERROR
>
> I'm guessing there is something wrong with my query then? This is the exact
> query applied:
> <xupdate:modifications version="1.0"
> xmlns:xupdate="http://www.xmldb.org/xupdate"><xupdate:update
> select="/domain/service[@key='PLAYOUT_SCHEDULER']/memberVariable[name='chan
>nel']">channel1</xupdate:update> </xupdate:modifications>
>
> Thanks,
> Julie.
>
> On Sunday 04 Sep 2005 23:01, Yan Langlois wrote:
> > Hello,
> >
> > When you use the method "updateResource("PO-NI-01", updateXml);" the
> > operation only concerns the document called PO-NI-01. I think this
> > document does not exist in your database.
> >
> > When you test this line : ResourceSet resourceSet =
> > queryService.query(queryXml);. the operation concerns on the whole
> > collection.
> >
> > To correct your program, you should use  this method:
> > "updateService.*update*(updateXml);", because the operation concerns the
> > whole collection. Or you should check if the document "PO-NI-01" exists.
> >
> > Tell me whether it helps you or not,
> >
> > Yan.
> >
> > Julie McCabe wrote:
> > >Hello,
> > >
> > >Im trying to execute a xupdate to change the value of an element in an
> > >document.
> > >
> > >String updateXml = "<xupdate:modifications version=\"1.0\""
> > >                        + "
> > > xmlns:xupdate=\"http://www.xmldb.org/xupdate\">" + "<xupdate:update
> > >select=\"/domain/service[@key='PLAYOUT']/memberVariable[name='channel']
> > > \">" + "channel1"
> > >            + "</xupdate:update>"
> > >            + "</xupdate:modifications>";
> > >
> > >            Collection collection = con.getCollection();
> > >            XUpdateQueryService updateService = (XUpdateQueryService)
> > >                collection.getService("XUpdateQueryService", "1.0");
> > >            updateService.updateResource("PO-NI-01", updateXml);
> > >
> > >The exception thrown is @ the server ...
> > >1168620 [http-8080-Processor23] WARN
> > >org.apache.xindice.core.xupdate.XUpdateQueryResolver  - ignored
> > > exception java.lang.NullPointerException
> > >        at
> > > org.xmldb.xupdate.lexus.commands.UpdateCommand.execute(Unknown Source)
> > >        at
> > >org.apache.xindice.core.xupdate.XUpdateImpl.execute(XUpdateImpl.java:116
> > >) at
> > >org.apache.xindice.core.xupdate.XUpdateQueryResolver$XUpdateQuery.execut
> > >e( XUpdateQueryResolver.java:142) at
> > >org.apache.xindice.core.xupdate.XUpdateQueryResolver.query(XUpdateQueryR
> > >es olver.java:84) at
> > >org.apache.xindice.core.query.QueryEngine.query(QueryEngine.java:122)
> > >        at
> > >org.apache.xindice.core.Collection.queryDocument(Collection.java:1242)
> > >        at
> > > org.apache.xindice.server.rpc.messages.Query.execute(Query.java:58) at
> > >org.apache.xindice.server.rpc.RPCMessageInterface.run(RPCMessageInterfac
> > >e. java:48) at sun.reflect.GeneratedMethodAccessor137.invoke(Unknown
> > > Source) at
> > >sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
> > >Im pl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at
> > > org.apache.xmlrpc.Invoker.execute(XmlRpcServer.java) at
> > >org.apache.xmlrpc.XmlRpcServer$Worker.executeInternal(XmlRpcServer.java)
> > >        at
> > > org.apache.xmlrpc.XmlRpcServer$Worker.execute(XmlRpcServer.java) at
> > > org.apache.xmlrpc.XmlRpcServer.execute(XmlRpcServer.java) at
> > > org.apache.xmlrpc.XmlRpcServer.execute(XmlRpcServer.java) at
> > >org.apache.xindice.server.XindiceServlet.doPost(XindiceServlet.java:90)
> > >....................
> > >
> > >>From the client it appears as if the update is successfull!  Ive tested
> > >> the
> > >
> > >select part of the xupdate query and it returns a document segement as
> > >expected - I tested this with ....
> > >
> > >Collection collection = con.getCollection();
> > >            XPathQueryService queryService = (XPathQueryService)
> > >                collection.getService("XPathQueryService", "1.0");
> > >            ResourceSet resourceSet = queryService.query(queryXml);
> > >
> > >
> > >Any ideas on this matter are greatly appreciated, as it doesnt make
> > > sense to me :)
> > >
> > >Configuration: xindice 1.1b4, tomcat 5.0.30, jdk 1.5, os RH 9.0.
> > >
> > >Regards,
> > >Julie.


Re: xupdate update fails but query using xpath succeeds?

Posted by Julie McCabe <ju...@qub.ac.uk>.
Hello,

Thanks for your response, however the document does exist in the collection 
and it is returned by the following code:

String result = null;
Collection collection = con.getCollection();
XMLResource resource = (XMLResource) collection.getResource("PO-NI-01");
if (resource != null)
{
      result = (String) resource.getContent();
}

I tried applying the query to the whole collection as you suggested, I got the 
same error message on the server but also got a client side exception of a 
vendor specific orgin which maps to 

FaultCodes.QRY_COMPILATION_ERROR

I'm guessing there is something wrong with my query then? This is the exact 
query applied:
<xupdate:modifications version="1.0" 
xmlns:xupdate="http://www.xmldb.org/xupdate"><xupdate:update 
select="/domain/service[@key='PLAYOUT_SCHEDULER']/memberVariable[name='channel']">channel1</xupdate:update>
</xupdate:modifications>

Thanks,
Julie.

On Sunday 04 Sep 2005 23:01, Yan Langlois wrote:
> Hello,
>
> When you use the method "updateResource("PO-NI-01", updateXml);" the
> operation only concerns the document called PO-NI-01. I think this
> document does not exist in your database.
>
> When you test this line : ResourceSet resourceSet =
> queryService.query(queryXml);. the operation concerns on the whole
> collection.
>
> To correct your program, you should use  this method:
> "updateService.*update*(updateXml);", because the operation concerns the
> whole collection. Or you should check if the document "PO-NI-01" exists.
>
> Tell me whether it helps you or not,
>
> Yan.
>
> Julie McCabe wrote:
> >Hello,
> >
> >Im trying to execute a xupdate to change the value of an element in an
> >document.
> >
> >String updateXml = "<xupdate:modifications version=\"1.0\""
> >                        + "
> > xmlns:xupdate=\"http://www.xmldb.org/xupdate\">" + "<xupdate:update
> >select=\"/domain/service[@key='PLAYOUT']/memberVariable[name='channel']
> > \">" + "channel1"
> >            + "</xupdate:update>"
> >            + "</xupdate:modifications>";
> >
> >            Collection collection = con.getCollection();
> >            XUpdateQueryService updateService = (XUpdateQueryService)
> >                collection.getService("XUpdateQueryService", "1.0");
> >            updateService.updateResource("PO-NI-01", updateXml);
> >
> >The exception thrown is @ the server ...
> >1168620 [http-8080-Processor23] WARN
> >org.apache.xindice.core.xupdate.XUpdateQueryResolver  - ignored exception
> >java.lang.NullPointerException
> >        at org.xmldb.xupdate.lexus.commands.UpdateCommand.execute(Unknown
> >Source)
> >        at
> >org.apache.xindice.core.xupdate.XUpdateImpl.execute(XUpdateImpl.java:116)
> >        at
> >org.apache.xindice.core.xupdate.XUpdateQueryResolver$XUpdateQuery.execute(
> >XUpdateQueryResolver.java:142) at
> >org.apache.xindice.core.xupdate.XUpdateQueryResolver.query(XUpdateQueryRes
> >olver.java:84) at
> >org.apache.xindice.core.query.QueryEngine.query(QueryEngine.java:122)
> >        at
> >org.apache.xindice.core.Collection.queryDocument(Collection.java:1242)
> >        at
> > org.apache.xindice.server.rpc.messages.Query.execute(Query.java:58) at
> >org.apache.xindice.server.rpc.RPCMessageInterface.run(RPCMessageInterface.
> >java:48) at sun.reflect.GeneratedMethodAccessor137.invoke(Unknown Source)
> > at
> >sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorIm
> >pl.java:25) at java.lang.reflect.Method.invoke(Method.java:585)
> >        at org.apache.xmlrpc.Invoker.execute(XmlRpcServer.java)
> >        at
> >org.apache.xmlrpc.XmlRpcServer$Worker.executeInternal(XmlRpcServer.java)
> >        at
> > org.apache.xmlrpc.XmlRpcServer$Worker.execute(XmlRpcServer.java) at
> > org.apache.xmlrpc.XmlRpcServer.execute(XmlRpcServer.java) at
> > org.apache.xmlrpc.XmlRpcServer.execute(XmlRpcServer.java) at
> >org.apache.xindice.server.XindiceServlet.doPost(XindiceServlet.java:90)
> >....................
> >
> >>From the client it appears as if the update is successfull!  Ive tested
> >> the
> >
> >select part of the xupdate query and it returns a document segement as
> >expected - I tested this with ....
> >
> >Collection collection = con.getCollection();
> >            XPathQueryService queryService = (XPathQueryService)
> >                collection.getService("XPathQueryService", "1.0");
> >            ResourceSet resourceSet = queryService.query(queryXml);
> >
> >
> >Any ideas on this matter are greatly appreciated, as it doesnt make sense
> > to me :)
> >
> >Configuration: xindice 1.1b4, tomcat 5.0.30, jdk 1.5, os RH 9.0.
> >
> >Regards,
> >Julie.


Re: xupdate update fails but query using xpath succeeds?

Posted by Yan Langlois <ya...@eseo.fr>.
Hello,

When you use the method "updateResource("PO-NI-01", updateXml);" the 
operation only concerns the document called PO-NI-01. I think this 
document does not exist in your database.

When you test this line : ResourceSet resourceSet = 
queryService.query(queryXml);. the operation concerns on the whole 
collection.

To correct your program, you should use  this method: 
"updateService.*update*(updateXml);", because the operation concerns the 
whole collection. Or you should check if the document "PO-NI-01" exists.

Tell me whether it helps you or not,

Yan.


Julie McCabe wrote:

>Hello,
>
>Im trying to execute a xupdate to change the value of an element in an 
>document.
>
>String updateXml = "<xupdate:modifications version=\"1.0\""
>                        + " xmlns:xupdate=\"http://www.xmldb.org/xupdate\">"
>                        + "<xupdate:update 
>select=\"/domain/service[@key='PLAYOUT']/memberVariable[name='channel'] \">" 
>+ "channel1"
>            + "</xupdate:update>"
>            + "</xupdate:modifications>";
>
>            Collection collection = con.getCollection();
>            XUpdateQueryService updateService = (XUpdateQueryService)
>                collection.getService("XUpdateQueryService", "1.0");
>            updateService.updateResource("PO-NI-01", updateXml);
>
>The exception thrown is @ the server ...
>1168620 [http-8080-Processor23] WARN  
>org.apache.xindice.core.xupdate.XUpdateQueryResolver  - ignored exception
>java.lang.NullPointerException
>        at org.xmldb.xupdate.lexus.commands.UpdateCommand.execute(Unknown 
>Source)
>        at 
>org.apache.xindice.core.xupdate.XUpdateImpl.execute(XUpdateImpl.java:116)
>        at 
>org.apache.xindice.core.xupdate.XUpdateQueryResolver$XUpdateQuery.execute(XUpdateQueryResolver.java:142)
>        at 
>org.apache.xindice.core.xupdate.XUpdateQueryResolver.query(XUpdateQueryResolver.java:84)
>        at 
>org.apache.xindice.core.query.QueryEngine.query(QueryEngine.java:122)
>        at 
>org.apache.xindice.core.Collection.queryDocument(Collection.java:1242)
>        at org.apache.xindice.server.rpc.messages.Query.execute(Query.java:58)
>        at 
>org.apache.xindice.server.rpc.RPCMessageInterface.run(RPCMessageInterface.java:48)
>        at sun.reflect.GeneratedMethodAccessor137.invoke(Unknown Source)
>        at 
>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:585)
>        at org.apache.xmlrpc.Invoker.execute(XmlRpcServer.java)
>        at 
>org.apache.xmlrpc.XmlRpcServer$Worker.executeInternal(XmlRpcServer.java)
>        at org.apache.xmlrpc.XmlRpcServer$Worker.execute(XmlRpcServer.java)
>        at org.apache.xmlrpc.XmlRpcServer.execute(XmlRpcServer.java)
>        at org.apache.xmlrpc.XmlRpcServer.execute(XmlRpcServer.java)
>        at 
>org.apache.xindice.server.XindiceServlet.doPost(XindiceServlet.java:90)
>....................
>
>>>From the client it appears as if the update is successfull!  Ive tested the 
>select part of the xupdate query and it returns a document segement as 
>expected - I tested this with ....
>
>Collection collection = con.getCollection();
>            XPathQueryService queryService = (XPathQueryService) 
>                collection.getService("XPathQueryService", "1.0");
>            ResourceSet resourceSet = queryService.query(queryXml);
>
>
>Any ideas on this matter are greatly appreciated, as it doesnt make sense to 
>me :)
>
>Configuration: xindice 1.1b4, tomcat 5.0.30, jdk 1.5, os RH 9.0.
>
>Regards,
>Julie.
>
>
>
>  
>