Instances and members

In the program below, the first println() produces "true".
The second println() yields a compile time error - "cannot find symbol 'x' "
If "obj" is indeed a "Foobar", why does the compiler not see its 'x' member?
Thank you.
public class NewInstance
     public static void main(String[] params) throws Exception
          Foobar foobar = new Foobar();
          Object obj = foobar.getClass().newInstance();
          System.out.println(obj instanceof Foobar);
          System.out.println(obj.x);
class Foobar
     int x = 123;
}

I'm trying to see if I can write a program that
instantiates a class whose type is not known at
compile time.
Any hints?
I've tried all manner of permutations of reflection.String className = ...; // get the actual class name to instantiate here
Class clazz = Class.forName(className); // create the class
Object instance = clazz.newInstance(); // create an instance
Now what do you want to do with the instance? If you want to call methods on it, how are you going to do that unless you already know of some interface that the class implements? You wouldn't just create any willy-nilly class instance - you'd expect the one you're creating to implement a known instance.
MyInterface myInstance = (MyInterface) instance;
Now you can call whatever methods MyInterface defined.

Similar Messages

  • Possible to create new ASM instance and "import" existing diskgroup?

    This is my worst nightmare. Two days before a server was about to be shut down, it crashed on me, corrupting the filesystem where Oracle was installed. Setup was an HP-UX 11.11 server running Oracle 10g with ASM storage on a disk array. Both instances were in the filesystem that got corrupted, and amazingly, we don't have a backup, so I'm not able to restore the instance configs and restart the database. Presumably, my data is still sitting there on the disks that belong to the ASM diskgroup, but I don't know how to get at it. I started by creating a new ASM instance, but I can't figure out if there's a way to create a diskgroup out of those 16 disks without wiping out what's on them.
    V$ASM_DISK shows all the disks as MEMBERs, with the CREATE_DATE that they were originally created, so I know at least the headers are intact. So is there any way I can manually recreate that diskgroup in my new instance so it will mount the disks and let me at the data?
    I realize that not having backups is the height of stupidity, but that boat has sailed. My company also chose not to pay for Oracle Support this year, so I'm kind of on my own. If anybody can at least point me in the right direction or tell me that it's a lost cause, I'd appreciate it.

    Well, a little progress. I was able to finally mount the disks in my new ASM instance, and using asmcmd, I can actually see my datafiles sitting there. So now I'm thinking I should try manually creating a new database instance pointing to the spfile that's in there and try starting that. I'm also going to try using RMAN and the XMLDB FTP trick to copy those datafiles somewhere else so I know I can play with them.

  • Custom Report using Metrics of Instance and Server

    Hello
    I need to create a custom report using different instance and server metrics like:
    File System Space Available
    Tablesapaces
    Database Spaces usage
    Sort in Memory
    library Cache Hit
    Data Dictionary Hit
    Buffer Cache Hit
    I already made the report, but I can´t change the size of the graphic (for a better presentation on my report)....
    Do you know how can I change the size of the report?
    I think that I´m using a "metric" so for that reason I Can´t change the size ... :(

    I am currently having a problem with this report and drilldown to KSB1, the cost centers selected int S_ALR_87013611 are not transferring to KSB1 and thus all the cost centers come up in the call to KSB1, are you experiencing this problem? I am on V4.7

  • How to find name of report if I know name of instance and location of instance in Output File Store

    Hello all,
    can somebody help me to find name of the report if I know name of report instance and also location of instance in Output File Store. It should be done via Query Builder.
    It is ...rpt file as output from Crystal Reports. I tried few commands in Query Builder but usually they finished with timeout error.
    Could you help me and send specific command? Or way how to change timeout of Query Builder?
    Thanks.
    matus

    Hello all,
    We finally found solution.
    We knew that file is located on path .../Output/a_145/009/002/133521/~ce10c.....9332.rtf
    This file has more than 2 GB. We tried to find which report is related and provide necessary actions.
    As I mentioned we still failed due to timeout error - There was an error retrieving data from the server: CMS operation timed out after 9 minutes.
    So we tried to use our testing environment. We started there QueryBuilder and there we successfully tested that we found details about files from FileStore /like Name of the report in Launch Pad, CUID, ...
    SELECT SI_NAME, SI_CUID, SI_FILES FROM CI_INFOOBJECTS WHERE SI_FILES.SI_PATH = 'frs://Input/a_148/020/000/5268/'
    or
    SELECT * FROM CI_INFOOBJECTS WHERE SI_FILES.SI_PATH = 'frs://Input/ a_148/020/000/5268/'
    Best regards,
    matus

  • Multiple instances and mail config

    Maybe I dont understand the right concept of multiple
    instances but what I did was the following:
    Setup up an instance for each domain I have running as a
    VHost on apache.
    What I was trying to accomplish is the failover of any one
    domain and also to use separate mail settings for each domain.
    But this is where I seem to have misunderstood the concept of
    multiple instances, is it not possible to use a different smtp
    server for each domain? When my forms for each domain generates an
    email I want the email to originate from that domain not the main
    one setup in CF...
    Thanks

    Your on the right track.
    Set up say 4 websites (virtual hosts) eg www.mydomain1.com,
    www.mydomain2.com etc
    Set up 4 cf instances if you have 4 domains, maybe call them
    mydomain1, mydomain2 etc
    Using the Web Server configuration tool, config the cf
    instance mydomain1 to virtual host mydomain1, cf instance mydomain2
    to VH mydomain2 etc
    The website should now be working using their own Cf
    instances.
    Go into the CF Admin, scroll to the bottom of the left menu
    and you should see Instance Manager
    Clicking on this should either reveal the 4 cf instances or
    you may have to add them (should be a button)
    Once you see all 4, you should be able to click on the admin
    for each individual instance and change the smtp server as
    appropriate.
    This won't give you failover though, if a CF instance goes
    down, that site is gone. Clustering is the way to give failover and
    you can achieve this fairly easily.
    Expanding on the above example, you would create 8 CF
    instances eg mydomain1-1 mydomain1-2, mydomain2-1 mydomain2-2.
    Create 4 clusters eg mydomain1cluster, mydomain2cluster etc
    In the CF Administrator Add mydomain1-1, mydomain1-2
    instances to mydomain1cluster etc
    Using the Web Server configuration tool, config the cluster
    mydomain1cluster to virtual host mydomain1 etc
    each domain should now be using 2 cf instances, you will be
    able to down on of those instances the the site will continue
    working.
    Back in the instance manager under CF Admin, you should now
    have 8 instances - config mydomain1-1, mydomain1-2 to the
    appropriate smtp server etc
    The above is for CF MX 6 onwards too, not sure about previous
    versions.
    I think thats what your after? I've skimmed over some parts
    above in relation to the clustering, but there's a handy doc
    floating around on the web by Herrlich & Ramuschkat that will
    guide you through it.
    BTW, those instances can sit on multiple physical servers for
    hardware redundancy. Depending on how many domains you have and the
    power of your machines, this is a preferred way to go although
    expensive due to multiple CF licences

  • IPad mini now terrible to use, apple support no help because warranty is up.  All cause by new ios8 update, wifi issues, many apps no longer work, apps that do work now crash regularly and sometimes take several instances and reboots to even open.

    IPad mini now terrible to use, apple support no help because warranty is up.  All cause by new ios8 update, wifi issues, many apps no longer work, apps that do work now crash regularly and sometimes take several instances and reboots to even open.

    need help uninstalling ios8 and going back to 7 where things worked please.

  • Stored procedure for getting host name, host instance and status of that host is it running or stopped.

    Hello all,
    yesterday I got one task in that I have to stored procedure for getting host name, host instance and status of that host is it running or stopped.
    any body knows where exactly, In which table this details are there in BizTalk databases.
    thanks

    Status of the host instance is not stored in the SQL database for you to query the status using stored procedure. You have to either use Powershell or WMI to get the status.
    In SQL, following table contains the details about the host like Name, LoginName, IsDisables etc but status of the host instance is not stored in the database.
    SELECT * FROM BizTalkMgmtDb..adm_HostInstance
    Powershell to get the status:
    http://axonolympus.nl/?page_id=186&post_id=969&cat_id=6&lang=en
    WMI to get the status:
    https://msdn.microsoft.com/en-us/library/aa561820.aspx?f=255&MSPPError=-2147217396
    https://msdn.microsoft.com/en-us/library/aa578621.aspx
    Regards,
    M.R.Ashwin Prabhu
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • How to attach a document to an instance and to an email

    I've a requirement to attach a document to an instance and attach the same to an email. Any suggestions??

    I've one suggestion see this code below:
    Attach in Instance:
    Fuego.Lib.Attachment attach ;
    attach.create(contents : attachBinary, name : attachname, description : attachdescription);
    Attach in Email :
    ProcessInstance.attachments[] attachments;
    foreach (a in ProcessInstance.attachments) {
    attachments.extend(source : a.contents, fileName : a.fileName);
    Mail reminderEmail;
    reminderEmail = Mail();
    reminderEmail.subject = "xxxx";
    reminderEmail.from = "[email protected]";
    reminderEmail.message = "xx";
    reminderEmail.attachments = attachments;
    MailSender sender;
    sender = MailSender(mail : reminderEmail);
    sender.send(implname : "mail");

  • Multiple instances and Apache 2.2

    I went thru the below livedoc to create multiple instances
    and then associate them with apache config..
    http://tinyurl.com/yzjpsl
    But the instances are all started but I have two problems.
    1. I cant find the CF administrator for all the sites
    2. I can go to each instance administrator page but not the
    main one and also apache does not resolve the VHosts.
    Thus if I type in the full domain for one of the instance
    sites then I get the page not found..
    SO assume my problem is with apache config since the instance
    sites are started and I can access them on the LAN.
    This is my changes I made to the config of apache..
    # JRun Settings
    LoadModule jrun_module
    "C:/JRun4/lib/wsconfig/1/mod_jrun22.so"
    <IfModule mod_jrun22.c>
    JRunConfig Verbose false
    JRunConfig Apialloc false
    JRunConfig Ssl false
    JRunConfig Ignoresuffixmap false
    #JRunConfig Serverstore
    "C:/JRun4/lib/wsconfig/1/jrunserver.store"
    #JRunConfig Bootstrap 127.0.0.1:51020
    #JRunConfig Errorurl <optionally redirect to this URL on
    errors>
    #JRunConfig ProxyRetryInterval 600
    #JRunConfig ConnectTimeout 15
    #JRunConfig RecvTimeout 300
    #JRunConfig SendTimeout 15
    AddHandler jrun-handler .jsp .jws .cfm .cfml .cfc .cfr
    .cfswf
    </IfModule>
    # Use name-based virtual hosting.
    NameVirtualHost *:80
    <VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "E:/Apache2/htdocs/nathess"
    ServerName www.nathess.com
    <IfModule mod_jrun22.c>
    JRunConfig Verbose false
    JRunConfig Serverstore
    "C:/JRun4/lib/wsconfig/1/jrunserver.store"
    JRunConfig Bootstrap 127.0.0.1:51000
    </IfModule>
    </VirtualHost>
    <VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "E:/Apache2/htdocs/mgel"
    ServerName www.mariannegel.com
    <IfModule mod_jrun22.c>
    JRunConfig Verbose false
    JRunConfig Serverstore
    "C:/JRun4/lib/wsconfig/MGel/jrunserver.store"
    JRunConfig Bootstrap 127.0.0.1:51002
    </IfModule>
    </VirtualHost>
    <VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "E:/Apache2/htdocs/destinationcdg"
    ServerName www.destinationcdg.com
    <IfModule mod_jrun22.c>
    JRunConfig Verbose false
    JRunConfig Serverstore
    "C:/JRun4/lib/wsconfig/DestinationCDG/jrunserver.store"
    JRunConfig Bootstrap 127.0.0.1:51003
    </IfModule>
    </VirtualHost>
    <VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "E:/Apache2/htdocs/mls"
    ServerName www.multilingit.com
    <IfModule mod_jrun22.c>
    JRunConfig Verbose false
    JRunConfig Serverstore
    "C:/JRun4/lib/wsconfig/MLS/jrunserver.store"
    JRunConfig Bootstrap 127.0.0.1:51004
    </IfModule>
    </VirtualHost>

    I went thru the below livedoc to create multiple instances
    and then associate them with apache config..
    http://tinyurl.com/yzjpsl
    But the instances are all started but I have two problems.
    1. I cant find the CF administrator for all the sites
    2. I can go to each instance administrator page but not the
    main one and also apache does not resolve the VHosts.
    Thus if I type in the full domain for one of the instance
    sites then I get the page not found..
    SO assume my problem is with apache config since the instance
    sites are started and I can access them on the LAN.
    This is my changes I made to the config of apache..
    # JRun Settings
    LoadModule jrun_module
    "C:/JRun4/lib/wsconfig/1/mod_jrun22.so"
    <IfModule mod_jrun22.c>
    JRunConfig Verbose false
    JRunConfig Apialloc false
    JRunConfig Ssl false
    JRunConfig Ignoresuffixmap false
    #JRunConfig Serverstore
    "C:/JRun4/lib/wsconfig/1/jrunserver.store"
    #JRunConfig Bootstrap 127.0.0.1:51020
    #JRunConfig Errorurl <optionally redirect to this URL on
    errors>
    #JRunConfig ProxyRetryInterval 600
    #JRunConfig ConnectTimeout 15
    #JRunConfig RecvTimeout 300
    #JRunConfig SendTimeout 15
    AddHandler jrun-handler .jsp .jws .cfm .cfml .cfc .cfr
    .cfswf
    </IfModule>
    # Use name-based virtual hosting.
    NameVirtualHost *:80
    <VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "E:/Apache2/htdocs/nathess"
    ServerName www.nathess.com
    <IfModule mod_jrun22.c>
    JRunConfig Verbose false
    JRunConfig Serverstore
    "C:/JRun4/lib/wsconfig/1/jrunserver.store"
    JRunConfig Bootstrap 127.0.0.1:51000
    </IfModule>
    </VirtualHost>
    <VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "E:/Apache2/htdocs/mgel"
    ServerName www.mariannegel.com
    <IfModule mod_jrun22.c>
    JRunConfig Verbose false
    JRunConfig Serverstore
    "C:/JRun4/lib/wsconfig/MGel/jrunserver.store"
    JRunConfig Bootstrap 127.0.0.1:51002
    </IfModule>
    </VirtualHost>
    <VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "E:/Apache2/htdocs/destinationcdg"
    ServerName www.destinationcdg.com
    <IfModule mod_jrun22.c>
    JRunConfig Verbose false
    JRunConfig Serverstore
    "C:/JRun4/lib/wsconfig/DestinationCDG/jrunserver.store"
    JRunConfig Bootstrap 127.0.0.1:51003
    </IfModule>
    </VirtualHost>
    <VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "E:/Apache2/htdocs/mls"
    ServerName www.multilingit.com
    <IfModule mod_jrun22.c>
    JRunConfig Verbose false
    JRunConfig Serverstore
    "C:/JRun4/lib/wsconfig/MLS/jrunserver.store"
    JRunConfig Bootstrap 127.0.0.1:51004
    </IfModule>
    </VirtualHost>

  • Looking to use BPEL Instance and counter inside of a transformation

    I'm trying to find a way to include the BPEL instance and a counter within a BPEL transformation to create a unique key.
    Example, picking up files with multiple lines and no unique keys, each file is processed as a unique BPEL instance (key 1), and would like to use the row number (of the file, but not specified in the file) as the second key.
    My process takes a file from a file adapter and loads it into a database adapter if that helps.
    Any ideas would be appreciated.

    We ended up finding a Node-set Function -> Position to return the position inside of the dataset.

  • Asm, instance and service failing to start 10g rac redhat el5

    hi,
    i have been following a how to guide from oracle's website about implementing a 10g rac system using el5 (http://www.oracle.com/technology/pub/articles/hunter_rac10gr2_iscsi.html), by the end of the installation and setup I had both the nodes up and running and all services were up and running. Then under the root account I rebooted one of the nodes. now when I check the status of the services I get this:
    [oracle@rac01 ~]$ crs_stat -t
    Name           Type           Target    State     Host
    ora.orcl.db    application    ONLINE    ONLINE    rac01
    ora...._taf.cs application    ONLINE    ONLINE    rac02
    ora....cl1.srv application    ONLINE    OFFLINE
    ora....cl2.srv application    ONLINE    ONLINE    rac02
    ora....l1.inst application    OFFLINE   OFFLINE
    ora....l2.inst application    ONLINE    ONLINE    rac02
    ora....SM1.asm application    OFFLINE   OFFLINE
    ora....01.lsnr application    ONLINE    ONLINE    rac01
    ora.rac01.gsd  application    ONLINE    ONLINE    rac01
    ora.rac01.ons  application    ONLINE    ONLINE    rac01
    ora.rac01.vip  application    ONLINE    ONLINE    rac01
    ora....SM2.asm application    ONLINE    ONLINE    rac02
    ora....02.lsnr application    ONLINE    ONLINE    rac02
    ora.rac02.gsd  application    ONLINE    ONLINE    rac02
    ora.rac02.ons  application    ONLINE    ONLINE    rac02
    ora.rac02.vip  application    ONLINE    ONLINE    rac02though I can start the asm instance manually by
    srvctl start asm -n rac01and it starts but the instance and service on the rebooted node still wont start. is there a log file which tells me what the error is when it tries to start the instance? what can I do to ensure that if a node is rebooted that all of the services get started correctly and the node automatically rejoins the cluster (i thought I had set all of this from the instructions of the guide I was following).
    Regards
    Martin.

    Check ASM resource:
    crs_stat -p "resource_name
    $ crs_stat | grep NAME\= | grep ASM1
    NAME=ora.rac01.ASM1.asm
    $ crs_stat -p ora.rac01.ASM1.asm
    NAME=ora.rac01.ASM1.asm
    TYPE=application
    ACTIVE_PLACEMENT=0
    *AUTO_START*=1
    CHECK_INTERVAL=600
    DESCRIPTION=CRS application for ASM instance
    What do you see AUTO_START?
    if 1 = auto start:
    or check error ASM while start... at ASM_HOME/log/rac01/racg/*
    If AUTO_START=2
    Oracle Clusterware is configured to start the VIP, listener, instance, ASM, database services and other resources during system boot. Starting with 10.1.0.4, it is possible to modify some resources to have their profile parameter AUTO_START set to the value 2. This means that after node reboot, or when Oracle Clusterware is started, resources with AUTO_START=2 will need to be started manually via srvctl. Please work with Oracle Support if you need to modify this attribute.
    If AUTO_START=2 and need to change to 1:
    Example:
    $ crs_stat -p ora.rac01.ASM1.asm
    NAME=ora.rac01.ASM1.asm
    TYPE=application
    ACTIVE_PLACEMENT=0
    AUTO_START=2
    $ crs_stat -p ora.rac01.ASM1.asm > ORA_CRS_HOME/crs/public/ora.rac01.ASM1.asm
    $ crs_unregister ora.rac01.ASM1.asm
    $ crs_stat -p ora.rac01.ASM1.asm
    CRS-0210: Could not find resource 'ora.rac01.ASM1.asm
    $ vi ORA_CRS_HOME/crs/public/ora.rac01.ASM1.asm.cap
    AUTO_START=2
    to
    AUTO_START=1
    $ crs_register ora.rac01.ASM1.asm
    $ crs_stat -p ora.rac01.ASM1.asm
    NAME=ora.rac01.ASM1.asm
    TYPE=application
    *AUTO_START=1*
    Edited by: Surachart Opun (HunterX) on Jul 31, 2009 1:06 PM

  • How to set the View instance and view  attribute to lov field ?

    Hi
    I created lov and textfield programatically.
    I want to set the viewattribute and view instance to that items(lovbean, texfieldbean).
    How to set programatically?
    Thanks in Advance
    Awadesh

    Hi
    Thanks. Its working fine. But now i got some another issue.
    after setting, i put simple system.out.println(Pagecontext.getparameter("idoflov"));
    But it returns null value.
    why. Actully i want to pass this value (according to my requirement).
    The view instance and view attribute are setting correctly. But after that i checked means it returns null value .
    plz let me know.
    Thanks

  • Oracle financials on one instance and PO,PA,EAM, Inventory etc on another

    Hi all,
    Can any one suggest a possible solution architecture with Oracle HRMS and Financial suite on one instance and all other modules like PO, PA, Inventory, EAM etc on another instance?
    Regards,
    Rajesh

    Please open a new thread for new questions.
    In your case, here is what you can do
    1) Manually copy all HR setups from HR instance to the SCM instance.
    2) Extract data such as employees, assignments etc.c from HR instance
    3) Load the data into the SCM instance using API/Interfaces.
    4) Retire HR instance.
    Hope this answers your question
    Sandeep Gandhi
    Omkar Technologies Inc.
    Independent Techno-functional Consultant
    513-325-9026

  • V$instance and V$database

    Hi
    Are these tables can contain more than one row? in which situation?

    Sagi wrote:
    Thinks for the help
    I'm trying to figure out some things about RAC environment and SBDB.What is SBDB?
    Is out of tables ($ V $ V INSTANC and DATABASSE) I can know whether the environment is a RAC environment
    I would suggest to look for the parameter cluster_database in the parameter file. If this parameters comes as true , that means you are on a clustered database. Otherwise, it would be false all the time. I don't have a db with me to test the output of both the views but based on the documentation, there is no column in both which does tells you that its a rac or non-rac db.
    and how NODE / DB / INSTANCE have around, same goes for SBDB environment.Sorry, I couldn't parse your statement. Can you rephrase please?
    Aman....

  • Custom Workflow generates a thousand of Workflow Instances and EREs

    Hi everyone,
    I developed a Custom Workflow that complete user attributes information when a user select a value from a drop down list. I tested this workflow with a Request MPR  with an Action Type "Create" and the workflow Works perfectly. But now, I
    have to use this workflow in an Action Type "Modify" , when I changed it, the workflow Works fine but generates  a thousand of Workflow Instances and in consequence a thousand of EREs.
    Can you help me please?
    Thanks in advance,

    Make sure that the change invoked by your workflow is not used as button to run another workflow - described scenario looks like you have created a loop.
    If you found my post helpful, please give it a Helpful vote. If it answered your question, remember to mark it as an Answer.

Maybe you are looking for

  • Can I use icloud with apple tv gen1

    Hi, I'm trying to figure out if i can put my apple tv gen 1 library on the cloud?  We have 3 ipads and at least 6 ipods running around this house.  It would be nice to put everything on the cloud and clear up some space on my desktop.  Also, if I can

  • Transfer photos from iPhone 5 to iPhoto on Mac

    Sometimes my photos automatically transfer from the iphone to iphoto - or maybe I am doing something to cause it because I am playing around with it.  But it generally takes hours.  I want to do this quickly.  Can you tell me how?

  • How do I put a space after a paragraph in Pages 5?

    This is something I did frequently in older Pages versions and in Word. Where is the setting for space before and after paragraphs?

  • Problem getting bg image to show after integrating Web Gallery in page

    Hi, I'm new to Dreamweaver this year just coming over from the bad guys. I was looking to create a web gallery for my client when I came across a great article by David Powers that really worked well and made it pretty simple. (see here) http://found

  • Cash Flow Statement Table.

    Dear All, I want an information regarding Cash Flow Statement , that where i can get the well prepared cash flow statement with monetary information. I have already went through and explored the following options , But I am getting empty reports with