4 Replies Latest reply on Jul 16, 2013 1:20 PM by 890683

    How can i execute Spaces API in java main class?




      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.




        • 1. Re: How can i execute Spaces API in java main class?
          Daniel Merchán


          Which API are you calling, WSDL?, REST? Directly to Java API?.



          • 2. Re: How can i execute Spaces API in java main class?

            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,


                                                              SpacesException {

                    Class2 class2 = new Class2();

                    GroupSpaceWSContext context = new GroupSpaceWSContext();





                    Properties systemProps = System.getProperties();





                    systemProps.put("javax.net.ssl.keyStorePassword", "Test12");


                    GroupSpaceWSClient groupSpaceWSClient;

                    try {

                        groupSpaceWSClient = new GroupSpaceWSClient(context);

                        System.out.println("URL: " +


                        //delete the Space



                        List<String> groupSpaces = groupSpaceWSClient.getGroupSpaces(null);

                        System.out.println("GroupSpaces:: " + groupSpaces.size());

                    } catch (Exception e) {









            • 3. Re: How can i execute Spaces API in java main class?

              Hi Raj,


              I think it would be easier, if your cron job invoked a program that in turn invoked the Spaces REST APIs to create the space. This way, you do not need to get in to understanding which jar if required at what time.


              Just take care of authentication, and you should be fine.




              • 4. Re: How can i execute Spaces API in java main class?

                Hi Harsha


                Thanks for your response.


                I have included all required jars and while executing the unix command to execute jar. Its giving this exception

                Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: InvalidSecurity : error in processing the WS-Security security header

                        at com.sun.xml.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:188)

                        at com.sun.xml.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:122)

                        at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:119)

                        at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:89)

                        at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:118)

                        at $Proxy33.getGroupSpaces(Unknown Source)

                        at kesko.SpacesWebServiceSoapHttpPortClient.main(SpacesWebServiceSoapHttpPortClient.java:60)


                This problem is quite similar to this thread: https://forums.oracle.com/thread/2553182  . How to resolve this error?