Use a variable to call a method
Hi
I'm not very familiar with JAVA. I'm just doing different things in my free time at home.
Now I try to write a abstract class so my mostly used methods are allways the same. but for that I have to call a method in a class but I know the method only at runtime.
e.g.
String[] methods = {"compare", "compareIgnoreCase"};
// Here I like to call the method out of the above string:
result = callMethod(class, methods[0], param1, param2);Is this possible in Java? If yes, how?
By the way, I have J2SE 1.5 installed. And I'm working with NetBeans as my developing tool.
Thanks for any help
Cheers
moba
Classes can be dynamically loaded to invoke their methods using Java Reflection feature.
The article http://java.sun.com/developer/technicalArticles/ALT/Reflection/index.html provides examples on using the reflection feature.
In particular, the section "Invoking Methods by Name" in the article gives an example of invoking a method dynamically.
The relevant APIs (in java.lang and java.lang.reflect packages) are documented at:
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/http://java.sun.com/j2se/1.5.0/docs/api/java/lang/reflect/package-summary.html
and http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Class.html.
Similar Messages
-
Using Java Reflection to call a method with int parameter
Hi,
Could someone please tell me how can i use the invoke() of the Method class to call an method wiht int parameter? The invoke() takes an array of Object, but I need to pass in an array of int.
For example I have a setI(int i) in my class.
Class[] INT_PARAMETER_TYPES = new Class[] {Integer.TYPE };
Method method = targetClass.getMethod(methodName, INT_PARAMETER_TYPES);
Object[] args = new Object[] {4}; // won't work, type mismatch
int[] args = new int[] {4}; // won't work, type mismatch
method.invoke(target, args);
thanks for any help.Object[] args = new Object[] {4}; // won't work, type
mismatchShould be:
Object[] args = new Object[] { new Integer(4) };The relevant part of the JavaDoc for Method.invoke(): "If the corresponding formal parameter has a primitive type, an unwrapping conversion is attempted to convert the object value to a value of a primitive type. If this attempt fails, the invocation throws an IllegalArgumentException. "
I suppose you could pass in any Number (eg, Double instead of Integer), but that's just speculation. -
Using a button to call a method
I am trying to get the button actionPerformed to call the connect method. But I get this error message on compile:
ras@2[nuvu]$ /usr/jdk/jdk1.6.0_04/bin/javac MonitorView2.java
MonitorView2.java:77: connectPort(java.lang.String) in MonitorView2 cannot be applied to ()
connectPort();
Can someone decipher this for me? Why can't this be done? thx
public class MonitorView2 extends JFrame {
static SerialPort serialPort;
ByteArrayOutputStream asciiStream = new ByteArrayOutputStream();
public MonitorView2() {
super("Monitor View 2");
JPanel pane = new JPanel();
setContentPane(pane);
JButton testButton = new JButton("Test Comm On");
pane.add(testButton);
setSize(600, 300);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
class TestButtonHandler implements ActionListener {
public void actionPerformed(ActionEvent e) {
System.out.println("Test button action works!");
try
String a = "33, 48, 48, 66, 67, 78, 49, 13"; //comm on;
//ByteArrayOutputStream asciiStream = new ByteArrayOutputStream();
byte[] buf = a.getBytes();
asciiStream.write(buf);
System.out.println("Buffer as a string");
System.out.println(asciiStream.toString());
System.out.println("Into array");
byte[] b = asciiStream.toByteArray();
for (int i=0; i<b.length; i++) {
System.out.print((char) b);
catch (Exception ex)
System.out.println("Exception has been thrown :" + ex);
connectPort();
testButton.addActionListener( new TestButtonHandler());
public void connectPort ( String portName ) throws Exception {
String defaultPort = "/dev/ttyS0";
String asciiString;
Charset asciiCharset = Charset.forName("US-ASCII");
CharsetDecoder decoder = asciiCharset.newDecoder();
//byte[] b = {33, 48, 48, 66, 67, 78, 49, 13}; //comm on
byte[] b = asciiStream.toByteArray();
ByteBuffer asciiBytes = ByteBuffer.wrap(b);
CharBuffer bChars = null;
try {
bChars = decoder.decode(asciiBytes);
} catch (CharacterCodingException e) {
System.err.println("Error decoding");
System.exit(-1);
System.out.println(bChars);
CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName);
if ( portIdentifier.isCurrentlyOwned() )
System.out.println("Error: Port is currently in use");
else
CommPort commPort = portIdentifier.open(this.getClass().getName(),2000);
if ( commPort instanceof SerialPort )
SerialPort serialPort = (SerialPort) commPort;
serialPort.setSerialPortParams(4800,SerialPort.DATABITS_8,SerialPort.STOPBITS_1,SerialPort.PARITY_NONE);
InputStream in = serialPort.getInputStream();
OutputStream out = serialPort.getOutputStream();
(new Thread(new SerialReader(in))).start();
(new Thread(new SerialWriter(out))).start();
out.write(b);
out.flush();
else
System.out.println("Error: Only serial ports are handled by this example.");Seriously, learn the basics.
Sun's [basic Java tutorial|http://java.sun.com/docs/books/tutorial/]
Sun's [New To Java Center|http://java.sun.com/learning/new2java/index.html].Includes an overview of what Java is, instructions for setting up Java, an intro to programming (that includes links to the above tutorial or to parts of it), quizzes, a list of resources, and info on certification and courses.
[http://javaalmanac.com|http://javaalmanac.com]. A couple dozen code examples that supplement [The Java Developers Almanac|http://www.amazon.com/exec/obidos/tg/detail/-/0201752808?v=glance].
jGuru. A general Java resource site. Includes FAQs, forums, courses, more.
JavaRanch. To quote the tagline on their homepage: "a friendly place for Java greenhorns." FAQs, forums (moderated, I believe), sample code, all kinds of goodies for newbies. From what I've heard, they live up to the "friendly" claim.
Bruce Eckel's [Thinking in Java|http://mindview.net/Books/DownloadSites] (Available online.)
Joshua Bloch's [Effective Java|http://www.amazon.com/Effective-Java-2nd-Joshua-Bloch/dp/0321356683/ref=pd_bbs_1?ie=UTF8&s=books&qid=1214349768&sr=8-1]
Bert Bates and Kathy Sierra's [Head First Java|http://www.amazon.com/exec/obidos/tg/detail/-/0596004656?v=glance].
James Gosling's [The Java Programming Language|http://www.bookpool.com/sm/0321349806]. Gosling is
the creator of Java. It doesn't get much more authoratative than this. -
In one sequence I have dozens of Pre-Expressions which are almost the same thing, like this...
Locals.tagID = (Parameters.singlePhaseEnabled ? "L" : "D") & Str(Locals.phase) & "006"
...and the only thing different is that three digit string at the end ("006" will vary). How can I write a function that I can call from a step's Pre-Expression so it would look something like this? ...
Locals.tagID = MyNewFunction("006")You cannot write custom commands for expressions.
That being said, there are a couple of options:
Create a subsequence with a single step. Use a parameter of the sequence as "function parameter".
Create a custom step type including a substep module which implements the function. Add an edit substep to enable the user of the steptype to gracefully change the parameter.
Store the variable parameter in a local/file global variable and modify the value in each step. This will, at least, keep the "function" the same for every step.
Norbert -
Superclass variable not calling subclass method
hi,
i've got a bit of a problem with my method invocation. i'll try to explain in abstract terms:
class SuperClass {
void method(int x){
//some action
class SubClass extends SuperClass {
static final int VARIABLE = 1;
void method(int x){
x = modify(x);
super.method(x)
int modify(int x){
return x += VARIABLE;
my problem is that i've got about 20 or so subclasses that i refer to through a superclass reference. as i understand it, i should be about to call:
int result = superClassRef.method(5);
and this will call the subclass method, perform the modification and return the result. my problem is twofold.
1) the superclass reference dosen't call the subclass's method
2) what happens when it gets to the subclass's modify method and trys to access the subclass's VARIABLE through a superclass reference? as i understand it shouldn't be accessible from the superclass reference.
hmmm...any help would be most appreciated.
cameronthat was what i ment -
SuperClass superClassRef = new SubClass();
superClassRef.method(5); //dosen't return anything
i think this may be turning into a more wide ranging application problem. i tried to bypass the natural superclass method invocation with the following code:
Method m = superClassRef.getClass().getMethod("method");
m.invoke(superClassRef, new Object[]{new Integer(x)});
but on trying this it throws an InvocationTargetException.
for clarity - the two methods in the subclass are:
void method(int x) (overrides the superclass's method(int x))
and
int modify(int x)
sorry for the bad naming.
i've figured out the variable thing - i'd only be if there were variable shaddowing in the subclass that problems could arrise. -
How to call a method w/ a variable
Hi all,
I'm new to programming and Java. I have some experience w/ PHP.
PHP allows me to use a variable to call a function:
$name = foo;
// will call foo()
$name();
function foo(){some code;}
Is there a similar way to call methods in Java? I've done some research and everything seems to point to 'Reflection'. Please let me know if this is the correct path.
Thanks,
rkenyon1969rkenyon1969 wrote:
I'm using Java w/ Google Web Toolkit(GWT) and I would like to call a class method based on the URL of the calling page.Well I can confidently say that I know less than squat about this. You may need reflection here, but I've no idea. I'm hopeful that you'll get a response from someone knowledgeable in this soon, and maybe we both can learn. Best of luck! -
Using a variable in an instance name
Hey all,
Simple question:
I'm trying to use a variable to call on different instance names:
var picCaller:uint=2;
material_mc.addChild(pic_""+picCaller+"");
The code in red is the issue in question. In this example, I'm trying to add a child called "pic_2", with the number two called from the variable "picCaller"
Any assistance is greatly appreciated.
Thanks!Just for context, here is what I'm trying to do:
I have jpegs in my library and I want to add them to the stage when they're needed, so just to add one image, here is the code I have:
var pic_1=new pic1(0,0);
var image_1:Bitmap=new Bitmap(pic_1);
material_mc.addChild(image_1);
I want to put the above into a loop so that I dont have to repeat those three lines for every image in my library like so:
var pic_1=new pic1(0,0);
var image_1:Bitmap=new Bitmap(pic_1);
var pic_2=new pic2(0,0);
var image_2:Bitmap=new Bitmap(pic_2);
var pic_3=new pic3(0,0);
var image_3:Bitmap=new Bitmap(pic_3);
var pic_4=new pic4(0,0);
var image_4:Bitmap=new Bitmap(pic_4);
var pic_5=new pic5(0,0);
var image_5:Bitmap=new Bitmap(pic_5);
var pic_6=new pic6(0,0);
var image_6:Bitmap=new Bitmap(pic_6);
var pic_7=new pic7(0,0);
var image_7:Bitmap=new Bitmap(pic_7);
the variable "picNum" is the total amount of images that in the library, each one exported as "pic1", "pic2", "pic3" respectively.
var picNum:uint=7;
var picCaller:uint=1;
var picMC:MovieClip = new MovieClip();
picMC=this["pic_"+picCaller];
for (var i:int = 1; i <= picNum; i=i+1)
var "pic_"+i = new image_i(0, 0);
var image:Bitmap = new Bitmap("pic_"+i);
Thanks so much for your help. -
Calling a method via String representation of instance
Is it possible to call a method of a specific (and already existing) instance of a class using a string representation of the instance?
By "String representation of an instance," I simply mean a string that has the same format as a normal method call would have. So where a method would normally be called like this:
ClassX itsInstance = new ClassX();
itsInstance.methodX();
The string representation would be:
String instanceName = "itsInstance";
And there would be some way of using this string to call the method referred to by instanceName.
The idea here is that I want to use the existing instance, whereas using reflection, as below, would create a new instance:
String className = "X";
String methodName = "print";
Class xClass = Class.forName(className);
Method xMethod = xClass.getMethod(methodName,null);
Object object = xClass.newInstance();
xMethod.invoke(object,null); -
Using a variable from another method within another method
I have a couple methods. In the beginning of the class I declared the double variables. Then I have a method1 that in that class that changes those double variables. Then the last method2 runs, and is suppose to print information to the screen with the changed variable information all being called from another class. How do I get those changed double variables to be read in method2?
Sorry about all that, when I paste it in from the compiler it's skews it some, but hopefully this should be more readable
* Project Filename: Lab1s2
* Program Filename: Lab1s2.java
* I/O Files used:
* Fuction: This program will use interactive input to ask cost of a
* product in dollars and cents (eg. 17.50). If the product
* is not less than $100.00, an error message will be displayed
* and input will be requested again. Once a valid value is
* given, the program will calculate the fewest bills and change
* to be returned if the customer gives a $100.00 bill.
* Formulas: (100 - amount = change)
* Algorithm:
* Purpose: The main method calls other methods found in the MoneyXX class
* that will accomplish the function of the project.
public class Lab2sl
public static void main( String[] args ) // main method begins program execution
Money2sl myMoney2sl = new Money2sl(); // create myMoney2sl object and assign it to Money2sl
myMoney2sl.inputSL();// calls input method and pass argument
myMoney2sl.changeSL(); // calls change method
System.out.println(); // output a blank line
myMoney2sl.outputSL(); //calls outputSL to show results
* Project Filename: Money2SL.java
import java.util.Scanner;
import java.util.Calendar;
public class Money2sl
Scanner input = new Scanner( System.in ); // create Scanner to obtain input from command window
private double change,
amount; // instant variable, stores amount
private double twentyD = 20.00;
private double tenD = 10.0;
private double fiveD = 5.0;
private double dollar = 1.0;
private double quarter = 0.25;
private double dime = 0.10;
private double nickel = 0.05;
private double penny = 0.01;
private double numTwentyD;
private double numTenD;
private double numFiveD;
private double numDollar;
private double numQuarter;
private double numDime;
private double numNickel;
private double numPenny;
// inputSL() method gets amount, checks to see if it is under $100, stores amount into variable
public void inputSL() //input method
Calendar dateTime = Calendar.getInstance(); // get current date and time
//print date and time
System.out.printf( "%s\n", "nothing" );
System.out.printf( "%1$ta, %1$tB. %1$te, %1$tY %1$tr\n\n", dateTime );
//print output
System.out.println( "Please enter the amount of money (less than $100) that you will spend: "); // prompt
amount = input.nextDouble();
while ( amount > 100 )
System.out.println( "error - enter amount less than $100");
System.out.println( "Please enter the amount of money (less than $100) that you will spend: "); // prompt
amount = input.nextDouble();
} // end inputSL method
// changeSL() calculates change from amount entered out of $100
public void changeSL()
change = 100 - amount; // calculate change
while(change > 0)
if ( change - fiveD >= 0 )
numFiveD ++;
change -= fiveD;
if ( change - fiveD >= 0 )
numFiveD ++;
change -= fiveD;
if ( change - dollar >= 0 )
numDollar++;
change -= dollar;
if ( change - quarter >= 0 )
numQuarter ++;
change -= quarter;
if ( change - dime >= 0 )
numDime ++;
change -= dime;
if ( change - nickel >= 0 )
numNickel ++;
change -= nickel;
if ( change - penny >= 0 )
numPenny ++;
change -= penny;
} // end changeSL method
//outputSL() displays original amount, change dollar amount, and change in individual bills and coins
public void outputSL()
System.out.printf( "$%.2f dollars will return $%.2f, which is: ",
amount, change );
System.out.println(); // blank line
System.out.println(); // blank line
if ( numTwentyD > 0 )
if ( numTwentyD > 1)
System.out.println( numTwentyD + " twenty dollar bills" );
System.out.println( numTwentyD + " twenty dollar bill" );
if ( numTenD > 0)
if ( numTenD > 1 )
System.out.println( numTwentyD + " ten dollar bills" );
System.out.println( numTwentyD + " ten dollar bill" );
if ( numFiveD > 0)
if ( numFiveD > 1 )
System.out.println( numFiveD + " five dollar bills" );
System.out.println( numFiveD + " five dollar bill" );
if ( numDollar > 0)
if ( numDollar > 1 )
System.out.println( numDollar + " one dollar bills" );
System.out.println( numDollar + " one dollar bill" );
if ( numQuarter > 0)
if ( numQuarter > 1 )
System.out.println( numQuarter + " quarters" );
System.out.println( numDollar + " quarter" );
if ( numDime > 0)
if ( numDime > 1 )
System.out.println( numDime + " dimes" );
System.out.println( numDime + " dime" );
if ( numNickel > 0)
if ( numNickel > 1 )
System.out.println( numNickel + " nickels" );
System.out.println( numNickel + " nickel" );
if (numPenny > 0)
if ( numPenny > 1 )
System.out.println( numPenny + " pennies" );
System.out.println( numPenny + " penny" );
} -
Using Parentheses to Call a Method?
So my code looks like this:
DATA: o_ztransload_tools TYPE REF TO zcl_transload_toolbox.
CREATE OBJECT o_ztransload_tools.
o_ztransload_tools->zzcreate_date_range( zzobjin_dtlw = zzin_dtlw
zzobjin_dthigh = zzin_dthigh ) .
This class method returns a date range. I would like to understand how to write this code without using the 'IMPORT' 'EXPORT' , parameter identifiers...if possible., and just using parentheses, as a shorthand way of writing the call method. So, from what I've read, it is possible to write the code this way.But when I try to add code for the single returning value, I get syntax errors. How should the code be written for the method's returning value to be syntactically correct?
Thank-You, TomThere would a several different combinations you may have to use depending on the type of parameters.
If you have a single RETURNING parameter and single IMPORTING parameter, you can receive the results in that variable directly. Llike:
lv_Day = zcl_Test=>give_day( sy-datum ).
If you have multiple Importing parameters, you call the method like:
zcl_test=>get_data(
io_data = o_data
io_data2 = o_data ).
You can also set the the preferred parameter, when you have more than one importing parameter. Like IO_DATA and IO_DATA2. If make the preferred parameter as the IO_DATA2, than you can use pass this parameter without specifying parameter name.
zcl_test=>get_Data( o_data_second ).
If you have importing, exporting, changing parameters; than you have to explicitly mention the word EXPORTING, IMPORTING ... etc to let the system know what to change
zcl_test_alv=>factory(
EXPORTING
iv_alv_type = alv_1
IMPORTING
eo_alv = me->o_alv
changing
ct_Data = t_Data ).
You can't have Receiving parameter along with Changing and Exporting parameters in the same method.
Regards,
Naimesh Patel -
Doubt in uploading using call transaction method
hi all
i am uploading f-29 in call transaction method .. i have a problem in currency field, the currency field is not picking up it shows a error that input field is longer than screen field .. i have declared currency field as type BSEG-WRBTR(same as screen field ...how to go about
thanks
lokeshHi,
When you use the database value directly in your BDC, you will have this issue. It is always advisable to use character fields when doing BDC. so change it to charecter field and try it..
Regards
Sudheer -
LVOOP "call parent method" doesn't work when used in sibling VI
It seems to me that the "call parent method" doesn't work properly according to the description given in the LabVIEW help.
I have two basic OOP functions I am doing examples for. I can get one to work easily and the other one is impossible.
Background
There are 3 basic situations in which you could use the "call parent method"
You are calling the parent VI (or method) of a child VI from within the child VI
You are calling the parent VI (or method) of a child VI from within a sibling VI
You are calling the parent VI (or method) of a child VI from a different class/object.
From the LabVIEW help system for "call parent method":
Calls the nearest ancestor implementation of a class method. You can use the Call Parent Method node only on the block diagram of a member VI that belongs to a class that inherits member VIs from an ancestor class. The child member VI must be a dynamic dispatching member VI and have the same name as the ancestor member VI
From my reading of that it means situation 3 is not supported but 1 & 2 should be.
Unfortunately only Situation 1 works in LabVIEW 2012.
Here is what I want
And this is what I actually get
What this means is that I can perform a classic "Extend Method" where a child VI will use the parent's implementation to augment it's functions BUT I cannot perform a "Revert Method" where I call the parent method's implementation rather than the one that belongs to the object.
If you want a picture
Any time I try and make operation2 the VI with the "call parent method" it shows up for about 1/2 sec and then turns into operation.
So there are only 3 possibilities I can see
Bug
Neither situation 2 or 3 are intended to work (see above) and the help is misleading
I just don't know what I am doing (and I am willing to accept this if someone can explain it to me)
The downside is that if situation 2 above doesn't work it does make the "call parent node" much less usefull AND it's usage/application just doesn't make sense. You cannot just drop the "call parent node" on a diagram, it only works if you have an existing VI and you perform a replace. If you can only perform situation 1 (see above) then you should just drop the "call parent node" and it picks up the correct VI as there is only 1 option. Basically if situation 2 is not intended to work then the way you apply "call parent method" doesn't make sense.
Attachements:
For the really keen I have included 2 zip files
One is the "Revert Method labVIEW project" which is of course not working properly because it wants to "call parent method" on operation not operation2
The other zip file is all pictures with a PIN for both "Revert Method" and "Extend Method" so you can see the subtle but important differences and pictrures of the relavant block diagrams including what NI suggested to me as the original fix for this problem but wasn't (they were suggesting I implement Extend Method).
If you are wondering where I got the names, concepts and PIN diagrams from see:
Elemental Design Patterns
By: Jason McColm Smith
Publisher: Addison-Wesley Professional
Pub. Date: March 28, 2012
Print ISBN-10: 0-321-71192-0
Print ISBN-13: 978-0-321-71192-2
Web ISBN-10: 0-321-71255-2
Web ISBN-13: 978-0-321-71255-4
All the best
David
Attachments:
Call parent node fault.zip 356 KB
Call parent node fault.zip 356 KBHi tst,
Thankyou for your reply. Can you have a look at my comments below on the points you make.
1) Have to disagree on that one. The help is unfortunately not clear. The part you quote in your reply only indicates that the VI you are applying "Call Parent Node" to must be dynamic dispatch. There is nowhere in the help it actually states that the call parent node applies to the VI of the block diagram it is placed into. Basically case 2 in my example fulfills all that the help file requires of it. The dynamic dispatch VI's operation are part of a class that inherits from a given ancestor. Operation 2 for Reverted behaviour is a child VI that is dynamic dispatch and has the same name as the ancestor VI (operation2). The help is missing one important piece of information and should be corrected.
2) True it does work this way. I was trying to build case 2 and had not yet built my ancestor DD for operation so the function dropped but wasn't associated with any VI. I was able to do this via a replace (obviously once the ancestor Vi was built) so this one is just bad operator
3) Keep in mind this is an example not my end goal. I have a child implementation because this is a case where I am trying to do a "reverse override" if you like.
3a) The point of the example is to override an objects method (operation2) with it's parent's method NOT it's own. The reason there is a child implementation with specific code is to prove that the parent method is called not the one that relates to the object (child's VI). If I start having to put case structures into the child VI I make the child VI have to determine which code to execute. The point of Revert method is to take this function out of the method that is doing the work. (Single Use Principal and encapsulation)
3b) The VI I am calling is a Dynamic Dispatch VI. That means if I drop the superclass's VI onto the child's block diagram it will become the child's implementation. Basically I can't use Dynamic Dispatch in this case at all. It would have to be static. That then means I have to put in additional logic unless there is some way to force a VI to use a particular version of a DD VI (which I can't seem to find).
Additional Background
One of the uses for "Revert Method" is in versioning.
I have a parent Version1 implementation of something and a child Version2. The child uses Version2 BUT if it fails the error trapping performs a call to Version1.
LabVIEW has the possibility of handling the scenario but only if both Case 1 and Case 2 work. It would actually be more useful if all 3 cases worked.
The advantage of the call parent method moving one up the tree means I don't have the track what my current object is and choose from a possible list, if, for example the hierarchy is maybe 5 levels deep. (so V4 calls V3 with a simple application of "call parent method" rather than doing additional plumbing with case structures that require care and feeding). Basically the sort of thing OOP is meant to help reduce. Anything that doesn't allow case 2 or 3 means you have to work around the limitation from a software design perspective.
If at the end of the day Case 2 and case 3 don't and won't ever work then the help file entry needs to be fixed.
All the best
David -
Browser Dependency when calling a method in backing bean using a javasript.
Hi all,
I have a problem which may look simple but bugging me for quite some time.
The problem is : When I call a method in the backing bean using a Javascript, (the method can alternatively be invoked by clicking on a command link) I am facing an exception (stack printed below).
The strange part is that...I am getting this exception only when I use Internet Explorer. It works absolutely fine when I use Mozilla or Netscape browsers. Also, even in ie, it is working fine when I click on the link directly. The probem comes only when I invoke the action using a javascript.
WARN [lifecycle] executePhase(RENDER_RESPONSE 6,com.sun.faces.cont
ext.FacesContextImpl@16ce9df) threw exception
javax.faces.FacesException
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java
:135)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:206)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.ja
va:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssoci
ationValve.java:179)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:
84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnecti
onValve.java:156)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http
11Protocol.java:580)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)
Caused by: ClientAbortException: java.net.SocketException: Connection reset by
peer: socket write error
at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:
358)
at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:434)
at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:309)
at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:288)
at org.apache.catalina.connector.Response.flushBuffer(Response.java:542)
at org.apache.catalina.connector.ResponseFacade.flushBuffer(ResponseFacade.java
:279)
at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:20
2)
at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java
:101)
at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:
222)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java
:106)
... 24 more
Caused by: java.net.SocketException: Connection reset by peer: socket write erro
r
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(Unknown Source)
at java.net.SocketOutputStream.write(Unknown Source)
at org.apache.coyote.http11.InternalOutputBuffer$OutputStreamOutputBuffer.doWri
te(InternalOutputBuffer.java:764)
at org.apache.coyote.http11.filters.ChunkedOutputFilter.doWrite(ChunkedOutputFi
lter.java:124)
at org.apache.coyote.http11.InternalOutputBuffer.doWrite(InternalOutputBuffer.j
ava:570)
at org.apache.coyote.Response.doWrite(Response.java:560)
at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:
353)
... 33 more
13:54:42,805 ERROR [STDERR] ClientAbortException: java.net.SocketException: Con
nection reset by peer: socket write error
13:54:42,805 ERROR [STDERR] at org.apache.catalina.connector.OutputBuffer.realW
riteBytes(OutputBuffer.java:358)
13:54:42,805 ERROR [STDERR] at org.apache.tomcat.util.buf.ByteChunk.flushBuffer
(ByteChunk.java:434)
13:54:42,805 ERROR [STDERR] at org.apache.catalina.connector.OutputBuffer.doFlu
sh(OutputBuffer.java:309)
13:54:42,805 ERROR [STDERR] at org.apache.catalina.connector.OutputBuffer.flush
(OutputBuffer.java:288)
13:54:42,820 ERROR [STDERR] at org.apache.catalina.connector.Response.flushBuff
er(Response.java:542)
13:54:42,820 ERROR [STDERR] at org.apache.catalina.connector.ResponseFacade.flu
shBuffer(ResponseFacade.java:279)
13:54:42,820 ERROR [STDERR] at com.sun.faces.application.ViewHandlerImpl.render
View(ViewHandlerImpl.java:202)
13:54:42,820 ERROR [STDERR] at org.ajax4jsf.framework.ViewHandlerWrapper.render
View(ViewHandlerWrapper.java:101)
13:54:42,820 ERROR [STDERR] at org.ajax4jsf.framework.ajax.AjaxViewHandler.rend
erView(AjaxViewHandler.java:222)
13:54:42,820 ERROR [STDERR] at com.sun.faces.lifecycle.RenderResponsePhase.exec
ute(RenderResponsePhase.java:106)
13:54:42,820 ERROR [STDERR] at com.sun.faces.lifecycle.LifecycleImpl.phase(Life
cycleImpl.java:251)
13:54:42,820 ERROR [STDERR] at com.sun.faces.lifecycle.LifecycleImpl.render(Lif
ecycleImpl.java:144)
13:54:42,820 ERROR [STDERR] at javax.faces.webapp.FacesServlet.service(FacesSer
vlet.java:245)
13:54:42,820 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.
internalDoFilter(ApplicationFilterChain.java:290)
13:54:42,820 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.
doFilter(ApplicationFilterChain.java:206)
13:54:42,820 ERROR [STDERR] at com.hds.vc.common.infrastructure.AIMFilter.doFil
ter(AIMFilter.java:27)
13:54:42,820 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.
internalDoFilter(ApplicationFilterChain.java:235)
13:54:42,820 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.
doFilter(ApplicationFilterChain.java:206)
13:54:42,820 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.d
oFilter(ReplyHeaderFilter.java:96)
13:54:42,820 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.
internalDoFilter(ApplicationFilterChain.java:235)
13:54:42,820 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.
doFilter(ApplicationFilterChain.java:206)
13:54:42,820 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.in
voke(StandardWrapperValve.java:230)
13:54:42,820 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.in
voke(StandardContextValve.java:175)
13:54:42,820 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociatio
nValve.invoke(SecurityAssociationValve.java:179)
13:54:42,820 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.i
nvoke(JaccContextValve.java:84)
13:54:42,820 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invok
e(StandardHostValve.java:128)
13:54:42,820 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invo
ke(ErrorReportValve.java:104)
13:54:42,820 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectio
nValve.invoke(CachedConnectionValve.java:156)
13:54:42,820 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.inv
oke(StandardEngineValve.java:109)
13:54:42,820 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.serv
ice(CoyoteAdapter.java:241)
13:54:42,820 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process
(Http11Processor.java:844)
13:54:42,820 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11Co
nnectionHandler.process(Http11Protocol.java:580)
13:54:42,820 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker.ru
n(JIoEndpoint.java:447)
13:54:42,820 ERROR [STDERR] at java.lang.Thread.run(Unknown Source)
13:54:42,820 ERROR [STDERR] Caused by: java.net.SocketException: Connection rese
t by peer: socket write error
13:54:42,820 ERROR [STDERR] at java.net.SocketOutputStream.socketWrite0(Native
Method)
13:54:42,820 ERROR [STDERR] at java.net.SocketOutputStream.socketWrite(Unknown
Source)
13:54:42,820 ERROR [STDERR] at java.net.SocketOutputStream.write(Unknown Source
13:54:42,820 ERROR [STDERR] at org.apache.coyote.http11.InternalOutputBuffer$Ou
tputStreamOutputBuffer.doWrite(InternalOutputBuffer.java:764)
13:54:42,820 ERROR [STDERR] at org.apache.coyote.http11.filters.ChunkedOutputFi
lter.doWrite(ChunkedOutputFilter.java:124)
13:54:42,820 ERROR [STDERR] at org.apache.coyote.http11.InternalOutputBuffer.do
Write(InternalOutputBuffer.java:570)
13:54:42,820 ERROR [STDERR] at org.apache.coyote.Response.doWrite(Response.java
:560)
13:54:42,820 ERROR [STDERR] at org.apache.catalina.connector.OutputBuffer.realW
riteBytes(OutputBuffer.java:353)
13:54:42,820 ERROR [STDERR] ... 33 more
Please throw some light on this issue.This is the Java script I am using
function submitForm(e){
var characterCode
if(e && e.which){
e = e
characterCode = e.which
}else{
e = event characterCode = e.keyCode
if (characterCode== 13){
document.getElementById('mainform:submitForm:search').onclick();
Regards,
Jagadeesh
Edited by: Jagadeesh.Pala on Oct 1, 2007 3:59 AM -
Calling a Method of Interface by using Object
Hi All,
I want to use a method of a class which will be IF_ABC_XYZ~ <amethod> ( ). how can i use this method in my program , I have the instance of the class which have the above mentioned method?
Thanks & Regards
Pavanthanks
here the case is like this
data :
lv_type TYPE REF TO IF_some xyz.
now by using a static class method i am able to get the return type equal to lv_type i.e
CALL METHOD cl_someclassname=> amethod ( )
IMPORTING
type = lv_type.
now when i debug and see lv_type is having a class name inside it. I want to use a method of this class.
How can I call the method which Iam able to see in the lv_type when i debug. -
Error while updating data using session and call transaction method
Hi all,
i have to update data using MM01 transaction from flat file to database.i have used both session method and call transaction method to do that.in both the methods data has been transferred from internal tables to screens but while updating the data that is by clicking the ok-code at the end of the transaction iam getting a dialogue box stating
SAP EXPRESS DOCUMENT "UPDATE WAS TERMINATED" RECEIVED FROM AUTHOR "SAP".
please tell whether the problem lies and solution for that.
thanks and regards.hi,
check your recording.check whether u saved your material no in recording or not.
once again record the transacton mm01.
MATNR LIKE RMMG1-MATNR,
MBRSH LIKE RMMG1-MBRSH,
MTART LIKE RMMG1-MTART,
MAKTX LIKE MAKT-MAKTX,
MEINS LIKE MARA-MEINS,
MATKL LIKE MARA-MATKL,
BISMT LIKE MARA-BISMT,
EXTWG LIKE MARA-EXTWG,
these are the fields which u have to take in internal table.
this is the record which i took in my flatfile.use filetype as asc and hasfieldseperator as 'X'.
SUDHU-6 R ROH MATSUDHU " 001 7890 AA
i did the same.but i didn't get any error.
Maybe you are looking for
-
Received the following error message while trying to install icloud 3.1 and my iTunes stops when I try to access the iTune store, Microsoft.vc80.CRT,type="win32",ver="8.0.50727.6195",processorArchitecture="amd 64".HRESULT:0x800703EE. Recently upgrade
-
EP Role assignment to User.
Hi, I have recently installed EP. When i assigned a New role Created (role i created) to a new User, The Contents assigned to that role is not getting displayed. But, when i also assign a super admin role to the user, the content of new role is getti
-
Hello like podria to make to show images with PHP
-
Supressing Dos window on executing system command
Hey, is there any way to supress the dos window when I call a system dependent .exe or bat file? AND is there any way to run a .exe file as a background process so that no window of it pops up? I use the Runtime.exe() to execute the system command bu
-
The information to be shown on the page has to be loaded dynamically from the database. As opposed to creating in static jsp pages, the fields and their attributes (name, label, etc.) are stored in the database tables, mag_registration_form_header an