Trying to raise a named exception, in an exception handler

We have some converted code that I'm trying to fix. Usually, the code isn't modularized, and is an EXCEPTION named at the top of a package gets raised, the code falls into the EXCEPTION handler and everything works fine.
create or replace package tmp_pg
as
  procedure main;
end tmp_pg;
create or replace package body tmp_pg
as
  x_datacheck EXCEPTION;
  wk_num      NUMBER(1);
begin
  wk_num := 1;
exception
  when x_datacheck then
    raise_application_error(-20500, 'datacheck');
  when others then
    raise;
end tmp_pg;
/The problem we're seeing for some of the code, is that inside the private methods in the PACKAGE BODY, the EXCEPTION defined at the PACKAGE BODY-level is raised, which results in a "ORA-06510: PL/SQL: unhandled user-defined exception" error:
create or replace package body tmp_pg
as
  x_datacheck EXCEPTION;
  wk_num      NUMBER(1);
  procedure main is
  begin
    if wk_num = 1 then
      raise x_datacheck;
    end if;
  end main;
begin
  wk_num := 1;
exception
  when x_datacheck then
    raise_application_error(-20500, 'datacheck');
  when others then
    raise;
end tmp_pg;So the code above compiles, but fails at runtime. I tried both of the following, which doesn't work:
- adding an exception handler in the procedure MAIN( ), which raises X_DATACHECK
  procedure main is
  begin
    if wk_num = 1 then
      raise x_datacheck;
    end if;
  exception
    when x_datacheck then
      raise x_datacheck
  end main;- adding a locally defined exception handler in MAIN( ), raising that, which in turn raises X_DATACHECK from the exception handler in MAIN( )
  procedure main is
    lx_datacheck EXCEPTION;
  begin
    if wk_num = 1 then
      raise lx_datacheck;
    end if;
  exception
    when lx_datacheck then
      raise x_datacheck;
  end main;Does anyone have another solution I could try?
Thanks,
--=Chuck

This block of code:
begin
  wk_num := 1;
exception
  when x_datacheck then
    raise_application_error(-20500, 'datacheck');
  when others then
    raise;
end tmp_pg;executes only once, the first time the package is accessed in a session. Since it does not raise x_datacheck, the exception block will not catch it. When x_datacheck is raised in main, the initialisation section has already finished running, so main needs to be the one catching and re-raising. Something like:
SQL> create package tmp_pg as
  2    procedure main;
  3  end tmp_pg;
  4  /
Package created.
SQL> create or replace package body tmp_pg as
  2    x_datacheck EXCEPTION;
  3    wk_num      NUMBER(1);
  4
  5    procedure main is
  6    begin
  7      if wk_num = 1 then
  8        raise x_datacheck;
  9      end if;
10    exception
11      when x_datacheck then
12        raise_application_error(-20500, 'datacheck');
13    end main;
14
15  begin
16    wk_num := 1;
17  end tmp_pg;
18  /
Package body created.
SQL> exec tmp_pg.main;
BEGIN tmp_pg.main; END;
ERROR at line 1:
ORA-20500: datacheck
ORA-06512: at "OPS$ORACLE.TMP_PG", line 12
ORA-06512: at line 1This would work even if some procedure called by main raised x_datacheck. If you want the initialisation section to catch x_datacheck, then either it needs to raise it itself, or call a procedure that raises x_datacheck.
John
John

