You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Lior Wehrli <li...@adnovum.ch> on 2012/03/02 08:55:50 UTC

Re: NullPointerException when executing XPath expression on

Hi,

Hi,

I have implemented a JAX-WS service using the Provider<SOAPMessage> 
interface. I would like to extract elements from the SOAP request using 
XPath. But when I execute the XPathExpression on the SOAPPart of the 
message, I get this ugly NullPointerException. I assume that, since 
SOAPPart implements a DOM Document, this should work.

Here is an extract of my code:

public SOAPMessage invoke(SOAPMessage message) {
     XPathFactory factory = XPathFactory.newInstance();
     XPath xpathBuilder = factory.newXPath();
     XPathExpression xpath = 
xpathBuilder.compile("//OnBehalfOf/UsernameToken/Username/text()");
     Node node = (Node) xpath.evaluate(message.getSOAPPart(), 
XPathConstants.NODE);
}

The exception:

Caused by: javax.xml.transform.TransformerException: Unknown error in 
XPath.
     at org.apache.xpath.XPath.execute(XPath.java:363)
     at org.apache.xpath.XPath.execute(XPath.java:301)
     at 
org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:123)
     at 
org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:97)
     at 
org.apache.xpath.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:178)
     ... 38 more
Caused by: java.lang.NullPointerException
     at org.apache.xml.dtm.ref.dom2dtm.DOM2DTM.nextNode(DOM2DTM.java:387)
     at 
org.apache.xml.dtm.ref.DTMDefaultBase._nextsib(DTMDefaultBase.java:563)
     at 
org.apache.xml.dtm.ref.DTMDefaultBase.getNextSibling(DTMDefaultBase.java:1140)
     at 
org.apache.xml.dtm.ref.DTMDefaultBaseTraversers$ChildTraverser.next(DTMDefaultBaseTraversers.java:461)
     at org.apache.xpath.axes.AxesWalker.getNextNode(AxesWalker.java:333)
     at org.apache.xpath.axes.AxesWalker.nextNode(AxesWalker.java:361)
     at 
org.apache.xpath.axes.WalkingIterator.nextNode(WalkingIterator.java:192)
     at org.apache.xpath.axes.NodeSequence.nextNode(NodeSequence.java:281)
     at org.apache.xpath.axes.NodeSequence.runTo(NodeSequence.java:435)
     at org.apache.xpath.axes.NodeSequence.setRoot(NodeSequence.java:218)
     at 
org.apache.xpath.axes.LocPathIterator.execute(LocPathIterator.java:210)
     at org.apache.xpath.XPath.execute(XPath.java:335)

I use Axis2 1.6.1 and JBoss 5

Has anybody seen something like this? Am I doing something wrong?

Thanks,

Lior

-- 

AdNovum Informatik AG
Lior Wehrli, Senior Software Engineer
MSc Computer Science ETH

Roentgenstrasse 22, CH-8005 Zurich
mailto:lior.wehrli@adnovum.ch
phone: +41 44 272 6111, fax: +41 44 272 6312
http://www.adnovum.ch

AdNovum Offices: Bern, Budapest, Singapore, Zurich (HQ)

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


Re: NullPointerException when executing XPath expression on DOM Tree in Provider

Posted by Sagara Gunathunga <sa...@gmail.com>.
Why don't you create a JIRA issue and upload your samples there so
that someone can reproduce your issue ?

Thanks !

