I entered a bug to track this:
http://sourceforge.net/tracker/index.php?func=detail&aid=1114932&group_id=116683&atid=675660
-Erik
Avinder Bahra wrote:
Hi Erik,
Yes as you thought the NPE is caused by the term:
method.invoke(instance, parameterValues.toArray())
When this invokes a method that returns void it evaluates to null. Hence the toString() on the term causes the NPE. I guess the fix would be to check for null before the toString(). Anyway I can change my method signature to return a string as a work-around.
Many thanks for your help,
Avinder
Snippet from org.orbeon.oxf.processor.DelegationProcessor.java
/** * Calls a method on an object with the reflexion API. */ private String callMethod(Class clazz, String methodName, java.util.List parameterTypes, Object instance, java.util.List parameterValues) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { String result; Class[] parameterClasses = new Class[parameterTypes.size()]; parameterTypes.toArray(parameterClasses); Method method = clazz.getDeclaredMethod(methodName, parameterClasses); result = method.invoke(instance, parameterValues.toArray()).toString(); return result; }
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Erik Bruchez Sent: 02 February 2005 17:15 To: [email protected] Subject: Re: [orbeon-user] Using Delegation Processor
This is the line producing the NPE:
result = method.invoke(instance, parameterValues.toArray()).toString();
If you are saying that the method is in fact called, this seems to mean that it returns null and that the call of toString() on null causes the
NPE.
Mabe Alex can comment on this.
-Erik
Avinder Bahra wrote:
Hi,
Thanks (Erik) for the answer to my previous question. I am however getting an NPE when using the Delegation Processor. The processor successfully calls the Stateless session EJB method (which prints to
the
console), but then immediately throws a NPE. I have tested the EJB method successfully with a Java client. Perhaps the XPL is incorrect? The EJB method signature is:
public void saveXForm( java.lang.String theform ) throws java.rmi.RemoteException;
XPL and stack trace listings are below:
Any help appreciated.
Regards, Avinder
<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" xmlns:oxf="http://www.orbeon.com/oxf/processors" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:delegation="http://orbeon.org/oxf/xml/delegation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<p:param name="data" type="output"/>
<p:processor name="oxf:delegation"> <p:input name="interface"> <config> <service id="save-xform" type="stateless-ejb"
uri="ejb/MyBeanHome"/>
</config>
</p:input>
<p:input name="call"> <delegation:execute service="save-xform" operation="saveXForm"> <theform xsi:type="xs:string">MyXformToSave</theform>
</delegation:execute>
</p:input>
<p:output name="data" ref="data"/>
</p:processor>
</p:config>
The stack trace is:
2005-02-02 16:12:26,018 INFO org.orbeon.oxf.pipeline.InitUtils null - /tutorial -hello3 - Received request Saving XForm='MyXformToSave' 2005-02-02 16:12:26,393 ERROR org.orbeon.oxf.pipeline.InitUtils null - Exception with no location data java.lang.NullPointerException at org.orbeon.oxf.processor.DelegationProcessor.callMethod(DelegationPro cessor.java:389) at org.orbeon.oxf.processor.DelegationProcessor.access$400(DelegationPro cessor.java:55) at org.orbeon.oxf.processor.DelegationProcessor$2.endElement(DelegationP rocessor.java:334) at org.orbeon.oxf.xml.SAXStore.replay(SAXStore.java:168) at org.orbeon.oxf.processor.generator.DOMGenerator$1.readImpl(DOMGenerat or.java:137) at org.orbeon.oxf.processor.ProcessorImpl$6.read(ProcessorImpl.java:945)
at org.orbeon.oxf.processor.ProcessorImpl$ProcessorOutputImpl.read(Proce ssorImpl.java:1106) at org.orbeon.oxf.processor.ProcessorImpl.readInputAsSAX(ProcessorImpl.j ava:340) at org.orbeon.oxf.processor.ProcessorImpl.readInputAsSAX(ProcessorImpl.j ava:345) at org.orbeon.oxf.processor.DelegationProcessor$1.readImpl(DelegationPro cessor.java:83) at org.orbeon.oxf.processor.ProcessorImpl$6.read(ProcessorImpl.java:945)
at org.orbeon.oxf.processor.ProcessorImpl$ProcessorOutputImpl.read(Proce ssorImpl.java:1106) at org.orbeon.oxf.processor.ProcessorImpl.readInputAsSAX(ProcessorImpl.j ava:340) at org.orbeon.oxf.processor.pipeline.PipelineProcessor.access$000(Pipeli neProcessor.java:61) at org.orbeon.oxf.processor.pipeline.PipelineProcessor$2.run(PipelinePro cessor.java:97) at org.orbeon.oxf.processor.ProcessorImpl.executeChildren(ProcessorImpl. java:505) at org.orbeon.oxf.processor.pipeline.PipelineProcessor.access$100(Pipeli neProcessor.java:61) at org.orbeon.oxf.processor.pipeline.PipelineProcessor$1.readImpl(Pipeli neProcessor.java:95) at org.orbeon.oxf.processor.ProcessorImpl$6.read(ProcessorImpl.java:945)
at org.orbeon.oxf.processor.ProcessorImpl$ProcessorOutputImpl.read(Proce ssorImpl.java:1106) at org.orbeon.oxf.processor.ProcessorImpl.readInputAsSAX(ProcessorImpl.j ava:340) at org.orbeon.oxf.processor.ProcessorImpl.readInputAsSAX(ProcessorImpl.j ava:345) at org.orbeon.oxf.processor.IdentityProcessor$1.readImpl(IdentityProcess or.java:30)
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Erik Bruchez Sent: 02 February 2005 14:11 To: [email protected] Subject: Re: [orbeon-user] Using Delegation Processor
If you want to pass a string, you should first convert the XML
instance
into a string. You can do this with the XML converter, for example.
http://www.orbeon.com/ois/doc/processors-converters#xml-converter
Then, with XSLT, build your "call" input document and embed the resulting string.
-Erik
Avinder Bahra wrote:
Hi,
I am using the Delegation Processor to call a stateless session EJB method. What I wan't to do is pass an Xforms instance as a string parameter to the EJB method. However the documentation example (listed
below) only shows how to pass in literal values. Is there a way to accomplish passing in an Xforms instance?
<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:oxf="http://www.orbeon.com/oxf/processors"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<p:param name="data" type="output"/>
<p:processor name="oxf:delegation">
<p:input name="interface">
<config>
<service id="save-xform" type="stateless-ejb" uri="ejb/MyBeanHome"/>
</config>
</p:input>
<p:input name="call">
<delegation:execute service="save-xform" operation="saveXForm">
<theform xsi:type="xs:string">I WOULD LIKE TO SAVE XFORMS INSTANCE</theform>
</delegation:execute>
</p:input>
<p:output name="data" ref="data"/>
</p:processor>
</p:config>
Any help appreciated.
Regards
Avinder
------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive
Reporting
Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl _______________________________________________ orbeon-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/orbeon-user
------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive
Reporting
Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl _______________________________________________ orbeon-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/orbeon-user
------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl _______________________________________________ orbeon-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/orbeon-user
------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl _______________________________________________ orbeon-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/orbeon-user
------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl _______________________________________________ orbeon-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/orbeon-user
