SKoneru
12 years agoContributor
Exception when new dependencies are added via maven
Hi,
I created a java project that imports additional jars from Maven and nexus repo that my company maintains. These java classes are being invoked from some Groovy test steps.
Now before I did this the Groovy test steps are working fine. But once I set-up the dependency to additional jars as described above, I noticed below exception.
May be the new dependencies loaded jars that cause this issue. But which jar exactly has the problem? How can I resolve this? Is the groovy script correct?
Simple Groovy code and the exception details:-
================================
def colorlist = ["Greens", "Reds", "Blues"]
def count = 0;
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def holder = groovyUtils.getXmlHolder( "AddFPItem#Request" )
holder.namespaces["ns1"] = /urn:ebay:apis:eBLBaseComponents/
def dNode = holder.getDomNode("//ns1:Variations[1]")
def doc = dNode.ownerDocument
org.w3c.dom.Node[] varnode = holder.getDomNodes("//ns1:Variation")
if(varnode.size() > 0){
for(def i = 1; i <= varnode.size(); i++){
org.w3c.dom.Node n = dNode.removeChild(holder.getDomNode("//ns1:Variation[1]"))
holder.updateProperty()
context.requestContent = holder.xml
log.info context.requestContent
}
}
Exception:-
=======
java.lang.ClassCastException: net.sf.saxon.dom.NodeWrapper cannot be cast to org.w3c.dom.Node
at org.apache.xmlbeans.impl.xpath.saxon.XBeansXPath.getUnderlyingNode(XBeansXPath.java:170)
at org.apache.xmlbeans.impl.xpath.saxon.XBeansXPath.selectNodes(XBeansXPath.java:127)
at org.apache.xmlbeans.impl.xpath.saxon.XBeansXPath.selectPath(XBeansXPath.java:148)
at org.apache.xmlbeans.impl.store.Path$DelegatePathImpl$DelegatePathEngine.next(Path.java:541)
at org.apache.xmlbeans.impl.store.Cursor._toSelection(Cursor.java:931)
at org.apache.xmlbeans.impl.store.Cursor._toNextSelection(Cursor.java:920)
at org.apache.xmlbeans.impl.store.Cursor.toNextSelection(Cursor.java:2670)
at com.eviware.soapui.support.xml.XmlUtils.selectFirstDomNode(XmlUtils.java:1411)
at com.eviware.soapui.support.XmlHolder.getDomNode(XmlHolder.java:147)
at com.eviware.soapui.support.XmlHolder$getDomNode.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at Script1.run(Script1.groovy:7)
at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:96)
I created a java project that imports additional jars from Maven and nexus repo that my company maintains. These java classes are being invoked from some Groovy test steps.
Now before I did this the Groovy test steps are working fine. But once I set-up the dependency to additional jars as described above, I noticed below exception.
May be the new dependencies loaded jars that cause this issue. But which jar exactly has the problem? How can I resolve this? Is the groovy script correct?
Simple Groovy code and the exception details:-
================================
def colorlist = ["Greens", "Reds", "Blues"]
def count = 0;
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def holder = groovyUtils.getXmlHolder( "AddFPItem#Request" )
holder.namespaces["ns1"] = /urn:ebay:apis:eBLBaseComponents/
def dNode = holder.getDomNode("//ns1:Variations[1]")
def doc = dNode.ownerDocument
org.w3c.dom.Node[] varnode = holder.getDomNodes("//ns1:Variation")
if(varnode.size() > 0){
for(def i = 1; i <= varnode.size(); i++){
org.w3c.dom.Node n = dNode.removeChild(holder.getDomNode("//ns1:Variation[1]"))
holder.updateProperty()
context.requestContent = holder.xml
log.info context.requestContent
}
}
Exception:-
=======
java.lang.ClassCastException: net.sf.saxon.dom.NodeWrapper cannot be cast to org.w3c.dom.Node
at org.apache.xmlbeans.impl.xpath.saxon.XBeansXPath.getUnderlyingNode(XBeansXPath.java:170)
at org.apache.xmlbeans.impl.xpath.saxon.XBeansXPath.selectNodes(XBeansXPath.java:127)
at org.apache.xmlbeans.impl.xpath.saxon.XBeansXPath.selectPath(XBeansXPath.java:148)
at org.apache.xmlbeans.impl.store.Path$DelegatePathImpl$DelegatePathEngine.next(Path.java:541)
at org.apache.xmlbeans.impl.store.Cursor._toSelection(Cursor.java:931)
at org.apache.xmlbeans.impl.store.Cursor._toNextSelection(Cursor.java:920)
at org.apache.xmlbeans.impl.store.Cursor.toNextSelection(Cursor.java:2670)
at com.eviware.soapui.support.xml.XmlUtils.selectFirstDomNode(XmlUtils.java:1411)
at com.eviware.soapui.support.XmlHolder.getDomNode(XmlHolder.java:147)
at com.eviware.soapui.support.XmlHolder$getDomNode.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at Script1.run(Script1.groovy:7)
at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:96)