On Fri, Mar 16, 2012 at 1:54 PM, Lior Wehrli <li...@adnovum.ch> wrote:
> Hi there,
>
> Is there any chance that anybody could have a look at this issue? Or
> could you guys open a JIRA ticket for it? Please react
>
> Thanks,
>
> Lior
>
>
> On 03/06/12 08:11, Lior Wehrli wrote:
>> Hi,
>>
>> This is the fourth time I am sending this email to an axis2 mail list.
>> So far I did not receive a reply. Is this the wrong list? Should I
>> open a JIRA ticket? What am I doing wrong?
>>
>> Please, can somebody have a look at this?
>>
>> Thanks,
>>
>> Lior
>>
>>
>> On 03/02/12 13:30, Lior Wehrli wrote:
>>> Hi,
>>>
>>> I have implemented a JAX-WS service using the Provider<SOAPMessage>
>>> interface. I would like to extract elements from the SOAP request
>>> using XPath. But when I execute the XPathExpression on the SOAPPart
>>> of the message, I get this ugly NullPointerException. I assume that,
>>> since SOAPPart implements a DOM Document, this should work.
>>>
>>> Here is an extract of my code:
>>>
>>> public SOAPMessage invoke(SOAPMessage message) {
>>>     XPathFactory factory = XPathFactory.newInstance();
>>>     XPath xpathBuilder = factory.newXPath();
>>>     XPathExpression xpath =
>>> xpathBuilder.compile("//OnBehalfOf/UsernameToken/Username/text()");
>>>     Node node = (Node) xpath.evaluate(message.getSOAPPart(),
>>> XPathConstants.NODE);
>>> }
>>>
>>> The exception:
>>>
>>> Caused by: javax.xml.transform.TransformerException: Unknown error in
>>> XPath.
>>>     at org.apache.xpath.XPath.execute(XPath.java:363)
>>>     at org.apache.xpath.XPath.execute(XPath.java:301)
>>>     at
>>> org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:123)
>>>     at
>>> org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:97)
>>>     at
>>> org.apache.xpath.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:178)
>>>     ... 38 more
>>> Caused by: java.lang.NullPointerException
>>>     at org.apache.xml.dtm.ref.dom2dtm.DOM2DTM.nextNode(DOM2DTM.java:387)
>>>     at
>>> org.apache.xml.dtm.ref.DTMDefaultBase._nextsib(DTMDefaultBase.java:563)
>>>     at
>>> org.apache.xml.dtm.ref.DTMDefaultBase.getNextSibling(DTMDefaultBase.java:1140)
>>>     at
>>> org.apache.xml.dtm.ref.DTMDefaultBaseTraversers$ChildTraverser.next(DTMDefaultBaseTraversers.java:461)
>>>     at org.apache.xpath.axes.AxesWalker.getNextNode(AxesWalker.java:333)
>>>     at org.apache.xpath.axes.AxesWalker.nextNode(AxesWalker.java:361)
>>>     at
>>> org.apache.xpath.axes.WalkingIterator.nextNode(WalkingIterator.java:192)
>>>     at
>>> org.apache.xpath.axes.NodeSequence.nextNode(NodeSequence.java:281)
>>>     at org.apache.xpath.axes.NodeSequence.runTo(NodeSequence.java:435)
>>>     at org.apache.xpath.axes.NodeSequence.setRoot(NodeSequence.java:218)
>>>     at
>>> org.apache.xpath.axes.LocPathIterator.execute(LocPathIterator.java:210)
>>>     at org.apache.xpath.XPath.execute(XPath.java:335)
>>>
>>> I use Axis2 1.6.1 and JBoss 5
>>>
>>> Has anybody seen something like this? Am I doing something wrong? Or
>>> this a bug?
>>>
>>> Thanks,
>>>
>>> Lior
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
>>> For additional commands, e-mail: java-dev-help@axis.apache.org
>>
>
> --
>
> AdNovum Informatik AG
> Lior Wehrli, Senior Software Engineer
> MSc Computer Science ETH
>
> Roentgenstrasse 22, CH-8005 Zurich
> mailto:lior.wehrli@adnovum.ch
> phone: +41 44 272 6111, fax: +41 44 272 6312
> http://www.adnovum.ch
>
> AdNovum Offices: Bern, Budapest, Singapore, Zurich (HQ)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>



-- 
Sagara Gunathunga

Blog      - http://ssagara.blogspot.com
Web      - http://people.apache.org/~sagara/
LinkedIn - http://www.linkedin.com/in/ssagara

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


Re: NullPointerException when executing XPath expression on DOM Tree in Provider

Posted by Lior Wehrli <li...@adnovum.ch>.
Hi there,

Is there any chance that anybody could have a look at this issue? Or
could you guys open a JIRA ticket for it? Please react

Thanks,

Lior


