Invoke-WSManAction command and CIM Object references

Hi,
I am using powershell on my Windows Server 2008 R2 system to invoke a CIM class method that takes a reference object argument. The signature of the method is something like:
uint32 DoSomething([IN, Description(" Does something ")] CIM_LogicalPort ref Target);
The command I use to invoke this method is:
PS C:\Users\Administrator> $list = Get-WSManInstance -Enumerate -ResourceURI "http://schemas.microsoft.com/wbem/wsman/1/wmi/root/****/CIM_FCPort" -ReturnType EPR
PS C:\Users\Administrator>
PS C:\Users\Administrator> invoke-wsmanaction -action DoSomething -resourceuri "http://schemas.microsoft.com/wbem/wsman/1/wmi/root/****/CIM_SoftwareInstallationService" -selectorset @{CreationClassName="CIM_SoftwareInstallationService";Name="CIM_SoftwareInstallationService";SystemCreationClassName="CIM_ComputerSystem";SystemName="testServer"}
-ValueSet @{Target=$($list[0].InnerXml)}
xsi         : http://www.w3.org/2001/XMLSchema-instance
p           : http://schemas.microsoft.com/wbem/wsman/1/wmi/root/****/CIM_SoftwareInstallationService
cim         : http://schemas.dmtf.org/wbem/wscim/1/common
lang        : en-US
ReturnValue : 32968
PS C:\Users\Administrator>
Though the command execution succeeds, the CIM Provider fails as the reference argument passed in the powershell command reaches the provider as NULL.
My questions are:
  1. What is the right way to pass the CIM objects by reference to the methods?
  2. Is the syntax of the commands I am using correct?
