Method passing

Hi I am new to passing methods and I am having some problems compiling a program. Any ideas on how to to solve the 20 errors I have?
import javax.swing.JOptionPane;
class MethodsHomework
     public static void main (String[]args)
          // define the correct combination
          int firstNo=3;
          int secondNo=7;
          int thirdNo =4;
          int num1=getInt(numb);
          int num2=getInt(numb);
          int num3=getInt(numb);
          int attempt=0; // counts number of attempts
          boolean success = false; // flag to indicate lock opened
          while ((attempt<3) && !success)
               boolean  correct = true; //  flag set false when guess wrong
          System.exit(0);
     public static int getInt(int numb)
          // first number
          String first = JOptionPane.showInputDialog(null,"Enter First Number",
          "Combination Lock",JOptionPane.QUESTION_MESSAGE);
          numb = Integer.parseInt(first);
          // second number
          String second = JOptionPane.showInputDialog(null,"Enter Second Number",
         "Combination Lock",JOptionPane.QUESTION_MESSAGE);
          numb = Integer.parseInt(second);
          // third number     
          String third = JOptionPane.showInputDialog(null,"Enter Third Number",
          "Combination Lock",JOptionPane.QUESTION_MESSAGE);
          numb = Integer.parseInt(third);
     public static boolean checkNumber(int num1,int num2,int num3)
          if (num1 != firstNo)
               correct = false;
          if (num2 != secondNo)
               correct = false;
          if (num3 != thirdNo)
               correct = false;
          return correct;          
     public static boolean outputResultOfGuess(String[]args)
          // result
          if (correct)
               return correct;
          return correct;
     public static void outputMessage(String result)
          if (correct)
               JOptionPane.showMessageDialog(null,"Lock Open",
                       "Combination Lock", JOptionPane.INFORMATION_MESSAGE);
               success=true;
          else
               JOptionPane.showMessageDialog(null,"Lock Not Open",
             "Combination Lock", JOptionPane.INFORMATION_MESSAGE);
             success=false;
          attempt++;
          // tidying up
          if ((attempt == 3) && (!success))
               JOptionPane.showMessageDialog(null,"You have had 3 attempts","Combination Lock",
               JOptionPane.INFORMATION_MESSAGE);
}

Thanks for your replies. I have now got rid of 11 errors. I now have 7 errors after changing my code. Here is the updated code:
import javax.swing.JOptionPane;
class MethodsHomework
     public static void main (String[]args)
          boolean correct=true;
          int num1=getInt();
          int num2=getInt();
          int num3=getInt();
     public static int getInt()
          // first number
          String numString = JOptionPane.showInputDialog(null,"Enter First Number",
          "Combination Lock",JOptionPane.QUESTION_MESSAGE);
          int numb = Integer.parseInt(numString);
     public static boolean checkNumber(int num1,int num2,int num3)
          // define the correct combination
          int firstNo=3;
          int secondNo=7;
          int thirdNo =4;
          if (num1 != firstNo)
               correct = false;
          if (num2 != secondNo)
               correct = false;
          if (num3 != thirdNo)
               correct = false;
          return correct;          
     public static boolean outputResultOfGuess(boolean correct)
          // result
          if (correct)
               return correct;
          return correct;
     public static void outputMessage(boolean correct)
          int attempt=0; // counts number of attempts
          if (correct)
               JOptionPane.showMessageDialog(null,"Lock Open",
                       "Combination Lock", JOptionPane.INFORMATION_MESSAGE);
               success=true;
          else
               JOptionPane.showMessageDialog(null,"Lock Not Open",
             "Combination Lock", JOptionPane.INFORMATION_MESSAGE);
             success=false;
          attempt++;
          // tidying up
          if ((attempt == 3) && (!success))
               JOptionPane.showMessageDialog(null,"You have had 3 attempts","Combination Lock",
               JOptionPane.INFORMATION_MESSAGE);
}Here is the error list:
--------------------Configuration: JDK version 1.4.2 <Default>--------------------
U:\Java\Week8\MethodsHomework\MethodsHomework.java:32: cannot resolve symbol
symbol  : variable correct
location: class MethodsHomework
               correct = false;
                        ^