On 03/06/12 08:11, Lior Wehrli wrote:
> Hi,
>
> This is the fourth time I am sending this email to an axis2 mail list.
> So far I did not receive a reply. Is this the wrong list? Should I
> open a JIRA ticket? What am I doing wrong?
>
> Please, can somebody have a look at this?
>
> Thanks,
>
> Lior
>
>
> On 03/02/12 13:30, Lior Wehrli wrote:
>> Hi,
>>
>> I have implemented a JAX-WS service using the Provider<SOAPMessage>
>> interface. I would like to extract elements from the SOAP request
>> using XPath. But when I execute the XPathExpression on the SOAPPart
>> of the message, I get this ugly NullPointerException. I assume that,
>> since SOAPPart implements a DOM Document, this should work.
>>
>> Here is an extract of my code:
>>
>> public SOAPMessage invoke(SOAPMessage message) {
>>     XPathFactory factory = XPathFactory.newInstance();
>>     XPath xpathBuilder = factory.newXPath();
>>     XPathExpression xpath =
>> xpathBuilder.compile("//OnBehalfOf/UsernameToken/Username/text()");
>>     Node node = (Node) xpath.evaluate(message.getSOAPPart(),
>> XPathConstants.NODE);
>> }
>>
>> The exception:
>>
>> Caused by: javax.xml.transform.TransformerException: Unknown error in
>> XPath.
>>     at org.apache.xpath.XPath.execute(XPath.java:363)
>>     at org.apache.xpath.XPath.execute(XPath.java:301)
>>     at
>> org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:123)
>>     at
>> org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:97)
>>     at
>> org.apache.xpath.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:178)
>>     ... 38 more
>> Caused by: java.lang.NullPointerException
>>     at org.apache.xml.dtm.ref.dom2dtm.DOM2DTM.nextNode(DOM2DTM.java:387)
>>     at
>> org.apache.xml.dtm.ref.DTMDefaultBase._nextsib(DTMDefaultBase.java:563)
>>     at
>> org.apache.xml.dtm.ref.DTMDefaultBase.getNextSibling(DTMDefaultBase.java:1140)
>>     at
>> org.apache.xml.dtm.ref.DTMDefaultBaseTraversers$ChildTraverser.next(DTMDefaultBaseTraversers.java:461)
>>     at org.apache.xpath.axes.AxesWalker.getNextNode(AxesWalker.java:333)
>>     at org.apache.xpath.axes.AxesWalker.nextNode(AxesWalker.java:361)
>>     at
>> org.apache.xpath.axes.WalkingIterator.nextNode(WalkingIterator.java:192)
>>     at
>> org.apache.xpath.axes.NodeSequence.nextNode(NodeSequence.java:281)
>>     at org.apache.xpath.axes.NodeSequence.runTo(NodeSequence.java:435)
>>     at org.apache.xpath.axes.NodeSequence.setRoot(NodeSequence.java:218)
>>     at
>> org.apache.xpath.axes.LocPathIterator.execute(LocPathIterator.java:210)
>>     at org.apache.xpath.XPath.execute(XPath.java:335)
>>
>> I use Axis2 1.6.1 and JBoss 5
>>
>> Has anybody seen something like this? Am I doing something wrong? Or
>> this a bug?
>>
>> Thanks,
>>
>> Lior
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
>> For additional commands, e-mail: java-dev-help@axis.apache.org
>

-- 

AdNovum Informatik AG
Lior Wehrli, Senior Software Engineer
MSc Computer Science ETH

Roentgenstrasse 22, CH-8005 Zurich
mailto:lior.wehrli@adnovum.ch
phone: +41 44 272 6111, fax: +41 44 272 6312
http://www.adnovum.ch

AdNovum Offices: Bern, Budapest, Singapore, Zurich (HQ)

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


Re: NullPointerException when executing XPath expression on DOM Tree in Provider

Posted by Lior Wehrli <li...@adnovum.ch>.
Hi,

This is the fourth time I am sending this email to an axis2 mail list. 
So far I did not receive a reply. Is this the wrong list? Should I open 
a JIRA ticket? What am I doing wrong?

Please, can somebody have a look at this?

Thanks,

Lior


