Error -- Java code using OIM API to find no of users in OIM

Hi Experts,
I hav a requirement that I need to query OIM to find out the total no of active users in the system using a stand alone java program to determine some other process. So I have developed a simple java code but it fails in the below line
rset=userIntf.findAllUsers(map);  -- It throws null pointer exception
I have tried with deleteUser() instead of findUsers() , still it throws the null pointer exception on the same line.I have checked the other posts in the forum but could not find out where is the mistake. Can u please suggest me??
Here is the code
System.setProperty("XL.HomeDir","D:/bea-oim/xellerate");
System.setProperty("java.security.auth.login.config","D:/bea-oim/xellerate/config/authwl.conf");
System.setProperty("java.security.policy","D:/bea-oim/xellerate/config/xl.policy");
System.setProperty("log4j.configuration","D:/bea-oim/xellerate/config/log.properties");
tcUtilityFactory utilityFactory = null;
tcUserOperationsIntf userIntf = null;
          try
               tcResultSet rset;
               ComplexSetting config = ConfigurationClient.getComplexSettingByPath("Discovery.CoreServer");
               final Hashtable env = config.getAllSettings();
               tcSignatureMessage moSignature = tcCryptoUtil.sign("xelsysadm","PrivateKey");
               utilityFactory = new tcUtilityFactory(env, moSignature);
               userIntf=(tcUserOperationsIntf)utilityFactory.getUtility("Thor.API.Operations.tcUserOperationsIntf");
               HashMap map = new HashMap();
               map.put("Users.Status","Active");
               rset=userIntf.findAllUsers(map);
System.out.println(rset.getRowCount());
     catch(NullPointerException ne)
     System.out.println(ne.getMessage());
     ne.printStackTrace();
     catch(Exception e)
     System.err.println(e.getMessage());
     e.printStackTrace();
Thanks & Regards
INIYA

* To change this template, choose Tools | Templates
* and open the template in the editor.
import java.util.HashMap;
import java.util.Properties;
import java.util.*;
import Thor.API.tcUtilityFactory;
import Thor.API.Operations.*;
import Thor.API.tcResultSet;
import com.thortech.xl.crypto.tcCryptoUtil;
import com.thortech.xl.util.config.ConfigurationClient;
* @author Rajiv
public class CreateBulkUsers {
public static void main(String args[])
System.setProperty("XL.HomeDir", "E:\\oim\\server\\xellerate");
System.setProperty("java.security.auth.login.config", "E:\\oim\\server\\xellerate\\config\\auth.conf");
System.setProperty("java.security.policy", "E:\\oim\\server\\xellerate\\config\\xl.policy");
          tcUtilityFactory utilityFactory = null;
tcUserOperationsIntf userIntf = null;
try
com.thortech.xl.util.config.ConfigurationClient.ComplexSetting config = ConfigurationClient.getComplexSettingByPath("Discovery.CoreServer");
java.util.Hashtable env = config.getAllSettings();
com.thortech.xl.crypto.tcSignatureMessage moSignature = tcCryptoUtil.sign("xelsysadm", "PrivateKey");
utilityFactory = new tcUtilityFactory(env, moSignature);
// System.out.println((new StringBuilder()).append("utilityFactory = ").append(utilityFactory).toString());
userIntf = (tcUserOperationsIntf)utilityFactory.getUtility("Thor.API.Operations.tcUserOperationsIntf");
HashMap map = new HashMap();
map.put("Users.Status", "Active");
tcResultSet rset = userIntf.findAllUsers(map);
System.out.println(rset.getRowCount());
catch(NullPointerException ne)
System.out.println(ne.getMessage());
ne.printStackTrace();
catch(Exception e)
System.err.println(e.getMessage());
e.printStackTrace();
Include all the JARs to run this class from outside not only of OIm of JBoss or Weblogic also.
eg: jboss\client and jboss\lib

Similar Messages

  • How can i return object from oracle in my java code using pl/sql procedure?

    How can i return object from oracle in my java code using pl/sql procedure?
    And How can i returned varios rows fron a pl/sql store procedure
    please send me a example....
    Thank you
    null

