Invoking method thru reflection
I have got a method which takes in a primitive datatype (eg. int) as its argument. One of the parameters of getMethod() in the class Class is Class[] representing the various args of the method to be invoked. How do I represent the primitive data type as part of this Class[]?
Your reply will be greatly appreciated.
import java.lang.reflect.*;
public class TT {
public static void loadClass(String className,String methodName,String arg)
Class l_class;
java.lang.Object returnValue=new Object();
try{
Class[] parameterTypes = new Class[] { int.class };
l_class=Class.forName(className);
java.lang.Object o = l_class.newInstance();
Method method =l_class.getMethod(methodName, parameterTypes);
java.lang.Object arguments[] = new java.lang.Object[1];
arguments[0] =new Integer(arg) ;
returnValue=method.invoke(o, arguments);
if( returnValue instanceof Integer ){
System.out.println("Int value = "+((Integer)returnValue).intValue() );
else{
System.out.println("Int value false");
catch(NoSuchMethodException nsme) { }
catch(IllegalArgumentException iae){ }
catch(InvocationTargetException ite) { }
catch(Exception e){ }
return ;
public static void main(String[] args) throws Exception
loadClass( args[0] , args[1], args[2] );
/// Example.java
public class Example
public int get(int i){
return i;
public static void main(String[] args)
System.out.println("Hello World!");
[email protected]
Similar Messages
-
Invoking methods through reflection
I need to check a property in the javax.faces.component.html.HtmlInputText.
If i do it in the following manner,I get things fine:
if(comp.getClass().getName().equalsIgnoreCase("javax.faces.component.html.HtmlInputText")) {
String getter=((javax.faces.component.html.HtmlInputText)comp).getOnfocus();
if(getter!=null) {
System.out.println(getter);
But if i invoke it through reflection,I get nothing.
I am doing the following:
Class reqClass = Class.forName("javax.faces.component.html.HtmlInputText");
Method[] methodList = reqClass.getDeclaredMethods();
int methodIdx = 0;
for (int i = 0; i < methodList.length; i++) {
Method reqMethod =methodList;
if(reqMethod.getName().indexOf("getOn")== 0) //method starts with getOn
// method accepts parameters, define the types in order here as Class[]
Class[] classParams = new Class [] {};
// set the method of the class object
Method method = reqClass.getMethod( reqMethod.getName(), classParams );
// pass values to fill parameters of method
Object[] arguments = new Object [] {};
// invoke method via reflection.Note that class has default constructor
Object retobj=method.invoke( reqClass.newInstance() ,
arguments );
String getterResult = (String)retobj;
if(getterResult!=null)
System.out.println(reqMethod.getName() + " ## " + getterResult);
What am i doing wrong while invoking the method through reflection.
I get no exception either.It is a simple typo.
An alternative I tried is the following ,but that does not work either.
Class reqClass = Class.forName("javax.faces.component.html.HtmlInputText");
Method[] methodList = reqClass.getDeclaredMethods();
int methodIdx = 0;
for (int i = 0; i < methodList.length; i++) {
Method reqMethod =methodList;
if(reqMethod.getName().startsWith("getOn")) //method starts with getOn
System.out.println(reqMethod.getName());
// pass values to fill parameters of method
Object[] arguments = new Object [] {};
// invoke method via reflection
Object retobj=reqMethod.invoke( reqClass.newInstance(), arguments );
String getterResult = (String)retobj;
if(getterResult!=null)
System.out.println(reqMethod.getName() + " ## " +getterResult); -
Invoking method with reflection - with String[] params
Hi there,
I have a method that I need to call with reflection. This method has one parameter
public void setArgs(String args[])
I'm trying to invoke it by reflection. I tryied this but didn't work:
Class[] parameterArgs = {String[].class};
Method mCallArgs = objClasseChiamata.getClass().getMethod("setArgs",parameterArgs);
Object[] nomeArgs = new Object[]{"Luca","Alessio"};
//I try too:
//String[] nomeArgs = new String[]{"Luca","Alessio"};
mCallArgs.invoke(objClasseChiamata ,nomeArgs);
It compile ok,
but in Runtime I find this error:
java.lang.IllegalArgumentException
java.lang.Throwable()
java.lang.Exception()
java.lang.RuntimeException()
java.lang.IllegalArgumentException()
java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object [])
void reflection.TestReflection.main(java.lang.String [])
Thank you,
AlessioThe thing that goes in the Object[] is the paramaters. The parameter is one String[], not two Strings:
Object[] nomeArgs = { new String[] {"Luca", "Alessio"} };
mCallArgs.invoke(objClasseChiamata ,nomeArgs);
// or
mCallArgs.invoke(objClasseChiamata, new Object[] { new String[] {"Luca", "Alessio"} });Note that there's no reason to use "new Object" when you're initializing a named array reference (just like you initialized the Class[] above). -
Hi,
Iam trying to invoke a private method of an object of some class thru reflection. Despite setting method.setAccessible( true), Iam not able to invoke the private method. Is invoking private methods via reflection not allowed at all?
thanks,This worked for me :
public class Test {
public static void main(String[] arg) throws Exception {
TestAccess t = new TestAccess();
Method m = t.getClass().getDeclaredMethod("foo", null);
m.setAccessible(true);
m.invoke(t, null);
class TestAccess {
private void foo() {
System.out.println("This is private");
} -
Invoking a method using reflection with json data as argument
Hi,
I want to invoke a method using reflection and this method have one argument . Now I want to pass a json data as an argument to this method .Please see the following code.
int HelloWorld(int Id){
return Id;
json data{"Id":43}
how can I use the reflection to use the json.
Please provide your guidelinesThanks for your reply, I am building a windows console application .And I want to convert the json data to object array to use in Method Base.Invoke method.
Regards,
Ethan
Maybe you could select the correct language development forum here:
http://social.msdn.microsoft.com/Forums/vstudio/en-US/home?category=vslanguages&filter=alltypes&sort=lastpostdesc
Best Regards,
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Difference between invoking a method using reflect.proxy and reflect.Method
Could any one tell me the difference between invoking a method using reflection java.lang.reflect.Method and java.lang.reflect.Proxy
using both the class, we can invoke a method at runtime
1)
Method mthd=cl.getMethod("methodName",parameterName);
Integer output=(Integer)mthd.invoke(new RunMthdRef(),input);
2)
Proxy.newProxyInstance(super.getClass().getClassLoader(), new Class[] { adapter }, new SomeClass(this));
Does anybody have any idea?The two idioms are fundamentally different. Using java.lang.reflect.Method is how we call a method on a class, using Proxy is how we intercept that method call. An exercise for you, to illustrate that they do not do the same thing: write a simple class with one method, then use java.lang.reflect.Method to invoke that method, and then use a Proxy to invoke that method
-
Failed to invoke end componentFailed to invoke method error
I am getting this error while invoking a web service in weblogic.
What is root cause of this error...?
Error Description:-
<remoteFault xmlns="http://schemas.oracle.com/bpel/extension">
-<part name="code">
<code>Server
</code>
</part>
-<part name="summary">
<summary>Failed to invoke end componentFailed to invoke method
</summary>
</part>
-<part name="detail">
<detail>
<detail><bea_fault:stacktrace xmlns:bea_fault="http://www.bea.com/servers/wls70/webservice/fault/1.0.0"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"/>java.lang.NullPointerException
at org.tcs.billingeai.ws.allocateBillCycle.AllocateBillCycle.allocateBillcycle(Unknown Source)
at org.tcs.billingeai.ws.allocateBillCycle.BillCycleService.invokeAllocateBillCycle(Unknown Source)
at sun.reflect.GeneratedMethodAccessor496.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at weblogic.wsee.component.pojo.JavaClassComponent.invoke(JavaClassComponent.java:91)
at weblogic.wsee.ws.dispatch.server.ComponentHandler.handleRequest(ComponentHandler.java:68)
at weblogic.wsee.handler.HandlerIterator.handleRequest(HandlerIterator.java:127)
at weblogic.wsee.ws.dispatch.server.ServerDispatcher.dispatch(ServerDispatcher.java:84)
at weblogic.wsee.ws.WsSkel.invoke(WsSkel.java:60)
at weblogic.wsee.server.servlet.SoapProcessor.handlePost(SoapProcessor.java:66)
at weblogic.wsee.server.servlet.SoapProcessor.process(SoapProcessor.java:44)
at weblogic.wsee.server.servlet.BaseWSServlet$AuthorizedInvoke.run(BaseWSServlet.java:124)
at weblogic.wsee.server.servlet.BaseWSServlet.service(BaseWSServlet.java:53)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:225)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:127)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:272)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:165)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3153)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:1973)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1880)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1310)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:179)
</detail>
</detail>
</part>
</remoteFault>
</fault
Edited by: 911694 on Jun 25, 2012 1:02 PMThis is a very convinient feature of Weblogic startup service - if your class
does not implement T3StartupDef it will look for (using introspection)
public static void main(String[] args) in your startup class, and, if it is
there it will execute it.
Ricky Wong <[email protected]> wrote:
It works, many thanks !
However I still have one more question out of my head - I found that my
startup class doesn't need to implement the T3StartupDef and it still
works, however my shutdown class must implement the T3ShutdownDef
(otherwise I'll get ClassCastException).
In article <[email protected]>, [email protected] says...
Most likely the HubDevicePool does not have a public default constructor.
Ricky Wong <[email protected]> wrote:
In what situation I'll get the error "Failed to invoke startup/shutdown
class" as below :
java.lang.InstantiationException:
dsb/eBanking/backOffice/connect/HubDevicePool
at java.lang.Class.newInstance0(Native Method)
at java.lang.Class.newInstance(Compiled Code)
at weblogic.t3.srvr.StartupThread.runStartup
(StartupThread.java:180)
at weblogic.t3.srvr.StartupThread.doWork(Compiled Code)
at weblogic.t3.srvr.PropertyExecuteThread.run
(PropertyExecuteThread.java:62)
I'm pretty sure that the class HubDevicePool has been coded (e.g.
implement T3xxxDef interface, with either the startup() or shutdown()
method) properly as I've another startup classes which work perfectly.
The class has been compiled without error, but it just cannot run when I
put it as either a startup or shutdown class for WebLogic.Dimitri
Dimitri -
Dynamically invoke methods of abstract class?
Hi,
I am using reflection to write a class (ClassA) to dynamically invoke methods of classes. I have an abstract class (ClassB) that has some of the methods already implemented, and some of the methods that are declared abstract. Is there any way that I can:
(a) invoke the methods that are already implemented in ClassB;
(b) I have another class (ClassC) that extends ClassB, some of the methods are declared in both classes. Can I dynamically invoke these methods from ClassB?
Thanks in advance,
Matt.Ok, the program is quite long, as it does other things as well, so I'll just put in the relevant bits.
What I have is a JTree that displays classes selected by the user from a JFileChooser, and their methods.
// I declare a variable called executeMethod
private static Method executeMethod;
// objectClass is a class that has been chosen by the user. I create a new instance of this class to execute the methods.
Object createdObject = objectClass.newInstance();
// methodName is the method selected by the user. objectClassMethods is an array containing all the methods in the chosen class.
executeMethod = objectClassMethods[j].getDeclaringClass().getMethod(methodName, null);
Object executeObject = executeMethod.invoke(createdObject, new Object[]{});Ok, here are the test classes:
public abstract class ClassB{
private int age;
private String name;
public ClassB(){ age = 1; name="Me";}
public int getAge(){ return age; }
public String getName(){ return name; }
public void PrintAge(){System.out.println(age);}
public void PrintName(){System.out.println(name);}
public abstract void PrintGreeting();
public class ClassC extends ClassB{
public ClassC(){super();}
public void PrintAge(){
System.out.println("I am " + getAge() + " years old.");
public void PrintGreeting(){
System.out.println("Hello");
}Now, I can print out the PrintAge method from ClassC (i.e. have it output "Hello" to the command line, how can I, say, get it to output the result of PrintName from ClassB, this method does not appear in ClassC. As you can see at the top, I can create a new instance of a normal method (in this case, ClassC), and have it output to the command line, but I know that I can't create a new instance of an abstract class. And since PrintName is implemented in abstract class ClassB, how do I get it to output to the command line?
Thanks,
Matt. -
Cannot invoke method "setMessageListener" within the J2EE container.
I use TopicSubscriber.setMessageListener method to convert messages to my own type, but oc4j jms throws following exception:
javax.jms.JMSException: TopicSubscriber[Oc4jJMS.Consumer.ypchang-cn.12da4a6:111d4f12137:-8000.94,Topic[CreatedSponsorTopic],null,null,false]: cannot invoke method "setMessageListener" within the J2EE container.
at com.evermind.server.jms.JMSUtils.make(JMSUtils.java:1072)
at com.evermind.server.jms.JMSUtils.toJMSException(JMSUtils.java:1152)
at com.evermind.server.jms.JMSUtils.toJMSException(JMSUtils.java:1123)
at com.evermind.server.jms.JMSUtils.assertNotContainer(JMSUtils.java:1538)
at com.evermind.server.jms.EvermindMessageConsumer.setMessageListener(EvermindMessageConsumer.java:217)
at com.firepond.bcmf.bus.BusSubscriberImpl.setMessageListener(BusSubscriberImpl.java:397)
OC4J JMS doesn't support user defined MessageListener?????!!!!!!!!!!
Who can help me out?
Thanks!Hi,
I am facing the same problem did you got any solution for it.
I am getting the following error message too:
Exception in Constructor
javax.jms.JMSException: QueueReceiver[Oc4jJMS.Consumer.ssipl-wrkst-139.-7dd2dd24:1122873d95f:-8000.269,Queue[360Transaction]]: cannot invoke method "setMessageListener" within the J2EE container.
at com.evermind.server.jms.JMSUtils.make(JMSUtils.java:1072)
at com.evermind.server.jms.JMSUtils.toJMSException(JMSUtils.java:1152)
at com.evermind.server.jms.JMSUtils.toJMSException(JMSUtils.java:1123)
at com.evermind.server.jms.JMSUtils.assertNotContainer(JMSUtils.java:1538)
at com.evermind.server.jms.EvermindMessageConsumer.setMessageListener(EvermindMessageConsumer.java:217)
at com.skillnetinc.storehub.connector.pos.publisher.ejb.publishTransactionWithSalesAudit.PublishTransactionWithSalesAuditBean.<init>(PublishTransactionWithSalesAuditBean.java:94)
at PublishTransactionWithSalesAuditBean_RemoteProxy_1dpbn83.OC4J_createBeanInstance(Unknown Source)
at com.evermind.server.ejb.StatelessSessionBeanPool.createContextImpl(StatelessSessionBeanPool.java:37)
at com.evermind.server.ejb.BeanPool.createContext(BeanPool.java:418)
at com.evermind.server.ejb.BeanPool.allocateContext(BeanPool.java:244)
at com.evermind.server.ejb.StatelessSessionEJBHome.getContextInstance(StatelessSessionEJBHome.java:25)
at com.evermind.server.ejb.StatelessSessionEJBObject.OC4J_invokeMethod(StatelessSessionEJBObject.java:86)
at PublishTransactionWithSalesAuditBean_RemoteProxy_1dpbn83.invoke(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.evermind.server.rmi.RmiMethodCall.run(RmiMethodCall.java:53)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:595) -
SEVERE: Caught an exception while invoking method 'setFlag' on object 'Lock
While try to run load test data , I got the exception as follows..
SEVERE: Caught an exception while invoking method 'setFlag' on object 'LockManager'. Releasing locks.
java.lang.reflect.InvocationTargetException
Finally I got a hint ,
"If the running Deployment Template script breaks halfway through its execution due to an unhandled
exception, or is manually interrupted by a user pressing Ctrl-C while it is running, the lock remains
set within the EAC"
The resolution is ,
On Windows: .\runcommand.bat LockManager releaseLock
update_lock
On UNIX: ./runcommand.sh LockManager releaseLock up¬
date_lockAfter spending some time on this, I looked at the source code for com.evermind.server.ThreadState
This is the code that throws the exception:
if(applicationThread != null && applicationThread.httpHandler != null && applicationThread.servletInfo != null)
try
server = applicationThread.httpHandler.request.getApplication().getApplication().getServer();
catch(Throwable t)
System.out.println("caught exception while getting the server instance " + t.getMessage());
t.printStackTrace(System.out);
It looks like this method expects a httpRequest, and would find null because I'm in the servlet.init()
(at least, that's my interpretation)
I tested my code (the remoteFacade.create()) inside of a jsp, and it worked...
So, the next logical question is:
Can I make EJB calls from within the init method of a servlet? (or more specifically from a struts plugin, which I believe should be more or less the same thing)
If so, do I need to take extra steps?
Again, any experience/help on this will be much appreciated.
Thanks,
Christophe. -
Error -50400 occurred at Invoke Method: FIFO.Read in Host.vi
Hey there,
we have sensors on an Engine which are connected to a NI cRIO 9014 board (with a NI9411 6-channel digital input modul) and go from there via network to a host computer.
cRIO board: the cRIO board collects the data from the engine and stores it in a buffer, this is because the network is to slow for the magnitude of data
host computer: the host computer reads over the network the buffer on the cRIO board, on the host computer it takes out specific portions of the data to create pressure graphs of the engine
Error:
Error -50400 occurred at Invoke Method: FIFO.Read in Host.vi
Possible reason(s):
The transfer did not complete within the timeout period or within the specified number of retries.
This error occurs in the following scenario:
- engine is running
- cRIO is running
When I press the start button (boolean 3) in the host.VI to start the reading of the data from the board AFTER I pressed the run button of the host VI.
The Error would not occur if I pressed the start button (boolean 3) BEFORE I pressed the run button of the host VI.
We tried to increase the time out, but it still did not work, the error occurs!
We would be really happy if you could look over it and help us in this case! If you need further informations or if we need to clarify some specific portion, please let us know!
We included the VI's in the attachement!
Thanks in advance!
Solved!
Go to Solution.
Attachments:
Host.vi 152 KB
C_RIO.vi 92 KB
Cyl_Pres.lvproj 196 KBChrisse,
There are a few things wrong in your application, if I may offer some suggestions.
First, your while loops are not running in parallel. In fact, they are in while loops with a true constant wired to them. I am not sure if this is by design for debugging, or on accident. I would put the Polling(read pulling zero elements) outside your main while loop.
Your second nested while loop (the one polling the # of elements and then pulling them out) is going to run just once, and may pull only a few samples. I don't think that is what you are looking for here, and there are a couple ways we can go here. You could continuously poll until you have 0 elements available for x amount of time, then you know you have no more samples available and you can process all the data OR you can put all of your data processing as part of that loop and just always write to file immediately as x samples are pulled.
Also, your main loop's stop condition is (i <= 3) Therefore, it will run once and then stop. Maybe you mean >=3?
Also, you have 'append to file' disabled on your write to spreadsheet, so everytime you write you are overwriting old data. If you want to continuously write, you will be losing data. This can be cured by either setting this to true(requiring a new file name or programatically deleting the old spreadsheet every time you run the vi) OR you can collect all of your data in a shift register, and only write to file once you have all your data available.
The error you are seeing is because you try to close your FPGA reference twice. You only need to close it once.
After seeing your overall picture, I think this can all be cured by simply hardwiring your Read to get your 1440X4 elements, but as we have seen, this does not work. Something is happening in your system....this is what I want you to do...run just the following code...and let me know how many elements remaining it gives you...Once the number has settled(I hope it does and your engine doesn't keep running), hit stop, and all the values will be put on a graph for you. My broken wires are because I do not have the FPGA VI.
Message Edited by Robbob on 04-21-2009 01:48 PM
Rob K
Measurements Mechanical Engineer (C-Series, USB X-Series)
National Instruments
CompactRIO Developers Guide
CompactRIO Out of the Box Video
Attachments:
numelements.jpg 39 KB -
Invoke Method: Run VI produces error when run as an application
Hello,
I have upgraded from LabView 7.0 to 2009. One test program uses Run VI Invoke Method to start the main UI. On LabView 7.0 it works OK , when build as an application, but with LabView 2009 it gives error 1003: Invoke Node xxx.vi <APPEND> VI Path: xxx. (I have checked that the path to "Open VI Reference" is correct.)
When run on LabView 2009 development environment (.vi) - no problem. I used the "Convert built script.." tool to convert to LabView 2009 built specifications. I have tried numerous different variations building application with LabView 2009 (including main UI files, different setups, etc.), but no luck. If someone has any ideas...
-timoMaybe it helps you for debugging:
I checked the property for the broken arrow. You need a property node and go Select Class 'Vi Server'->'VI' (skip this in your Application but navigate to the VI via the server and feed it to the node). Then it is Execution->State.
I need to draw some code to do it for me as well, once I'm done I'll post it here.
Felix
www.aescusoft.de
My latest community nugget on producer/consumer design
My current blog: A journey through uml -
Cannot invoke method multiply() on null object
Hi ,
when im trying to follow Developing Rich Web Applications With Oracle ADF tutorial in this link http://docs.oracle.com/cd/E18941_01/tutorials/jdtut_11r2_55/jdtut_11r2_55_3.html
and in the part ( Add CRUD Operation Components to your Page ) when pressing the CreateInsert i got the error message Cannot invoke method multiply() on null object ,
the logs as below
<Utils> <buildFacesMessage> ADF: Adding the following JSF error message: Cannot invoke method multiply() on null object
java.lang.NullPointerException: Cannot invoke method multiply() on null object
at org.codehaus.groovy.runtime.NullObject.invokeMethod(NullObject.java:77)
at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:750)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:727)
at org.codehaus.groovy.runtime.callsite.NullCallSite.call(NullCallSite.java:17)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:54)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at bc4j_model_EmpDetails_AnnualSalary_null_gs.run(bc4j_model_EmpDetails_AnnualSalary_null_gs.groovy:1)
at oracle.jbo.ExprEval.internalEvaluateGroovyScript(ExprEval.java:1200)
at oracle.jbo.ExprEval.doEvaluate(ExprEval.java:1253)
at oracle.jbo.ExprEval.evaluateForRow(ExprEval.java:1075)
at oracle.jbo.server.AttributeDefImpl.evaluateTransientExpression(AttributeDefImpl.java:2131)
at oracle.jbo.server.ViewRowStorage.getAttributeInternal(ViewRowStorage.java:1827)
at oracle.jbo.server.ViewRowImpl.getAttributeValue(ViewRowImpl.java:1962)
at oracle.jbo.server.ViewRowImpl.getAttributeInternal(ViewRowImpl.java:824)
at oracle.jbo.server.ViewRowImpl.getAttrInvokeAccessor(ViewRowImpl.java:906)
at oracle.jbo.server.ViewRowImpl.getAttribute(ViewRowImpl.java:854)
at oracle.jbo.uicli.binding.JUCtrlValueBinding.internalGetAttributeValueFromRow(JUCtrlValueBinding.java:1213)
at oracle.jbo.uicli.binding.JUCtrlValueBinding.getAttributeFromRow(JUCtrlValueBinding.java:764)
at oracle.jbo.uicli.binding.JUCtrlValueBinding.getInputValueInRow(JUCtrlValueBinding.java:3004)
at oracle.jbo.uicli.binding.JUCtrlValueBinding.getInputValue(JUCtrlValueBinding.java:2852)
at oracle.jbo.uicli.binding.JUCtrlValueBinding.getInputValue(JUCtrlValueBinding.java:2841)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlAttrsBinding.getInputValue(FacesCtrlAttrsBinding.java:183)
at oracle.jbo.uicli.binding.JUCtrlValueBinding.internalGet(JUCtrlValueBinding.java:2416)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlAttrsBinding.internalGet(FacesCtrlAttrsBinding.java:275)
at oracle.adf.model.binding.DCControlBinding.get(DCControlBinding.java:749)
at javax.el.MapELResolver.getValue(MapELResolver.java:164)
at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
at com.sun.el.parser.AstValue.getValue(Unknown Source)
at com.sun.el.ValueExpressionImpl.getValue(Unknown Source)
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
at org.apache.myfaces.trinidad.bean.FacesBeanImpl.getProperty(FacesBeanImpl.java:73)
at oracle.adfinternal.view.faces.renderkit.rich.ValueRenderer.getValue(ValueRenderer.java:184)
at oracle.adfinternal.view.faces.renderkit.rich.SimpleInputBaseRenderer.renderContentStyleAttributes(SimpleInputBaseRenderer.java:512)
at oracle.adfinternal.view.faces.renderkit.rich.SimpleInputBaseRenderer.renderNonElementContent(SimpleInputBaseRenderer.java:397)
at oracle.adfinternal.view.faces.renderkit.rich.FormInputRenderer.encodeAllAsNonElement(FormInputRenderer.java:300)
at oracle.adfinternal.view.faces.renderkit.rich.FormElementRenderer.encodeAll(FormElementRenderer.java:160)
at oracle.adf.view.rich.render.RichRenderer.delegateRenderer(RichRenderer.java:1700)
at oracle.adfinternal.view.faces.renderkit.rich.LabeledInputRenderer.renderFieldCellContents(LabeledInputRenderer.java:228)
at oracle.adfinternal.view.faces.renderkit.rich.LabelLayoutRenderer.renderFieldCell(LabelLayoutRenderer.java:528)
at oracle.adfinternal.view.faces.renderkit.rich.LabelLayoutRenderer.encodeAll(LabelLayoutRenderer.java:305)
at oracle.adfinternal.view.faces.renderkit.rich.LabeledInputRenderer.encodeAll(LabeledInputRenderer.java:215)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1452)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:511)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:923)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1659)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:624)
at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:3201)
at oracle.adfinternal.view.faces.renderkit.rich.PanelFormLayoutRenderer._encodeFormItem(PanelFormLayoutRenderer.java:1088)
at oracle.adfinternal.view.faces.renderkit.rich.PanelFormLayoutRenderer.access$100(PanelFormLayoutRenderer.java:50)
at oracle.adfinternal.view.faces.renderkit.rich.PanelFormLayoutRenderer$FormColumnEncoder.processComponent(PanelFormLayoutRenderer.java:1604)
at oracle.adfinternal.view.faces.renderkit.rich.PanelFormLayoutRenderer$FormColumnEncoder.processComponent(PanelFormLayoutRenderer.java:1523)
at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:187)
at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:318)
at org.apache.myfaces.trinidad.component.UIXComponent.encodeFlattenedChildren(UIXComponent.java:283)
at oracle.adfinternal.view.faces.renderkit.rich.PanelFormLayoutRenderer._encodeChildren(PanelFormLayoutRenderer.java:420)
at oracle.adfinternal.view.faces.renderkit.rich.PanelFormLayoutRenderer.encodeAll(PanelFormLayoutRenderer.java:208)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1452)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:511)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:923)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1659)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:624)
at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:3201)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer._encodeChild(PanelGroupLayoutRenderer.java:447)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer.access$1500(PanelGroupLayoutRenderer.java:30)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer$EncoderCallback.processComponent(PanelGroupLayoutRenderer.java:734)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer$EncoderCallback.processComponent(PanelGroupLayoutRenderer.java:637)
at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:187)
at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:318)
at org.apache.myfaces.trinidad.component.UIXComponent.encodeFlattenedChildren(UIXComponent.java:283)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer.encodeAll(PanelGroupLayoutRenderer.java:360)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1452)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:511)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:923)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1659)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:624)
at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:3201)
at oracle.adfinternal.view.faces.renderkit.rich.DecorativeBoxRenderer.encodeFacet(DecorativeBoxRenderer.java:440)
at oracle.adfinternal.view.faces.renderkit.rich.DecorativeBoxRenderer._encodeCenterPane(DecorativeBoxRenderer.java:704)
at oracle.adfinternal.view.faces.renderkit.rich.DecorativeBoxRenderer.encodeAll(DecorativeBoxRenderer.java:380)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1452)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:511)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:923)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1659)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:624)
at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:3201)
at oracle.adfinternal.view.faces.renderkit.rich.DecorativeBoxRenderer.encodeFacet(DecorativeBoxRenderer.java:440)
at oracle.adfinternal.view.faces.renderkit.rich.DecorativeBoxRenderer._encodeCenterPane(DecorativeBoxRenderer.java:704)
at oracle.adfinternal.view.faces.renderkit.rich.DecorativeBoxRenderer.encodeAll(DecorativeBoxRenderer.java:380)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1452)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:511)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:923)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1659)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:624)
at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:3201)
at oracle.adfinternal.view.faces.renderkit.rich.PanelStretchLayoutRenderer.encodeCenterFacet(PanelStretchLayoutRenderer.java:879)
at oracle.adfinternal.view.faces.renderkit.rich.PanelStretchLayoutRenderer._encodeCenterPane(PanelStretchLayoutRenderer.java:1294)
at oracle.adfinternal.view.faces.renderkit.rich.PanelStretchLayoutRenderer._encodeMiddlePanes(PanelStretchLayoutRenderer.java:351)
at oracle.adfinternal.view.faces.renderkit.rich.PanelStretchLayoutRenderer.encodeAll(PanelStretchLayoutRenderer.java:316)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1452)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:511)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:923)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1659)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:624)
at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:3201)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:641)
at oracle.adf.view.rich.render.RichRenderer.encodeAllChildrenInContext(RichRenderer.java:3062)
at oracle.adfinternal.view.faces.renderkit.rich.FormRenderer.encodeAll(FormRenderer.java:274)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1452)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:511)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:923)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1659)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:624)
at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:3201)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:641)
at oracle.adf.view.rich.render.RichRenderer.encodeAllChildrenInContext(RichRenderer.java:3062)
at oracle.adfinternal.view.faces.renderkit.rich.DocumentRenderer.encodeAll(DocumentRenderer.java:1277)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1452)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:511)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:923)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1659)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1655)
at oracle.adfinternal.view.faces.component.AdfViewRoot.encodeAll(AdfViewRoot.java:91)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:399)
at org.apache.myfaces.trinidadinternal.application.ViewDeclarationLanguageFactoryImpl$ChangeApplyingVDLWrapper.renderView(ViewDeclarationLanguageFactoryImpl.java:350)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:273)
at org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:165)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._renderResponse(LifecycleImpl.java:1027)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:334)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:232)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:313)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:173)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:122)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:293)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:199)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:180)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
<Utils> <buildFacesMessage> ADF: Adding the following JSF error message: Cannot invoke method multiply() on null object
any help please ?Thanks Frank ,
really i've already downloaded the ZIP of the final application , but the same error message ,
when removing the Annual salary ( Which is a new Attribute ( not DB column) Salary * 12 ) every think is fine and no more error message ,there is no null salary all the employees have a salary , my JDeveloper Version is 11.1.2.1.0
also , because of the EmpDetails is based on the query
FROM EMPLOYEES Employees, DEPARTMENTS Departments
WHERE Employees.DEPARTMENT_ID = Departments.DEPARTMENT_ID
and the Department id is non editable value , that means even if you add a new user u cant never check this user in this interface , u can check this user only on DB (SQL) level .
Edited by: 876602 on Jul 1, 2012 5:17 AM -
RFC - Java Proxy (Synchronous) invoking method
Hi,
I have problems to call my inbound java proxy.
My scenario consist of send RFC -> Java Proxy (Synchronous)
Proxy this registered
http://hcp095.intra.csc.es:50100/ProxyServer/register?ns=http://csc.es/xi/rca&interface=Z_RCA_SCS&bean=ZRCASCS_PortTypeBean&method=zRCASCS
ejb-jar.xml:
<ejb-jar>
<description>EJB JAR description</description>
<display-name>EJB JAR</display-name>
<enterprise-beans>
<session>
<ejb-name>ZRCASCS_PortTypeBean</ejb-name>
<home>com.sap.aii.proxy.xiruntime.core.AbstractProxyInboundHome4</home>
<remote>com.sap.aii.proxy.xiruntime.core.AbstractProxyInboundRemote4</remote>
<local-home>com.sap.aii.proxy.xiruntime.core.AbstractProxyInboundLocalHome4</local-home>
<local>com.sap.aii.proxy.xiruntime.core.AbstractProxyInboundLocal4</local>
<ejb-class>es.csc.xi.rca.ZRCASCS_PortTypeBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>
Class Impl:
package es.csc.xi.rca;
public class ZRCASCS_PortTypeImpl extends AbstractProxy implements ZRCASCS_PortType {
public ZRCASCSResponse_Type zRCASCS(ZRCASCS_Type parameters) throws ZRCASCSException_Message_Exception, SystemFaultException, ApplicationFaultException{
//throw new RuntimeException();
Rca_ws a = new Rca_ws();
return a.zRCASCS(parameters);
Error: XI_Monitor
<SAP:Category>XIAdapterFramework</SAP:Category>
<SAP:Code area="MESSAGE">GENERAL</SAP:Code>
<SAP:P1 />
<SAP:P2 />
<SAP:P3 />
<SAP:P4 />
<SAP:AdditionalText>com.sap.aii.af.ra.ms.api.DeliveryException: Error invoking method zRCASCS of proxy bean $Proxy305: cannot assign instance of com.sap.guid.GUID to field com.sap.aii.proxy.xiruntime.core.MessageSpecifierImpl.guid of type com.sap.guid.IGUID in instance of com.sap.aii.proxy.xiruntime.core.MessageSpecifierImpl: com.sap.aii.proxy.xiruntime.core.XmlInboundException: Error invoking method zRCASCS of proxy bean $Proxy305: cannot assign instance of com.sap.guid.GUID to field com.sap.aii.proxy.xiruntime.core.MessageSpecifierImpl.guid of type com.sap.guid.IGUID in instance of com.sap.aii.proxy.xiruntime.core.MessageSpecifierImpl</SAP:AdditionalText>
<SAP:ApplicationFaultMessage namespace="" />
Error: defaultTrace
#hcp095.intra.csc_XID_19271950#ANGUZMAN#ec20b7f019f611de98340011259e6830#
SAPEngine_Application_Thread[impl:3]_36##0#0#Error##Plain##
#com.sap.aii.proxy.xiruntime.core.XmlProxyException: Error invoking method zRCASCS of proxy bean $Proxy366:
cannot assign instance of com.sap.guid.GUID to field com.sap.aii.proxy.xiruntime.core.MessageSpecifierImpl.guid
of type com.sap.guid.IGUID in instance of com.sap.aii.proxy.xiruntime.core.MessageSpecifierImpl
at com.sap.aii.proxy.xiruntime.core.XmlProxyJ2EE.call(XmlProxyJ2EE.java:192)
at com.sap.aii.proxy.xiruntime.core.XmlProxy$ProxyBeanCaller.call(XmlProxy.java:225)
at com.sap.aii.proxy.xiruntime.core.XmlProxy.processRequest(XmlProxy.java:194)
at com.sap.aii.proxy.xiruntime.core.XmlInbound.processRequestMessage(XmlInbound.java:126)
at com.sap.aii.proxy.xiruntime.core.XmlInbound.processMessage(XmlInbound.java:83)
at com.sap.aii.proxy.xiruntime.sbeans.JPRBean.onMessage(JPRBean.java:158)
at com.sap.aii.proxy.xiruntime.sbeans.JPRLocalLocalObjectImpl0_0.onMessage(JPRLocalLocalObjectImpl0_0.java:175)
at com.sap.aii.af.ra.ms.impl.ServicesImpl.deliver(ServicesImpl.java:276)
at com.sap.aii.adapter.xi.ms.XIEventHandler.onDeliver(XIEventHandler.java:1049)
at com.sap.aii.af.ra.ms.impl.core.queue.RequestConsumer.onMessage(RequestConsumer.java:119)
at com.sap.aii.af.ra.ms.impl.core.queue.Queue.run(Queue.java:850)
at com.sap.aii.af.ra.ms.runtime.MSWorkWrapper.run(MSWorkWrapper.java:56)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(AccessController.java:180)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:102)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:172)
If somebody can help me.
Thank you very muchSolved!!!
to assign library references to the project application-j2eeengine.xml
com.sap.aii.proxy.xiruntime
com.sap.aii.messaging.runtime
com.sap.xi.util.misc
com.sap.guid -
Invoking methods via java.lang.Method.invoke().
I need to invoke the getter methods that I have defined for a Trade object passed as an argument.
I am getting the excepion : java.lang.IIlegalArgumentException: wrong number of arguments.
This is the first time I am invoking methods this way.
Am I correct to assume that methods on an object can be invoked in this way?
How can I invoke the getter methods of the trade object.
Please help.
public void displayData(Trade trade){
Method[] m = trade.getClass().getMethods();
for(int i=0;i<m.length;i++){
if(m.getName().startsWith("get")){
try {
m[i].invoke(trade, new Trade[] { trade });
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();bhuru_luthria wrote:
The getter methods of the trade object require no arguments.
The three getter methods of the trade object are:
getTradeId();
getProductId()
getReferenceId()Read the Javadoc; use it like this:
m.invoke(trade);
Maybe you are looking for
-
Tabs and stacked canvases ...
Why are tab canvases effectively implemented as stacked canvases? It seems crazy that you have to first create a "content" canvas (which will never have any items placed on it) on which to display your tab canvas! I want to create the layout where I
-
External hard drive use?
I do lots of dv video work using a sony pd170 dv/dvcam video camera. i have the mac mini using final cut express 4. for small videos the system works fine, small project 10 mins or less. I am currently working on a very large project 90 to 120 mins.
-
How To Increase The height of a line dynamically
Dear all, In a table I am using expand to fit height for the text fields in the table.It's working fine.But the height of the partition lines of the table which divide the columns are not increasing. I have taken the rows of the table as different su
-
How can I get content saved on iCloud on my iPhone?
How do you get content saved on iCloud on your iPhone?
-
How do I download Lion if I'm running Mountain Lion?
I need to instal Lion on an older mac but I can't download it from Mountain Lion? It says "This version of Mac OS X 10.7 cannot be installed on this computer" but I don't want to install it on this mac I want to install it on another mac. Any work ar