On 03/02/12 13:30, Lior Wehrli wrote:
> Hi,
>
> I have implemented a JAX-WS service using the Provider<SOAPMessage> 
> interface. I would like to extract elements from the SOAP request 
> using XPath. But when I execute the XPathExpression on the SOAPPart of 
> the message, I get this ugly NullPointerException. I assume that, 
> since SOAPPart implements a DOM Document, this should work.
>
> Here is an extract of my code:
>
> public SOAPMessage invoke(SOAPMessage message) {
>     XPathFactory factory = XPathFactory.newInstance();
>     XPath xpathBuilder = factory.newXPath();
>     XPathExpression xpath = 
> xpathBuilder.compile("//OnBehalfOf/UsernameToken/Username/text()");
>     Node node = (Node) xpath.evaluate(message.getSOAPPart(), 
> XPathConstants.NODE);
> }
>
> The exception:
>
> Caused by: javax.xml.transform.TransformerException: Unknown error in 
> XPath.
>     at org.apache.xpath.XPath.execute(XPath.java:363)
>     at org.apache.xpath.XPath.execute(XPath.java:301)
>     at 
> org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:123)
>     at 
> org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:97)
>     at 
> org.apache.xpath.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:178)
>     ... 38 more
> Caused by: java.lang.NullPointerException
>     at org.apache.xml.dtm.ref.dom2dtm.DOM2DTM.nextNode(DOM2DTM.java:387)
>     at 
> org.apache.xml.dtm.ref.DTMDefaultBase._nextsib(DTMDefaultBase.java:563)
>     at 
> org.apache.xml.dtm.ref.DTMDefaultBase.getNextSibling(DTMDefaultBase.java:1140)
>     at 
> org.apache.xml.dtm.ref.DTMDefaultBaseTraversers$ChildTraverser.next(DTMDefaultBaseTraversers.java:461)
>     at org.apache.xpath.axes.AxesWalker.getNextNode(AxesWalker.java:333)
>     at org.apache.xpath.axes.AxesWalker.nextNode(AxesWalker.java:361)
>     at 
> org.apache.xpath.axes.WalkingIterator.nextNode(WalkingIterator.java:192)
>     at org.apache.xpath.axes.NodeSequence.nextNode(NodeSequence.java:281)
>     at org.apache.xpath.axes.NodeSequence.runTo(NodeSequence.java:435)
>     at org.apache.xpath.axes.NodeSequence.setRoot(NodeSequence.java:218)
>     at 
> org.apache.xpath.axes.LocPathIterator.execute(LocPathIterator.java:210)
>     at org.apache.xpath.XPath.execute(XPath.java:335)
>
> I use Axis2 1.6.1 and JBoss 5
>
> Has anybody seen something like this? Am I doing something wrong? Or 
> this a bug?
>
> Thanks,
>
> Lior
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


NullPointerException when executing XPath expression on DOM Tree in Provider

Posted by Lior Wehrli <li...@adnovum.ch>.
Hi,

I have implemented a JAX-WS service using the Provider<SOAPMessage> 
interface. I would like to extract elements from the SOAP request using 
XPath. But when I execute the XPathExpression on the SOAPPart of the 
message, I get this ugly NullPointerException. I assume that, since 
SOAPPart implements a DOM Document, this should work.

Here is an extract of my code:

public SOAPMessage invoke(SOAPMessage message) {
     XPathFactory factory = XPathFactory.newInstance();
     XPath xpathBuilder = factory.newXPath();
     XPathExpression xpath = 
xpathBuilder.compile("//OnBehalfOf/UsernameToken/Username/text()");
     Node node = (Node) xpath.evaluate(message.getSOAPPart(), 
XPathConstants.NODE);
}

The exception:

Caused by: javax.xml.transform.TransformerException: Unknown error in 
XPath.
     at org.apache.xpath.XPath.execute(XPath.java:363)
     at org.apache.xpath.XPath.execute(XPath.java:301)
     at 
org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:123)
     at 
org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:97)
     at 
org.apache.xpath.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:178)
     ... 38 more
Caused by: java.lang.NullPointerException
     at org.apache.xml.dtm.ref.dom2dtm.DOM2DTM.nextNode(DOM2DTM.java:387)
     at 
org.apache.xml.dtm.ref.DTMDefaultBase._nextsib(DTMDefaultBase.java:563)
     at 
org.apache.xml.dtm.ref.DTMDefaultBase.getNextSibling(DTMDefaultBase.java:1140)
     at 
org.apache.xml.dtm.ref.DTMDefaultBaseTraversers$ChildTraverser.next(DTMDefaultBaseTraversers.java:461)
     at org.apache.xpath.axes.AxesWalker.getNextNode(AxesWalker.java:333)
     at org.apache.xpath.axes.AxesWalker.nextNode(AxesWalker.java:361)
     at 
org.apache.xpath.axes.WalkingIterator.nextNode(WalkingIterator.java:192)
     at org.apache.xpath.axes.NodeSequence.nextNode(NodeSequence.java:281)
     at org.apache.xpath.axes.NodeSequence.runTo(NodeSequence.java:435)
     at org.apache.xpath.axes.NodeSequence.setRoot(NodeSequence.java:218)
     at 
org.apache.xpath.axes.LocPathIterator.execute(LocPathIterator.java:210)
     at org.apache.xpath.XPath.execute(XPath.java:335)

I use Axis2 1.6.1 and JBoss 5

Has anybody seen something like this? Am I doing something wrong? Or 
this a bug?

Thanks,

Lior

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org