Can't find class because of try catch block ?!

Hello,
I'm using the JNI to use a java library from my c++ code.
JNI can't find the "Comverse10" class below, but when i put the try catch block in createMessage in comment, FindClass succeeds ?!
Unfortunatly i need the code inside the try block ;-)
I tried a few things, but none of them worked:
- let createMessage throw the exception (public void createMessage throws ElementAlreadyExistsException ), so there isn't a try catch block in createMessage => result: the same
- make a "wrapper" class Comverse that has a Comverse10 object as attribute and just calls the corresponding Comverse10.function. Result: Comvers could be found, but not constructed (NewObject failed).
Can someone tell me what is going on ?!
Thank you,
Pieter.
//Comverse10 class
public class Comverse10 {
MultimediaMessage message;
/** Creates a new instance of Comverse10 */
public Comverse10() {
public void createMessage() {
TextMediaElement text1 = new TextMediaElement("Pieter");
text1.setColor(Color.blue);
SimpleSlide slide1 = new SimpleSlide();
//if i put this try catch block in comment, it works ?!
try{
slide1.add(text1);
catch(com.comverse.mms.mmspade.api.ElementAlreadyExistsException e){}
MessageContent content = new MessageContent();
content.addSlide(slide1);
this.message = new MultimediaMessage();
message.setContent(content);
message.setSubject("Mijn subjectje");
for those of you who are intersted: here's my C++ code:
//creation of JVM
HRESULT Java::CreateJavaVMdll()
     HRESULT HRv = S_OK;
char classpath[1024];
     jint res;
     if(blog)     this->oDebugLog->Printf("CreateJavaVMdll()");
     strcpy(classpath,"-Djava.class.path="); /*This tells jvm that it is getting the class path*/
     strcat(classpath,getenv("PATH"));
     strcat(classpath,";D:\\Projects\\RingRing\\MMSComposer;C:\\Progra~1\\j2sdk1~1.1_0\\lib");     //;C:\\Comverse\\MMS_SDK\\SDK\\lib\\mail.jar;C:\\Comverse\\MMS_SDK\\SDK\\lib\\activation.jar;C:\\Comverse\\MMS_SDK\\SDK\\lib\\mmspade.jar
     //------Set Options for virtual machine
     options[0].optionString = "-Djava.compiler=NONE"; //JIT compiler
     options[1].optionString = classpath;                                        //CLASSPATH
     //------Set argument structure components
     vm_args.options = options;
     vm_args.nOptions = 2;
     vm_args.ignoreUnrecognized = JNI_TRUE;
     vm_args.version = JNI_VERSION_1_4;
     /* Win32 version */
     HINSTANCE hVM = LoadLibrary("C:\\Program Files\\j2sdk1.4.1_01\\jre\\bin\\client\\jvm.dll");
     if (hVM == NULL){
          if(blog) oDebugLog->Printf("Can't load jvm.dll");
          return E_FAIL;
     if(blog) oDebugLog->Printf("jvm.dll loaded\n");
     LPFNDLLFUNC1 func = (LPFNDLLFUNC1)GetProcAddress(hVM, "JNI_CreateJavaVM");
     if(!func){
          if(blog)     oDebugLog->Printf("Can't get ProcAddress of JNI_CreateJavaVM");
          FreeLibrary(hVM);     hVM = NULL;
          return E_FAIL;
     if(blog)     oDebugLog->Printf("ProcAddress found");
     res = func(&jvm,(void**)&env,&vm_args);
     if (res < 0) {
if(blog)     oDebugLog->Printf("Can't create JVM with JNI_CreateJavaVM %d\n",res);
return E_FAIL;
     if(blog)     oDebugLog->Printf("JVM created");
     return HRv;
//finding Comverse10 class:
HRESULT CALLAS MMSComposer::InitializeJNI(void)
     HRESULT HRv=E_FAIL;
     DWORD T=0;
     try
          if(blog)     oDebugLog->Printf("\nInitializeJNI()");
          bJVM = FALSE;
          jni = new Java(oDebugLog);
          if(jni->CreateJavaVMdll()!=S_OK){
               if(blog)     oDebugLog->Printf("CreateJavaVMdll() failed");     
               return HRv;
          jclass jcls = jni->env->FindClass("Comverse10");
          if (jcls == 0) {
if(blog)     oDebugLog->Printf("Can't find Comverse10 class");
               jclass jcls2 = jni->env->FindClass("test");
               if (jcls2 == 0) {
                    if(blog)     oDebugLog->Printf("Can't find test class");
                    return HRv;
               if(blog)     oDebugLog->Printf("test class found %08x",jcls2);
return HRv;
          if(blog)     oDebugLog->Printf("Comverse10 class found %08x",jcls);
          jmethodID mid = jni->env->GetMethodID(jcls , "<init>", "()V");
          if (mid == 0) {
               if(blog)     oDebugLog->Printf("Can't find Comverse10() constructor");
return HRv;
          if(blog)     oDebugLog->Printf("Comverse10() constructor found");
          jobject jobj = jni->env->NewObject(jcls,mid);
          if(jobj==0)
               if(blog)     oDebugLog->Printf("Can't construct a Comverse10 object");
return HRv;
          if(blog)     oDebugLog->Printf("Comverse10 object constucted");
          //Create Global reference, so java garbage collector won't delete it
          jni->jobj_comv = jni->env->NewGlobalRef(jobj);
          if(jni->jobj_comv==0)
               if(blog)     oDebugLog->Printf("Can't create global reference to Comverse10 object");
return HRv;
          if(blog)     oDebugLog->Printf("global reference to Comverse10 object %08x created",jni->jobj_comv);
          bJVM=TRUE;
          HRv=S_OK;
     }     catch( IDB * bgError ) { throw bgError->ErrorTrace("InitializeJNI::~InitializeJNI",HRv, 0, T); }
          catch(...) { throw IDB::NewErrorTrace("InitializeJNI::~InitializeJNI",HRv, 0, T ); }
          return HRv;

>
I would guess that the real problem is that that the
exception you are catching is not in the class path
that you are defining.Thanks jschell, that was indeed the case.
I don't have the docs, but I would guess that
FindClass() only returns null if an exception is
thrown. And you are not checking for the exception.
Which would tell you the problem.Ok, i'll remember that. But what with exceptions thrown in my java code, the documents say
// jthrowable ExceptionOccurred(JNIEnv *env);
// Determines if an exception is being thrown. The exception stays being thrown until either the native code calls ExceptionClear(), or the Java code handles the exception
so, what if the java code throws an exception and catches it, will i be able to see that in my c++ code with ExceptionOccurred ?
or
should the java method be declared to throw the exception (and not catch it inside the method)
Again, thank you for your help, it's greatly appreciated !

Similar Messages

  • Can't find class error on Tru64 UNIX

    I have written a class, TextProcessor, and I can compile and run it without any problems on my Win2K box. I ftp the source to works Tru64 box and compile the class just fine. When I issue the command "java TextProcessor" I get the msg "Can't find class TextProcessor". I immediately thought I had a classpath issue. I messed around with setting my classpath but without luck.
    I then wrote a new class on the Unix box using vi called Hello.java. I compile the Hello class without a problem. I issue the command "java Hello" and get "Hello!", just like I am supposed to get.
    The 2 classes reside in the same directory, TextProcessor does not have any package statements. I am totaly confused.
    Environment information:
    Tru64 UNIX version 5 or so.
    JDK 1.1.8 (not my choice and I have no control over the JDK)
    JRE 1.2.2 is also installed.
    Please help!
    Thanks

    Maybe.....
    Make sure that you have the permissions necesary to read,write and execute the file from your own account.
    If you canno't find any class maybe is because you cannot read.
    What account are you used to pute the file from Win?
    you can try this...
    chmod 777 TextProcessor.java
    chmod 777 TextProcessor.class
    But......????? uhmmmmmm??
    I'm not sure, because If you can compile then you can read the file, but it's depends you umask ......
    it's only a suggest

  • Please help me to find my iPad and iPhone 5C. I lost all of them last night. I set up icloud for my devices but i can't find them because they were not connect to the Internet. Please guide me other ways to find my "best friends".

    Dear Apple,
    Please help me to find my iPad Air 2 64 GB and iPhone 5C 8GB. They're in IOS 8.0 maybe...I lost all of them last night. I set up icloud for my devices but i can't find them because they were not connect to the Internet. Please guide me other ways to find my "best friends". They're very important to me. Many important files for my job in here and it has sentimental value to me. My boyfriend gave it for me so i don't want to lose them. And because i just lost my iPad Air last 3 month, and now i just bought iPad Air 2 two months ago. I'm so sad and lost. I want to catch the thief to the police so bad because they keep my bag and many other important things. I can not do anything without them. Please help me and contact me via my email or my phone. Thank you very much. Hope to receive your answer soon.

    Hey there thaovy309,
    Welcome to Apple Support Communities.
    The linked article below provides a lot of great information and suggestions that should address your concerns about your data and finding your lost or stolen iPhone 5c and iPad Air 2.
    If your iPhone, iPad, or iPod touch is lost or stolen - Apple Support
    Take care,
    -Jason

  • Can't find class org/apache/jk/apr/AprImpl

    Hi
    I have Tomcat 4.1.29 and Apache Web Server 2.0.48 installed.
    I have used this tutorial since I'm a newbie :(
    http://www.gregoire.org/howto/Apache2_Jk2_TC4.1.x_JSDK1.4.x.html
    My problem is when I try to regroup them, I obtained this error error.log.
    error] Can't find class org/apache/jk/apr/AprImpl
    java.lang.NoClassDefFoundError: javax/management/MBeanRegistration
         at java.lang.ClassLoader.defineClass0(Native Method)
         at java.lang.ClassLoader.defineClass(Unknown Source)
         at java.security.SecureClassLoader.defineClass(Unknown Source)
         at java.net.URLClassLoader.defineClass(Unknown Source)
         at java.net.URLClassLoader.access$100(Unknown Source)
         at java.net.URLClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClassInternal(Unknown Source)
         at java.lang.ClassLoader.defineClass0(Native Method)
         at java.lang.ClassLoader.defineClass(Unknown Source)
         at java.security.SecureClassLoader.defineClass(Unknown Source)
         at java.net.URLClassLoader.defineClass(Unknown Source)
         at java.net.URLClassLoader.access$100(Unknown Source)
         at java.net.URLClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    Here is my confid file (workers.properties) :
    [logger]
    level=DEBUG
    [config:]
    #file=C:/Apache2/conf/workers2.properties
    file=C:/Apache2/conf/workers2.properties
    debug=0
    debugEnv=0
    [uriMap:]
    info=Maps the requests. Options: debug
    debug=0
    # Alternate file logger
    #[logger.file:0]
    #level=DEBUG
    #file=C:/Apache2/logs/jk2.log
    [shm:]
    info=Scoreboard. Required for reconfiguration and status with multiprocess servers
    file=C:/Apache2/logs/jk2.shm
    size=1000000
    debug=0
    disabled=0
    [workerEnv:]
    info=Global server options
    timing=1
    debug=0
    # Default Native Logger (apache2 or win32 )
    # can be overriden to a file logger, useful
    # when tracing win32 related issues
    #logger=logger.file:0
    [lb:lb]
    info=Default load balancer.
    debug=0
    #[lb:lb_1]
    #info=A second load balancer.
    #debug=0
    [channel.socket:localhost:8009]
    info=Ajp13 forwarding over socket
    debug=0
    tomcatId=localhost:8009
    #[channel.socket:localhost:8019]
    #info=A second tomcat instance.
    #debug=0
    #tomcatId=localhost:8019
    #lb_factor=1
    #group=lb
    #group=lb_1
    #disabled=0
    #[channel.un:/opt/33/work/jk2.socket]
    #info=A second channel connecting to localhost:8019 via unix socket
    #tomcatId=localhost:8019
    #lb_factor=1
    #debug=0
    [channel.jni:jni]
    info=The jni channel, used if tomcat is started inprocess
    [status:]
    info=Status worker, displays runtime informations
    [vm:]
    info=Parameters used to load a JVM in the server process
    #JVM=C:\jdk\jre\bin\hotspot\jvm.dll
    OPT=-Djava.class.path=c:/Tomcat/bin/tomcat-jni.jar;c:/Tomcat/server/lib/commons-logging.jar
    OPT=-Dtomcat.home=${TOMCAT_HOME}
    OPT=-Dcatalina.home=${TOMCAT_HOME}
    OPT=-Xmx128M
    #OPT=-Djava.compiler=NONE
    disabled=0
    [worker.jni:onStartup]
    info=Command to be executed by the VM on startup. This one will start tomcat.
    class=org/apache/jk/apr/TomcatStarter
    ARG=start
    disabled=0
    stdout=C:/Apache2/logs/stdout.log
    stderr=C:/Apache2/logs/stderr.log
    [worker.jni:onShutdown]
    info=Command to be executed by the VM on shutdown. This one will stop tomcat.
    class=org/apache/jk/apr/TomcatStarter
    ARG=stop
    disabled=0
    [uri:/jkstatus/*]
    info=Display status information and checks the config file for changes.
    group=status:
    #[uri:127.0.0.1:8003]
    #info=Example virtual host. Make sure myVirtualHost is in /etc/hosts to test it
    #alias=myVirtualHost:8003
    #[uri:127.0.0.1:8003/ex]
    #info=Example webapp in the virtual host. It'll go to lb_1 ( i.e. localhost:8019 )
    #context=/ex
    #group=lb_1
    [uri:/examples]
    info=Example webapp in the default context.
    context=/examples
    debug=0
    #[uri:/examples1/*]
    #info=A second webapp, this time going to the second tomcat only.
    #group=lb_1
    #debug=0
    [uri:/examples/servlets/*]
    info=Prefix mapping
    [uri:/examples/*.jsp]
    info=Extension mapping
    [uri:/examples/*]
    info=Map the whole webapp
    [uri:/examples/servlets/HelloW]
    info=Exampel with debug enabled.
    debug=10
    Thank you for your time !
    Max

    Btw: I get the warning starting IIS - It seems to me that IIS tries to load Tomcat on-the-fly. The Tomcat load the fails and IIS continues to load successfully.
    The beginning of the IIS Event log outputs this:
    Apache Jakarta Connector2, Information, Info: [jk_vm_default.c (340)]: vm.detach() ok
    Apache Jakarta Connector2, Warning, Error: [jk_worker_jni.c (308)]: Can't find class org/apache/jk/apr/AprImpl
    Apache Jakarta Connector2, Information, Info: [jk_worker_jni.c (297)]: Loaded org/apache/jk/apr/TomcatStarter
    Apache Jakarta Connector2, None, Debug: [jk_vm_default.c (302)]: vm.attach() allready attached
    Apache Jakarta Connector2, Information, Info: [jk_worker_jni.c (252)]: jni.validate() class= org/apache/jk/apr/TomcatStarter
    Apache Jakarta Connector2, Information, Info: [jk_vm_default.c (607)]: vm.open2() done
    Apache Jakarta Connector2, Information, Info: [jk_vm_default.c (500)]: vm.init(): Jni lib: C:\wwwapps\j2sdk1.4.2_01\jre\bin\client\jvm.dll
    /watson

  • ERROR: Can't find class Startadmin

    Hello,
    why do I get this error message:
    Can't find class Startadmin
    I want to start my class Startadmin.java with "java Startadmin"!
    The file is in the current path, so I tried "java -classpath .: Startadmin" too, but I sill get this error!
    What can I do?

    Can you please post the solution, I'm having similar problem.
    I set the classpath before compiling the program
    export CLASSPATH=/usr/java/lib/classes.zip:/oracle/product/8.1.6/demo/lib/classes111.zip
    When I try to run the program at the command prompt
    $ java JdbcTest
    I am getting error message "Can't find class JdbcTest"
    When tried
    $ java -classpath . JdbcTest
    I was getting different error message
    java.lang.NoClassDefFoundError: oracle/jdbc/driver/OracleDriver at JdbcTest.main(Compiled Code)
    Any help is appreiated
    Thanks
    SJ

  • Error: Can't find Class

    Hi there,
    I have added an external library (jtom) to my project. I get this runtime error when running my midlet:
    Error: Can't find Class jtom.service.JTOMException.
    When I extract the contents of the library(jtom), I can see that the class (jtom.service.JTOMException) exists. I can also see this class in myProject>>Build>>compiled folder.
    I'm using Netbeans Mobility 5.5
    Please Assist,
    Pheks

    Can you please post the solution, I'm having similar problem.
    I set the classpath before compiling the program
    export CLASSPATH=/usr/java/lib/classes.zip:/oracle/product/8.1.6/demo/lib/classes111.zip
    When I try to run the program at the command prompt
    $ java JdbcTest
    I am getting error message "Can't find class JdbcTest"
    When tried
    $ java -classpath . JdbcTest
    I was getting different error message
    java.lang.NoClassDefFoundError: oracle/jdbc/driver/OracleDriver at JdbcTest.main(Compiled Code)
    Any help is appreiated
    Thanks
    SJ

  • Can't find class

    Hi,
    A have made an annotation processing test class using netbeans 6 and jsr 269
    @SupportedAnnotationTypes("*")
    @SupportedSourceVersion(RELEASE_6)
    public class CustoWizardAnnotationsTest extends AbstractProcessor {
    @Override
    public boolean process(Set<? extends TypeElement> typeElements, RoundEnvironment roundEnv) {
    This is working, but I have a problem using it, I tried 3 different scenarios:
    1) add the test class to the project which it is tested on. The problem is you can't compile the project anymore because the test is not available anymore after a full clean. I can't find an option to tell the project to compile the testclass first and then start using it.
    2) Make a separate project for the testclass. The problem is that I need some classes from the main project in the test, so I need to add the classes from the main project as a library. Same problem here after a clean of both projects, the testclass can't compile as the libraries of the main project are not available, and the main project can't compile as the testclass is not available.
    3) same as option 2, but now using the java source files as a library. Now I still can compile the testclass when the main project was cleaned, but then another problem occurs. As the testclass is compiling some libraries, it will keep using them, thus resolving in sometimes using too old libraries for running the tests on. It can be solved by recompiling the testclass every time before the main project is compiled, but this doesn't seem a very good solution to me...
    Can anybody help me out of this problem?

    The main project however does not have a dependency on the testclass, but it seems the testclass needs to be compiled before the main project can be compiled, as that class is used during compile time, and that's the problem I'm encountering.
    I hope this provides some more information?You might to need to explain why that bit happens. What error messages are you getting when you compile?
    But you might not if these guesses at what is happening lead you in the right direction.
    *1* It might be that you are using the autodiscovery mechanism, and your META-INF/services/javax.annotation.processing.Processor file (containing the fully qualified name of your Processor) is in the src tree while the Processor itself is in the test tree, which would mean javac would look for your processor when it builds the main part of the project.
    *2* Another scenario which I have encountered, which might be what you are seeing is a sort of bootstrapping catch22. This occurs where you have a META-INF/services/javax.annotation.processing.Processor file pointing to your processor, and they are both in the src tree. It can happen that the META-INF file is also on the classpath (in the build/classes dir as a result of a previous build) so when compiling the processor, it tries to run that same processor but can't find it because it hasn't yet been successfully compiled. A CLEAN_AND_BUILD will normally bypass this issue each time it occurs. If this is biting you often, it might be best to delay coding the META-INF file till the processor is working correctly (or just temporarily comment out the name of your processor in that file) - just use the explicit processor option on javac command line when testing it.
    *3* Yet another scenario might be that you are trying to compile the enum, annotation, processor and all the code that uses the enum/annotation pair all at the same time, and you are expecting the processor to run as part of that compilation. This is not going to work at least after a clean.
    You will need to build the processor before compiling the source that uses the enum/annotation. So that's 2 projects. Where you put the enum and annotation is up to you, but if you put them in the main project, you'll need to write your processor so that it doesn't have a dependency on them.
    That means you shouldn't use Element.getAnnotation(Class) method, because you can't refer to the annotation class. You can use Element.getAnnotationMirrors() to obtain a model of the annotation and use Names to find it which breaks your dependency on the annotation. (There is an easier way which I can explain in a separate post if need be - just ask).
    Bruce

  • HELP - 'Can't find class' error

    I have just bought a new computer with Windows XP and downloaded and installed the new versions of the jdk, jre, etc.
    I have written the Hello World program to check that everything works. It compiles fine, but when I try to run I get an error - Can't find class helloworld - and then it exits.
    I know that the path variable is set correctly and I used to have to set the classpath as well, but have been told that this is not necessary.
    I really need to get this working as have some important programming to do.
    Thanks for any help,
    Olly

    Try this;-
    prompt>set CLASSPATH=
    .......> return key
    prompt>java helloWorld
    Hello World!
    prompt>
    AMAZING!
    This works fine. Thanx.
    Is there any way to set it so that I dont have to do
    the set classpath stuff each time I run a program
    though?
    CheersWell, set a system variable
    CLASSPATH=.;<java_home>\jre\lib\rt.jar
    regardws, Thomas

  • Can't find class when executing javabean test

    Hi,
    I've installed Sunone 6.0
    JSP is installed
    JDK is installed
    I've written and compiled a simple javabeans program
    and it generates class correctly.
    When I try to execute I get "Can't find class" error.
    Where does the class need to reside after compiling?
    Is my PATH hosed?
    Thanks for any pointer
    Willie

    hi
    did you get a chance to read this doc:
    http://docs.sun.com/source/817-6251/pwajsp.html

  • Problem. Alla my tools and panels are hidden, can´t find them. Have try Windows menyer....... and checked. all is ok.

    Problem. Alla my tools and panels are hidden, can´t find them. Have try Windows>menyer....... and checked. all is ok.

    Press the Tab key, it shows/hides panels.
    Or Window > Workspace > Reset  or use a different workspace.
    Gene

  • Trouble opening a just created Pages file.....error message says I need a newer version of Pages......Apple Store says I have version 5.0.......opening an older Pages file it says I have version 4.3.......can not find any way to try another upgrade to 5.0

    Trouble opening a just created Pages file.....error message says I need a newer version of Pages......Apple Store says I have version 5.0.......opening an older Pages file it says I have version 4.3.......can not find any way to try another upgrade to 5.0........please help......
    Thanks

    Personally, I would not recommend deleting/removing the iWorks 09 folder for several reasons: one is that the new versions have had several functionalities removed and until you decide that you can work with the new one and do not miss any features the older version had, I would leave the old one in place. Personally, I will not be using the new versions.
    The second reason is that you can accomplish what you want using a different approach: simply open a Get Info window of your document and choose which version of Pages you want this to open in - you can also stipulate that all docs like this are opened with whichever particular version.
    FWIW: Once you have edited an old document in the new Pages version, you can no longer open it in the older version. However, you can still export it to the old version.

  • Where can i find class files in server

    Hi Gurus,where can i find class files in server.
    Kranthi

    Hi,
    Class files:
    Common\JAVA_TOP
    Pages:
    Appl\mds
    Regards
    Meher Irk

  • "can't find class" error

    i have win xp as my OS and jdk1.1.8 installed. I have my class path set correctly. I have changed the environment variable to c:\jdk1.1.8\bin
    When I compile my java programs using javac at the command prompt, the program compiles successfully and the class file is made but when I run it I get the erro "can't find class filename"
    I there some other way to set the class path in XP .
    I don't understand where I am going wrong.
    Please help...

    to run a java file you would type c:\jdk1.1.8\bin\java ClassName
    leave it at that, i think the error your getting is caused when you type the .class extention ie. c:\jdk1.1.8\bin\java ClassName.class

  • Performance impact on using too much try catch block

    I have several questions here:
    1. The system that I'm developing requires to be high performance, but I am not sure how will try catch block affect overall performance.
    2. I wanted to know which would be more efficient (result in faster processing)
    Have several generic try catch OR catch all exceptions individually?
    ex:
    try {
    } catch (Exception e){
    }vs.
    try{
    } catch (MalformedUrlException me){
    } catch(SQLException){
    }3. Which one would be faster, one big try catch block or several small try catch blocks?
    ex.
    try{
    //read from io file
    //query database
    //parse data
    //write to file
    //query database again
    } catch(Exception e){
    //log exception
    }vs.
    try{
    //read from io file
    } catch(FileNotFoundException fnfe){
    //log exception
    try{
    //query database
    }catch(SQLException se){
    //log exception
    try{
    //parse data
    }catch(SaxParserException saxe){
    //log exception
    try{
    //query database again
    }catch(SQLException se2){
    //log exception
    try{
    //write to file
    } catch(FileNotFoundException fnfe){
    //log exception

    1. The system that I'm developing requires to be high performance, but I am not sure how will try catch block affect overall performance.Compared to what? You can't write an equivalent program that doesn't have a try-catch block, so the answer would have to be that it doesn't affect performance at all.
    2. I wanted to know which would be more efficient (result in faster processing)Have several generic try catch OR catch all exceptions individually?
    You still have it backwards. Do you need to do different things for different exceptions? If so, then that's what you have to do and there is no other code that might be "faster".
    Here's what you should do. Write the code that needs to be written. Don't leave out necessary stuff because of performance reasons. (If you left out all your code, the program would run much faster.) Then find out which parts of the program ACTUALLY take the most time and work on speeding them up.

  • How to get the returned error messages in the Try/Catch block in DS 3.0?

    A customer sent me the following questions when he tried to implement custom error handling in DS 3.0. I could only find the function "smtp_to" can return the last few lines of trace or error log file but this is not what he wants. Does anyone know the answers? Thanks!
    I am trying to implement the Try/Catch for error handling, but I have
    hard time to get the return the msg from DI, so I can write it to out
    custom log table.
    Can you tell me or point me to sample code that can do this, also, can
    you tell me which tables capture these info if I want to query it from
    DI system tables

    Hi Larry,
    In Data Services XI 3.1 (GAd yesterday) we made several enhancements for our Try/Catch blocks. One of them is the additional of functions to get details on the error that was catched :
    - error_message() Returns the error message of the caught exception
    - error_number() Returns the error number of the caught exception
    - error_timestamp() Returns the timestamp of the caught exception.
    - error_context() Returns the context of the caught exception. For example, "|Session Datapreview_job|Dataflow debug_DataFlow|Transform Debug"
    In previous versions, the only thing you could do was in the mail_to function specify the number of lines you want to include from the error_log, which would send the error_log details in the body of the mail.
    Thanks,
    Ben.

Maybe you are looking for

  • I have a nano, 2 ipods, ipad, and ipad2. I want to have just one account and one itunes. I would like to combine all of them and not have to have all different accounts, is there a way to do this. I

    I would like to have just one itunes account. Is there anyway to do that? Right now I have too many accounts and all on different computers. I would like to combine them and just have one place for all my music, books, movies and games. I would need

  • TouchScreen

    Hi, My touchscreen doesn't respond when I touch it. I restart my playbook, but it does nothing. Thanks for your help Denis

  • HTML5 et CCS photo display problem !

    Hi, I develop my e-commerce site using DREAMWEAVER CS5.5 using HTML5 and CCS My site directory is positioned in WAMPSERVEUR 2.2 and in the "www" My local server is configured and it works I start my program HEADER HTML5 and the CCS I realize my layou

  • DDE Command

    ドキュワークスファイルを10個程度選択し.クリック>「Adobe PDFに変換」をクリックする操作を 繰り返し行っていると.時々Acrobat failed to send a DDE commandというのエラーが表示されます. [OK]で閉じても.ただ閉じるだけのため.なにかに影響が起きているかわからない状態です. PDFに変換したいファイルは大量にあり.連続で上記操作を行う必要があります. また連続で操作を行うため.どのファイルが処理された時に エラーが表示されているかも不明です. そのた

  • How can I find terminal window?

    How can I find Terminal window?