Overriding Interface methods via JNI

Hello,
How we can override Interface methods via JNI?
For example:
At HelloWorldSwing example:
http://download.oracle.com/javase/tutorial/uiswing/examples/start/HelloWorldSwingProject/src/start/HelloWorldSwing.java
I've written anonymous Interface as:
import javax.swing.*;       
public class HelloWorldSwing1 {
     * Create the GUI and show it.  For thread safety,
     * this method should be invoked from the
     * event-dispatching thread.
    private static void createAndShowGUI() {
        //Create and set up the window.
        JFrame frame = new JFrame("HelloWorldSwing");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //Add the ubiquitous "Hello World" label.
        JLabel label = new JLabel("Hello World");
        frame.getContentPane().add(label);
        //Display the window.
        frame.pack();
        frame.setVisible(true);
    static Runnable runnableObject = new Runnable() {
         public void run() {
              createAndShowGUI();              
   public static void main(String[] args) {
         //Schedule a job for the event-dispatching thread:
        //creating and showing this application's GUI.
        SwingUtilities.invokeLater(runnableObject);
}via JNI functions(http://download.oracle.com/javase/1.4.2/docs/guide/jni/spec/functions.html) we cannot override Runnable Interface's run method? Can we?
Only:
RunnableClass's value isn't null with given example at below. FindClass finds the Runnable Interface.
jclass RunnableClass;
RunnableClass = (*env)->FindClass(env,"java/lang/Runnable");
  if( RunnableClass == NULL ) {
    printf("can't find class Runnable\n");
    exit (-1);
  }But How can we override Runnable class's run method?
Thanks in Advance

The only way you can override a method in Java is by defining a class that does so, either statically or as an anonymous inner class. You can't do either of those things in JNI. Ergo you cannot do what you are asking about.

Similar Messages

  • How to get exit code from C code when calling java method via JNI?

    Hi, All
    in my project, i need to call a java method from C code using JNI, yet I do
    not know how to
    retrieve the exit code of java program. the java code is like below
    public static void main(....)
    if(error){
    System.exit(-77);// the exit code is -77
    and the JNI c code may like below
    /* Invoke main method. */
        (*env)->CallStaticVoidMethod(env, mainClass, mainID, mainArgs);
    //here I want to retrieve the exit code from java to check if there is an
    error
    any suggestions? thanks

    Hi Liang Zhang,
    In your C code add:
    void (JNICALL y_exit)(jint code) {
    and when you are initialazing JVM options add:
    JavaVMOption options[...];
    options[...].optionString = "exit";
    options[...].extraInfo    = y_exit;
    See http://java.sun.com/j2se/1.3/docs/guide/jni/jni-12.html
    Best regards, Maksim Rashchynski.

  • Add an interface Method/Event via enhancement??

    Hi expert.
    I want to pass additional data between two standard webdynpro components. As for as I know, I can use infterface method/event in custom webdynpro component and click check box 'Interface' of method/event.
    However I can add new method/event in standard webdynpro via enhancement,  the check box 'Interface' is dispear.
    So is it possibe to add an interface method/event via enhancement? or pass additional data between standard webdynpro component?

    Hi,
    First you need to understood the standard webdynpro component which you are looking for.
    If the standard component is providing interface methods/events then you can call from your custom  webdynpro component  re-using the standard component in your custom component.
    If you provide mroe information about which standard component and which event/method you are looking for, so that I will provide more info.
    Best of luck..
    Regards,
    Naresh

  • Native library NOT thread safe - how to use it via JNI?

    Hello,
    has anybody ever tried to use a native library from JNI, when the library is not thread safe?
    The library (Windows DLL) was up to now used in an MFC App and thus was only used by one user - that meant one thread - at a time.
    Now we would like to use the library like a "server": many Java clients connect the same time to the library via JNI. That would mean each client makes its calls to the library in its own thread. Because the library is not thread safe, this would cause problems.
    Now we discussed to load the library several times - separately for each client (for each thread).
    Is this possible at all? How can we do that?
    And do you think we can solve the problem in this way?
    Are there other ways to use the library, though it is not thread safe?
    Any ideas welcome.
    Thanks for any contributions to the discussion, Ina

    (1)
    has anybody ever tried to use a native library from
    JNI, when the library (Windows DLL) is not thread safe?
    Now we want many Java clients.
    That would mean each client makes its calls
    to the library in its own thread. Because the library
    is not thread safe, this would cause problems.Right. And therefore you have to encapsulate the DLL behind a properly synchronized interface class.
    Now the details of how you have to do that depends: (a) does the DLL contain state information other than TLS? (b) do you know which methods are not thread-safe?
    Depending on (a), (b) two extremes are both possible:
    One extreme would be to get an instance of the interface to the DLL from a factory method you'll have to write, where the factory method will block until it can give you "the DLL". Every client thread would obtain "the DLL", then use it, then release it. That would make the whole thing a "client-driven" "dedicated" server. If a client forgets to release the DLL, everybody else is going to be locked out. :-(
    The other extreme would be just to mirror the DLL methods, and mark the relevant ones as synchronized. That should be doable if (a) is false, and (b) is true.
    (2)
    Now we discussed to load the library several times -
    separately for each client (for each thread).
    Is this possible at all? How can we do that?
    And do you think we can solve the problem in this
    way?The DLL is going to be mapped into the process address space on first usage. More Java threads just means adding more references to the same DLL instance.
    That would not result in thread-safe behavior.

  • ...is not abstract and does not override abstract method compare

    Why am I getting the above compile error when I am very clearly overriding abstract method compare (ditto abstract method compareTo)? Here is my code -- which was presented 1.5 code and I'm trying to retrofit to 1.4 -- followed by the complete compile time error. Thanks in advance for your help (even though I'm sure this is an easy question for you experts):
    import java.util.*;
       This program sorts a set of item by comparing
       their descriptions.
    public class TreeSetTest
       public static void main(String[] args)
          SortedSet parts = new TreeSet();
          parts.add(new Item("Toaster", 1234));
          parts.add(new Item("Widget", 4562));
          parts.add(new Item("Modem", 9912));
          System.out.println(parts);
          SortedSet sortByDescription = new TreeSet(new
             Comparator()
                public int compare(Item a, Item b)   // LINE CAUSING THE ERROR
                   String descrA = a.getDescription();
                   String descrB = b.getDescription();
                   return descrA.compareTo(descrB);
          sortByDescription.addAll(parts);
          System.out.println(sortByDescription);
       An item with a description and a part number.
    class Item implements Comparable     
          Constructs an item.
          @param aDescription the item's description
          @param aPartNumber the item's part number
       public Item(String aDescription, int aPartNumber)
          description = aDescription;
          partNumber = aPartNumber;
          Gets the description of this item.
          @return the description
       public String getDescription()
          return description;
       public String toString()
          return "[descripion=" + description
             + ", partNumber=" + partNumber + "]";
       public boolean equals(Object otherObject)
          if (this == otherObject) return true;
          if (otherObject == null) return false;
          if (getClass() != otherObject.getClass()) return false;
          Item other = (Item) otherObject;
          return description.equals(other.description)
             && partNumber == other.partNumber;
       public int hashCode()
          return 13 * description.hashCode() + 17 * partNumber;
       public int compareTo(Item other)   // OTHER LINE CAUSING THE ERROR
          return partNumber - other.partNumber;
       private String description;
       private int partNumber;
    }Compiler error:
    TreeSetTest.java:25: <anonymous TreeSetTest$1> is not abstract and does not over
    ride abstract method compare(java.lang.Object,java.lang.Object) in java.util.Com
    parator
                public int compare(Item a, Item b)
                           ^
    TreeSetTest.java:41: Item is not abstract and does not override abstract method
    compareTo(java.lang.Object) in java.lang.Comparable
    class Item implements Comparable
    ^
    2 errors

    According to the book I'm reading, if you merely take
    out the generic from the code, it should compile and
    run in v1.4 (assuming, of course, that the class
    exists in 1.4). I don't know what book you are reading but that's certainly incorrect or incomplete at least. I've manually retrofitted code to 1.4, and you'll be inserting casts as well as replacing type references with Object (or the erased type, to be more precise).
    These interfaces do exist in 1.4, and
    without the generics.Exactly. Which means compareTo takes an Object, and you should change your overriding method accordingly.
    But this raises a new question: how does my 1.4
    compiler know anything about generics? It doesn't and it can't. As the compiler is telling you, those interfaces expect Object. Think about it, you want to implement one interface which declares a method argument type of Object, in several classes, each with a different type. Obviously all of those are not valid overrides.

  • Product is not abstract and does not override abstract method

    Received the following errors.
    Product.java:3: Product is not abstract and does not override abstract method ge
    tDisplayText() in Displayable
    public class Product implements Displayable
    ^
    Product.java:16: getDisplayText() in Product cannot implement getDisplayText() i
    n Displayable; attempting to use incompatible return type
    found : void
    required: java.lang.String
    public void getDisplayText()
    ^
    2 errors
    Code reads as follows
    import java.text.NumberFormat;
    public class Product implements Displayable
         private String code;
         private String description;
         private double price;
         public Product()
              this.code = "";
              this.description = "";
              this.price = 0;
    public void getDisplayText()
    String message =
    "Code: " + code + "\n" +
    "Description: " + description + "\n" +
    "Price: " + this.getFormattedPrice() + "\n";
         public Product(String code, String description, double price)
              this.code = code;
              this.description = description;
              this.price = price;
         public void setCode(String code)
              this.code = code;
         public String getCode(){
              return code;
         public void setDescription(String description)
              this.description = description;
         public String getDescription()
              return description;
         public void setPrice(double price)
              this.price = price;
         public double getPrice()
              return price;
         public String getFormattedPrice()
              NumberFormat currency = NumberFormat.getCurrencyInstance();
              return currency.format(price);
    Please help!

    Received the following errors.
    Product.java:3: Product is not abstract and does not
    override abstract method ge
    tDisplayText() in Displayable
    public class Product implements Displayable
    ^
    Product.java:16: getDisplayText() in Product cannot
    implement getDisplayText() i
    n Displayable; attempting to use incompatible return
    type
    found : void
    required: java.lang.String
    public void getDisplayText()
    ^
    2 errors
    Code reads as follows
    Please use the code tags when posting code. There is a code button right above the text box where you enter your post. Click on it and put the code between the code tags.
    These error messages are quite clear in telling what is wrong. You have an Interface called Displayable that specifies a method something like thispublic String getDisplayText() {But in your Product source code, you created thismethodpublic void getDisplayText() {The compiler is complaining because the methods are not the same.
    You also need to return a String in the method probalby like thisreturn message;

  • Calling a method via invokeMethod (JDI)

    Hi !
    Does anybody know how to invoke a method
    via the invokeMethod method of the Java Debug Interface (JDI).
    This suspends the execution of the program !
    I've read somewhere that the vm must be resumed,
    but I don't see how, as a vm.resume() after the
    invocation is never reached !
    Thanx for any help !
    Alex

    I have the same problem ..Null pointer exception thrown. here is my sample code that I did:
    public void methodExitEvent(MethodExitEvent event)
    ObjectReference obj = objectReference(event);
    if(obj!=null && !event.method().name().equals("<init>"))
    System.out.println(" Leaving the method " + event.method().name() + "() Object " + obj.hashCode());
    List objMethodsList= event.method().declaringType().methodsByName("methodA");
    Method emptyState= (Method)objMethodsList.get(0);
    //ClassType myClass= (ClassType)obj.referenceType();
    //Method emptyState= myClass.concreteMethodByName("methodA","()V");
    try
    Value myValue= obj.invokeMethod(event.thread(), emptyState ,null,ObjectReference.INVOKE_SINGLE_THREADED);
    catch(Exception e)
    e.printStackTrace();
    System.out.println("Error in invoking method "+e.getMessage());
    else if(obj!=null && event.method().name().equals("<init>"))
    System.out.println("Object " + obj.hashCode()+" END its life");
    and here is the trace that i got from the exception thrown:
    java.lang.NullPointerException
    at com.sun.tools.jdi.MirrorImpl.validateMirrorsOrNulls(MirrorImpl.java:8
    2)
    at com.sun.tools.jdi.ObjectReferenceImpl.invokeMethod(ObjectReferenceImp
    l.java:355)
    at EventThread.methodExitEvent(EventThread.java:186)
    at EventThread.handleEvent(EventThread.java:69)
    at EventThread.run(EventThread.java:35)
    Error in invoking method null
    Need help ASAP especially those of you who have created debugger. Im trying to create a tracer and try to invoke the method of the debugee object....

  • Compilation error in creating shared library via JNI

    Hi ALL,
    I amin serious trouble with a problem. I am developing a Simulator, a function of which is to decode MPEG-2 Video files in real time and play it as well.I have got a MPEG-2 Decoder implemented in C from an open source and need to integrate with my Simulator which is writtebn in Java. The integration part I am doing via JNI(Java Native Interface). Now I have a bunch of C files in MPEG-2 decoder which are to be compiled during the Execution of the Java Simulator.Can anybody give some idea about how to call multiple C files from the Java Source through JNI at one go? Another problem I am facing is in calling a single C code from the traditional "HelloWorld" Java Code itself. The problem comes when I am trying to compile the shared library between the C native code and Java Code in my Linux Machine...I am getting the following message:
    /usr/lib/gcc-lib/i386-redhat-linux/2.96/.../../../crt1.0 : In function '_start' :
    /usr/lib/gcc-lib/i386-redhat-linux/2.96/.../../../crt1.0(.text+0x18): undefined reference to 'main'
    collect2: ld retrurned 1 exit status
    What does the above errot mean? How to rectify it.It will be of great help if you anybody can give me clues.

    It means that your compiler options are wrong.
    You need to create a shared library.
    Instead you are creating an executable, which is not the same as a shared library.
    If you search this forum you will find posts with command line options that work.

  • Calling Java from Delphi via JNI

    Hi all. I've got a J2EE application, and I'm trying to write a Delphi client for the server. More specifics:
    Server and test client running in Win2000 SP4.
    Server running in JBoss (JUnit test cases have successfully connected to the server)
    JDK 1.4
    I'm using some Delphi files from JEDI which allow me to load/access a JVM via JNI. So far, I've been able to:
    1) Create a Properties object.
    2) Populate the Properties object with String values (making sure to use NewStringUTF to pass into the Properties method
    3) Find my java client classes which facilitate opening a connection.
    However, when I attempt to call the method on the object which actually creates the connection, I get an Exception.
    My immediate question is how do I see what the Exception is? I have an Exception object, but ExceptionDescribe doesn't product anything, and I'm having trouble finding any details about the Exception (what type of exception, what the Message or Call Stack is). At the moment, something's wrong but I can't see what. And I'll have no chance of fixing it if I don't know what the problem is.
    Thanks for any help,
    Ed

    I use some code for solving this task (in real project with Delphi 6.0 & Java 1.4.1).
    May be, it will help.
    procedure TJavaInterp.CheckJNIException(Message : string);
    begin
    if JNI_ExceptionCheck(JNIEnv) = JNI_TRUE then
    begin
    JNI_ExceptionDescribe(JNIEnv);
    JNI_ExceptionClear(JNIEnv);
    raise Exception.Create(Message);
    end;
    end;{ TJavaInterp.CheckJNIException }
    procedure TJavaInterp.HandleException(excpt : jthrowable);
    var
    Msg: string;
    ESyntax : Exception;
    CauseName : WideString;
    Tag : OleVariant;
    begin
    if JNI_IsInstanceOf(JNIEnv, excpt, FclsCommonSyntaxError) = JNI_TRUE then
    begin
    ESyntax := Self.BuildSyntaxException(excpt);
    JNI_DeleteLocalRef(JNIEnv, excpt);
    raise ESyntax;
    end;
    Msg := Self.GetMessage(excpt);
    if JNI_IsInstanceOf(JNIEnv, excpt, FclsNPScriptRuntimeException) = JNI_TRUE then
    begin
    CauseName := Self.GetCauseName(excpt);
    Tag := Self.GetTag(excpt);
    JNI_DeleteLocalRef(JNIEnv, excpt);
    raise NPScriptHelper.BuildNPScriptRuntimeException(Msg, CauseName, Tag);
    end;
    if JNI_IsInstanceOf(JNIEnv, excpt, FclsHaltException) = JNI_TRUE then
    begin
    JNI_DeleteLocalRef(JNIEnv, excpt);
    raise Exception.Create(Msg);
    end;
    Msg := Self.ToString(excpt);
    JNI_DeleteLocalRef(JNIEnv, excpt);
    raise Exception.Create(Msg);
    end;{ TJavaInterp.HandleException }

  • How can i pass string from C++ DLL to Java via JNI?

    Hi everybody. I made a DLL with Borland C++. I must pass a string from this dll to Java via JNI.Namely i define a string variable in C++ DLL and i send this variable's value to Java via JNI.
    I can pass integers but i couldnt Strings. . How can i do this? is there any sample?

    Hi,
    So your function should be private static native String get_text();
    (It's often a good idea to make native methods private since when you change signatures you generally have to change java wrapper methods only).
    I know nothing about C++ strings but I'm pretty sure that you can convert it to char*, so
    do :
    char* szMyString = myString.toChar*();
    Then return from native with JNU_NewStringPlatform(env, szMyString)
    (see my 1st answer for JNU_NewStringPlatform() description).
    --Marc (http://jnative.sf.net)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Transfer a Jpeg From Delphi to Java via JNI?

    Hi Guys,
    I am currently working on a project in which I have Windows DLL code that takes a screen capture (I'm using Delphi to write this). The result of this capture is stored as a TJpegImage. I have my Delphi code hooked to Java code (which the main program is written in) via JNI. I am trynig to transfer the Jpeg in a format in which Java can easily take it and make a BufferedImage out of it. How can I go about this? I have a few ideas, but I want to do it in the most efficient way possible. If someone knows how to do this, can they please share the solution with me?
    Thanks,
    -Tony

    whome0,
    Yes, thanks, that's exactly what I've been using. Basically, I'm at the point now where I know how to transfer the bytes, but for some reason, when I do this on the Java end:
    ByteArrayInputStream input = new ByteArrayInputStream( byteArr );
    JPEGImageDecoder decoder = JPEGCodec.createJPEGDecoder( input );
    BufferedImage bi = decoder.decodeAsBufferedImage();
    I get this error:
    com.sun.image.codec.jpeg.ImageFormatException: Not a JPEG file: starts with 0x60 0x23
    at sun.awt.image.codec.JPEGImageDecoderImpl.readJPEGStream(Native Method)
    at sun.awt.image.codec.JPEGImageDecoderImpl.decodeAsBufferedImage(Unknown Source)
    at com.sun.media.protocol.screen.LiveStream.read(LiveStream.java:166)
    at com.sun.media.parser.RawBufferParser$FrameTrack.transferData(RawBufferParser.java:725)
    at com.sun.media.protocol.screen.LiveStream.run(LiveStream.java:235)
    at java.lang.Thread.run(Unknown Source)
    I am baffled at this point, because I do a byte count before I send from my Delphi code, and a byte count on the Java receiving end, and they are identical. Looking at other JPGs I have on my hard drive, they begin in the same manner that this file does. So I'm not sure what's going on here.
    -Tony

  • DLL crashes / gives no response via JNI

    I hope anyone can help me with this...
    We have a java test client which calls DLL A via JNI (testpath 1).
    We also have a native test client that calls DLL A directly (testpath 2).
    DLL A calls DLL B, and DLL B calls DLL C.
    Now, according to the debugging, the method call and input parameters ultimately received by DLL C are
    the same (and correct) in both test paths. Now the following occurs: with testpath 2, the reply
    from DLL C is correct, but with testpath 1, DLL C gives no reply whatsoever!
    Could this have something to do with jvm regional settings? Obviously, something in testpath 1
    differs from testpath 2, but I have no idea what this could be...
    Some comments: DLL C uses a lot of global variables and global initializers. Maybe the problem
    is in that area?

    We solved it. Turns out DLL A reserved too much space on the stack. Putting a testclient before
    DLL A left just not enough room on the stack for DLL C to work with.

  • Access specifiers for interface methods

    When we implement the interface ,we have to specify the implementing method access specifier to be "PUBLIC" ,but not "PROTECTED" or "PRIVATE".
    Compiler is giving an error -- attempting to assign weaker access privileges ,when we specify protected.
    what is the internal reason for this?Why we shouldnt make the access weaker in the implementing class.
    Can any one help me on this.Your help is highly appreciated.

    When we implement the interface ,we have to specify
    the implementing method access specifier to be
    "PUBLIC" ,but not "PROTECTED" or "PRIVATE".
    Compiler is giving an error -- attempting to assign
    weaker access privileges ,when we specify protected.
    what is the internal reason for this?There is absolutely no point in having a private interface method. The interface represents a visible abstraction and private methods are never visible so it is a contradiction in terms.
    An interface is intended to represent an abstraction that a user (software) uses. Protected via child/parent represents a usage that is restricted to a child from a parent. The child can already see the parent so there is no point in having an abstraction for the child. And it would probably be unwise to limit a child by such an abstraction.
    Protected via the package and interfaces is more contentious as to why it is not allowed. There are those that argue that this should be allowed so that a package can use interfaces but restrict them to the package. To me this seems like a minor point given that most interfaces will probably represent an abstraction to other packages and not within a single package. This applies specifically to default access as well.

  • Canot call Weblogic Bean from Delphi via JNI

    I tried to call a bean within the weblogiv server 7 from Delphi.
    I use a JNI Wrapper which allows me easily to acces normal java objects.
    I can call the bean from a java application.
    When i try to call the bean via jni, the following error occurs:
    weblogic.utils.AssertionError: ***** ASSERTION FAILED *****
    [ Assertion violated] at weblogic.utils.Debug.assertion(Debug.java:74)
    at weblogic.j2ee.ApplicationManager.loadClass(ApplicationManager.java:258)
    at weblogic.j2ee.ApplicationManager.loadClass(ApplicationManager.java:233)
    at weblogic.rmi.internal.ClientRuntimeDescriptor.computeInterfaces(ClientRuntimeDescriptor.java:224)
    at weblogic.rmi.internal.ClientRuntimeDescriptor.intern(ClientRuntimeDescriptor.java:123)
    at weblogic.jndi.WLInitialContextFactoryDelegate.<clinit>(WLInitialContextFactoryDelegate.java:165)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:145)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:671)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:242)
    at javax.naming.InitialContext.init(InitialContext.java:218)
    at javax.naming.InitialContext.<init>(InitialContext.java:194)
    at ejbtest3.ejbtest3sbTestClient1.getInitialContext(ejbtest3sbTestClient1.java:104)
    at ejbtest3.ejbtest3sbTestClient1.init(ejbtest3sbTestClient1.java:32)
    at ejbtest3.ejbtest3sbTestClient1.testmain(ejbtest3sbTestClient1.java:277)
    It seems that i canno create a context object, but i do not know why ...
    So i would be glad if anyone could help me here ...
    Regards Robert

    I would try this with the newest service pack since it seems this assertion does
    not exist in later code lines. It appears to be related to a class loader
    issue. Do you know what version of the Java VM Delphi uses?
    Sam
    robert wrote:
    I tried to call a bean within the weblogiv server 7 from Delphi.
    I use a JNI Wrapper which allows me easily to acces normal java objects.
    I can call the bean from a java application.
    When i try to call the bean via jni, the following error occurs:
    weblogic.utils.AssertionError: ***** ASSERTION FAILED *****
    [ Assertion violated] at weblogic.utils.Debug.assertion(Debug.java:74)
    at weblogic.j2ee.ApplicationManager.loadClass(ApplicationManager.java:258)
    at weblogic.j2ee.ApplicationManager.loadClass(ApplicationManager.java:233)
    at weblogic.rmi.internal.ClientRuntimeDescriptor.computeInterfaces(ClientRuntimeDescriptor.java:224)
    at weblogic.rmi.internal.ClientRuntimeDescriptor.intern(ClientRuntimeDescriptor.java:123)
    at weblogic.jndi.WLInitialContextFactoryDelegate.<clinit>(WLInitialContextFactoryDelegate.java:165)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:145)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:671)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:242)
    at javax.naming.InitialContext.init(InitialContext.java:218)
    at javax.naming.InitialContext.<init>(InitialContext.java:194)
    at ejbtest3.ejbtest3sbTestClient1.getInitialContext(ejbtest3sbTestClient1.java:104)
    at ejbtest3.ejbtest3sbTestClient1.init(ejbtest3sbTestClient1.java:32)
    at ejbtest3.ejbtest3sbTestClient1.testmain(ejbtest3sbTestClient1.java:277)
    It seems that i canno create a context object, but i do not know why ...
    So i would be glad if anyone could help me here ...
    Regards Robert

  • Overriding executeQuery Method in VOImpl in oaf

    Hi All,
    I am trying to override executeQuery method in my extended VOImpl method.
    The VO that I extended is JobsWithGradeLovVO.
    This is what I am writing in my method:
        public void executeQuery(){            
            writeLog("In the executeQuery");
            OADBTransaction tx = ((OAApplicationModuleImpl)getApplicationModule()).getOADBTransaction();               
            String where_grade = getCustomWhereClause(tx);
            this.setBindingStyle(1);
            writeLog("The binding style is: "+this.getBindingStyle());
            writeLog("The where clause is: "+where_grade);
            this.setWhereClause(null);
            this.setWhereClauseParams(null);       
            this.setWhereClauseParam(0, where_grade);
            //this.setWhereClause(where_grade);                
            String query = this.getQuery();       
            writeLog("The query is: "+query);               
            super.executeQuery();
    I modified the where clause of the Query in the xml  as (I added and vg.grade_id not in : 0 at the end of the where clause. The rest of it is the seeded one.):
    job.job_group_id = jgr.job_group_id  and jgr.internal_name = 'HR_'||:4  and (jgr.business_group_id = :5 or jgr.business_group_id is null) and  job.business_group_id = :6  and :7 between job.date_from and nvl(job.date_to ,:8) and job.job_id=vg.job_id(+) and :9=:9    and :10 between nvl(vg.date_from(+),:11) and nvl(vg.date_to(+),:12) and  hl.lookup_type(+)='YES_NO' and hl.lookup_code(+)=nvl2(vg.valid_grade_id,'Y',(decode(:13, -1,'', 'N'))) and pos.position_id(+)=:14 and job.job_id=pos.job_id(+) and :15 between nvl(pos.effective_start_date(+),:16) and nvl(pos.effective_end_date(+),:17) and vg.grade_id not in : 0
    I could observe that there is another "and" condition that is getting appended at the run time which is AND (( UPPER(job.NAME)  like UPPER( :2) ).
    When I try to run the page, I am getting Missing IN OR OUT PARAMETER at index 3.
    Could anyone please help me by letting me know the solution to this.
    Thanks,
    Srikanth

    doSelect() is not related to view object functionality.
    View Object's perform their own query, but coordinate via attribute mapping metadata, with underlying EO's.
    doSelect() is invoked on an Entity instance when:
    [list]
    [*]The entity instance needs to lock its row in the database (the lock boolean flag will be true if this is the case)
    [*]The entity instance needs to be faulted into memory either because of a findByPrimaryKey() in progress, or because business logic has referenced an attribute of the entity that was not already in the cache due to some view object's querying it.
    [list]

Maybe you are looking for

  • Various Apple apps not working after upgrading to Mavericks

    Some time after updating to Mavericks many of the native Apple applications started acting up. Immediately the App Store would only show updates and only gave the spinning "loading" circle or blank screen in "featured" or "top charts," but all is wel

  • How do I sync one item at a time?

    I recently got a refurbished iphone 4. I had to reset it as a new phone to get rid of a previous passcode setting on the applications store. But I had already synced it. Now I would like to restore my contacts, photos, music, messsages, etc. without

  • Please check the code

    I AM TRYING TO REPLICATE THE ADDRESS OF EQUIPMENT FROM ECC TO CRM. I AM ABLE TO REPLICATE THE IDENTIFICATION NUMBER. WHILE USING THE SAME FUNCTION MODULE FOR ADDRESS, THE ADDRESS IS NOT GETTING REPLICATED. PLEASE CHECK THE CODE AND TELL ME WHAT PRE-R

  • How do i know that the iphone i just bought is original and new one

    how do i know that the iphone i just bought is original and new one

  • "A reference to an ResourceRef" exception

    hi All, When the Server starts there's a problem with loading the WAR project. the exception is not a critical one and the application runs anyway, but I want to fix it anyway. [16:43:02:808 IST 07/03/05] 16d416d4 WebContainer A SRVE0169I: Loading We