U:\Java\Week8\MethodsHomework\MethodsHomework.java:35: cannot resolve symbol
symbol  : variable correct
location: class MethodsHomework
               correct = false;
                        ^
U:\Java\Week8\MethodsHomework\MethodsHomework.java:39: cannot resolve symbol
symbol  : variable correct
location: class MethodsHomework
               correct = false;
                        ^
U:\Java\Week8\MethodsHomework\MethodsHomework.java:40: cannot resolve symbol
symbol  : variable correct
location: class MethodsHomework
          return correct;          
                       ^
U:\Java\Week8\MethodsHomework\MethodsHomework.java:63: cannot resolve symbol
symbol  : variable success
location: class MethodsHomework
               success=true;
                        ^
U:\Java\Week8\MethodsHomework\MethodsHomework.java:69: cannot resolve symbol
symbol  : variable success
location: class MethodsHomework
             success=false;
                ^
U:\Java\Week8\MethodsHomework\MethodsHomework.java:75: cannot resolve symbol
symbol  : variable success
location: class MethodsHomework
          if ((attempt == 3) && (!success))
                                        ^
7 errors
Process completed.Thanks for your assistance,

Similar Messages

  • Open Document Method Passing Parameter and Logoon Toke Examples

    I'm looking for Open Document Method Passing Parameter and Logoon Toke Examples. Is it possilbe for a user inside the firewall to click a url link with all the logon token and parameters built in using open document method, i have not bee able examples? Thanks

    Hi,
    Make sure to apply the latest Patch2.11 and retest.
    Also, please state your datasource type. This can influence the syntax (i.e. when passign BEx variable values)
    Finally, have you tried the Web (DHTML) editor (bilaunchpad webi preference)?  it has an OpenDocument 'wizard' to help you build-up the correct syntax . 
    please do the 2 above steps, and get back to us.
    Regards,
    H

  • Runtime.getRuntime().exec(java method); - Passing strings between methods

    Hi all,
    I am using Runtime.getRuntime().exec(java xxxxxx); to run a java program from within a java program, i also need to pass a string to the new program. Does anyone know how to do this?
    Matt

    how would i retrive those strings in myApp as i want
    to put the values from them in a JLabelYou have a main method like this, right?
    public static void main(String[] args) { ... }
    args contains the array of strings passed to the app from the command line.

  • Filereference pointing to a cfc method, passing it additional parameters

    hi all
    is it possible for someone to show a script which demonstrate how a filereference can point to a cfc function (and pass aditional parameters...) ?
    it would REALLY help some of us
    cheers
    cosmits

    HI
    GOOD
    GO THROUGH THIS LINK
    http://www.abapforum.com/forum/viewtopic.php?t=1962&language=english
    THANKS
    MRUTYUN

  • Methods (passing params) & loops

    Evening all, i'm having a problem with some repetition in my code here. I've been troubleshooting it for the past hour now and haven't got any further.
    I'm calling methods from the main class, but this one is a little fudged.
    /*Program to call
    *methods which are
    *created after the
    *main class
    import java.util.*;
    public class FunctionName1050
         public static void main(String[] args)
         String prompt = "Enter a number from 10 to 50";
         int num1 = 10;
         int num2 = 50;
         tenTofifty(prompt, num1, num2);
         public static int tenTofifty(String prompt, int num1, int num2)
              Scanner kybd = new Scanner(System.in);
              System.out.print(prompt);
              System.out.println("\n");
              while(kybd.nextInt() <num1 || kybd.nextInt() >num2)
              System.out.print(prompt);
              System.out.println("\n");
              return kybd.nextInt();
    }As you can see, I simply want my tenTofifty method to quit if the user enters a number between 10 & 50. I can't return the value before my while loop else it can not be reached, should I be using a different loop? I need an iterative loop which continues and then exits when the user enters the correct number.
    The loop itself works, but does not quit when I enter between 10-50, a further 2 lines of random values can be entered before it quits.
    Can anybody spot my mistake?
    Message was edited by:
    Drew___
    null

    import java.util.*;
    public class FunctionName1050
         public static void main(String[] args)
         String prompt = "Enter a number from 10 to 50";
         int num1 = 10;
         int num2 = 50;
         tenTofifty(prompt, num1, num2);
         public static int tenTofifty(String prompt, int num1, int num2)
              Scanner kybd = new Scanner(System.in);
              System.out.print(prompt);
              System.out.println("\n");
              int i = kybd.nextInt();
              while(i <num1 || i >num2)
              System.out.print(prompt);
              System.out.println("\n");
                    i = kybd.nextInt();
              return i;
    }

  • Passing resultsets in a method

    Hello all I am curious what the general thought/idea is about methods passing result sets to the caller - I am guessing bad idea correct ?

    The reason that I am asking is because I am in a
    situation where I need to be able to docomparisions
    from one resultset to another, and putting all ofthe
    code into one method makes it rather long.
    So don't put all the code in one method! Split up the
    code into tasks and code the tasks.Guess it will just take some engineering, as looking at it right away they all rely on each other, but I bet if I work at it a bit I can get everything split up.
    Thanks again for all the info.
    And no it's not possible to do it all in SQL, as some things are dependant on the previous comparison of 2 tables which require other things etc etc.

  • How do you invoke a method with native int array argument?

    Hi,
    Will someone help me to show me a few codes samples on how to invoke a method which has only one argument, an int [] array.
    For exampe:
    public void Method1(int [] intArray) {...};
    Here is some simple code fragment I used:
    Class<?> aClass = Class.forName("Test2");
    Class[] argTypes = new Class[] {int[].class};
    Method method = aClass.getDeclaredMethod("Method_1", argTypes);
    int [] intArray = new int[] {111, 222, 333};
    Object [] args = new Object[1];
    args[0] = Array.newInstance(int.class, intArray);
    method.invoke(aClass, args);I can compile without any error, but when runs, it died in the "invoke" statement with:
    Exception in thread "main" java.lang.IllegalArgumentException: object is not an instance of declaring class
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at Test1.invoke_Method_1(Test1.java:262)
         at Test1.start(Test1.java:33)
         at Test1.main(Test1.java:12)
    Any help is greatly appreciated!
    Jeff

    Sorry, my bad. I was able to invoke static methods and instance methods with all data types except native int, short, double and float, not sure the proper ways to declare them.
    After many frustrating hours, I posted the message for help, but at that time, my mind was so numb that I created a faulted example because I cut and pasted the static method invocation example to test the instance method passing int array argument.
    As your post suggested, "args[0] = intArray;", that works. Thanks!
    You know, I did tried passing the argument like that first, but because I was not declaring the type properly, I ended up messing up the actual passing as well as the instantiation step.
    I will honestly slap my hand three times.
    jml

  • Sysmon ActiveX "Relog()" method not working properly

    The "Relog()" method of the Sysmon ActiveX seems not to be working properly. Windows 7 + IE 11 + Sysmon.ocx v. 6.1.7601.17514
    I have a (local) HTML document with an embedded Sysmon (System Monitor Control) ActiveX that has 1 counter added + a log file in TSV format located in a local network SMB Share. When I try to use the "Relog()" method, nothing happens and it
    does not throw an error. However when you pass an invalid parameter to the "FileType" parameter of the method it throws an "unspecified" error. So, below is the code:
    --------------------------------sysmon.htm-------------------------------------------
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//BR"><HTML>
    <HEAD>
    <META NAME="GENERATOR" Content="Microsoft System Monitor">
    </HEAD><BODY onload="myf()">
    <OBJECT ID="x" WIDTH="100%" HEIGHT="100%"
    CLASSID="CLSID:C4D2D8E0-D1DD-11CE-940F-008029004347">
    <PARAM NAME="_Version" VALUE="393219">
    <PARAM NAME="_ExtentX" VALUE="11430">
    <PARAM NAME="_ExtentY" VALUE="8996">
    <PARAM NAME="DisplayType" VALUE="1">
    <PARAM NAME="ReportValueType" VALUE="0">
    <PARAM NAME="MaximumScale" VALUE="100">
    <PARAM NAME="MinimumScale" VALUE="0">
    <PARAM NAME="ShowLegend" VALUE="-1">
    <PARAM NAME="ShowToolbar" VALUE="-1">
    <PARAM NAME="ShowScaleLabels" VALUE="-1">
    <PARAM NAME="ShowHorizontalGrid" VALUE="0">
    <PARAM NAME="ShowVerticalGrid" VALUE="0">
    <PARAM NAME="ShowValueBar" VALUE="-1">
    <PARAM NAME="ManualUpdate" VALUE="0">
    <PARAM NAME="Highlight" VALUE="0">
    <PARAM NAME="ReadOnly" VALUE="0">
    <PARAM NAME="MonitorDuplicateInstances" VALUE="-1">
    <PARAM NAME="UpdateInterval" VALUE="1">
    <PARAM NAME="DisplayFilter" VALUE="1">
    <PARAM NAME="BackColorCtl" VALUE="-2147483633">
    <PARAM NAME="ForeColor" VALUE="-1">
    <PARAM NAME="BackColor" VALUE="-2147483633">
    <PARAM NAME="GridColor" VALUE="8421504">
    <PARAM NAME="TimeBarColor" VALUE="255">
    <PARAM NAME="Appearance" VALUE="-1">
    <PARAM NAME="BorderStyle" VALUE="0">
    <PARAM NAME="NextCounterColor" VALUE="2">
    <PARAM NAME="NextCounterWidth" VALUE="0">
    <PARAM NAME="NextCounterLineStyle" VALUE="0">
    <PARAM NAME="GraphTitle" VALUE="">
    <PARAM NAME="YAxisLabel" VALUE="">
    <PARAM NAME="DataSourceType" VALUE="1">
    <PARAM NAME="SqlDsnName" VALUE="">
    <PARAM NAME="SqlLogSetName" VALUE="">
    <PARAM NAME="LogFileCount" VALUE="1">
    <param name="LogFileName001" Value="\\computer2\sharedf\test6_000010.tsv">
    <PARAM NAME="AmbientFont" VALUE="-1">
    <PARAM NAME="LegendColumnWidths" VALUE="0.110294117647059 0.110294117647059 0.355392156862745 0.149509803921569 0.127450980392157 0.127450980392157 0.186274509803922">
    <PARAM NAME="LegendSortDirection" VALUE="0">
    <PARAM NAME="LegendSortColumn" VALUE="2097272">
    <PARAM NAME="CounterCount" VALUE="1">
    <PARAM NAME="MaximumSamples" VALUE="100">
    <PARAM NAME="SampleCount" VALUE="100">
    <PARAM NAME="SampleIndex" VALUE="16">
    <PARAM NAME="StepNumber" VALUE="15">
    <PARAM NAME="Counter00001.Path" VALUE="\Thread(_Total/_Total)\Elapsed Time">
    <PARAM NAME="Counter00001.Color" VALUE="32768">
    <PARAM NAME="Counter00001.Width" VALUE="1">
    <PARAM NAME="Counter00001.LineStyle" VALUE="0">
    <PARAM NAME="Counter00001.ScaleFactor" VALUE="0">
    <PARAM NAME="Counter00001.Minimum" VALUE="0">
    <PARAM NAME="Counter00001.Maximum" VALUE="45.3125">
    <PARAM NAME="Counter00001.Average" VALUE="3.2354797979798">
    <PARAM NAME="Counter00001.StatisticStatus" VALUE="0">
    <PARAM NAME="Counter00001.Data" VALUE="4.6875 0 0 1.5625 6.25 29.6875 0 1.5625 0 0 31.25 0 0 0 0 0 0 3.125 4.6875 4.6875 0 0 0 0 0 0 0 3.125 45.3125 7.8125 0 1.5625 1.5625 0 0 0 1.5625 28.125 43.75 0 0 0 0 4.6875 0 3.125 3.125 37.5 3.125
    0 1.5625 0 0 0 3.125 3.125 3.125 4.6875 0 0 0 0 0 0 1.5625 3.125 4.6875 0 0 0 0 0 0 0 3.125 3.125 1.5625 0 0 0 0 0 0 3.125 6.25 3.125 0 0 1.5625 0 0 0 1.5625 0 0 0 0 0 0 -1">
    <PARAM NAME="Selected" VALUE="\Thread(_Total/_Total)\Elapsed Time">
    </OBJECT>
    <script>
    function myf()
    x.Relog("c:\\programdata\\test.tsv",5,1);
    </script>
    </BODY>
    </HTML>
    ---------------------------------------------------------end--------------------------------------------------------------
    * The valid values for the sysmon file type parameter are 3,4 and 5. I tried all of them and no error is thrown, but the new log file is also not created, not in the local disk nor in the SMB share which I have full access (including create files of course).
    The TSV log file:
    -----------------------------------6_000010.tsv----------------------------------------------
    "(PDH-TSV 4.0) (Hora oficial do Brasil)(180)" "\Thread(_Total/_Total)\Elapsed Time" "comment"
    "05/16/2014 07:47:57.375" "0" "comment"
    "05/16/2014 07:47:58.390" "0" "comment"
    "05/16/2014 07:47:59.390" "0" "comment"
    The TSV log file is loaded successfully. So, what am I doing incorrectly here?
    How should I use the "Relog()" method ? Sample needed, if possible, please.
    PS: I have also tried renaming the local HTML document to '.hta' just in case a security measure was blocking the method from being executed, but the exact same thing happens.
    PS2: I have already read the MSDN article on the Sysmon ActiveX and the "Relog()" method.
    Thanks.

    I know SysMonFileType for TSV is 4, I just tested the other ones because nothing was happening. When I mean nothing is that the new log file was not being created and no error was being thrown. I got the TSV log code and the HTML document code from Perfmon.
    The script code I created myself learning from MSDN. Sorry, but I didnt fail anywhere, I told I read the documentation :
    http://msdn.microsoft.com/en-us/library/windows/desktop/aa379757(v=vs.85).aspx sorry for not posting the link.
    I just need to know what is wrong with the script portion code, because everything else is doing fine. The log file is read and loaded successfully, but when I try the "Relog()" method passing valid arguments, nothing happens. It is like there was no script
    code in there. Maybe a bug
    Thank you anyway jrv.

  • Can i pass an int * to a native function?

    From Java, can I pass an int pointer to the JNI?
    I want the native function to assign data to an int in the Java program.
    Many thanks!

    838478 wrote:
    Many thanks to both of you for your helpful responses. I pitched my original question somewhat disingenuously in order to be precise. My actual development issue is broader:
    I have C++ API that passes many data types by reference (as pointers or references) in order to modify the passed values. If I were to wrap this API to call it from from Java it sounds as though passing each parameter as an object (e.g. Integer for int would be the cleanest way to go. Does this sound correct?
    One enigma: I have to call a native function with a char * argument that returns with that char * pointing to a buffer of binary data. How should I pass back that binary buffer to Java? As a String? Your problem is not specific enough.
    1. You want to create data, regardless of the type, on the native heap and pass it through java to another native method. Solution: Use a long. You have a pointer to the data (again the type does NOT matter), you cast it to a long, you return that from your first method, pass it into the second, and there you cast the long back to the pointer. The pointer can point to anything you like including complex data types.
    2. You want to create data, of some complex structure, on the native heap and then access that data in java. Then you MUST map it to java types, every piece of data, of every type, specific to the type. So a native int maps to a java int (if the sizes match), a char* maps to a String, etc. You MUST create in some fashion every java data item that you need. There are NO shortcuts.

  • Pass array as a parameter

    I am trying to make a method that compare and return the smallest number in the array.But it doesn't work.
    Thanks!
    // The "Pass" class.
    import java.io.*;
    import java.lang.*;
    public class Pass
        public static void main (String [] args)
            int [] a = {10, 22, 13, 4,5};
            System.out.println (a[mini (int a[])]);
                public int mini (int [] num)//Compare and pick the smallest number
                    int min = 1, j;
                    for (int j = 0 ; j < 5 ; j++)
                        if (num [j] < num [min])
                            min = j;
                    return min;
          } // main method
    } // Pass class

    import java.io.*;
    import java.lang.*;
    public class Pass
        public static void main (String [] args)
            int [] a = {10, 22, 13, 4,5};
            //System.out.println (a[mini (int a[])]);
            Pass p = new Pass();
            System.out.println("minimum: "+p.mini(a));
          } // main method
           public int mini (int [] num)//Compare and pick the smallest number
                    int min=0;
                    for(int j=0;j<num.length;j++){
                      if(j==0){
                        min=num[j];
                      }else{
                        if(num[j]<min){
                          min=num[j];
                    return min;
    } // Pass class

  • Method access question

    I have a object which has been declared and created via another class. Is it possible to access another object and its methods in the "parent" class?
    Looking at the java API i thought maybe getClass().getDeclaringClass().myMethod() might work, but getClass().getDeclaringClass() returns null. I havent been able to find anything on the internet regarding this. I wouldnt think it would be an uncommon thing to want to do?...Any ideas? Cheers in advance...Nick

    Thanks for the suggestion. I actually tried this method (passing a reference to the constructor) in a previous project, but i thought maybe there was an easier way (Is this the usual way to tackle this kind of problem?). However, trying to use it in this one leads to more troubles. My instance of class1 is created when a button is clicked, through a buttonListener inner class in my MainWindow class. So what happes is that when i try to use
    Class1 = new Class1(this);instead of passing a reference to MainWindow, it passes a reference to buttonListener instead. This may be where i was on the right track because i then tried
    Class1 = newClass1(getClass().getEnclosingClass());i think i tried using getDeclaringClass() aswell and both would return null. Am i doing this right?

  • Tochange the string in Std Class Builder "New Method"

    HI freinds,
    Im using the std program of "RFDOPR10"...(changed into my customised program as ZRFDOPR10).....
    Here i want to change the strings of Id_type eq 4 availble under the class builder "New Method".
    "id_ruler_string = '2.13.24.29|43|58|73|88|103|118|'" (for 24...i want to give 38.....then 45...)
    Pls help me how to change the std method function  for my z program...
    FYR:
    RFDOPR10 is the std program for tcode :"s_alr_87012178", Customer analysis.If u want to c the example report, in this tcode...give OI:1, Summ level:6, OI list:1 and Company CD:2 under Output control tab in selection screen with Company code.Now, u able to see the reports in the screen.There, after Customer number....I've to give some more spaces(length) for Sort field.
    Thanks & regards
    Sankar.

    Associated with the text box there will be some kind of event handler. Maybe it's an action event on the text box (when the user clicks return) or maybe you have a separate button that the user clicks.
    Either way, in the event handler, get the text from the text box, and then call the sendData method, passing the text as an argument.

  • EJB method parameters are sent but nulls are received

    My client calls my EJB method passing two serializable objects as parameters.
    Using print statements and a network snoop I have confirmed that:
    - the client is calling the method with valid objects
    - from examining the data it appears that the objects are being serialized and sent across the network
    - the EJB seems to receive null values.
    I have deployed the EJB to both 9iAS and a standalone instance of OC4J with exactly the same results.
    Any ideas?

    Hi Dale and Kamesh,
    No error messages? Nothing in the log files? Have you tried running OC4J in debug mode? In case you haven't already seen it, this "Technical Note" has more details.
    Pardon me if I am stating the obvious, but it seems like there is a deserialization problem. Are the client JVM and server JVM both the same version? Have you implemented custom [de]serialization for the parameter classes? Is the same version of the parameter class files located both at the client and at the server?
    Good Luck,
    Avi.

  • Error ejb weblogic 11g - method remove

    Hi,
    When trying to deploy an ejb in weblogic 11g me the following error.
    Unable to deploy EJB: ConceptType from ejb-admin.jar:
    [EJB:010101]A mismatch exists between the bean code and generated code.Clase(Application: ejb-jar, EJBComponent: ejb-jar) . Please rerun appc on the bean code. The error was java.lang.NoSuchFieldException: md_ejbRemoveClaseTipo_L
         at java.lang.Class.getField(Class.java:1520)
         at weblogic.ejb.container.deployer.BeanInfoImpl.setHomeMDField(BeanInfoImpl.java:896)
         at weblogic.ejb.container.deployer.BeanInfoImpl.setMDField(BeanInfoImpl.java:861)
         at weblogic.ejb.container.deployer.BeanInfoImpl.setMethodDescriptor(BeanInfoImpl.java:794)
         at weblogic.ejb.container.deployer.ClientDrivenBeanInfoImpl.setMethodDescriptor(ClientDrivenBeanInfoImpl.java:784)
         at weblogic.ejb.container.deployer.ClientDrivenBeanInfoImpl.setMethodDescriptors(ClientDrivenBeanInfoImpl.java:758)
         at weblogic.ejb.container.deployer.ClientDrivenBeanInfoImpl.setMethodDescriptors(ClientDrivenBeanInfoImpl.java:657)
         at weblogic.ejb.container.deployer.ClientDrivenBeanInfoImpl.prepare(ClientDrivenBeanInfoImpl.java:1072)
         at weblogic.ejb.container.deployer.EntityBeanInfoImpl.prepare(EntityBeanInfoImpl.java:67)
         at weblogic.ejb.container.deployer.EJBDeployer.setupBeanInfos(EJBDeployer.java:1031)
         at weblogic.ejb.container.deployer.EJBDeployer.prepare(EJBDeployer.java:1288)
         at weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:442)
         at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:199)
         at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:518)
         at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
         at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:159)
         at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:47)
         at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:649)
         at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
         at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:191)
         at weblogic.application.internal.SingleModuleDeployment.prepare(SingleModuleDeployment.java:44)
         at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:154)
         at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60)
         at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:209)
         at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:98)
         at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217)
         at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:749)
         at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1216)
         at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:250)
         at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:160)
         at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:171)
         at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:13)
         at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:47)
         at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:545)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
    . NestedException Message is :md_ejbRemoveClaseTipo_L
    Anyone know why?

    There's a null pointer at:
    mil.ahrs.emilpo.ejb.entity.personnelaccounting.SoldrasgtPK.equals(SoldrasgtPK.java:24)
    If you need more help debugging this, you'll have to show me the source code for that class.
    -- Rob
    Vy Nguyen wrote:
    I'm using WLS 6.1SP2. When I called ejbRemove() method passing the PK, and I got the following error:
    EJB Exception: ; nested exception is: java.lang.NullPointerException Start server side stack trace: java.rmi.RemoteException: EJB Exception: ; nested exception is: java.lang.NullPointerException java.lang.NullPointerException at mil.ahrs.emilpo.ejb.entity.personnelaccounting.SoldrasgtPK.equals(SoldrasgtPK.java:24) at java.util.HashMap.remove(HashMap.java:380) at weblogic.utils.SoftHashMap.remove(SoftHashMap.java:242) at java.util.Collections$SynchronizedMap.remove(Collections.java:1440) at weblogic.ejb20.internal.EntityEJBLocalHome.releaseEO(EntityEJBLocalHome.java:406) at weblogic.ejb20.internal.EntityEJBLocalHome.remove(EntityEJBLocalHome.java:233) at mil.ahrs.emilpo.ejb.entity.personnelaccounting.SoldrasgtBean_8m4rrx_LocalHomeImpl.remove(SoldrasgtBean_8m4rrx_LocalHomeImpl.java:169) at mil.ahrs.emilpo.ejb.session.personnelaccounting.AssignmentServicesBean.removeCurrentAssignment
    I saw someone on-line had a similar issue and about CR044294_600sp2rp12.jar causing the error. How do I overcome this problem?
    THANK YOU.
    Vy--
    AVAILABLE NOW!: Building J2EE Applications & BEA WebLogic Server
    by Michael Girdley, Rob Woollen, and Sandra Emerson
    http://learnWebLogic.com
    [att1.html]

  • Error passing Integer to a bean

    Hello,
    I have two JSP's Students.jsp and People.jsp. Students displays the list of only people who have the role of student whereas People displays a list of all people in the db.
    Currently, I am referencing com.project.train.People bean and calling the viewPeople() method to get a list of people, and the viewStudents() method to get a list of Students. (see code below) This code works well, but it is basically just redundant code. If I want to get a list of people with any other role, the code will be duplicated again.
    What I would like to do is to change this to only call the viewPeople() method passing the integer of the role ID to use in the WHERE clause of the SQL (Prepared)Statement (like ...WHERE ROLE_ID = ?). Of course, if I only want to get all of the people, I could pass "null" and get a full list.
    My problem is that when I do this and try calling the viewPeople method, whether or not I pass a value to the method, I get a variation on the following error:
    C:\Tomcat 4.1\work\Standalone\localhost\ISupport\Students_jsp.java:97: viewPeople(java.lang.Integer) in com.project.common.People cannot be applied to (int)
         ResultSet rs = student.viewPeople(1);
    ---------------------^
    Many thanks in advance for your help.
    James.
    com.project.train.People:
    package com.project.train;
    import java.sql.*;
    import java.util.*;
    public class People extends Object implements java.io.Serializable {
    String error;
    Connection con;
    public void connect(){
    <connect to db...>
    public void disconnect(){
    <disconnect from db...>
    public ResultSet viewStudents() throws SQLException, Exception{
    ResultSet rs = null;
    try{
    String queryString = ("<SQL to get only students from db>:");
    Statement stmt = con.createStatement();
    rs = stmt.executeQuery(queryString);
    } catch (SQLException sqle) {
    <handle it>
    } catch (Exception e) {
    <handle it>
    return rs;
    public ResultSet viewPeople() throws SQLException, Exception{
    ResultSet rs = null;
    try{
    String queryString = ("<SQL to get all people from db>:");
    Statement stmt = con.createStatement();
    rs = stmt.executeQuery(queryString);
    } catch (SQLException sqle) {
    <handle it>
    } catch (Exception e) {
    <handle it>
    return rs;
    Proposed code for new viewPeople method:
    public ResultSet viewPeople(Integer intRoleID) throws SQLException, Exception{
    ResultSet rs = null;
    PreparedStatement psQuery;
    try{
    if (!(intRoleID == null)){
    psQuery = con.prepareStatement("SELECT <...> where role_id = ?");
    psQuery.setString(1, intRoleID.toString());
    }else{
    psQuery = con.prepareStatement("SELECT * FROM People");
    rs = psQuery.executeQuery();
    } catch (SQLException sqle) {
    <handle it>
    } catch (Exception e) {
    <handle it>
    return rs;

    In the class named Students_jsp.java, your code is...
    ResultSet rs = student.viewPeople(1);
    But you have defined viewPeople() to take an argument of type Integer. 1 is an int, not an Integer. This should cure that problem.
    ResultSet rs = student.viewPeople(new Integer(1));

Maybe you are looking for