Notes:
  - I have tried the same thing with "winrm" and "Invoke-CIMMethod" commands as well, but with the same failure.
  - The same commands seem to have worked for some people in a similar scenario (http://somethingaboutcode.wordpress.com/2009/11/09/invoking-hyper-v-wmi-api-methods-with-reference-parameters-using-ws-management/).
I really appreciate any help on this.
Cheers,
Venu

Hello AnnaWY,
First of all, thanks for the reply.
In fact, that is the link I followed to get my commands and it was very helpful. I think the EPR is reaching the WINRM server as it is supposed to (I have verified it with wireshark capture when executing the command remotely; copy-pasted below), but when
it reaches the CIM Provider, it is NULL. I suspect one of the below might be happening:
  1. WINRM is not able to get the object from the EPR.
  2. WINRM is passing the argument as NULL when invoking the method.
  3. Something could be going wrong during marshalling (?!!).
Is there a way to know which one of the above is the case?
Please note: I have tried enabling the "WMI" and "Windows Remote Management" traces and it didn't help much.
Thanks again,
Venu
REQUEST
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:p="http://schemas.microsoft.com/wbem/wsman/1/wsman.xsd" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
    <s:Header>
        <a:To>http://10.192.203.53:5985/wsman</a:To>
        <w:ResourceURI s:mustUnderstand="true">http://schemas.microsoft.com/wbem/wsman/1/wmi/root/****/CIM_SoftwareInstallationService</w:ResourceURI>
        <a:ReplyTo>
            <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
        </a:ReplyTo>
        <a:Action s:mustUnderstand="true">http://schemas.microsoft.com/wbem/wsman/1/wmi/root/****/CIM_SoftwareInstallationService/DoSomething</a:Action>
        <w:MaxEnvelopeSize s:mustUnderstand="true">153600</w:MaxEnvelopeSize>
        <a:MessageID>uuid:2A713DC6-F79A-452F-9AA6-D19D9A929C9B</a:MessageID>
        <w:Locale s:mustUnderstand="false" xml:lang="en-US"/>
        <w:OperationTimeout>PT60.000S</w:OperationTimeout>
        <w:SelectorSet>
            <w:Selector Name="CreationClassName">CIM_SoftwareInstallationService</w:Selector>
            <w:Selector Name="Name">CIM_SoftwareInstallationService</w:Selector>
            <w:Selector Name="SystemCreationClassName">CIM_ComputerSystem</w:Selector>
            <w:Selector Name="SystemName">testServer</w:Selector>
        </w:SelectorSet>
    </s:Header>
    <s:Body>
        <p:DoSomething_INPUT xmlns:p="http://schemas.microsoft.com/wbem/wsman/1/wmi/root/****/CIM_SoftwareInstallationService">
            <p:Target>
                <a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
                <a:ReferenceParameters>
                    <w:ResourceURI>http://schemas.microsoft.com/wbem/wsman/1/wmi/root/****/CIM_FCPort</w:ResourceURI>
                    <w:SelectorSet>
                        <w:Selector Name="CreationClassName">CIM_FCPort</w:Selector>
                        <w:Selector Name="DeviceID">0000ABCDABCD0000</w:Selector>
                        <w:Selector Name="SystemCreationClassName">CIM_ComputerSystem</w:Selector>
                        <w:Selector Name="SystemName">testServer</w:Selector>
                    </w:SelectorSet>
                </a:ReferenceParameters>
            </p:Target>
        </p:DoSomething_INPUT>
    </s:Body>
</s:Envelope>
RESPONSE
<s:Envelope xml:lang="en-US" xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:x="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"
xmlns:p="http://schemas.microsoft.com/wbem/wsman/1/wsman.xsd">
    <s:Header>
        <a:Action>http://schemas.microsoft.com/wbem/wsman/1/wmi/root/****/CIM_SoftwareInstallationService/DoSomethingResponse</a:Action>
        <a:MessageID>uuid:25561441-A48B-4DDF-B201-BDD00024EC25</a:MessageID>
        <a:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:To>
        <a:RelatesTo>uuid:2A713DC6-F79A-452F-9AA6-D19D9A929C9B</a:RelatesTo>
    </s:Header>
    <s:Body>
        <p:DoSomething_OUTPUT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://schemas.microsoft.com/wbem/wsman/1/wmi/root/****/CIM_SoftwareInstallationService" xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common">
            <p:ReturnValue>32968</p:ReturnValue>
        </p:DoSomething_OUTPUT>
    </s:Body>
</s:Envelope>

Similar Messages

  • Object Reference not set to instance of Object when sub-report on new page

    I have a problem when my sub-report goes onto the second page of the report, with an error message.
    My VB.NET displays a report and sub-report (in the footer) in a CrystalReportViewer:
    - When both are on the first page, both display fine
    - When the sub-report (or at least part) goes to the second page, the report displays OK, but without the subreport. When I go to page 2 of the report - hoping to see the sub-report - an error message is displayed, with title "Crystal Report Windows Forms Viewer" and text "Object Reference not set to an instance of an object".
    This problem occurs both on my development machine in VS and at a user site.
    Am desperate for some ideas please! I have VB.NET in Visual Studio 2010, and SAP Crystal Reports, version for Visual Studio 2010. The program is targeted for .NET Framework 3.5.
    I looked for the HandleException event on my Windows Forms Viewer, as suggested by SAP and Microsoft, but cannot find this. See for [example|http://devlibrary.businessobjects.com/businessobjectsxi/en/en/crystalreports_dotnet_sdk/crystalreports_net_doc/doc/crsdk_net_doc/html/crlrfwindowsformscrystalreportviewerclasshandleexceptioneventtopic.htm]

    Usually, the error is due to the object going out of scope. Placing the object in a session may help. Moving the CR code to page init or page load may help. Looking at samples may help:
    http://wiki.sdn.sap.com/wiki/x/JQBmBQ
    CR Dev help files are here:
    SAP Crystal Reports .NET API Guide     http://help.sap.com/businessobject/product_guides/sapCRVS2010/en/crnet_api_2010_en.zip
    SAP Crystal Reports .NET SDK Developer Guide     http://help.sap.com/businessobject/product_guides/sapCRVS2010/en/crnet_dg_2010_en.zip
    Finally, ensure you are using Service Pack 2 (see the sticky thread at the top of this forum).
    Ludek
    Follow us on Twitter http://twitter.com/SAPCRNetSup
    Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports]

  • Test-OutlookConnectivity WARNING: An unexpected error has occurred and a Watson dump is being generated: Object reference not set to an instance of an object.

    Hi All,
    When we do a test-outlookconnectivity -protocol:http the result is a success but then we get the following:
    ClientAccessServer   ServiceEndpoint                               Scenario                           
    Result  Latency
    (MS)
    xxxxxxxxxxxx... xxxxxxxxxxxxxx                 Autodiscover: Web service request.  Success   46.80
    WARNING: An unexpected error has occurred and a Watson dump is being generated: Object reference not set to an instance
     of an object.
    Object reference not set to an instance of an object.
        + CategoryInfo          : NotSpecified: (:) [Test-OutlookConnectivity], NullReferenceException
        + FullyQualifiedErrorId : System.NullReferenceException,Microsoft.Exchange.Monitoring.TestOutlookConnectivityTask
    So it looks like it's not completing successfully.
    I can't find anything on this in particular, and don't really know how to go about solving it - We are fully up to date, Exchange 2010 Sp2 with Rollup 5-v2
    Any help appreciated!

    hi,
    I have the same issue also on Exchange 2010 SP2 RU5v2
    I ran your command and get the below
    [PS] C:\Installs\report\Activesync>Test-OutlookConnectivity -Protocol:http |FL
    RunspaceId                  : ebd2c626-1634-40ad-a17e-c9a713d1a62b
    ServiceEndpoint             : autodiscover.domain.com
    Id                          : Autodiscover
    ClientAccessServer          : CAS01.domain.com
    Scenario                    : Autodiscover: Web service request.
    ScenarioDescription         :
    PerformanceCounterName      :
    Result                      : Success
    Error                       :
    UserName                    : Gazpromuk.intra\extest_645e41faa55f4
    StartTime                   : 8/21/2013 4:08:50 PM
    Latency                     : 00:00:00.1250048
    EventType                   : Success
    LatencyInMillisecondsString : 125.00
    Identity                    :
    IsValid                     : True
    WARNING: An unexpected error has occurred and a Watson dump is being generated: Object reference not set to an instance of an object.
    Object reference not set to an instance of an object.
        + CategoryInfo          : NotSpecified: (:) [Test-OutlookConnectivity], NullReferenceException
        + FullyQualifiedErrorId : System.NullReferenceException,Microsoft.Exchange.Monitoring.TestOutlookConnectivityTask
     Any help would be greatly appreciated, I also get random failures of OWA, EAS and web services, very frustrating
    I have no errors in the app event log
    thanks
    Faisal Saleem Windows Systems Analyst 07595781867

  • "cacheHostInfo is null" and Add-SPDistributedCacheServiceInstance : Object reference not set to an instance of an object.

    I am working on a standalone install Sharepoint 2013 (no Active Directory). I found newsfeed feature is not available and checked Distributed Cache service is stopped. When start it “cacheHostInfo is null” is returned.
    I checked the Windows service “AppFabric caching service” is stopped because the default identity “Network Service” not work. Then I change the AppFabric service identity to use “.\administrator” (which is also the sp farm administrator) and the service can
    be started.
    However the “cacheHostInfo is null” when try to start Distributed Cache service in central admin.
    I searched on web and found this blog: http://rakatechblog.wordpress.com/2013/02/04/sharepoint-2013-spdistributedcacheserviceinstance-cachehostinfo-is-null/
    I tried to run the script but it return error:
    Add-SPDistributedCacheServiceInstance : Object reference not set to an
    instance of an object.
    At C:\root\ps\test.ps1:8 char:13
    + $whatever = Add-SPDistributedCacheServiceInstance
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidData: (Microsoft.Share…ServiceInstance:
    SPCmdletAddDist…ServiceInstance) [Add-SPDistributedCacheServiceInstance]
    , NullReferenceException
    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletAddDistr
    ibutedCacheServiceInstance
    I am not sure what went wrong. Please give me some idea? Thank you for any comment!

    Can you deploy Active Directory as installing without is not a supported installation scenario - http://support.microsoft.com/kb/2764086.
    Trevor Seward
    Follow or contact me at...
    &nbsp&nbsp
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • How to invoke BASH shell and execute a command in that shell in Windows 98

    Hello, I have a problem and if somebody will help me, I will be very glad. Thank you.
    I am using BASH shell on Windows 98 OS by means of CYGWIN. And I want to invoke this BASH shell and execute a preprogrammed command in the shell (./scan fileName.txt) from a JAVA program. But so far, I am not sucessful. I can not read or write anything from / to BASH shell. It either blocks and freezes (When I use waitFor( ) ) or appears and disappears without executing scan command (When I do not use waitFor( ) ). My code is like this:
    // This method is used for compiling a file.
    // It invokes BASH shell and executes "./scan fileName.txt" command
    public void compileFileMethod () {
    try {
    Process proc = ( Runtime.getRuntime() ).exec ("C:\\MyDocuments\\CYGWIN.BAT); //I also tried to add -c ./scan fileName.txt after .BAT );
    // I also tried to write "C:\\MyDocuments\\BASH.EXE" but it did not help
    OutputStream ostr = proc.getOutputStream();
    BufferedWriter bw = new BufferedWriter ( new OutputStreamWriter (ostr) );
    InputStream istr = proc.getInputStream();
    BufferedReader br = new BufferedReader ( new InputStreamReader (istr) );
    InputStream errorStr = proc.getErrorStream();
    BufferedReader errorBr = new BufferedReader ( new InputStreamReader (errorStr) );
    bw.write("scan case40.10.txt"); /* I am trying to input the scan command to the shell,but it is not working*/
    bw.flush();
    Vector list = new Vector (1) ;
    String str;
    while ( (str = br.readLine() ) != null) {
    list.addElement(str);
    } // End of while
    Enumeration enumForList = list.elements();
    while ( enumForList.hasMoreElements() ) {
    String tempString;
    tempString = ( String ) enumForList.nextElement();
    System.out.println(tempString); // I am trying to read the outputs of the scan command but it is not reading (I can not see any output)
    I tried with and without waitFor( ), it did not work
    // wait for command to terminate
    proc.waitFor();
    // close streams
    br.close();
    bw.close();
    errorBr.close();
    } // End of try
    catch ( IOException ioe ) {
    JOptionPane.showMessageDialog (null, "Input / output error occured while compiling file ", "Error", JOptionPane.ERROR_MESSAGE);
    } // End of catch
    catch ( SecurityException se ) {
    JOptionPane.showMessageDialog (null, "Security error occured while compiling file ", "Error", JOptionPane.ERROR_MESSAGE);
    catch ( InterruptedException ie ) {
    JOptionPane.showMessageDialog (null, "Interruption error occured while compiling file ", "Error", JOptionPane.ERROR_MESSAGE);
    } // End of method compileFileMethod
    // Thank you for your helps and time.

    You cannot invoke BAT files directly, you have to invoke the program that run those files which is your Windows 98 shell. For example (under windows 2000), i would invoke "cmd.exe sricpt.bat some args", rather than "script.bar some args".
    Hope this will help you out.

  • The truth about objects, references, instances and cloning (Trees and Lists

    Hello
    As a few of you may have know from my postings over the past few weeks, ive been building my first real java ap and trying to learn along the way, hitting a few snags here and there.
    One main snag i seem to have been hitting a fair bit is objects and instances, im kinda learning on how they work and what they mean but as a php programmer it seems to be very different.
    as pointed out to me if you have objectA=objectB then in php you have two objects that share the same value but in java you have still one object value and one object pointing to the value.
    sooo my first question is
    if i have this
    Object objA=new Object()
    Object objB=objA()then object A creates a new memory allocation for the object data right? and object B is simply a reference to the object A memory allocation right?
    so therefore there is no instance of objectB? or is there an instance of object B but it just takes up the same memory allocation as object A?
    anyway, what is the point of being able to say objB=objA what can that be used for if not for making a copy of an object (i understand now that it doesnt copy an object)
    My second question (which i think i actually understand now, but im posting it to see if the answers may help others)
    If i have a List structure (e.g. arraylist) then when i add a datatype such as a treemap does it not add the changed treemap, ill try and explain with code
    ArrayList mylist=new ArrayList()
    Treemap myTree=new Treemap()
    myTree.put("hello","howdy");
    myTree.put("bye","cya");
    mylist.put(myTree);
    System.out.println(mylist.toString());
    myTree.put("another","one");
    mylist.put(myTree);
    System.out.println(mylist.toString());now to be honest ive not actually tried that code and it may actually procude the right results, but from my experience so far that similar sort of thing hasnt been working (by the way i know the above code wont compile as is :p)
    anyway what i assume is that will output this
    [Hello,howdy,bye,cya] <<this is the first system out
    [Hello,howdy,bye,cya,another,one  <<this is the second system out
    Hello,howdy,bye,cya,another,one] <<this is the second system out
    where it should produce this
    [Hello,howdy,bye,cya,
    Hello,howdy,bye,cya,another,one]
    Why when I update the treemap does the arraylist change, is this because the thing that is being put in the array list is infact not an object but simply a reference to an object?
    thanks for everyones help so far :)

    as pointed out to me if you have objectA=objectB then
    in php you have two objects that share the same value
    but in java you have still one object value and one
    object pointing to the value.Some years ago, I built a small website managing data saved in an XML file using PHP. Being used to Java, I used an OO approach and created classes managing data structures and having setter/getter methods. The fact that PHP did actually create a copy of any object being passed as and argument made me crazy. This way, I wasn't able to reach the same instances from several different places in my code. Instead, I had to put a certain operator ("&" I think) before any reference to force PHP not to make a copy but pass the reference. I also found a note on the PHP site saying that copying was faster than passing the reference, which I actually couldn't believe. If I'm not wrong, they changed the default behaviour in PHP5.
    if i have this
    Object objA=new Object()
    Object objB=objA()then object A creates a new memory allocation for the
    object data right? and object B is simply a reference
    to the object A memory allocation right?The statement "new <Class>" allocates memory. The reference itself just takes up a few bytes in order to maintain some administrative data (such as the memory address). References are basically like pointers in C, though there's no pointer arithmetics and they can't point to any arbitrary place in memory (only a legal instance or null).
    so therefore there is no instance of objectB? or is
    there an instance of object B but it just takes up
    the same memory allocation as object A?There is an instance of objectB, but it's just the same instance that objectA is pointing at. Both references objectA and objectB contain the same memory address. That's why they'd produce a result of "true" if compared using the "==" operator.
    anyway, what is the point of being able to say
    objB=objA what can that be used for if not for making
    a copy of an object (i understand now that it doesnt
    copy an object)Sometimes you don't want to make a copy, as 1) it consumes more memory and 2) you'd lose the reference to it (making it more difficult to tell what instance is actually accessed). If there was no way to pass a reference to an object into a method, methods wouldn't be able to affect the original instance.
    Why when I update the treemap does the arraylist
    change, is this because the thing that is being put
    in the array list is infact not an object but simply
    a reference to an object?The ArrayList doesn't change at all. It's the instance that's being changed, and the ArrayList has a reference to it.

  • Event ID 1502 and 6398 : Translation Service Application is failing to execute. Object reference not set to an instance of an object.

    hi,
    We have deployed Sharepoint 2013 in hosting mode. And i followed this
    guide. And i have 1 web server, 1 app server and 1  DB server. My Application server is logging 2 critical event after every 15 min.
    Event ID: 1502, Task Category: Timer Job, Source: SharePoint Translation Services
    "Timer job '735da5fd-a74a-46b8-9a75-70e85d125eb2' for service application 'Translation Service Application' is failing to execute. More information is included below.
    Object reference not set to an instance of an object. "
    Followed by this one one more critical event,
    Event ID: 6398, Task Category: Timer , Source: SharePoint Foundation
    "The Execute method of job definition Microsoft.Office.TranslationServices.QueueJob (ID 735da5fd-a74a-46b8-9a75-70e85d125eb2) threw an exception. More information is included below.
    Object reference not set to an instance of an object."
    I tried to search everywhere, but no solution. Because of this two critical events AppFabricCaching service is also crashing.
    Any suggestion how i can fix this?
    SaM

    Hi  SaM,
    According to your error message, it says that the Timer job '735da5fd-a74a-46b8-9a75-70e85d125eb2' for service application 'Translation Service Application' fail to create due to some referred object cannot
    be found. For this issue, it can be caused by missing assembly .
    Could you please provide detail error message of ULS log  to determine the exact cause of the error?
    For SharePoint 2013, by default, ULS log is at      
    C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\LOGS
    Here is a blog you can have a look:
    http://powerpivotgeek.com/2010/10/04/bug-cannot-install-powerpivot-if-a-sql-server-shared-folder-has-been-specified-in-a-previous-installation-to-other-than-the-default-folder/
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • Differences between object and object references

    What's the differences between object and object references? To me, it seems the same, but I am sure there are differences.
    Student s = new Student("Joe",20);
    s is an object of class Student. Can we say s is an object reference of class Student?
    Please clarify. thanks!!

    Student s = new Student("Joe",20);
    s is an object of class Student. Can we say s is an
    object reference of class Student?The thing you created via "new Student()" is an object. The variable you declared via "Student s" contains a reference to that object. People say all kinds of things but I find it clearer to differentiate between variables and the objects they refer to.

  • Differences between using a Object Reference and the Object itself

    Example:
    public class Myclass
    //difference between
    Myclass myobj;
    //and
    Myclass myobj = new Myclass();
    can anyone help me?

    Both lines you showed declare an object reference.
    The first one is not explictely assigned a value and
    is thus implicetly assigned the null reference (= a
    reference pointing to no object). The latter is
    initialized with an reference to the newly created
    Object (new Myclass()).
    They're both given a value of null first.
    The second one is then given a value that points to that object that was created.
    If they were inside a method, then the first one's value would be undefined.

  • Had Lion 10.7.3 and spctl enabled, after upgrading to 10.7.4 i got this error message: 'error: invalid API object reference'

    I had Lion 10.7.3 with spctl enabled, few days ago i had thru Software Updates > Upgrade to 10.7.4; i upgraded but this time when im trying to install an program i have the message that producer is not signed or software was from AppleStore so i tried to disable on Terminal, but i got this message:
    'error: invalid API object reference'
    i guess now i cant install anything because either i want to enable or disable the result is the same.

    I have this same trouble with an IMac, was also 10.7.3 with spctl enabled, and after upgraded to 10.7.4, i cant install anything.

  • Iam Running an Application it is running and working fine in Firefox where as Chrome pushing an error stating "Object reference not set to an instance of an object."

    Iam Running an Application it is running and working fine in Firefox where as Chrome pushing an error stating "Object reference not set to an instance of an object."

    This forum is for discussing technical documentations on Microsoft's web site.
    If you need help with an app, contact its author.
    Visual C++ MVP

  • Help me to solve it, JPanel and object reference

    Hi, friends,
    please help to solve this problem
    I have array of objects, let's say
    JLabel a[][] = new JLabel[4][4];then i add them into a JPanel(new GridLayout(4,4));
    public void buildLayout(){
       lfMouse lf = new lfMouse(); //MouseListener
          for(int i=0;i<4;i++){
         for(int j=0;j<4;j++){
                             lbl[i][j] = new JLabel(i*10+j+"");
             lbl[i][j].addMouseListener(lf);
             pane.add(lbl[i][j]);
    }What i need is when user click the label, the label will change to another JLabel's object, and the panel can immediately update itself.
    Here's my assumption:
    class lfMouse extends MouseAdapter{
            public void mouseClicked(MouseEvent e){
                      JLabel temp = (JLabel)e.getSource(); //get the clicked object
                       temp = new JLabel("Hihi"); //change its address to other    
                                                                        //object's reference
                       pane.revalidate();
    }But it didn't work...can anyone help me to understand object reference concept in Java? And how can i update the UI of JPanel immediately?
    I don't use setText(), because i need to change to another object...
    All i can do is to remove all the label in JPanel, and add the label to JPanel again..but i think it's not the effective way...
    please help me to solve it....
    Thanks for your help.... :)

    Creating a new Object does not add the Object to the panel. Its just an Object sitting in memory.
    I don't use setText(), because i need to change to another object...setText(...) is the obvious solution
    If you need to keep the original text String in your array then your array should be an array of Strings. Then you would build your JLabels using the Strings contained in the array. This way when you update the text of the label you are not touching the original array String values.
    All i can do is to remove all the label in JPanel, and add the label to JPanel again..but i think it's not the effective way...Its the only other way if you don't want to use setText(...);

  • Object references and array of integers

    Hello,
    Taking some java test, I came across the following question:
    Given the below (UML) diagram, how many of the ClassA attributes will be object references when this class is implemented in the Java language?:
           ClassA                                         <<enumeration>>   
                                  ------------------->         Enum1
          var1 : int                                              
          var2 : String                                         Elem1
          var3 : int[]                                          Elem2
          var4 : float                                          Elem3
          var5 : Double                                         Elem4
          var6 : Enum1   I answered 3, but the correct answer was 4. The one which I did not include was var3. Why will var3 be an object reference?
    Thank you,
    Mihai

    That is true, my mistake. Arrays are object references (you do indeed instantiate an array by using the new keyword), but I was thrown off by what the array holds, namely primitive types, not object references.
    Thank you,
    Mihai

  • Hi,i am trying to edit a BP and i get this error;An attempt was made to execute a dynamic method callon an initial(NULL-) object reference. The reference must refer to an object. what could be missing?

    BP_....AccountActivitiesOV.htm....application BPBT.
    what could be wrong? An attempt was made to execute a dynamic method callon an initial(NULL-) object reference. The reference must refer to an object???

    Hi Dunamis,
    Please check if below links can help you;
    Error on execution of Web Interface
    Help! I meet this Business Server Page (BSP) error CX_SY_REF_IS_INITIAL
    Strange Error in Transformation of 2LiS_03_BF with 0IC_C03
    Regards,
    Kamfrk.

  • Musings: MVC Front Controller/Command and Controller Strategy

    Hi,
    I am currently taking my first shot at implementing the Front Controller pattern, the Command and Controller Strategy flavor, in Java. When applying the pattern, my chosen point of focus is achieving as much isolation as possible of Client-specific implementation details from the rest of the framework (Web-based framework Clients, Swing-based framework Clients, queueing-based framework Clients, etc.) However, I am running into a lot of (apparent?) inconsistencies when it comes to CCS discussions "out there", so I have a feeling that perhaps I have misunderstood the Front Controller/Command and Controller Strategy pattern. Maybe the MVC gurus out there would have some thoughts on the matter.
    My issues:
    1.) Some CCS discussions seem to assign View presentation (sometimes called "dispatch", or "rendering", or "forwarding"?) to an ApplicationController. It seems puzzling to me, since only a concrete FrontController should include any knowledge of a concrete View structure. Shouldn't only a FrontController perform a logical-to-physical resource mapping, thus encapsulating knowledge whether a particular View is a separate, stand-alone Web page or a compound, argument-driven Swing object, and how to "present it" (by either redirecting to a Web page, or bringing a particular Swing object into the foreground)?
    2.) Some CCS discussions seem to introduce Client-specific implementation details at the ApplicationController level, for example "HTTP requests" or "HTTP responses". It seems puzzling to me, since I feel that every part of the framework, except for a concrete FrontController, should be completely independent of the nature of a Client making a request. Instead, I created a generic Request object w/arguments and have a concrete FrontController translate any client-specific details into such a generic Request, before delegating to an ApplicationController.
    3.) In the light of the (2.) above, I am not sure what constitutes a "response" from an ApplicationController back to a FrontController. It seems to me that the only universal "response" is a LogicalViewEnumeration: what View to present once a command has been completed, in many cases a "don't care", or a "show the requestor", or a "show a home page" (not every request has to result in changing a View). Well, perhaps a LogicalViewEnumeration as well as possible View arguments (?).
    4.) In the light of the (3.) above, I suspect that any failures in Request delegation, or Command execution, should be perhaps propagated back to a FrontController by exceptions only, since, say, a WebFrontController might want to show a click-through error page, when a SwingFrontController might prefer to show an error dialog box, a LogicalErrorViewEnumeration might not make sense at all in the context of a particular Client, for example a queueing Client.
    5.) In the light of the (4.) above, there is the question of an appropriate Request interface (into an ApplicationController), an appropriate Response interface (back into a FrontController), as well as an appropriate ViewArguments interface (into a FrontController and later into a View). The problem with generic Requests is that they can be created with nonsensical argument combinations, so shouldn't Requests be abstract and force proper arguments in concrete subclasses, through explicit constructors (in a sense, degenerate Commands)? The problem with Responses and ViewArguments is that... well, I have not found any formal discussion anywhere as to what those should look like. In most samples I have encountered, Responses include Client-specific implementation details, as mentioned in (2.), above.
    6.) Some CCS discussions seem to introduce a Flow Manager at the ApplicationController level. It seems puzzling to me, since the whole point of the Command and Controller Strategy flavor seems to be centralization of business logic execution within self-contained Command objects. Shouldn't Requests get associated with Handlers (objects capable of actually carrying out Requests) and transformed into Commands inside an ApplicationController, thus Commands themselves return appropriate LogicalViewEnumeration back to an ApplicationController, back to a FrontController? Let's consider a ShowMyShippingAddress request coming into the framework: unless such a Request is eventually treated as a Command returning a particular LogicalViewEnumeration, it is suddenly a Flow Manager "acting" as a business logic driver. I guess the question here is: except for a few special cases handled by a particular ApplicationController (authentication, error conditions, default behavior, etc.), should flow management be considered stand-alone, or always delegated to Commands?
    7.) Some CCS discussions seem to include an extra Request argument that specifies an ApplicationController to use (Request.Action="create", Request.Controller="account", Request.Username="me-me-me"), instead of using a Router inside of a FrontController to resolve to a particular ApplicationController through a generic action (Request.Action="createAccount", Request.Username="me-me-me"). I am not sure about the reason for such a design decision: why should a Client or a FrontController be allowed to concern itself with an implementation-level structure of the framework? Wouldn't any framework state -dependent ApplicationController resolution issues be best handled inside a Router, used by a FrontController to resolve [obtain] an appropriate ApplicationController, thus preventing Clients from ever forcing the framework into a possibly inconsistent behavior?
    Any comments appreciated...
    Thanks,
    Gary

    gniemcew wrote:
    1.) Some CCS discussions seem to assign View presentation (sometimes called "dispatch", or "rendering", or "forwarding"?) to an ApplicationController. It seems puzzling to me, since only a concrete FrontController should include any knowledge of a concrete View structure. Shouldn't only a FrontController perform a logical-to-physical resource mapping, thus encapsulating knowledge whether a particular View is a separate, stand-alone Web page or a compound, argument-driven Swing object, and how to "present it" (by either redirecting to a Web page, or bringing a particular Swing object into the foreground)?It is hard to tell without reading the actual discussion, but my guess is that the posters were either conflating or being loose with the distinction between a FrontController and an ApplicationController. The former is (normally) intimately tied to the actual view being used (HTTP, Swing, etc.) whereas the ApplicationController typically is not. Both are involved in dispatch and event processing. The former normally renders a view whereas the latter does not.
    gniemcew wrote:
    2.) Some CCS discussions seem to introduce Client-specific implementation details at the ApplicationController level, for example "HTTP requests" or "HTTP responses". It seems puzzling to me, since I feel that every part of the framework, except for a concrete FrontController, should be completely independent of the nature of a Client making a request. Instead, I created a generic Request object w/arguments and have a concrete FrontController translate any client-specific details into such a generic Request, before delegating to an ApplicationController.Generic is fine. However, you can become generic to the point where your Request and Response interfaces are only acting as "marker" interfaces (think of java.io.Serializable). Writing a truly generic controller is possible, but personally, I have never found the effort justified.
    gniemcew wrote:
    3.) In the light of the (2.) above, I am not sure what constitutes a "response" from an ApplicationController back to a FrontController. It seems to me that the only universal "response" is a LogicalViewEnumeration: what View to present once a command has been completed, in many cases a "don't care", or a "show the requestor", or a "show a home page" (not every request has to result in changing a View). Well, perhaps a LogicalViewEnumeration as well as possible View arguments (?).A given service (if you ascribe to SOA) should be the fundamental unit in your architectural design. A good application controller would be responsible for determining how to dispatch a given Command. Whether a Command pattern is used or whether service methods are invoked directly from your FrontController, the ApplicationController should enforce common service aspects. These include authentication, authorization, auditing, orchestration, validation, logging, error handling, just to name a few.
    The ApplicationController should ideally offload these aspects from a given service. The service would indicate how the aspects are to be applied (e.g., strong authentication required, x role required, fetching of existing process state, etc.) This allows services to be developed more quickly and to have these critical aforementioned aspects developed and tested centrally.
    Your FrontController, in contrast, is responsible for transforming whatever input it is designed to receive (HTTP form data posts, XML-RPC, etc.) and ensure that it honors the contract(s) that the ApplicationController establishes. There are no cut-and-dry decisions though about when a given piece of functionality should be ApplicationController or FrontController. Take error handling. Should I emit just a generic ServiceException or allow the FrontController to decide what to do with a more concrete checked exception? (The FrontController, in any case, should present the error to the user in a manner dictated by the protocol it serves).
    gniemcew wrote:
    4.) In the light of the (3.) above, I suspect that any failures in Request delegation, or Command execution, should be perhaps propagated back to a FrontController by exceptions only, since, say, a WebFrontController might want to show a click-through error page, when a SwingFrontController might prefer to show an error dialog box, a LogicalErrorViewEnumeration might not make sense at all in the context of a particular Client, for example a queueing Client.See above. Yes. However, the ApplicationController could easily 'hide' details about the failure. For example, any number of exceptions being mapped to a generic DataAccessException or even more abstractly to a ServiceFailureException. The ApplicationController could indicate whether the failure was recoverable and/or populate information necessary to speed up production support (e.g., mapping exceptions to error codes and/or providing a primary key in an error audit log table for support to reference). A given FrontController would present that information to the user in the method that makes sense (e.g., error dialog for Swing, error page for HTML, etc.)
    gniemcew wrote:
    5.) In the light of the (4.) above, there is the question of an appropriate Request interface (into an ApplicationController), an appropriate Response interface (back into a FrontController), as well as an appropriate ViewArguments interface (into a FrontController and later into a View). The problem with generic Requests is that they can be created with nonsensical argument combinations, so shouldn't Requests be abstract and force proper arguments in concrete subclasses, through explicit constructors (in a sense, degenerate Commands)? The problem with Responses and ViewArguments is that... well, I have not found any formal discussion anywhere as to what those should look like. In most samples I have encountered, Responses include Client-specific implementation details, as mentioned in (2.), above.See comment on marker interfaces above. Nothing, however, stops you from requiring a certain sub-type in a given service method. You can still pass in the interface and validate the proper type by an assert statement (after all, in the vast majority of situations, the proper service method should get the proper instance of a given Request object). IMO, the FrontController would create the Command instance which would be passed to the ApplicationController which would dispatch and invoke the proper service method. A model response would be received by the FrontController which would then render the appropriate view.
    gniemcew wrote:
    6.) Some CCS discussions seem to introduce a Flow Manager at the ApplicationController level. It seems puzzling to me, since the whole point of the Command and Controller Strategy flavor seems to be centralization of business logic execution within self-contained Command objects. Shouldn't Requests get associated with Handlers (objects capable of actually carrying out Requests) and transformed into Commands inside an ApplicationController, thus Commands themselves return appropriate LogicalViewEnumeration back to an ApplicationController, back to a FrontController? Let's consider a ShowMyShippingAddress request coming into the framework: unless such a Request is eventually treated as a Command returning a particular LogicalViewEnumeration, it is suddenly a Flow Manager "acting" as a business logic driver. I guess the question here is: except for a few special cases handled by a particular ApplicationController (authentication, error conditions, default behavior, etc.), should flow management be considered stand-alone, or always delegated to Commands?There are distinct kinds of flow management. For example, orchestration (or BPM) is properly at either the service or ApplicationController layers. However, determining which view to display is properly at the FrontController layer. The ApplicationController should receive a Command (with a populate Request) and return that Command (with a populated Response). Both the Request and Response are fundamentally model classes (within MVC). The FrontController is responsible for populating the Request and/or Command and rendering the Response and/or Command. Generic error handling is usually centralized for both controllers.
    gniemcew wrote:
    7.) Some CCS discussions seem to include an extra Request argument that specifies an ApplicationController to use (Request.Action="create", Request.Controller="account", Request.Username="me-me-me"), instead of using a Router inside of a FrontController to resolve to a particular ApplicationController through a generic action (Request.Action="createAccount", Request.Username="me-me-me"). I am not sure about the reason for such a design decision: why should a Client or a FrontController be allowed to concern itself with an implementation-level structure of the framework? Wouldn't any framework state -dependent ApplicationController resolution issues be best handled inside a Router, used by a FrontController to resolve [obtain] an appropriate ApplicationController, thus preventing Clients from ever forcing the framework into a possibly inconsistent behavior?I am not 100% sure of what you are getting at here. However, it seems to be the method by which commands are dispatched. They are in effect allowing a FrontController to dictate which of n ApplicationControllers should receive the request. If we allow a FrontController to directly invoke a service method, then the ApplicationController is simply a centralized framework that should always be invoked for each service method (enforced via AOP or some other mechanism). If there is a single, concrete ApplicationController which handles dispatch, then all FrontControllers communicate directly with that instance. It is really just a design decision (probably based on your comfort level with concepts like AOP that allow the ApplicationController to exist solely behind the scenes).
    I might have totally missed your questions, but those are my thoughts on a Monday. Best of luck.
    - Saish

