How can i execute Spaces API in java main class?

Hi
I am able to execute Spaces API through portal application. However if i try to execute it in java main class, its throwing an exception
"SEVERE: java.io.FileNotFoundException: .\config\jps-config.xml (The system cannot find the path specified)"
oracle.wsm.common.sdk.WSMException: WSM-00145 : Keystore location or path can not be null or empty; it must be configured through JPS configuration or policy configuration override.
How can i set this path, so that i can execute Spaces API from java main class.
Need this main class to configure in cron job, to schedule a task.
Regards
Raj

Hi Daniel
Currently i have implemented create functionality in my portal application using Spaces API, which is working fine. Now the requirement is, i need to implement a "Cron Job" to schedule a task, which will execute to create space(for example once in a week). Cron job will execute only the main method. So I have created java main class, in which I have used Spaces API to perform create space operation. Then it was giving exception.
Later I understood the reason, as I am executing the Space API with a simple JSE client, its failing since a simple java program has no idea of default-keystore.jks, jps-config.xml, Security Policy. Hence i have included those details in main class. Now I am getting new error,
SEVERE: WSM-06303 The method "registerListener" was not called with required permission "oracle.wsm.policyaccess"
For your reference i have attached the code below, please help. How can i use Spaces API in java main method(i mean public static void main(String[] args) by giving all required information.
    public static void main(String[] args) throws InstantiationException,
                                                  GroupSpaceWSException,
                                                  SpacesException {
        Class2 class2 = new Class2();
        GroupSpaceWSContext context = new GroupSpaceWSContext();
        FactoryFinder.init(null);
        context.setEndPoint("http://10.161.226.30/webcenter/SpacesWebService");
        context.setSamlIssuerName("www.oracle.com");
        context.setRecipientKeyAlias("orakey");
        Properties systemProps = System.getProperties();
        systemProps.put("java.security.policy","oracle/wss11_saml_or_username_token_with_message_protection_client_policy");
        systemProps.put("javax.net.ssl.trustStore","C:\\Oracle\\Middleware11.1.7\\wlserver_10.3\\server\\lib\\cacerts.jks");
systemProps.put("oracle.security.jps.config","C:\\Oracle\\Middleware11.1.7\\user_projects\\domains\\workspace\\system11.1.1.7.40.64.93\\DefaultDomain\\config\\fmwconfig\\jps-config.xml");
        systemProps.put("javax.net.ssl.keyStore",C:\\Oracle\\Middleware11.1.7\\user_projects\\domains\\workspace\\system11.1.1.7.40.64.93\\DefaultDomain\\config\\fmwconfig\\consumer.jks");
        systemProps.put("javax.net.ssl.keyStorePassword", "Test12");
        System.setProperties(systemProps);
        GroupSpaceWSClient groupSpaceWSClient;
        try {
            groupSpaceWSClient = new GroupSpaceWSClient(context);
            System.out.println("URL: " +
                               groupSpaceWSClient.getWebCenterSpacesURL());
            //delete the Space
            List<String> groupSpaces = groupSpaceWSClient.getGroupSpaces(null);
            System.out.println("GroupSpaces:: " + groupSpaces.size());
        } catch (Exception e) {
Regards
Raj

Similar Messages

  • How can I assign image file name from Main() class

    I am trying to create library class which will be accessed and used by different applications (with different image files to be assigned). So, what image file to call should be determined by and in the Main class.
    Here is the Main class
    import org.me.lib.MyJNIWindowClass;
    public class Main {
    public Main() {
    public static void main(String[] args) {
    MyJNIWindowClass mw = new MyJNIWindowClass();
    mw.s = "clock.gif";
    And here is the library class
    package org.me.lib;
    public class MyJNIWindowClass {
    public String s;
    ImageIcon image = new ImageIcon("C:/Documents and Settings/Administrator/Desktop/" + s);
    public MyJNIWindowClass() {
    JLabel jl = new JLabel(image);
    JFrame jf = new JFrame();
    jf.add(jl);
    jf.setVisible(true);
    jf.pack();
    I do understand that when I am making reference from main() method to MyJNIWindowClass() s first initialized to null and that is why clock could not be seen but how can I assign image file name from Main() class for library class without creating reference to Main() from MyJNIWindowClass()? As I said, I want this library class being accessed from different applications (means different Main() classes).
    Thank you.

    Your problem is one of timing. Consider this simple example.
    public class Example {
        public String s;
        private String message = "Hello, " + s;
        public String toString() {
            return message;
        public static void main(String[] args) {
            Example ex = new Example();
            ex.s = "world";
            System.out.println(ex.toString());
    }When this code is executed, the following happens in order:
    1. new Example() is executed, causing an object to constructed. In particular:
    2. field s is given value null (since no value is explicitly assigned.
    3. field message is given value "Hello, null"
    4. Back in method main, field s is now given value "world", but that
    doesn't change message.
    5. Finally, "Hello, null" is output.
    The following fixes the above example:
    public class Example {
        private String message;
        public Example(String name) {
            message = "Hello, " + name;
        public String toString() {
            return message;
        public static void main(String[] args) {
            Example ex = new Example("world");
            System.out.println(ex.toString());
    }

  • How can i execute vb scripts in java program

    hi
    how can i execute any batch files or any other exe files (vb scripts) from java programs
    thanks

    Hi,
    You use Runtime.exec to execute commands / exe-files. See the documentation (and remember that it will only work on windows):
    http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html
    /Kaj

  • How can I execute a batch file from my java program

    Hi,
    Can someone help me or direct me to a link,
    How can I execute a DOS batch file from my java program?
    Thanks

    You will need to grab a handle to the process's
    outputstream so u can see its output.The OP didn't mention any output from any batch file;
    nor any input for that
    matter,so lets not complicate matters here for now
    ok?Actually I think this is essential to see whether it works or not. It's either that or do some manual check to see whether it ran, which is not exactly elegant, and in some cases this may not be easier than simply writing the output stream code, or in fact it may be impossible to check manually.
    I'm sure it wasn't intentional that your post appeared to be bristling with attitude.

  • How can i execute excelsheet without giving path in java

    Hi,
    How can i execute excelsheet without giving path in java, through this code, you can open the notepad but
    I want whereever the excel is installed in your machine , fine and open excelsheet without given absolute path.
    class ExecuteCommand{
    public static void main(String d[]){
         Runtime r = Runtime.getRuntime();
         Process p= null;
         try{
         p = r.exec("notepad");
              catch(Exception e){
                   System.out.println("error");
    If you know please send me your idea and code samples.
    regards
    Mohan kumar

    just execute the exelfile with the Windows "start" command:
    Runtime.exec("cmd /c start "+excelFileName);But this requires that Excel is the default application for the Excel file type (*.xls). You can test this by simply typing "start myTestExcel.xls" in a dos box.

  • How can i add custom attributes to a new Class Object using the API ?

    Hello everyone,
    Here is my problem. I just created a subclass of Document using the API (not XML), by creating a ClassObjectDefinition and a ClassObject. Here is the code :
    // doc is an instance of Document
    ClassObject co = doc.getClassObject();
    ClassObjectDefinition cod = new ClassObjectDefinition(ifsSession);
    cod.setSuperclass(co);
    cod.setSuperclassName(co.getName());
    cod.setName("MYDocument");
    ClassObject c = (ClassObject)ifsSession.createSchemaObject(cod);
    Everything seems to be OK since i can see the new class when i use ifsmgr. But my question is : how can i add custom attributes to this new class ? Here is what i tried :
    AttributeDefinition value = new AttributeDefinition(ifsSession);
    value.setAttribute("FOO", AttributeValue.newAttributeValue("bar"));
    c.addAttribute(value);
    But i got the following error message :
    oracle.ifs.common.IfsException: IFS-30002: Unable to create new LibraryObject
    java.sql.SQLException: ORA-01400: impossible d'insirer NULL dans ("IFSSYS"."ODM_ATTRIBUTE"."DATATYPE")
    oracle.ifs.server.S_LibraryObjectData oracle.ifs.beans.LibrarySession.DMNewSchemaObject(oracle.ifs.server.S_LibraryObjectDefinition)
    oracle.ifs.beans.SchemaObject oracle.ifs.beans.LibrarySession.NewSchemaObject(oracle.ifs.beans.SchemaObjectDefinition)
    oracle.ifs.beans.SchemaObject oracle.ifs.beans.LibrarySession.createSchemaObject(oracle.ifs.beans.SchemaObjectDefinition)
    void fr.sword.ifs.GestionDocument.IFSDocument.createDocument(java.lang.String)
    void fr.sword.ifs.GestionDocument.IFSDocument.main(java.lang.String[])
    So, what am i doing wrong ?
    More generally, are we restricted in the types of the attributes ? (for example, would it be possible to add an attribute that would be an inputStream ? Or an object that i have already created ?).
    Any help would be appreciated. Thanks in advance.
    Guillaume
    PS : i'm using Oracle iFS 1.1.9 on NT4 SP6 and Oracle 8.1.7
    null

    Hi Guillaume,
    you're welcome. Don't know exactly, but assume that ATTRIBUTEDATATYPE_UNKNOWN
    is used to check for erronous cases only
    and it shouldn't be used otherwise.
    Creating your own objects could be simply done via
    ClassObject ifsClassObject;
    DocumentDefinition ifsDocDef = new DocumentDefinition(ifsSession);
    // get class object for my very own document
    ifsClassObject = ClassObject.getClassObjectFromLabel(ifsSession, "MYDOCUMENT");
    // set the class for the document i'd like to create
    ifsDocDef.setClassObject(ifsClassObject);
    // set attributes and content for the document...
    ifsDocDef.setAttribute("MYFOO_ATTRIBUTE",....);
    ifsDocDef.setContent("This is the content of my document");
    // create the document...
    PublicObject doc = ifsSession.createPublicObject(ifsDocDef);
    null

  • How can i execute a workflow using a bapi/wapi??

    Hi All,
    How can i execute a workflow using a bapi/wapi??
    pls advice
    thanks

    Hi Hrus,
    it's not as simple as a single BAPI to approve a workflow.
    Workflow comes with a Workflow API (WAPI) that you can use to programmatically interact with the workflow system. The WAPI is implemented as a group of RFC-enabled function modules that are prefixed with "SAP_WAPI_".
    Approving a workflow is simply taking a decision path for a workflow item. It is logically no different to rejecting the same workflow item or any other workflow decision.
    As part of NetWeaver workflow is tightly coupled to the WAS platform you are running on so you may need to perform WAPI operations slightly differently on older releases.
    Some of the WAPI calls you might need to use include: -
      SAP_WAPI_GET_HEADER to get the workitem header
      SAP_WAPI_READ_CONTAINER to get the workitem container
      SAP_WAPI_GET_OBJECTS to get the attached objects
      SAP_WAPI_DECISION_READ to get a list of possible decisions
      SAP_WAPI_SET_WORKITEM_STATUS to set the workitem status
      SAP_WAPI_WRITE_CONTAINER to write to the workitem container
      SAP_WAPI_EXECUTE_WORKITEM to execute the workitem
    I usually do what you are trying to do by adding the decision to the workflow container and then executing the workflow.
    Be warned, you can really stuff things up if you get this wrong! Make sure you know what you are doing.
    Quoting from Practical Workflow for SAP by Alan Rickayzen, et al from SAP Press...
    Writing directly to the workflow container is dangerous because it can compromise the integrity of the process.
    ...be careful that you do not waste time duplicating existing ad hoc features of SAP's Workflow Engine.
    For example you can use events (combined with wait steps), instead of container modifications to force the workflow to restart.
    Cheers
    Graham Robbo

  • How can i use C/Javascript/php/Java in flex?

    can i embed these language into my flex project?
    since i have to check harddisk space, free memory remain. Also, i need to check the pixel of photos before the photos becoming bitmapdata
    please help~

    saipanBETTY0509 wrote:
    Subject: How can i use C/Javascript/php/Java in flex?
    can i embed these language into my flex project?
    You can't.  Why do you want to do this?
    saipanBETTY0509 wrote:
    since i have to check harddisk space, free memory remain. Also, i need to check the pixel of photos before the photos becoming bitmapdata
    I think what this means is "I want to check to see how much hard disk space is available.  Also, I need to check the pixel dimensions of an image."
    Is that right?
    There is no way in the Flash Player (as far as I know) that you can determine the amount of free disk space.  However, in AIR you can use air.File.applicationStorageDirectory.spaceAvailable to determine the storage space available in the application storage directory.
    As far as determining the dimensions of an image, there are plenty of good resources out there on that.  Maybe this one will be helpful to you?
    http://www.yswfblog.com/blog/2008/12/22/flash-10-experiments-the-warholizer-loading-and-pr ocessing-local-images/
      -Josh

  • How can i modify exe resource in java?

    How can i modify exe resource in java?
    No jni
    thx.

    if it is .NET code decompilation is possible if, and only if the code is not Packed by protections!
    but if the EXE file is native and created by VB 6.0,C/C++,Delphi,... it is not possible to obtain source code from it, not as far as i know.
    (some program does it , but the returned source code is as useful as its assembly code in debugger).
    if decompilation was that easy then Reverse Engineering was no longer needed!
    What program it is so that can put two exe file into each other ?
    the program you seen might put second exe file into its DATA section then when it executes ,
    it jumps to data section of itself!
    otherwise it is not possible.
    Good luck.
    Edited by: 0mega7 on Apr 5, 2008 8:27 AM
    Edited by: 0mega7 on Apr 5, 2008 8:29 AM

  • How can i get system variable using java

    Hi,
    I just want to know how can i get system variables using java code.
    for example i want to get the the date for today or i want to get the number of processes that's running.
    Thanks alot

    Hi,
    I just want to know how can i get system variables
    using java code.
    for example i want to get the the date for today or i
    want to get the number of processes that's running.
    Thanks alotSome generic "system variables" are available though Java, usually through the System class.
    Date today = new Date();
    is instantiated with the current date and time.
    Other system values, like environment values, should be passed to java through the command line (-D option) by setting system properties.
    Finally, platform specific values like the number of processes running will have to be written in platform specific code and executed by JNI (java native interface).
    Java is platform or system agnostic. Common system values, like time, are implemented. Hopefully you won't need platform specific values.

  • How can i display the result of java class in InputText ?

    Hi all,
    How can i get the result of java class to InputText Or OutputText ???
    also can every one in the forum give me road map for dealing with java in oracle adf because i'm beginner in oracle adf
    i saw some samples in oracle adf corner but it's difficult for me.

    User,
    Always mention your JDev version, technologies used and clear usecase description (read through this announcement : https://forums.oracle.com/forums/ann.jspa?annID=56)
    How can i get the result of java class to InputText Or OutputText ???Can you elaborate on your requirement? Do you mean the return value of a method in a class as output text? Or an attribute in your class (bean?) as text field?
    -Arun

  • How can I execute a Procedure with OUT variable is %ROWTYPE on SQL Prompt

    Hi,
    I have a procedure with OUT variable is %ROWTYPE
    How can I execute the following procedure on SQL prompt.
    (without creating anonymous block)
    CREATE OR REPLACE PROCEDURE zz_sp_EMP(VEMPNO IN EMP.EMPNO%TYPE,
    V_REC IN OUT EMP%ROWTYPE)
    AS
    BEGIN
    SELECT * INTO V_REC FROM EMP WHERE EMPNO = VEMPNO;
    END;
    Thanks & Regards,
    Naresh

    as previous posters said: it's not possible to do this without declaring a variable in the anonymous block.
    With anonymous block it would look like this (had to change it a bit, since i'm using hr-schema on oracle XE):
    declare
    l_rec EMPLOYEES%ROWTYPE;
    begin
    zz_sp_EMP(VEMPNO => 100, V_REC => l_rec);
    DBMS_OUTPUT.PUT_LINE ( 'first_name = ' || l_rec.first_name );
    DBMS_OUTPUT.PUT_LINE ( 'last_name = ' || l_rec.last_name );
    end;
    first_name = Steven
    last_name = King

  • How can I execute Stored Procedures in PARALLEL and DYNAMICALLY ?

    Hi 
    I have a stored procedure. It can be executed like this
    exec test @p = 1;
    exec test @p = 2
    exec test @p = n;
    n can be hundred.
    I want the sp being executed in parallel, not sequence. It means the 3 examples above can be run at the same time.
    If I know the number in advance, say 3, I can create 3 different Execution SQL Tasks. They can be run in parallel.
    However, the n is not static. It is coming from a table. 
    How can I execute Stored Procedures in PARALLEL and DYNAMICALLY ?
    I think about using script task. In the script, I get the value of n, and the list of p, from the table, then running a loop with. In the loop, I create a threat and in the threat, I execute the sp like : exec test @p = p. So the exec test may
    be run parallel. But I am not sure if it works.
    Any idea is really appreciated.

    Hi nam_man,
    According to your description, you want to call stored procedures in parallel, right?
    In SSIS, we can create separate jobs with different stored procedures, then set the same schedule to kick the jobs off at the same time. In this way, we should be careful to monitor blocking and deadlocking depending on what the jobs are doing.
    We can also put all stored procedures in SSIS Sequence container, then they will be run in parallel.
    For more information about SSIS job and Sequence container, please refer to the following documents:
    http://www.mssqltips.com/sqlservertutorial/220/scheduling-ssis-packages-with-sql-server-agent/
    https://msdn.microsoft.com/en-us/library/ms139855(v=sql.110).aspx
    If you have any more questions, please feel free to ask.
    Thanks,
    Wendy Fu
    Wendy Fu
    TechNet Community Support

  • How can I execute program after using F4_Filename function?

    Hi all,
    I'm a new user on the forum. I've been working with ABAP and SAP for a few weeks. I wrote a program for importing data from excel file to SAP using BDC. During searching this forum I found information about F4_Filename function which allows users to browse the disc for a file. I'd like to add this function to my program. I have a parameter for a file name but this is an ordinary static string field. When I added the code which I found in the message on this forum the rest of program doesn't execute.
    This is simple program for example:
    REPORT  Z_TEST8_AB.
    DATA f_name TYPE STRING.
    PARAMETERS p_file like rlgrap-filename DEFAULT 'c:\test.xls'.
    f_name = p_file.
    write:/ f_name.
    This program works correctly. There is a field for parameter. I can change the default name for a file.
    After all, I can run the program (F8) and rest of the code is executed. The field for parameter dissapears from the screen and the file name is displayed. ( command write)
    Now I added a function F4_Filename
    REPORT  Z_TEST8_AB.
    DATA f_name TYPE STRING.
    PARAMETERS p_file like rlgrap-filename DEFAULT 'c:\test.xls'.
    at selection-screen on value-request for p_file.
      call function 'F4_FILENAME'
           exporting
                program_name  = syst-repid
                dynpro_number = syst-dynnr
                field_name    = 'p_file'
           importing
                file_name     = p_file.
    f_name = p_file.
    write:/ f_name.
    I can browse a computer for a file now but after selecting the file I can't run the rest of the code. When I click on the icon or press key F8 the field for parameter doesn't dissapier and the command write is not executed.
    What do I do wrong?
    Could anyone suggest me a solution? How can I executed the code after using this function?
    Thanks in advance.
    Regards,
    Arek.

    Hi arkadiusz,
    1. simple
    2.
    <b>start-of-selection.</b>
    f_name = p_file.
    write:/ f_name.
    regards,
    amit m.

  • How can I execute external application?

    Hi friends I want printing my barcodes a laser printer (Kyocera) it isn't a barcode printer. So I think (and I look kyocera web page my model doesn't support barcode printing in sap) print my barcodes using an external system. Before SAP we are using JollyPrint application for printing barcodes. It is using an Excel file.
    I can create a excel file for this application. I must execute this (JollyPrint-it is a label application) application when I press a button. How can I execute this application?
    Thanks
    Mehmet
    P.S. I have been writing this message with details may be somebody can give me a simple way for this

    Well, I can suggest you following steps. May be it works for you .
    -Create an external OS command in SM69
    -Test OS command in SM49 ( <u><i>about OS command if you search in SDN you’ll get lot of material</i></u> )
    -Create a Script at your OS level, I’m assuming you might have some UNIX flavor or Sun solaria’s.
    -Create a Shell script , which execute the printer job from OS .
    -Shell script will have parameters . ( e.g. printer name, destination etc )
    -set the path of shell script directory in SM69 ( the command you just created )
    -Execute shell script using your ABAP program ( use FM "SXPG_COMMAND_EXECUTE" )
    In the ABAP  program you can pass the parameters and execute the command from ABAP as a result your job will start printing on the required destination. Moreover, you can also capture the spool at OS level .
    FYI
    For UNIX script, if you search in www.google.com ( UNIX forums) . you’ll get shell script .
    Hope this’ll give you idea!!
    <b>P.S award the points.</b>
    Good luck
    Thanks
    Saquib Khan
    "Some are wise and some are otherwise"

Maybe you are looking for