    yes, i do
    But i can't run this examples...
    my problem is that i want recive a object from a PL/SQL
    //procedure callObject(miObj out MyObject)
    in my java code
    public static EmployeeObj callObject(Connection lv_con,
    String pv_idEmp)
    EmployeeObj ret = new EmployeeObj();
    try
    CallableStatement cstmt =
    lv_con.prepareCall("{call admin.callObject(?)}");
    cstmt.registerOutParameter(1, OracleTypes.STRUCT); // line ocurr wrong
    //registerOutParameter(int parameterIndex, int sqlType,String sql_name)
    cstmt.execute();
    ret = (EmployeeObj) cstmt.getObject(1);
    }//try
    catch (SQLException ex)
    System.out.println("error SQL");
    System.out.println ("\n*** SQLException caught ***\n");
    while (ex != null)
    System.out.println ("SQLState: " + ex.getSQLState ());
    System.out.println ("Message: " + ex.getMessage ());
    System.out.println ("Vendor: " + ex.getErrorCode ());
    ex = ex.getNextException ();
    System.out.println ("");
    catch (java.lang.Exception ex)
    System.out.println("error Lenguaje");
    return ret;
    Do you have any idea?

  • Need a java code using swing that can do master configuration

    I need a java code using swing that can do master configuration.For example, in the 1st screen it will show all configuration checke boxes . According to those selected check box, it will show the needed panels sequentially and finnaly it will update many xml files.

    TapasB wrote:
    I need a java code .......and I wish you much luck in creating it. Please come back if you have a specific question on a specific part of your code that is not working quite right.

  • Can i develope a java application using C API

    hai,
    i have C api, the project was developed in C before, now i am having that api. I have to do that in java by using that C api.
    can any one suggest me how to do this?

    Your question is not that very clear!! You want to convert the C api to a Java api? or you want to develop a Java application that uses the C api?
    For the first question I believe that you should check the functionality of the C api and re-code it in Java! do not believe you should find anything imposible in that! (unless that api is trying to do something crzy directly with memory)
    For the second question then I believe you will have to use native calling or something like that. I have never used it, but read about it, and it seems one way how Java can interect with C.
    Over here there is a forum.
    Regards,
    Sim085

  • Sharepoint-Hosted App giving FORBIDDEN error when i use REST Api

    Hi,
    I have created a sharepoint hosted app which will create Team site on button click.
    I used REST Api  and  NAPA Tool to develop this app.
    Napa tool gives to things ClientWebpart.aspx and Default.aspx.
    When i run my Default.aspx code is working fine but ClientWebpart.aspx is giving FORBIDDEN error when i am trying to create site.
    Below is the code which i used to create site
    code:
    var hostweburl;
    var appweburl;
    $(document).ready(function () {
    hostweburl= decodeURIComponent(getQueryStringParameter("SPHostUrl"));
    appweburl = decodeURIComponent(getQueryStringParameter("SPAppWebUrl"));
    function createSPWeb() {
    $.ajax(
    url: appweburl +
    "/_api/SP.AppContextSite(@target)/web/webinfos/add?@target='" +
    hostweburl + "'",
    type: "POST",
    data: JSON.stringify(
    'parameters':
    '__metadata': { 'type': 'SP.WebInfoCreationInformation' },
    'Url': 'RestSubWeb',
    'Title': 'RestSubWeb',
    'Description': 'REST created web',
    'Language': 1033,
    'WebTemplate': 'sts#0',
    'UseUniquePermissions': false
    headers: {
    "accept": "application/json;odata=verbose",
    "content-type": "application/json;odata=verbose",
    "X-RequestDigest": $("#__REQUESTDIGEST").val()
    success: successHandler,
    error: errorHandler
    NOTE:This is on sharepoint online.
    Please help
    Regards,
    sudeep

    So in the app you are testing, are you using the FQDN or the NetBIOS name? Bad practice but could you test with both (hard code the absolute URL for testing purposes) then retest your app?
    If you are making a web part based on the new app model this will be an "app part" and probably have the same issues you are experiencing. If this is for something internal rather than a product you are developing to resell then the script editor /
    content editor web part approach could work for you.
    Paul
    Paul Mather | Twitter |
    http://pwmather.wordpress.com | CPS

  • [METASOLV XML AP]devolop JAVA client using XML API for metasolv application

    Hi All,
    I am new in this group, and I need to help me to develop a java client to communicate with metasolv application using XML API.
    I read "XML API Developer’s Reference" document, but I still not understand how can I setup the cllient.
    I still need:
    1- What API needed(jar files) I must use to build the client
    2- A sample of source code using java.
    3- detailed guide to communicate with metasolv application using XML API.
    Thanks&Best Regards
    RADOUANE Mohamed

    any help please!!!!

  • Monitor java code using BAM

    Hi,
    I am new to BAM, and I have a specific use case, for which I couldnt find any doc in the web. I want to monitor a java code at different point using BAM. To be in more detail, I would like to add sensors at different location in my java code, which would possible push it to JMS queue and BAM monitors those data objects.
    Thanks,
    Sudarsan M

    Hi Sudarshan,
    Please look in the blog entry below that demonstrate how you can feed BAM Data objects by listening to JMS Queue/Topic.
    http://beatechnologies.wordpress.com/2011/05/20/integrating-oracle-bam-11g-with-bpel-jms-sensor-action/
    The example in the blog illustrate how a BPEL process uses a JMS Sensor action to publish Data to a JMS Queue and from there how it is picked up by External Message Sources in BAM.
    For your use case you can write a small client code to post an XML message from your Java Class to a Queue in Weblogic.
    Hope it helps.

  • Invoke exe through java code(using java.lang.Runtime)

    Iam trying to invoke an exe from java code.If i give the complete path for that exe it is running fine .But if i set the environment variable and directly execute the exe through command prompt it iss running fine , but it fails to run when i do the same using java code i.e. java.lang.Runtime.exec function

    Give "//" for directory seperator.
    E.g. r.exec("c://test//test.exe",null);
    Why? That doesn't look correct.It is correct. It will work fine. Try it out.But it doesn't add or solve anything. A forward slash
    does not need to be escaped.'
    It's not even escaping. It's just doubling up. If that works, I'd bet "C://///test///////test.exe" does also.

  • Sample JAVA code using Resource Adapter for RFC Connections

    Hi Java Knowledgeable Ones.
    I have successfully deployed the SAP Netweaver J2ee Engine "Resource Adapter for RFC Connections to ABAP Systems" to my Web Application Server.  Now I need to develop a JAVA application that would utilize this deployed resource adapter.  The resource adapter specifies the SAPClient, UserName, and password.  I am thinking that the JAVA code to invoke this connection would therefore not need to provide this information as it should be available in the resource adapter.
    Do you have sample code that you could send to me showing how to do this?
    Thanks,
    Kevin

    Hi Kevin,
    this is actually no good style! You should not open the connection with the adaptor knowing the password. Usually it should work via a connection that uses only basic rights  and the user has already authenticated and is using his security ticket.
    For security handling see:
    http://help.sap.com/saphelp_nw04/helpdata/en/61/f8bc3d52f39d33e10000000a11405a/frameset.htm
    Regards,
    Benny

  • Reverse-Engineer Java Code using JDeveloper

    Hi,
    Is it possible to reverse-engineer java code and produce class diagrams in JDeveloper? If so , how?
    I have JDeveloper 10g.
    Thanks

    Yes you can.
    Just open the java classes in a JDeveloper project, create a new class diagram and drag the classes onto the empty diagram.

  • Java SerialPort using COMM API

    Hi All,
    I am trying to develop a java program that will dial a GSM modem and send some data over it.For developing this i am using java rxtxcomm API with jdk 1.6_38 on windows 7 OS.I am using notifyOnDataAvailable method in order to listen to any incomming data.
    The following is the set of steps i need to perform
    1) I am first executing AT command to check if the modem is connected or not
    outpursteam.write("AR\r");
    the above statement should return OK if the modem is connected.
    2) then i will try to dial the number using DTD<modileNo> which should return CONNECT 9600.
    if the remote party is nor responding or some problem in dialing the above command will returrn ERROR
    3) Once the connection is open and no operation is performed for 1 Minute the connection will be closed by the destination which will be indicated By NO CARIER message.
    when i run my program the first statement will return OK so now i am dialing the specified destination number (Step 2) it should return CONNECT 9600 but i did not get any message.After 1 minute i am getting both CONNECT 9600 and NO CARIEIER message together.
    Can some one help me in resolving this problem
    Thanks&Regards
    kishore.m

    Presumably step 2 has a \r on it.

  • How to check special characters in java code using Java.util.regex package

    String guid="first_Name;Last_Name";
    Pattern p5 = Pattern.compile("\\p{Punct}");
    Matcher m5 =p5.matcher(guid);
    boolean test=m5.matches();
    I want to find out the weather any speacial characters are there in the String guid using regex.
    but above code is always returning false. pls suggest.

    Pattern.compile ("[^\\w]");The above will match any non [a-zA-Z0-9_] character.
    Or you could do
    Pattern.compile("[^\\s^\\w]");This should match anything that is not a valid charcter and is not whitespace.

  • Best practice of OSB logging Report handling or java code using publish

    Hi all,
    I want to do common error handling of OSB I did two implementations as below just want to know which one is the best practice.
    1. By using the custom report handler --> When ever we want to log we will use the report action of OSB which will call the Custom java class which
    Will log the data in to DB.
    2. By using plain java class --> creating a java class publish to the proxy which will call this java class and do the logging.
    Which is the best practice and pros and cons.
    Thanks
    Phani

    Hi Anuj,
    Thanks for the links, they have been helpful.
    I understand now that OSR is only meant to contain only Proxy services. The synch facility is between OSR and OSB so that in case when you are not using OER, you can publish Proxy services to OSR from OSB. What I didn't understand was why there was a option to publish a Proxy service back to OSB and why it ended up as a Business service. From the link you provided, it mentioned that this case is for multi-domain OSBs, where one OSB wants to use the other OSB's service. It is clear now.
    Some more questions:
    1) In the design-time, in OER no Endpoints are generated for Proxy services. Then how do we publish our design-time services to OSR for testing purposes? What is the correct way of doing this?
    Thanks,
    Umar

  • Error Add Item using DI API 2007  B

    Sirs,
         I gettin a error on add a item using a follow code:
                       If m_Item.GetByKey('100') = True Then
                            m_Item.ItemType = ItemTypeEnum.itItems
                            m_Item.ItemsGroupCode = 1
                            m_Item.ItemClass = ItemClassEnum.itcMaterial 
    'This line ocorred a error 'oToBP.ItemClass = {"Property 'ItemClass' of 'Item' is invalid"}
                            lErrorCode = m_Item.Update()
                        Else
                            lErrorCode = 1
                        End If
    Please,
    I'm waiting a urgent response .
    Great.
    Fábio Nascimento

    Fabio,
    In 2007 A the ItemsgroupCode start at 100 and not 1.
    Perhaps this is your problem.
    Christophe

  • Changing java code using Java program

    hi All,
    I have some java classes, which i need to modify. The changes are mechanical, like putting finally block for the methods where there is a try block.
    Please suggest on how to write a small java program that will accomplish the task. Some code snippets may be helpful.
    Thanks,
    Raj.

    no, you got me wrong. After i add the finally blocks,
    i will perform the clean up tasks there. The first
    part of adding the finally blocks,i want to perform
    using a program.No you really don't want to do this.
    a) This will not be easy and in fact will be quite messy.
    b) It doesn't gain you anything anyway. As you yourself just noted you will have to put appropriate code in all those blocks anyway.
    So give this up and do it manually and for next time you will have learned that you should follow the standards from your project from the start.