Maybe you are looking for

  • MS Access 2010 and Oracle SQL Developer Version 4.0.3.16 Error

    OS: Windows 7 Enterprise System Type: 64-bit Operating System I can not get MS Access 2010 to work/open with SQL Developer version 4.0.3.16. ERROR when testing connection to MS Access 2010 "Status : Failure -Test failed: [Microsoft][ODBC Driver Manag

  • Am I the only person that thinks this is a problem?

    I have a Iphone4 and my friend sends me a multimedia text and I open it to find that it has came in two parts, one for the pic an the other for the sound which destroys the whole idea of the multimedia text for me, then I say ok if I can't enjoy it t

  • Cannot launch VM console

    When trying to connect to the console for a VM, I get the Java dialog box with OK - then nothing else. The Java Console shows: 28/02/2012 8:52:03 AM com.oracle.ovm.ras.proxy.RasProxyApplet main INFO: Server : dcporat03.hearing.net 28/02/2012 8:52:03

  • Need info about CPU and HDD for Tecra 8200

    Hi Guys im new and have just bought the above laptop. However i want a faster CPU and bigger Harddrive (10GIG at the mo after 40 GIG if possible) and my CPU is Intel Pentium III 750MHZ. Please could someone point me in the right direction of where i

  • Error exporting NFS, not supported by fstype "hfs" (readdir), how to fix?

    Hi there! I went in single user mode on my server and did a "fsck -fy /" (old linux habit of putting the slash there). When I rebooted, I was not able to export using NFS and received this error in the logs. 14/05/11 11:57:55 AM          /sbin/nfsd[6