64-bit JNI C++ to JAVA invocation multiple threads classloader problem

Hi ALL,
I have a C++ app that invokes Java classes on 64-bit Solaris 10 with 64-bit JVM.
Here is the problem:
The native non-main (not the thread that initializes the JVM) threads would not be able to find any user-define class.
Here are the symptoms and observations:
1. JNIEnv::ExceptionDescribe() showed the following StackOverflowError:
Exception in thread "Thread-0" java.lang.StackOverflowError
        at java.util.Arrays.copyOf(Arrays.java:2734)
        at java.util.Vector.ensureCapacityHelper(Vector.java:226)
        at java.util.Vector.addElement(Vector.java:573)
        at java.lang.ClassLoader.addClass(ClassLoader.java:173)
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
        at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)2. The "main thread" that instantiates the JVM has no problem finding and loading any class or method
3. But the other threads (non-main threads) would not be able to find the user-defined classes unless the classes were already loaded by the main thread.
4. The non-main threads can find the "standard" java classes with no problem
5. The same app ran fine on 32-bit system.
6. Except for the JVM reference is global, each thread acquired JNIEnv by either GetEnv() or AttachCurrentThread().
Any idea why it is a problem with 64-bit?
I have the sample program to reproduce this issue in this thread: http://forums.sun.com/thread.jspa?messageID=10885363&#10885363. That was the original thread I raised but I have narrowed it down to a more concrete scenario. That's why I am creating this new thread. I hope this does not break any rule on this forum. If it does, I apologize.
I really appreciate it if anyone can provide any help/suggestion.
Regards,
- Triet