Similar Messages

  • Failover exception handling in partnerlink

    Hi All,
    I've been trying to test the failover exception handling feature in partnerlink and were not able to replicate it. Can you please assist me on this? Here is the steps which I've carried out:
    1.) Develop a web service and deploy to my localhost's OC4J instance with the following ending point:
    http://localhost:8888/plsqlwebService-webservice-context-root/plsqlwebserviceSoapHttpPort
    2.) Develop the same web service and deploy it to my testing application server with the following ending point:
    http://myappserver:8888/plsqlwebService-webservice-context-root/plsqlwebserviceSoapHttpPort
    3.) Create a bpel synchronous project with a partnerlink originally pointing to my testing application server WSDL file. Also, I've created a Location property for that same partnerlink with 2 sets of values - first having the ending point of my testing application server and the second one is the ending point of my local OC4J instance.
    4.) Deploy the deploy Bpel project to my testing application server.
    5.) To test it, I purposely disabled the web service created in step 2 and initiate the Bpel project on the Bpel console. I was hoping that because the primary web service is not available and it will try to call the second one which I've defined in the Location property but it did not work.
    Have I misunderstood the concept or missed out some important tasks? Thank you for your timne and assistance.
    Have a nice day,
    John

    Hi Jayakrishna,
    In General , there are non execptions in BAPIs, because of the reason, that the exception raised in a SAP envoronment may not mean anything for a non SAP initiator. All the exception situations would only fill the return table(TYpe BAPIRET2 or something like that). If you read that table after the call to the bapi, you can understand what has gone wrong.
    Regards,
    Ravi

  • DataSource CORP_LDAP: Naming exception when trying to create principal

    Using NetWeaver 6.40 SP 15.
    I have configured the UME to use writable LDAP and database. Specifically, for LDAP I'm using the Sun One Directory Server. I'm able to authenticate using one of the LDAP users using a Web Dynpro app.
    When I try to create a user through the NWA web app, I simply get a "Could not create user" error in the application. In the server instance "security.log" I found the following:
    Date : 03/08/2006
    Time : 16:22:59:248
    Message : DataSource CORP_LDAP: Naming exception when trying to create principal ***************************************************************************
    com.sap.security.core.persistence.imp.PrincipalDatabagMaint Wed Mar 08 16:22:59 CST 2006
    UniqueID: USER.CORP_LDAP.testuser
    Type: USER
    Home data source: CORP_LDAP
    Private id part: testuser
    "com.sap.security.core.usermanagement"|->"uniquename" (no time limit)="testuser"
    "com.sap.security.core.usermanagement"|->"department" (no time limit)="CI&T"
    "com.sap.security.core.usermanagement"|->"PRINCIPAL_CREATION_DATE" (no time limit)="0001141856579248"
    "com.sap.security.core.usermanagement"|->"firstname" (no time limit)="user"
    "com.sap.security.core.usermanagement"|->"lastname" (no time limit)="test"
    "com.sap.security.core.usermanagement"|->"PRINCIPAL_TYPE_ATTRIBUTE" (no time limit)="USER"
    "com.sap.security.core.usermanagement"|->"email" (no time limit)="[email protected]"
    "com.sap.security.core.usermanagement"|->"company" (no time limit)=""
    "com.sap.security.core.usermanagement"|->"accessibilitylevel" (no time limit)="0"
    Severity : Error
    Category : /System/Security/Usermanagement
    Location : com.sap.security.core.persistence
    Application : sap.com/com.sap.security.core.admin
    Thread : SAPEngine_Application_Thread[impl:3]_22
    Datasource : 1141856104605:C:\usr\sap\J2E\JC00\j2ee\cluster\server0\log\system\security.log
    Message ID : 000D60DD8A4D00540000001C0000136000040E8333C9FD7C
    Source Name : /System/Security/Usermanagement
    Argument Objs : CORP_LDAP,***************************************************************************
    com.sap.security.core.persistence.imp.PrincipalDatabagMaint Wed Mar 08 16:22:59 CST 2006
    UniqueID: USER.CORP_LDAP.testuser
    Type: USER
    Home data source: CORP_LDAP
    Private id part: testuser
    "com.sap.security.core.usermanagement"|->"uniquename" (no time limit)="testuser"
    "com.sap.security.core.usermanagement"|->"department" (no time limit)="CI&T"
    "com.sap.security.core.usermanagement"|->"PRINCIPAL_CREATION_DATE" (no time limit)="0001141856579248"
    "com.sap.security.core.usermanagement"|->"firstname" (no time limit)="user"
    "com.sap.security.core.usermanagement"|->"lastname" (no time limit)="test"
    "com.sap.security.core.usermanagement"|->"PRINCIPAL_TYPE_ATTRIBUTE" (no time limit)="USER"
    "com.sap.security.core.usermanagement"|->"email" (no time limit)="[email protected]"
    "com.sap.security.core.usermanagement"|->"company" (no time limit)=""
    "com.sap.security.core.usermanagement"|->"accessibilitylevel" (no time limit)="0"
    Arguments : CORP_LDAP,***************************************************************************
    com.sap.security.core.persistence.imp.PrincipalDatabagMaint Wed Mar 08 16:22:59 CST 2006
    UniqueID: USER.CORP_LDAP.testuser
    Type: USER
    Home data source: CORP_LDAP
    Private id part: testuser
    "com.sap.security.core.usermanagement"|->"uniquename" (no time limit)="testuser"
    "com.sap.security.core.usermanagement"|->"department" (no time limit)="CI&T"
    "com.sap.security.core.usermanagement"|->"PRINCIPAL_CREATION_DATE" (no time limit)="0001141856579248"
    "com.sap.security.core.usermanagement"|->"firstname" (no time limit)="user"
    "com.sap.security.core.usermanagement"|->"lastname" (no time limit)="test"
    "com.sap.security.core.usermanagement"|->"PRINCIPAL_TYPE_ATTRIBUTE" (no time limit)="USER"
    "com.sap.security.core.usermanagement"|->"email" (no time limit)="[email protected]"
    "com.sap.security.core.usermanagement"|->"company" (no time limit)=""
    "com.sap.security.core.usermanagement"|->"accessibilitylevel" (no time limit)="0"
    Dsr Component : <masked id>_J2E_7234450
    Dsr Transaction : 79521ee0aef011da9168000d60dd8a4d
    Dsr User : Administrator
    Indent : 0
    Level : 0
    Message Code :
    Message Type : 1
    Relatives : com.sap.security.core.persistence
    Resource Bundlename :
    Session : 200
    Source : /System/Security/Usermanagement
    ThreadObject : SAPEngine_Application_Thread[impl:3]_22
    Transaction :
    User : Administrator
    Where can I find the initial NamingException?

    Hi All,
    Thanks for your replies and SORRY for my late response.
    Now, what I actually want is that though my UME is connected to LDAP i want to the portal admin to be able to create users in the portal DB. I checked my UME configuration and it says
    Microsoft ADS (Deep Hheirarchy) + Database
    and the name of the configuration file is
    dataSourceConfiguration_ads_deep_writeable_db.xml
    Now I could not understand why I am not able to create users in the DB?
    Does the portal has any restriction like at any given point of time only one of the user stores can be active? Doesnt the portal allow both the user stores to be active at a time?
    regards,
    PK

  • JNDI naming exception: Naming exception trying to connect to:help !!!!!!!!!

    Hi,
    Iam getting this exception and i have no clue what is this exception means.....and how to resolve this Naming Exceptions problem.
    what iam doing is.....Iam trying to deploy a war file from my unix system to a win2000 machine(amasdqyt095).
    This is where and how my script(myscript.sh) looks like:
    java -classpath /xyz/bea/wlserver6.1/lib/weblogic.jar weblogic.deploy -port 7001 -host amasdqyt095 -component myWebApp:myserver update weblogic myWebApp /export/home/applications/xyz.war
    i have created this script at: /xyz/bea/wlserver6.1/config/scripts/myscript.sh
    then i did chmod +x myscript.sh
    and the i did:
    ./myscript.sh
    and then iam getting this exception:
    JNDI naming exception: Naming exception trying to connect to: t3://amasdqyt095:7001 as: system: weblogic
    please help ????
    -sangita

    I had the same problem because the weblogic.jar's version in the server was diferent from my machine (SP2 and SP4). I stops when I updated the server to SP4.
    But now I'm having the same problem in another server, and the versions are ok. If anybody knows something else, please let me know.
    I'm using Weblogic 6.1
    []s
    Leonardo

  • Use of raise in exception handling block

    what is the use of raise in exception handling block for eg.
    declare
    a number;
    b emp.empno%type;
    begin
    begin
    SELECT empno INTO a FROM emp where 1=2;
    exception
    when others then
    dbms_output.put_line('inner');
    raise;
    end;
    exception
    when no_data_found then
    dbms_output.put_line('outer');
    end;
    output will be like below ..
    inner
    outer
    PL/SQL procedure successfully completed.
    my question is wht is the use of using raise in exception handing part, is there any specific reason we use in the development ????
    Regards,
    AAK.

    In the first block, you do not raise you user-defined exception WHEN_NO_DATA_FOUND, but the predefined one, which is raised to the WHEN OTHERS exception handler.
    Consider:
    SQL> declare
      2     a number;
      3     my_err exception;
      4     no_data_found exception;
      5  begin
      6     begin
      7        select 1 into a from dual where 1=2;
      8     exception
      9     when no_data_found then
    10        dbms_output.put_line(' In system defined');
    11        raise my_err;
    12     end;
    13  exception
    14     when my_err then
    15        dbms_output.put_line('In User Defined');
    16     when others then
    17        declare
    18           v_sqlerrm varchar2(100);
    19        begin
    20           v_sqlerrm := sqlerrm;
    21        dbms_output.put_line(' In when others '||sqlerrm);
    22        end;
    23  end;
    24  /
    In when others ORA-01403: no data found
    PL/SQL procedure successfully completed.
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2     a number;
      3     my_err exception;
      4     --no_data_found exception;
      5  begin
      6     begin
      7        select 1 into a from dual where 1=2;
      8     exception
      9     when no_data_found then
    10        dbms_output.put_line(' In system defined');
    11        raise my_err;
    12     end;
    13  exception
    14     when my_err then
    15        dbms_output.put_line('In User Defined');
    16     when others then
    17        declare
    18           v_sqlerrm varchar2(100);
    19        begin
    20           v_sqlerrm := sqlerrm;
    21        dbms_output.put_line(' In when others '||sqlerrm);
    22        end;
    23* end;
    SQL> /
    In system defined
    In User Defined
    PL/SQL procedure successfully completed.
    SQL>Note that in the second block, I deleted the declaration of the user defined exception NO_DATA_FOUND.
    This is taken from the documentation:
    Redeclaring Predefined Exceptions
    Remember, PL/SQL declares predefined exceptions globally in package STANDARD, so you need not declare them yourself. Redeclaring predefined exceptions is error prone because your local declaration overrides the global declaration. For example, if you declare an exception named invalid_number and then PL/SQL raises the predefined exception INVALID_NUMBER internally, a handler written for INVALID_NUMBER will not catch the internal exception. In such cases, you must use dot notation to specify the predefined exception, as follows:
    EXCEPTION
      WHEN invalid_number OR STANDARD.INVALID_NUMBER THEN
        -- handle the error
    END;You can read yourself :
    http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14261/errors.htm
    Regards,
    Gerd

  • Naming exception from the pcd... occurred in PI 7.1

    In PI 7.1 Iu2019ve got a process which gets invoked as SOAP service and synchronously calls a second SOAP service. The service returns the correct result and works, when called from the Web Services Navigator. When I call the Service on PI the Web Services Navigator only shows a NullPointerException (although the service gets invoked). The Message Monitoring of the Runtime Workbench doesnu2019t show any Message at all.
    I looked at the Trace-Log and found the Message:
    Naming exception from the pcd when trying to access the principal ROLE.PCD_ROLE_PERSISTENCE.VvlvkEGjiW9zPFaxR/4pd2/bX5Q=
    Has anybody got an idea what could cause this behavior or how one can solve this problem? As far as I could find out PCD_ROLE_PERSISTENCE is part of the portal which is not meant to be Part of PI.
    Regards,
    Tarik

    Hello Osman,
    We are also facing same ROLE.PCD_ROLE_PERSISTENCE.VvlvkEGjiW9zPFaxR/4pd2/bX5Q= error.
    Also when I send a message via SAOPUI I get error:
    com.sap.engine.interfaces.messaging.api.exception.MessagingException: com.sap.engine.interfaces.messaging.api.exception.ConfigException: Some of the IS access information is not available. SLDAccess property may be set to true, but SLD is not available.
    How did you exactly solve your issue?
    System: PI 7.1
    SP: 71006

  • Weblogic.deploy causes JNDI naming exception resp java.io.StreamCorruptedException

    Help needed!
    I'm using WLS6.1 with SP1.
    Calling weblogic.deploy on command line causes the following exceptions no
    matter if i'm using list or deploy option:
    java weblogic.deploy -port 7501 list 12345678
    java.io.StreamCorruptedException: Type code out of range, is 0
    at java.io.ObjectInputStream.peekCode(ObjectInputStream.java:1280)
    at
    java.io.ObjectInputStream.SkipToEndOfBlockData(ObjectInputStream.java:1211)
    at
    java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java:776)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:353)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:232)
    at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:978)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:232)
    at
    weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedObjectIn
    putStream.java:107)
    at
    weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedObjectIn
    putStream.java:115)
    at
    weblogic.rjvm.ConnectionManager.readPeerInfo(ConnectionManager.java:686)
    at
    weblogic.rjvm.ConnectionManagerClient.handleIdentifyResponse(ConnectionManag
    erClient.java:140)
    at
    weblogic.rjvm.ConnectionManager.dispatch(ConnectionManager.java:627)
    at weblogic.rjvm.t3.T3JVMConnection.dispatch(T3JVMConnection.java,
    Compiled Code)
    at
    weblogic.socket.JavaSocketMuxer.processSockets2(JavaSocketMuxer.java,
    Compiled Code)
    at
    weblogic.socket.JavaSocketMuxer.processSockets(JavaSocketMuxer.java,
    Compiled Code)
    at
    weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:24)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled
    Code)
    --------------- nested within: ------------------
    weblogic.utils.AssertionError: ***** ASSERTION FAILED ***** - with nested
    exception:
    [java.io.StreamCorruptedException: Type code out of range, is 0]
    at
    weblogic.rjvm.ConnectionManager.readPeerInfo(ConnectionManager.java:688)
    at
    weblogic.rjvm.ConnectionManagerClient.handleIdentifyResponse(ConnectionManag
    erClient.java:140)
    at
    weblogic.rjvm.ConnectionManager.dispatch(ConnectionManager.java:627)
    at weblogic.rjvm.t3.T3JVMConnection.dispatch(T3JVMConnection.java,
    Compiled Code)
    at
    weblogic.socket.JavaSocketMuxer.processSockets2(JavaSocketMuxer.java,
    Compiled Code)
    at
    weblogic.socket.JavaSocketMuxer.processSockets(JavaSocketMuxer.java,
    Compiled Code)
    at
    weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:24)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled
    Code)
    JNDI naming exception: Naming exception trying to connect to:
    t3://localhost:7501 as: system: beaadmin

    yes, that was the reason.
    thank you very much!
    "Dimitri Rakitine" <[email protected]> schrieb im Newsbeitrag
    news:[email protected]...
    That sounds like you use 1.2 on the client side - make sure that you use1.3.
    >
    In weblogic.developer.interest.ejb Nora Serinek <[email protected]>
    wrote:
    Help needed!
    I'm using WLS6.1 with SP1.
    Calling weblogic.deploy on command line causes the following exceptionsno
    matter if i'm using list or deploy option:
    java weblogic.deploy -port 7501 list 12345678
    java.io.StreamCorruptedException: Type code out of range, is 0
    at
    java.io.ObjectInputStream.peekCode(ObjectInputStream.java:1280)
    at
    java.io.ObjectInputStream.SkipToEndOfBlockData(ObjectInputStream.java:1211)
    at
    java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java:776)
    atjava.io.ObjectInputStream.readObject(ObjectInputStream.java:353)
    atjava.io.ObjectInputStream.readObject(ObjectInputStream.java:232)
    atjava.io.ObjectInputStream.inputObject(ObjectInputStream.java:978)
    atjava.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
    atjava.io.ObjectInputStream.readObject(ObjectInputStream.java:232)
    at
    weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedObjectIn
    putStream.java:107)
    at
    weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedObjectIn
    putStream.java:115)
    at
    weblogic.rjvm.ConnectionManager.readPeerInfo(ConnectionManager.java:686)
    at
    weblogic.rjvm.ConnectionManagerClient.handleIdentifyResponse(ConnectionManag
    erClient.java:140)
    at
    weblogic.rjvm.ConnectionManager.dispatch(ConnectionManager.java:627)
    atweblogic.rjvm.t3.T3JVMConnection.dispatch(T3JVMConnection.java,
    Compiled Code)
    at
    weblogic.socket.JavaSocketMuxer.processSockets2(JavaSocketMuxer.java,
    Compiled Code)
    at
    weblogic.socket.JavaSocketMuxer.processSockets(JavaSocketMuxer.java,
    Compiled Code)
    at
    weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:24)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java,Compiled
    Code)
    --------------- nested within: ------------------
    weblogic.utils.AssertionError: ***** ASSERTION FAILED ***** - withnested
    exception:
    [java.io.StreamCorruptedException: Type code out of range, is 0]
    at
    weblogic.rjvm.ConnectionManager.readPeerInfo(ConnectionManager.java:688)
    at
    weblogic.rjvm.ConnectionManagerClient.handleIdentifyResponse(ConnectionManag
    erClient.java:140)
    at
    weblogic.rjvm.ConnectionManager.dispatch(ConnectionManager.java:627)
    atweblogic.rjvm.t3.T3JVMConnection.dispatch(T3JVMConnection.java,
    Compiled Code)
    at
    weblogic.socket.JavaSocketMuxer.processSockets2(JavaSocketMuxer.java,
    Compiled Code)
    at
    weblogic.socket.JavaSocketMuxer.processSockets(JavaSocketMuxer.java,
    Compiled Code)
    at
    weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:24)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java,Compiled
    Code)
    JNDI naming exception: Naming exception trying to connect to:
    t3://localhost:7501 as: system: beaadmin--
    Dimitri

  • JNDI naming exception...unable to resolve 'weblogic.management.adminhome'

    I'm able to start admin server and access admin console (web). When I try to connect to admin server from managed server using WLST, I'm getting the error "compatibility mbean server is not initialized properly....". I tried to ping admin server from managed server using WLST ping command (java weblogic.Admin -url xxxxx -username xxxx-password xxxx PING), I'm getting error "JNDI naming exception....unable to resolve 'weblogic.management.adminhome'".

    In order to run it remotely, I need to manually export the EAR file from Eclipse, ftp to the remote server and deploy it to the managed server.
    It seems that I missed some jar files in the managed server classpath. But, I don't know which.

  • I am trying to raise event at UserControl, and catch it at Main program, But the event always return null

    I am trying to raise a event in one of classes of userControl, and Fire it in the Main class. I tried two different ways to fire this event, one of them works, But I still want to know why other way cannot work, and how to fix it.
    My userContol class:
    public partial class UserControl1 : UserControl
    public UserControl1()
    InitializeComponent();
    if (System.ComponentModel.DesignerProperties.GetIsInDesignMode(this))
    return;
    Class1 c = new Class1();
    Thread accept = new Thread(
    () =>
    c.connection();
    accept.Start();
    And the Class1:
    public class Class1
    public delegate void myhandler(object sender, EventArgs e);
    public event myhandler test;
    public Class1()
    public void connection()
    test(this, new EventArgs());
    In the Main, I just simply add into referent, and add
    xmlns:my="clr-namespace:WpfControlLibrary1;assembly=WpfControlLibrary1"
    then I try to subscribe this event in the main
    public partial class SurfaceWindow1 : SurfaceWindow
    /// <summary>
    /// Default constructor.
    /// </summary>
    public SurfaceWindow1()
    InitializeComponent();
    Class1 c = new Class1();
    c.test+=new Class1.myhandler(c_test);
    // Add handlers for window availability events
    AddWindowAvailabilityHandlers();
    public void c_test(object sender, EventArgs e)
    MessageBox.Show("fire");
    If I only raise this event not into thread, it works fine, but If I try to let it raise in this thread, this test event only return null, and shows:
    Object reference not set to an instance of an object.
    looks like I did not subscribe it ever. So How to fix it if I must use it in thread.

    Subscribing to events window to class is not a great approach.
    You have to then go un subscribe those handlers in order to allow your instance to be disposed.
    Forget that and you'll eventually notice you have memory leaks.
    The way I do this sort of thing is using mvvm light messenger.
    You can keep everything decoupled then.
    http://social.technet.microsoft.com/wiki/contents/articles/26070.aspx
    I just did a bit of code for someone else which shows how to do cross thread stuff with this approach.
    public partial class MainWindow : Window
    public MainWindow()
    InitializeComponent();
    Messenger.Default.Register<String>(this, (action) => ReceiveString(action));
    private void ReceiveString(string msg)
    MessageBox.Show(msg);
    Dispatcher.BeginInvoke((Action)delegate()
    tb.Text = msg;
    private void Button_Click(object sender, RoutedEventArgs e)
    Task.Factory.StartNew(() => {
    Messenger.Default.Send<String>("Hello World");
    Note that the message arrives on the thread it was sent from. That's not the ui thread because it was sent from that task.factory.startnew to deliberately put it on a different thread.
    In order to change UI controls, it uses dispatcher.begininvoke to run code on the UI thread.
    Although this is in one piece of code behind publisher and subscriber can be in two totally different classes which have no reference of knowledge of each other.
    Meaning you can send a message<t> from any class1 or whatever you like and your mainwindow can subscribe and act of receipt of a message<t>.
    It is the type which defines which message one is. You put data you want to send in t and use it in the subscriber.
    Hope that helps.
    Technet articles: Uneventful MVVM;
    All my Technet Articles

  • Error while trying to raise a Goods Receipt PO in SAP B1 v 9.0

    Hi Experts,
    while trying to raise a Goods Receipt PO in SAP B1 v 9.0 the following error is been generated:
    You should use existing Serial/batch number for this document type [21-59 ]
    Note:We are able  to generate Goods Receipt PO for an item which is not serialized.
    Thanks
    Regards,
    Satish.

    Hi Edy,
    Dim oPDN As SAPbobsCOM.Documents
    oPDN = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseDeliveryNotes)
                    oPDN.CardCode = "C232323"
                    oPDN.Lines.ItemCode = "A00004"
                    'oGR.Lines.LineNum = 0
                    oPDN.Lines.BaseLine = 1
                    oPDN.Lines.BaseEntry = 202
                    'oGR.Lines.BaseRef = 203
                    oPDN.Lines.BaseType = 20
                    oPDN.Lines.Quantity = 1
                    oPDN.Lines.UnitPrice = 2
                    oPDN.Lines.WarehouseCode = '01'
                        oPDN.Lines.SerialNumbers.InternalSerialNumber = 3
                        oPDN.Lines.SerialNumbers.SystemSerialNumber = "Sh01"
                        oPDN.Lines.SerialNumbers.ManufacturerSerialNumber = "Mf01"
                        oPDN.Lines.SerialNumbers.SetCurrentLine(iRowNo)
                        oPDN.Lines.SerialNumbers.Add()
                    End If
                Next
                oPDN.Lines.Add()
                lRetCode = oPDN.Add
    Thanks,
    Satish.

  • Error on /SafeMode: error while trying to run project uncaught exception thrown by method called

    i try run VS 2012 with /SafeMode. I create new empty Winform. When I start debug, I got:
    "error while trying to run project uncaught exception thrown by method called through reflection"

    Hi Matanya Zac,
    Did you restart your machine? How about installing the VS2012 update 4?
    >>error while trying to run project uncaught exception thrown by method
    Did you install the VS update in your VS IDE? I met this issue before which was related to the VS update:
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/5ead8ee9-ea09-4060-88b0-ee2e2044ff82/error-while-trying-to-run-a-project-uncaught-exception-thrown-by-method-called-through-reflection?forum=vsdebug
    If still no help, I suggest you repair your VS, and then restart your machine, test the result.
    Best Regards,
    Jack
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Raising USER DEFINED exceptions

    Can I raise my own exception for a Select clause(rather than the
    default no_data_found exception?)
    Lets suppose I have a Select query which does not return a row.
    Rather than go to the no_data_found exception,I'd like to create
    my own exception
    Select sdi_num into v_sdi_num
    from sdi
    where sdi_num = 0;               -- row returns no data.
    EXCEPTION
    When
    no_data_found
    then
    ...........Now,I want to raise my own exception for this Select clause that does not return a row,rather than
    the default no_data_found exception.
    Some thing like the below:
    Select sdi_num into v_sdi_num
    from sdi
    where sdi_num = 0;               -- row returns no data.
    If v_sdi_num IS NULL THEN
       RAISE my_own_exception;
    END IF;How do I raise my own exceptions in place of no_data_found?

    Typically you would handle the NO_DATA_FOUND at the point it is raised by using a nested BEGIN .. END; block and raise your own exception instead.
    Personal Oracle Database 10g Release 10.1.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL> CREATE TABLE sdi (sdi_num NUMBER);
    Table created.
    SQL> SET SERVEROUTPUT ON;
    SQL> DECLARE
      2     v_sdi_num sdi.sdi_num%TYPE;
      3     no_sdi_num_found EXCEPTION;
      4  BEGIN
      5 
      6     BEGIN
      7        SELECT sdi_num
      8        INTO   v_sdi_num
      9        FROM   sdi
    10        WHERE  sdi_num = 0;                              -- row returns no data.
    11     EXCEPTION
    12        WHEN NO_DATA_FOUND THEN
    13           RAISE no_sdi_num_found;
    14     END;
    15    
    16  EXCEPTION
    17     WHEN no_sdi_num_found THEN
    18        DBMS_OUTPUT.PUT_LINE ('sdi number not found.');
    19    
    20  END;
    21  /
    sdi number not found.
    PL/SQL procedure successfully completed.
    SQL>

  • JNDI naming exception: javax.naming.ServiceUnavailableException

    Hi,
    I am running a standalone version of WLS 6.1 sp4. When I start WLS, it throws
    this exception:
    <Mar 19, 2004 2:39:11 PM PST> <Critical> <Log Management> <Unable
    to contact managed server - med1d2ms01, at d_conitti/10.0.4.81:7301.
    Domain logfile will notcontain messages from this server.
    java.lang.IllegalArgumentException: JNDI naming exception: javax.naming.ServiceUnavailableException
    [Root exception is java.net.UnknownHostException: d_conitti]
    However, weblogic doesn't shut down after this. It continues and deploys all the
    apps. What intrigues me is, where is weblogic reading the 'd_conitti' managed
    server from. I am not running any cluster. It beats me totally. I searched for
    'd_conitti' on my whole machine. I didn't find any file with that word.
    My environment is:
    Win2k Server
    wls 6.1 sp4
    jdk 1.3.1
    I would appreciate any help.
    Thanks,
    Abbas

    Hi,
    I am running a standalone version of WLS 6.1 sp4. When I start WLS, it throws
    this exception:
    <Mar 19, 2004 2:39:11 PM PST> <Critical> <Log Management> <Unable
    to contact managed server - med1d2ms01, at d_conitti/10.0.4.81:7301.
    Domain logfile will notcontain messages from this server.
    java.lang.IllegalArgumentException: JNDI naming exception: javax.naming.ServiceUnavailableException
    [Root exception is java.net.UnknownHostException: d_conitti]
    However, weblogic doesn't shut down after this. It continues and deploys all the
    apps. What intrigues me is, where is weblogic reading the 'd_conitti' managed
    server from. I am not running any cluster. It beats me totally. I searched for
    'd_conitti' on my whole machine. I didn't find any file with that word.
    My environment is:
    Win2k Server
    wls 6.1 sp4
    jdk 1.3.1
    I would appreciate any help.
    Thanks,
    Abbas

  • Naming Exception error in initiate task

    Hi guys, I'm really in need of help. I'm getting naming exception error in my initiate task. There is no error code from bpel. I had copied my workflow from my development server (using oracle 10g) to my production server (using oracle 9i). I did not get this error when I'm in my development server.
    The difference between these two servers are:
    1) IP address
    2) Oracle database version as stated above
    3) domain name
    The initiate task is just after setsystemdefineattribute and before my next task of sending email. The error did not halt the workflow but continue to the task of sending email.
    Can someone help me? I can't seems to find the error which cause this problem.

    I've found out the reason why I'm getting the naming exception error. It is due to wrong configuration in is_config.xml. I'm using Active Directory instead of JAZN and somehow I configure it wrongly to get the error.
    I've switch back to JAZN XML base provider and it is working fine now but I would want to use the active directory as my identity service provider.
    Currently my active directory in my production server is win2000. I'm using the is_config_for_activedirectory template but I still don't understand what values is needed to provide for the is_config.
    Below are some of the items I don't understand.
    1) Can I still use this if my AD is on win2k? If not, what should i use as I'm using AD as my id service provider now.
    2) The default xmlns after the tag <BPMIdentityServiceConfig> do we need to change it? If so, to what values?
    3) What is this property name and values after the providerType?
    4) What is needed for binddn? I only know what to put for ou and dc but I'm not sure about cn.
    5) What is this password for and whose password?
    6) The whole lot under userControls and roleControl, I'm totally lost.
    I've read through the Identity Service Provider (16.7.1) but I still can't understand how to config the active directory part.
    I really hope someone could help enlighten me on this. Thanks
    Hi guys, I'm really in need of help. I'm getting
    naming exception error in my initiate task. There is
    no error code from bpel. I had copied my workflow
    from my development server (using oracle 10g) to my
    production server (using oracle 9i). I did not get
    this error when I'm in my development server.
    The difference between these two servers are:
    1) IP address
    2) Oracle database version as stated above
    3) domain name
    The initiate task is just after
    setsystemdefineattribute and before my next task of
    sending email. The error did not halt the workflow
    but continue to the task of sending email.
    Can someone help me? I can't seems to find the error
    which cause this problem.

  • The invoked JCA adapter raised a resource exception.

    Hello,
    I have to use an Oracle apps adapter in Bpel. Thus I created a non-XA datasource and a connection pool for the Oracle Apps Adapter - eis/Apps/DS with its datasource as jdbc/DS. Now when I invoke the Oracle apps adapter, i get the following error in the standalone weblogic server.
    The selected operation ProcessApprove could not be invoked.
    An exception occured while invoking the webservice operation. Please see logs for more details.
    oracle.sysman.emSDK.webservices.wsdlapi.SoapTestException: Client received SOAP Fault from server : Exception occured when binding was invoked.
    Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'MyAppAdapter' failed due to: Apps Context Error.
    Error occurred while setting up Apps Context.
    Context parameters should be valid.
    Contact oracle support if error is not fixable.
    The invoked JCA adapter raised a resource exception.
    Please examine the above error message carefully to determine a resolution.
    How do I resolve?? Any help please.
    Thanks

    Hello,
    I have to use an Oracle apps adapter in Bpel. Thus I created a non-XA datasource and a connection pool for the Oracle Apps Adapter - eis/Apps/DS with its datasource as jdbc/DS. Now when I invoke the Oracle apps adapter, i get the following error in the standalone weblogic server.
    The selected operation ProcessApprove could not be invoked.
    An exception occured while invoking the webservice operation. Please see logs for more details.
    oracle.sysman.emSDK.webservices.wsdlapi.SoapTestException: Client received SOAP Fault from server : Exception occured when binding was invoked.
    Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'MyAppAdapter' failed due to: Apps Context Error.
    Error occurred while setting up Apps Context.
    Context parameters should be valid.
    Contact oracle support if error is not fixable.
    The invoked JCA adapter raised a resource exception.
    Please examine the above error message carefully to determine a resolution.
    How do I resolve?? Any help please.
    Thanks

Maybe you are looking for