Maybe you are looking for

  • Report parameter

    hi all im new in report builder i want to make a report that based on an invoice no it will run i think i must make the invoice no as a user parameter that when the user enter the specific invoice_no areport will run according to this invoice_no the

  • Safari opening full screen, then automatically opens iTunes. Application ribbon on side of screen is inaccessible.

    Software was automatically installed on my i7 Mac during the last two weeks.  Now the Mac is using MOS 10.7.4 and Safari 6.0. Since Safari 6.0 installed on my i7 Mac last week, I have had four problems: 1)  Sarari now opens showing full screen, compl

  • Oracle 8i db import error

    while importing oracle 8.1.7.0.0 to oracle 11g R2, i am getting following error... IMP-00017: following statement failed with ORACLE error 3249: "CREATE TABLESPACE "TOOLS" DATAFILE '/home/oradata/oracanet/tools01.dbf' SI" "ZE 10485760 AUTOEXTEND ON N

  • RPT_MOPZ_COPY_STACK_XML shows SC version differs for JAVA and DUAL-Stack xml files

    Hi All, I am using the report/program RPT_MOPZ_COPY_STACK_XML to copy the stack xml file I used from a previous upgraded system. Systems are identical. However, report shows below.. "Software Component Version KRNL64UC7.20 [01200615320200013056] diff

  • OTN is in a mess

    Can someone at Oracle PLEASE sort OTN out. Many links are broken and it's very difficult to find useful information. This website is not a good advert for your company, guys!