Here is the sample program. Again, this works on 32-bit but not 64-bit.
#include <string>
#include "jni.h"
#include "TestThread.h"
static JavaVM *g_pjvm = NULL;  /* denotes a Java VM */
static JNIEnv *g_penv = NULL;  /* pointer to native method interface */
void initJVM(char** jvmOptions) {
    printf("RJniTest init starts...\n");
    JavaVMInitArgs vm_args; /* JDK/JRE 6 VM initialization arguments */
    JavaVMOption* poptions;
    int optionLen = 0;
    while (jvmOptions[optionLen]) {
        optionLen++;
    printf("RJniTest::init len=%d\n", optionLen);
    if (optionLen > 0) {
        printf("RJniWrapper::init jvmOptions\n");
        poptions = new JavaVMOption[optionLen];
        //poptions[0].optionString = "-Djava.class.path=/usr/lib/java";
        int idx = 0;
        while (jvmOptions[idx]) {
            poptions[idx].optionString = jvmOptions[idx];
            idx++;
    printf("RJniTest::init vm_args: version(%x), nOptions(%d)\n",
            JNI_VERSION_1_6, optionLen);
    vm_args.version = JNI_VERSION_1_6;
    vm_args.nOptions = optionLen;
    vm_args.options = poptions;
    vm_args.ignoreUnrecognized = JNI_FALSE;
    // load and initialize a Java VM, return a JNI interface
    // pointer in env
    printf("RJniTest::init creates JVM\n");
    JNI_CreateJavaVM(&g_pjvm, (void**)&g_penv, &vm_args);
    printf("RJniTest init ends\n");
void findClass(const char* classname) {
    static const char* fname = "justFindClasses";
    printf("%s: findClass: %s\n", fname, classname);
    JNIEnv* jenv;
    jint ret = g_pjvm->GetEnv((void**)&jenv, JNI_VERSION_1_6);
    if (ret == JNI_EDETACHED) {
        ret = g_pjvm->AttachCurrentThread((void**)&jenv, NULL);
        if (ret != JNI_OK || jenv == NULL) {
            printf("%s: get env error: ret=%d\n", ret, fname);
        } else {
            printf("%s: got new env\n", fname);
    } else if (ret == JNI_OK) {
        printf("%s: env already there\n");
    jclass classref;
    classref = jenv->FindClass(classname);
    if (classref == NULL) {
        printf("%s: %s class not found!\n", fname, classname);
        if (jenv->ExceptionOccurred()) {
            jenv->ExceptionDescribe();
            jenv->ExceptionClear();
    printf("%s: found class: %s\n", fname, classname);
class RJniTestThread : public TestThread {
public:
    void threadmain();
void RJniTestThread::threadmain() {
    printf("RJniTestThread::threadmain: Starting testing\n");
    findClass("org/apache/commons/logging/Log");
    findClass("java/util/List");
    printf("RJniTestThread::threadmain: done.\n");
int main(int argc, char** argv) {
    char **jvmOptions = NULL;
    printf("RJniTestDriver starts...\n");
    if (argc > 1) {
        jvmOptions = new char*[argc];
        for (int i = 0; i < argc ; i ++) {
            jvmOptions[i] = argv[i + 1];
        jvmOptions[argc - 1] = NULL;
    } else {
        int size = 8;
        int i = 0;
        jvmOptions = new char*[size];
        jvmOptions[i++] = (char*) "-Djava.class.path=<list of jar files and path here>";
        jvmOptions[i++] = (char*) "-Djava.library.path=/sandbox/mxdev/3rdparty/java/unix/jdk1.6.0_14/jre/lib/sparc";
        jvmOptions[i++] = (char*) "-Djava.compiler=NONE";
        jvmOptions[i++] = (char*) "-verbose:jni";
        jvmOptions[i++] = (char*) "-Xcheck:jni";
        jvmOptions[i++] = NULL;
    printf("init JVM\n");
    initJVM(jvmOptions);
    // UNCOMMENT HERE
    // findClass("org/apache/commons/logging/Log");
    // findClass("java/util/List");
    // UNCOMMENT END
    printf("start test thread\n");
    RJniTestThread testThread;
    ThreadId tid = testThread.launch();
    printf("wait for test thread\n");
    int ret = pthread_join(tid, NULL);
    printf("RJniTestDriver ends\n");
}

Similar Messages

  • Berkeley DB Java Edition - multiple threads accessing database

    Hi,
    I would like to access (read & write) a Berkeley DB from multiple threads (all same process/jvm).
    Should I use a single com.sleepycat.je.Database object for all threads, or should I create an instance for each?
    Or is there any other way of doing it?
    Thanks

    The Database object may be used by multiple threads, so you can use a single instance or multiple ones, as best suits you. From http://docs.oracle.com/cd/E17277_02/html/java/com/sleepycat/je/Database.html,
    Database handles are free-threaded and may be used concurrently by multiple threads. 'If you read through the javadoc, you'll find other notes on using classes from multiple threads.
    Regards,
    Linda

  • How to proces the record in Table with multiple threads using Pl/Sql & Java

    I have a table containing millions of records in it; and numbers of records also keep on increasing because of a high speed process populating this table.
    I want to process this table using multiple threads of java. But the condition is that each records should process only once by any of the thread. And after processing I need to delete that record from the table.
    Here is what I am thinking. I will put the code to process the records in PL/SQL procedure and call it by multiple threads of Java to make the processing concurrent.
    Java Thread.1 }
    Java Thread.2 }
    .....................} -------------> PL/SQL Procedure to process and delete Records ------> <<<Table >>>
    Java Thread.n }
    But the problem is how can I restrict a record not to pick by another thread while processing(So it should not processed multiple times) ?
    I am very much familiar with PL/SQL code. Only issue I am facing is How to fetch/process/delete the record only once.
    I can change the structure of table to add any new column if needed.
    Thanks in advance.
    Edited by: abhisheak123 on Aug 2, 2009 11:29 PM

    Check if you can use the bucket logic in your PLSQL code..
    By bucket I mean if you can make multiple buckets of your data to be processed so that each bucket contains the different rows and then call the PLSQL process in parallel.
    Lets say there is a column create_date and processed_flag in your table.
    Your PLSQL code should take 2 parameters start_date and end_date.
    Now if you want to process data say between 01-Jan to 06-Jan, a wrapper program should first create 6 buckets each of one day and then call PLSQL proc in parallel for these 6 different buckets.
    Regards
    Arun

  • Java Logger incrementing thread ids for a thread spawnned via JNI

    Hi all,
    I have a Java Logger object that I am passing to a JNI dll written in C++.
    If I spawn a thread from the JNI dll and log from that thread, the thread id in the log file increments for each log entry.
    To test this I wrote an infinite loop on the thread to make sure that the logging originated from a single thread. The thread id keeps incrementing in the log and the memory usage of the process increases too. However, the thread count in Task Manager does not increase.
    I will let the process run overnight to determine if the thread id will overflow or if an out of memory exception occurs.
    Has anyone else seen this behavior? Does anyone know what I might be doing wrong? I'm using jre 1.5.1.
    Thanks,
    William

    (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.

  • JDK 1.6 on Solaris. Multiple java processes and thread freezes

    Hi, we've come across a really weird behavior on the Solaris JVM, reported by a customer of ours.
    Our server application consists of multiple threads. Normally we see them all running within a single Java process, and all is fine.
    At some point in time, and only on Solaris 10, it seems that the main Java process starts a second Java process. This is not our code trying to execute some other application/command. It's the JVM itself forking a new copy of itself. I assumed this was because of some JVM behaviour on Solaris that uses multiple processes if the number of threads is > 128. However at the time of spawn there are less than 90 threads running.
    In any case, once this second process starts, some of the threads of the application (incidentally, they're the first threads created by the application at startup, in the first threadgroup) stop working. Our application dumps a list of all threads in the system every ten minutes, and even when they're not working, the threads are still there. Our logs also show that when the second process starts, these threads were not in the running state. They had just completed their operations and were sleeping in their thread pool, in a wait() call. Once the second process starts, jobs for these threads just queue up, and the wait() does not return, even after another thread has done a notify() to inform them of the new jobs.
    Even more interesting, when the customer manually kills -9 the second process, without doing anything in our application, all threads that were 'frozen' start working again, immediately. This (and the fact that this never happens on other OSes) makes us think that this is some sort of problem (or misconfiguration) specific to the Solaris JVM, and not our application.
    The customer initially reported this with JDK 1.5.0_12 , we told them to upgrade to the latest JDK 1.6 update 6, but the problem remains. There are no special JVM switches (apart from -Xms32m -Xmx256m) used. We're really at a dead end here in diagnosing this problem, as it clearly seems to be outside our app. Any suggestion?

    Actually, we've discovered that that's not really what was going on. I still believe there's a bug in the JVM, but the fork was happening because our Java code tries to exec a command line tool once a minute. After hours of this, we get a rogue child process with this stack (which is where we are forking this command line tool once a minute):
    JVM version is 1.5.0_08-b03
    Thread t@38: (state = IN_NATIVE)
    - java.lang.UNIXProcess.forkAndExec(byte[], byte[], int, byte[], int, byte[], boolean, java.io.FileDescriptor, java.io.FileDescriptor, java.io.FileDescriptor) @bci=168980456 (Interpreted frame)
    - java.lang.UNIXProcess.forkAndExec(byte[], byte[], int, byte[], int, byte[], boolean, java.io.FileDescriptor, java.io.FileDescriptor, java.io.FileDescriptor) @bci=0 (Interpreted frame)
    - java.lang.UNIXProcess.<init>(byte[], byte[], int, byte[], int, byte[], boolean) @bci=62, line=53 (Interpreted frame)
    - java.lang.ProcessImpl.start(java.lang.String[], java.util.Map, java.lang.String, boolean) @bci=182, line=65 (Interpreted frame)
    - java.lang.ProcessBuilder.start() @bci=112, line=451 (Interpreted frame)
    - java.lang.Runtime.exec(java.lang.String[], java.lang.String[], java.io.File) @bci=16, line=591 (Interpreted frame)
    - java.lang.Runtime.exec(java.lang.String, java.lang.String[], java.io.File) @bci=69, line=429 (Interpreted frame)
    - java.lang.Runtime.exec(java.lang.String) @bci=4, line=326 (Interpreted frame)
    - java.lang.Thread.run() @bci=11, line=595 (Interpreted frame)There are also several dozen other threads all with the same stack:
    Thread t@32: (state = BLOCKED)
    Error occurred during stack walking:
    sun.jvm.hotspot.debugger.DebuggerException: can't map thread id to thread handle!
         at sun.jvm.hotspot.debugger.proc.ProcDebuggerLocal.getThreadIntegerRegisterSet0(Native Method)
         at sun.jvm.hotspot.debugger.proc.ProcDebuggerLocal.getThreadIntegerRegisterSet(ProcDebuggerLocal.java:364)
         at sun.jvm.hotspot.debugger.proc.sparc.ProcSPARCThread.getContext(ProcSPARCThread.java:35)
         at sun.jvm.hotspot.runtime.solaris_sparc.SolarisSPARCJavaThreadPDAccess.getCurrentFrameGuess(SolarisSPARCJavaThreadPDAccess.java:108)
         at sun.jvm.hotspot.runtime.JavaThread.getCurrentFrameGuess(JavaThread.java:252)
         at sun.jvm.hotspot.runtime.JavaThread.getLastJavaVFrameDbg(JavaThread.java:211)
         at sun.jvm.hotspot.tools.StackTrace.run(StackTrace.java:50)
         at sun.jvm.hotspot.tools.JStack.run(JStack.java:41)
         at sun.jvm.hotspot.tools.Tool.start(Tool.java:204)
         at sun.jvm.hotspot.tools.JStack.main(JStack.java:58)I'm pretty sure this is because the fork part of the UnixProcess.forkAndExec is using the Solaris fork1 system call, and thus all the Java context thinks all those threads exist, whereas the actual threads don't exist in that process.
    It seems to me that something is broken in UnixProcess.forkAndExec in native code; it did the fork, but not the exec, and this exec thread just sits there forever. And of course, it's still holding all the file descriptors of the original process, which means that if we decide to restart our process, we can't reopen our sockets for listening or whatever else we want to do.
    There is another possibility, which I can't completely rule out: this child process just happened to be the one that was fork'd when the parent process called Runtime.halt(), which is how the Java process exits. We decided to exit halfway through a Runtime.exec(), and got this child process stuck. But I don't think that's what happens... from what I understand that we collected, we see this same child process created at some point in time, and it doesn't go away.
    Yes, I realize that my JVM is very old, but I cannot find any bug fixes in the release notes that claim to fix something like this. And since this only happens once every day or two, I'm reluctant to just throw a new JVM at this--although I'm sure I will shortly.
    Has anyone else seen anything like this?

  • Logging variable value to log via Java Invocation

    Hi,
    I'm trying to log a variable value to log file via Java Invocation.
    This are my imports:
      <bpelx:exec import="java.util.logging.Logger"/>
      <bpelx:exec import="java.util.logging.Level"/>
      <bpelx:exec import="oracle.fabric.logging.LogFormatter"/>
      <bpelx:exec import="org.w3c.dom.*"/>
      <bpelx:exec import="oracle.xml.parser.v2.XMLElement"/>
      <bpelx:exec import="java.util.*"/>
      <bpelx:exec import="java.lang.*"/>
      <bpelx:exec import="java.math.*"/>
      <bpelx:exec import="java.io.*"/>
      <bpelx:exec import="oracle.soa.common.util.Base64Decoder"/>If I do this, my bpel compiles fine:
            <bpelx:exec name="Java_Embedding_1" version="1.5" language="java">
              <![CDATA[
                  Logger logger = Logger.getLogger("oracle.soa.Logger");
                  LogFormatter.configFormatter(logger);]]>
            </bpelx:exec>Now, if I do this (in order to cast the getVariableData(...) to Element or String, to get it logged):
            <bpelx:exec name="Java_Embedding_1" version="1.5" language="java">
              <![CDATA[
                  Logger logger = Logger.getLogger("oracle.soa.Logger");
                  LogFormatter.configFormatter(logger);
                  getVariableData("sendMessage_InputVariable","body","/ns2:sendMessageInput/ns2:invocationId");]]>
            </bpelx:exec>my BPEL won't compile. I get the error
    Error(55,33): Failed to compile bpel generated classes.
    failure to compile the generated BPEL classes for BPEL process "BPELProcess" of composite "default/JDeveloper_BPEL_Project!1.0"
    The class path setting is incorrect.
    Ensure that the class path is set correctly. If this happens on the server side, verify that the custom classes or jars which this BPEL process is depending on are deployed correctly. Also verify that the run time is using the same release/version.
    Not much help in my scac.log. No error, just warning:
    2012-11-13 14:59:40 com.collaxa.cube.CubeLogger info
    INFO: LibClasspath=/opt/Oracle_Middleware_Home/jdeveloper/../oracle_common/modules/commonj.sdo_2.1.0.jar:/opt/Oracle_Middleware_Home/jdeveloper/../oracle_common/modules/oracle.fabriccommon_11.1.1/fabric-common.jar:/opt/Oracle_Middleware_Home/jdeveloper/../oracle_common/modules/oracle.xdk_11.1.0/xmlparserv2.jar:/opt/Oracle_Middleware_Home/jdeveloper/soa/modules/oracle.soa.bpel_11.1.1/orabpel-thirdparty.jar:/opt/Oracle_Middleware_Home/jdeveloper/soa/modules/oracle.soa.bpel_11.1.1/orabpel.jar:/opt/Oracle_Middleware_Home/jdeveloper/soa/modules/oracle.soa.bpel_11.1.1/orabpel-exts.jar:/opt/Oracle_Middleware_Home/jdeveloper/soa/modules/oracle.soa.bpel_11.1.1/orabpel-common.jar:/opt/Oracle_Middleware_Home/jdeveloper/soa/modules/oracle.soa.bpel_11.1.1/orabpel-validator.jar:/opt/Oracle_Middleware_Home/jdeveloper/soa/modules/oracle.soa.fabric_11.1.1/fabric-client.jar:/opt/Oracle_Middleware_Home/jdeveloper/soa/modules/oracle.soa.fabric_11.1.1/oracle.soa.fabric.jar:/opt/Oracle_Middleware_Home/jdeveloper/soa/modules/oracle.soa.fabric_11.1.1/fabric-runtime.jar:/opt/Oracle_Middleware_Home/jdeveloper/soa/modules/oracle.soa.fabric_11.1.1/soa-infra-tools.jar:/opt/Oracle_Middleware_Home/jdeveloper/soa/modules/oracle.soa.fabric_11.1.1/fabric-ext.jar:/opt/Oracle_Middleware_Home/jdeveloper/soa/modules/oracle.soa.ext_11.1.1/classes/:/opt/Oracle_Middleware_Home/jdeveloper/../oracle_common/soa/modules/oracle.soa.mgmt_11.1.1/soa-infra-mgmt.jar
    2012-11-13 14:59:40 com.collaxa.cube.CubeLogger info
    INFO: validating "BPELProcess.bpel" ...
    2012-11-13 14:59:41 com.collaxa.cube.CubeLogger warn
    WARNING: CubeProcessor.compileGeneratedClasses() classpath is: /opt/Oracle_Middleware_Home/jdeveloper/jdev/extensions/oracle.sca.modeler.jar:/opt/Oracle_Middleware_Home/jdeveloper/soa/modules/oracle.soa.fabric_11.1.1/fabric-runtime.jar:/opt/Oracle_Middleware_Home/jdeveloper/soa/modules/oracle.soa.mgmt_11.1.1/soa-infra-mgmt.jar:/opt/Oracle_Middleware_Home/oracle_common/modules/oracle.fabriccommon_11.1.1/fabric-common.jar:/opt/Oracle_Middleware_Home/jdeveloper/soa/modules/oracle.soa.bpel_11.1.1/orabpel.jar:/opt/Oracle_Middleware_Home/jdeveloper/soa/modules/oracle.soa.mediator_11.1.1/mediator_client.jar:/opt/Oracle_Middleware_Home/oracle_common/modules/oracle.mds_11.1.1/mdsrt.jar:/opt/Oracle_Middleware_Home/oracle_common/modules/oracle.xdk_11.1.0/xmlparserv2.jar:/opt/Oracle_Middleware_Home/oracle_common/modules/oracle.xdk_11.1.0/xml.jar::/home/veronica/myProject/myProject_Repozytorium/Asynchronic_BPEL/JDeveloper_Asynchronic_BPEL/JDeveloper_BPEL_Project/SCA-INF/classes:/home/veronica/myProject/myProject_Repozytorium/Asynchronic_BPEL/JDeveloper_Asynchronic_BPEL/JDeveloper_BPEL_Project/SCA-INF/classes:/home/veronica/myProject/myProject_Repozytorium/Asynchronic_BPEL/JDeveloper_Asynchronic_BPEL/JDeveloper_BPEL_Project/SCA-INF/gen-classes:/opt/Oracle_Middleware_Home/jdeveloper/../oracle_common/modules/commonj.sdo_2.1.0.jar:/opt/Oracle_Middleware_Home/jdeveloper/../oracle_common/modules/oracle.fabriccommon_11.1.1/fabric-common.jar:/opt/Oracle_Middleware_Home/jdeveloper/../oracle_common/modules/oracle.xdk_11.1.0/xmlparserv2.jar:/opt/Oracle_Middleware_Home/jdeveloper/soa/modules/oracle.soa.bpel_11.1.1/orabpel-thirdparty.jar:/opt/Oracle_Middleware_Home/jdeveloper/soa/modules/oracle.soa.bpel_11.1.1/orabpel.jar:/opt/Oracle_Middleware_Home/jdeveloper/soa/modules/oracle.soa.bpel_11.1.1/orabpel-exts.jar:/opt/Oracle_Middleware_Home/jdeveloper/soa/modules/oracle.soa.bpel_11.1.1/orabpel-common.jar:/opt/Oracle_Middleware_Home/jdeveloper/soa/modules/oracle.soa.bpel_11.1.1/orabpel-validator.jar:/opt/Oracle_Middleware_Home/jdeveloper/soa/modules/oracle.soa.fabric_11.1.1/fabric-client.jar:/opt/Oracle_Middleware_Home/jdeveloper/soa/modules/oracle.soa.fabric_11.1.1/oracle.soa.fabric.jar:/opt/Oracle_Middleware_Home/jdeveloper/soa/modules/oracle.soa.fabric_11.1.1/fabric-runtime.jar:/opt/Oracle_Middleware_Home/jdeveloper/soa/modules/oracle.soa.fabric_11.1.1/soa-infra-tools.jar:/opt/Oracle_Middleware_Home/jdeveloper/soa/modules/oracle.soa.fabric_11.1.1/fabric-ext.jar:/opt/Oracle_Middleware_Home/jdeveloper/soa/modules/oracle.soa.ext_11.1.1/classes/:/opt/Oracle_Middleware_Home/jdeveloper/../oracle_common/soa/modules/oracle.soa.mgmt_11.1.1/soa-infra-mgmt.jarIs it missing something? What it is missing?

    Actually I got it to work, and I'm not sure why it hasn't worked before.
    Where are the compiler complaints stored?

  • How java support multiple inheritance by the use of interface.

    As per my understanding, Interface is just having the signatures of the methods not the implementation.
    So How java support multiple inheritance by the use of interface?
    Answer 1: we can institate interface reference by its implemented
    class.
              ����� interface inf...
              ����� class aa implements inf..
              ����� class bb implements inf....
               Now, inf i = new aa();
               inf i = new bb();
    Answer 2: We can extends as many interface as we want in the
    single
               interface.
               i.e. interface infFirst....
               interface infSecond....
               interface infThird....
               Now ,
               interface ingMulti extends infFrist, infThird...
    By above two answers its not prity clear as per the multiple inheritance in C or C++.
               i.e.
               class first{
               method abc();....}
               class second{
               method bbc()......}
               class multi::first::second{
               we can call to abc();.....as well as bbc();
    -Please give your important suggstion on the same.(Hope I explain it well.)
    -Jeff

    The keyword implement is used only for interfaces not
    for abstract class. If i am wrong correct me.I believe your right, but I will double check.
    As for the multiple inheritence think about the following code:
    class Animal {
        //  Animal generic stuff in this class
    interface Eat {
        //  Generic stuff that models eating behavior
    interface Runs {
        //  generic methods that model running behavior
    public class Horse extends Animal implements Eat, Runs {
        //  Stuff specific to a horse
    }The Animal class is generic but has stuff in it common to all animals.
    The Eat interface models behavior that is generic to eating, all living things have to eat something to survive. Herbavore are different from carnivores.
    The Runs interface models generic behavior to running, such as speed. A cheeta definately runs faster than a human.
    This brings us to the Horse class. It extends the Animal class because it "is-a" animal, and it implements the eat and runs interface because they are behaviors a horse has.
    I hope that helps.
    Extending an abstract class is the same as extending a regular class with the exception you MUST override all abstract methods in the abstract class. Thats not too difficult but I believe when designing classes, designing an abstract can be more diffecult than modeling the base class, and generic behaviors in interfaces. JMO.
    JJ

  • I am using a Application in c dll calling from jni jar by java applet in firefox version 19.0 , the problem is click event message box will not working correct

    I am using a Application in c dll calling from jni jar by java applet in firefox version 19.0 , the problem is button click event message box or popup window will not working correctly. Please any one suggest me the steps to overcome this not responding or slowness in the responding problem of Button click event.

    Hello,
    In Firefox 23, as part of an effort to simplify the Firefox options set and protect users from unintentially damaging their Firefox, the option to disable JavaScript was removed from the Firefox Options window.
    However, the option to disable JavaScript was not removed from Firefox entirely. You can still access it from about:config or by installing an add-on.
    '''about:config'''
    # In the address bar, type "about:config" (with no quotes), and press Enter.
    # Click "I'll be careful, I promise"
    # In the search bar, search for "javascript.enabled" (with no quotes).
    # Right click the result named "javascript.enabled" and click "Toggle". JavaScript is now disabled.
    To Re-enable JavaScript, repeat these steps.
    '''Add-ons'''
    You can alternatively install an add-on that lets you disable JavaScript, such as
    *[https://addons.mozilla.org/firefox/addon/noscript/ No-Script] (to disable JavaScript on a per page basis, as required)
    *[https://addons.mozilla.org/firefox/addon/quickjava/ QuickJava] (to easily disable and enable JavaScript, automatic loading of images, and other content)
    Thank you and I hope this helps!

  • WLS 10.3 (64 bit) / Aix 6.1 / Java 6 (64 bit) does not perform

    We are testing a new configuration as shown below
    WLS 10.3 (64 bit) / Aix 6.1 / Java 6 (64 bit)
    Our previous releases were mainly 32 bit versions/models. In the new release we are using 64 bit mainly and on HP/Win/Solaris/Aix. Currently unable to certify anything on AIX.
    Problem:
    Server can hardly standup for 30 minutes. Server will freeze and sometimes even "kill -9 <PID>" does not kill the server cleanely. (Will have to reboot). In the AdminServer logs, I can see available server memory as low as 0% or 1%. Then it seems to recover and go to around 20% but will eventually stop responding. Same story on 3-4 machines. But no issues on HP/Soalris/Windows.
    Been working with BEA and front line support is telling me that they can't find anything in the core files (yes. We took core files by 'kill -3 <PID>'
    Has anyone seen anything like the above.

    Are you talking about a AIX patch or a WLS patch?
    We did some memory analysing (through IBM Support Assistan Workbench) and we have ruled out memory as the issue. However, the core dumps are showing many socket realted waits. Thanks for your reponse though

  • HT5678 Carnegie-Mellon/DHS Vulnerability Note VU#858729 "Java contains multiple vulnerabilitie"

    does this update address/resolve the Carnegie-Mellon/DHS Vulnerability Note VU#858729 "Java contains multiple vulnerabilities" http://www.kb.cert.org/vuls/id/858729 ?

    Do you believe this update has the necessary changes to make it safe to re-enable our Java?
    Java on the Web (not to be confused with JavaScript, to which it's not related, despite the similarity of the names) is a weak point in the security of any system. Java is, among other things, a platform for running complex applications in a web page, on the client. That was never a good idea, and Java's developers have had a lot of trouble implementing it without also creating a portal for malware to enter. Past Java exploits are the closest thing there has ever been to a Windows-style "virus" affecting OS X. Merely loading a page with malicious Java content could be harmful. Fortunately, Java on the Web is mostly extinct. Only a few outmoded sites still use it. Try to hasten the process of extinction by avoiding those sites, if you have a choice.
    Java is not included in OS X 10.7 and later. A discrete Java installer is distributed by Apple, and another one by Oracle (the developer of Java.) Don't use either one unless you need it. Most people don't. If Java is installed, disable it — not JavaScript — in your browsers. In Safari, this is done by unchecking the box marked Enable Java in the Security tab of the preferences dialog.
    Regardless of version, experience has shown that Java on the Web can't be trusted. If you must use a Java applet for a specific task, enable Java only when needed for the task and disable it immediately when done. Close all other browser windows and tabs, and don't visit any other sites while Java is active. Never enable Java on a public web page that carries third-party advertising. Use it, if at all, only on well-known, password-protected, secure websites without ads. In Safari 6 or later, you'll see a lock icon in the address bar with the abbreviation "https" when visiting a secure site.

  • Hi All , Will Java supports Multiple Inheritance  classes???

    Hi All ,
    Will Java supports Multiple Inheritance by classes???
    Thanks in advance,
    Prakash

    No, Multiple inheritance would look like
    public class A extends B,C {(You can do that in C++, but it's rarely a good idea).That's not true at all. It's not inherently harmful, in C++ or any other language. It's entirely possible to do it correctly when it truly makes sense.
    Java just guarantees that nothing bad can happen to you by only allowing multiple inheritance of interface. You can't ever have multiple inheritance of implementation, that's all.
    %

  • Jms c api does NOT support multiple threads on solaris?

    It appears that weblogic jms c api (solaris) does not work with multiple threads.
              I wrote a simple test program with multiple threads in the following environment:
              <p>
              <pre>solaris 5.7 Generic_106541-22 sun4u sparc SUNW,Ultra-250,
              weblogic 8.1.3
              jdk 1.4.2_b04
              </pre>
              <b>ONLY the first thread is able to create jms queue senders and send text messages without any problem. The second thread always get the following exception:</b>
              <pre>weblogic.jms.common.JMSException
              at weblogic.jms.dispatcher.DispatcherWrapperState.dispatchSyncTran(DispatcherWrapperStat
              e.java:440)
              at weblogic.jms.client.JMSProducer.sendInternal(JMSProducer.java:382)
              at weblogic.jms.client.JMSProducer.send(JMSProducer.java:207)
              Caused by: java.lang.ExceptionInInitializerError
              at weblogic.j2ee.ApplicationManager.loadClass(ApplicationManager.java:309)
              at weblogic.j2ee.ApplicationManager.loadClass(ApplicationManager.java:258)
              at weblogic.j2ee.ApplicationManager.loadClass(ApplicationManager.java:253)
              at weblogic.rjvm.MsgAbbrevInputStream.resolveClass(MsgAbbrevInputStream.java:324)
              at weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream
              .java:96)
              at weblogic.rjvm.MsgAbbrevInputStream.readObject(MsgAbbrevInputStream.java:117)
              at weblogic.rmi.internal.ObjectIO.readObject(ObjectIO.java:56)
              at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:159)
              at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:138)
              at weblogic.jms.dispatcher.DispatcherImpl_813_WLStub.dispatchSyncTranFuture(Unknown Sour
              ce)
              at weblogic.jms.dispatcher.DispatcherWrapperState.dispatchSyncTran(DispatcherWrapperStat
              e.java:406)
              ... 2 more
              Caused by: <b>java.lang.NullPointerException</b>
              at weblogic.i18ntools.L10nLookup.loadProps(L10nLookup.java:88)
              at weblogic.i18ntools.L10nLookup.<init>(L10nLookup.java:160)
              at weblogic.i18ntools.L10nLookup.init(L10nLookup.java:132)
              at weblogic.i18ntools.L10nLookup.getLocalizer(L10nLookup.java:315)
              at weblogic.management.commo.internal.CommoCommandLineTextFormatter.<init>(CommoCommandL
              ineTextFormatter.java:20)
              at weblogic.management.commo.Commo.<clinit>(Commo.java:89)
              ... 13 more</pre>

    It was caused by the 2nd threads' classloader.
              The 2nd thread uses the bootstrap classloader by default when attached to jvm, which loads the 'core' java classes only, not even extended classes.
              <p>
              This cause JNDI factory initialization failed.
              <p>
              The solution is to set the 2nd thread's context loader as the system class loader using JNI. See java.lang.Thread#setContextLoader and java.lang.ClassLoader#getSystemClassLoader.

  • Servlet spawning multiple threads causes server to freeze PC

    I'm attempting to write a servlet which, upon receipt of a particular GET request, spawns a thread to do various work which can then be queried by a different GET request. A third type of GET request stops a specified thread.
    This is working fine, except that I can only seem to have spawned one thread at a time. When I spawn another thread, my entire PC stops responding (even Windows Task Manager becomes so sluggish that I cannot kill the server) , and I have to do a hard reset of my PC. I'm using Sun Java System Application Server. The server logs do not contain any errors. I've tried the NetBeans debugger a bit, and it seems to happen when I call the start() method of the Thread.
    This is my first experience with servlets, as well as my first experience with Sun Java System Application Server. I'm also not a Java expert by any means. I'm sure I'm doing something stupid, but I haven't a clue what.
    I can post my code if necessary, but does anyone have any idea what could be causing the server to stop responding just because a servlet spawns two threads? Should I post my code?
    Sorry if this is a n00b question. Thanks in advance.

    I think you may need to spawn it into HTML frame. Each frame will perform
              and download independently.
              Is it what you need ?
              Siros
              "sam ernie" <[email protected]> wrote in message
              news:[email protected]..
              > Hi,
              >
              > In our application, the content of the main page is being
              > retrieved from different databases. All the requests originiate from
              > one JSP to different databases to retrieve the info. As the JSP
              > processes each of the request sequentailly, there is considerable delay
              > before the contents are displayed to the user.
              >
              > What I want to acheive is spawn multiple threads and display the content
              > to the user in fractions as each thread returns. For eaxmple, if the
              > user has subscribed to three news servers.. I want to be able to
              > display the news from first server to the user without waiting to
              > recieve response from the other two servers.
              >
              > What is the best approach to follow for such requirements ?? Any
              > thoughts on this would be highly appreciated.
              >
              > Thanks,
              >
              > Sam
              >
              

  • PrinterException when multiple threads try to print report using JRC

    Iam using Crystal Report's JRC for printing reports, it works fine.
    But the problem araises when i use multiple threads.
    I used the following:
    reportClientDocument.getPrinterOutputController().printReport(.....); to print.
    I get the following exception
    Caused by: java.awt.print.PrinterException: No printer named "\\ch03\printer05" could be found.
    Without multiple thread it works fine.
    I have been scratching my head for days on this problem, any help is very much appreciated..

    If an API doesn't specifically say that it is thread safe then it isn't likely to be thread safe and the only way to approach it is to assume that it isn't.

  • Multiple threads access the same method.

    Hello,
    I have been trying for a long time to find out multiple threads access the shared data.
    I have written a sample code, there I my intention is that method has to be accessed
    onlny one thread at a time., mean one thread finished the job, then next thread can
    access the shared source. But for this code I am not getting the desired out put what I want. But if I am using synchronized block I am getting the output. Please correct where I got mistake. Please see my code.
    public class TestThread implements Runnable {
         Shared r;
         public TestThread() {
              r = new Shared();
         public static void main(String args[]) {
              Thread t1 = new Thread(new TestThread());
              Thread t2 = new Thread(new TestThread());
              t1.setName("A");
              t2.setName("B");
              t1.start();
              t2.start();
          * (non-Javadoc)
          * @see java.lang.Runnable#run()
         @Override
         public void run() {
              // TODO Auto-generated method stub
              r.count();
    class Shared {
         public synchronized void count() {
              String name = Thread.currentThread().getName();
              System.out.println(name + ":accessed...");
              try {
                   for (int i = 0; i < 5; i++) {
                        System.out.println(name + ": " + i);
              } catch (Exception e) {
                   // TODO: handle exception
    }Thanks
    Bhanu lakshmi.

    It depends on what you synchronize. Non-static methods synchronize on the object, so if you're using several objects, you'll be able to call each from their own thread.
    Make your method synchronized or use only a single object and see the difference.

Maybe you are looking for

  • Help looking for a database

    For years I have relied upon Appleworks for my simple database issues but have not hit a snag. The nature of the data I am now storing requires large numbers of characters to be stored in a single field. Appleworks has a character limit of approx 500

  • Why will my firefox not open all the time on my windows xp pro and gives me an error message instead?

    I some times get this message "The instructions at "ox879ab0e3 referenced memory at "ox879ab0e3" . The memory could not be "read". Check ok to terminate the program. And sometimes the session will simply not update since the firefox has shutdown but

  • Problem with 7.6 and my itouch

    When I connect my itouch and I open itunes, a pop-up appear and says that it's detect but it is not identify correctly, and after, I have to disconnect it and retry... I do it like... 5 times but it doesn't work. It's new, this morning, all was worki

  • EOIO with dynamic queuename possible in SOAP sender ?

    The customer has a requirement to pass a queuename parameter within its SOAP message, and our PI SOAP sender adapter (which must use QoS EOIO) should use that queuename. Apart from the question if that makes sense: is that possible at all ? If yet, w

  • Need to populate description  beside its selection screen

    Hi I need to populate description of the following field beside its selection screen. can someone guide and help.. for eg: If i enter 1 in the selection screen. its following description shd be populated next to it Kamlesh