UNICORE adaptor: how to use the correct context?

Added by Frizziero Eric almost 6 years ago

My file "$JSAGA_HOME/etc/jsaga-default-contexts.xml":

<?xml version="1.0" encoding="UTF-8"?>
<jsaga-default xmlns="http://www.in2p3.fr/jsaga/session">
    <contexts>
        <context type="VOMS">
            <data type="gsiftp"/>
            <data type="srm"/>
            <data type="lfn"/>
            <job type="wms"/>
            <job type="cream"/>
        </context>
       <context type="JKS">
            <job type="unicore"/>
       </context>
    </contexts>

    <session>
       <context type="JKS">
          <attribute name="Keystore" value="/home/frizzier/.globus/mykeystore.jks"/>
          <attribute name="KeystorePass" value="passwd"/>
          <attribute name="trustStore" value="/home/frizzier/EMI-truststore.jks"/>
          <attribute name="trustStorePassword" value="passwd"/>
       </context>

       <context type="VOMS">
          <attribute name="Server" value="voms://voms.hellasgrid.gr:15004/C=GR/O=HellasGrid/OU=hellasgrid.gr/CN=voms.hellasgrid.gr"/>
          <attribute name="VomsDir" value="etc/vomsdir"/>
        </context>
    </session>
</jsaga-default>

I try to submit a job using the JSAGA UNICORE adaptor, but I find an issue with the context for authentication.

jsaga-context-destroy.sh
jsaga-context-init.sh JKS
Enter UserPass for security context: JKS1 (JKS)
jsaga-context-info.sh 
Security context: JKS1 (JKS)
  subject          : CN=Eric Frizziero, L=Padova, OU=Personal Certificate, O=INFN, C=IT
  issuer           : CN=INFN CA, O=INFN, C=IT
  not valid before     : 2012/09/28-15:46:55
  not valid after     : 2013/09/28-15:46:55

Security context: VOMS2 (VOMS)
  Context not initialized [java.io.FileNotFoundException: /tmp/x509up_u500 (No such file or directory)]

jsaga-context-info.sh JKS
Security context: JKS1 (JKS)
  subject          : CN=Eric Frizziero, L=Padova, OU=Personal Certificate, O=INFN, C=IT
  issuer           : CN=INFN CA, O=INFN, C=IT
  not valid before     : 2012/09/28-15:46:55
  not valid after     : 2013/09/28-15:46:55

So, the context "JKS" seems to be correct, but when I try to submit a simple job to unicore:

jsaga-job-run.sh -b -Executable /bin/hostname -r unicore://zam052v02.zam.kfa-juelich.de:8080/?Target=EMI-UNICOREX-RC -Output output.txt -Error error.txt
Exception in thread "main" NoSuccess: java.io.FileNotFoundException: /tmp/x509up_u500 (No such file or directory)
    at fr.in2p3.jsaga.adaptor.security.VOMSSecurityAdaptor.createSecurityCredential(VOMSSecurityAdaptor.java:189)
    at fr.in2p3.jsaga.impl.context.ContextImpl.createCredential(ContextImpl.java:282)
    at fr.in2p3.jsaga.impl.session.SessionImpl.addContext(SessionImpl.java:63)
    at fr.in2p3.jsaga.engine.session.SessionConfiguration.setDefaultSession(SessionConfiguration.java:98)
    at fr.in2p3.jsaga.impl.session.SessionFactoryImpl.doCreateSession(SessionFactoryImpl.java:31)
    at org.ogf.saga.session.SessionFactory.createSession(SessionFactory.java:63)
    at org.ogf.saga.session.SessionFactory.createSession(SessionFactory.java:43)
    at fr.in2p3.jsaga.command.JobRun.main(JobRun.java:76)
Caused by: java.io.FileNotFoundException: /tmp/x509up_u500 (No such file or directory)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:137)
    at fr.in2p3.jsaga.adaptor.security.VOMSSecurityAdaptor.load(VOMSSecurityAdaptor.java:242)
    at fr.in2p3.jsaga.adaptor.security.VOMSSecurityAdaptor.createSecurityCredential(VOMSSecurityAdaptor.java:170)
    ... 7 more

I don't know ... why is the context "VOMS" used?
How should I specify to use the context "JKS" for the UNICORE adaptor?

Thanks in advance,
E r i c.

PS:
Using the JSAGA API the job submission to UNICORE works fine.

context = ContextFactory.createContext("JKS");
               System.setProperty("javax.net.ssl.trustStore", "/home/frizzier/EMI-truststore.jks");
               System.setProperty("javax.net.ssl.trustStorePassword", "passwd");
               context.setAttribute("Keystore","/home/frizzier/.globus/mykeystore.jks");
               context.setAttribute("KeystorePass","passwd");

Replies (10)

RE: UNICORE adaptor: how to use the correct context? - Added by Schwarz Lionel almost 6 years ago

Hi Eric,

When you run jsaga-* commands, the default session is created: that means that all contexts defined in the <session> tag are potentially usable in the session and thus all should be initialized before. This way, Jsaga is able to use the appropriate context for the particular adaptor (JKS for UNICORE).

Using the API, you probably create a void session with createSession(false) and add the JKS context only, that's why you do not have this issue.

We are aware that the way jsaga-* commands work with sessions is not easy to understand and use. But if you use the JSAGA API, it should not be a big issue for you.

If you really want to use the jsaga-* commands, then I recommend to have one configuration file per context:

jsaga-voms-context.xml:

<?xml version="1.0" encoding="UTF-8"?>
<jsaga-default xmlns="http://www.in2p3.fr/jsaga/session">
    <contexts>
        <context type="VOMS">
            <data type="gsiftp"/>
            <data type="srm"/>
            <data type="lfn"/>
            <job type="wms"/>
            <job type="cream"/>
        </context>
    </contexts>

    <session>
       <context type="VOMS">
          <attribute name="Server" value="voms://voms.hellasgrid.gr:15004/C=GR/O=HellasGrid/OU=hellasgrid.gr/CN=voms.hellasgrid.gr"/>
          <attribute name="VomsDir" value="etc/vomsdir"/>
        </context>
    </session>
</jsaga-default>

jsaga-jks-context.xml:

<?xml version="1.0" encoding="UTF-8"?>
<jsaga-default xmlns="http://www.in2p3.fr/jsaga/session">
    <contexts>
       <context type="JKS">
            <job type="unicore"/>
       </context>
    </contexts>

    <session>
       <context type="JKS">
          <attribute name="Keystore" value="/home/frizzier/.globus/mykeystore.jks"/>
          <attribute name="KeystorePass" value="passwd"/>
          <attribute name="trustStore" value="/home/frizzier/EMI-truststore.jks"/>
          <attribute name="trustStorePassword" value="passwd"/>
       </context>
    </session>
</jsaga-default>

and specify the file you want to use with the system property
-Djsaga.default.contexts=jsaga-jks-context.xml

Does this fit your needs?

Regards,
Lionel

RE: UNICORE adaptor: how to use the correct context? - Added by Frizziero Eric almost 6 years ago

Hi Lionel,

I have created the context file "jsaga-jks-context.xml":

<?xml version="1.0" encoding="UTF-8"?>
<jsaga-default xmlns="http://www.in2p3.fr/jsaga/session">
    <contexts>
       <context type="JKS">
            <job type="unicore"/>
       </context>
    </contexts>

 <session>
      <context type="JKS">
      <attribute name="Keystore" value="/home/frizzier/.globus/mykeystore.jks"/>
      <attribute name="KeystorePass" value="passwd"/>
      <attribute name="trustStore" value="/home/frizzier/EMI-truststore.jks"/>
      <attribute name="trustStorePassword" value="passwd"/>
    </context>
</session>
</jsaga-default>

Then, in order to do a test, I have modified the script "jsaga-job-run.sh":

# set system properties
#PROPERTIES=
PROPERTIES="${PROPERTIES} -Djsaga.default.contexts=file:///usr/local/jsaga-0.9.15/etc/jsaga-jks-context.xml" 
PROPERTIES="${PROPERTIES} -DJSAGA_HOME=$JSAGA_HOME" 
PROPERTIES="${PROPERTIES} -Ddebug" 

But by executing the script:

jsaga-job-run.sh -Executable /bin/hostname -r unicore://zam052v02.zam.kfa-juelich.de:8080/?Target=EMI-UNICOREX-RC -Output output.txt -Error error.txt
[2013-06-21 11:35:02,902] DEBUG fr.in2p3.jsaga.adaptor.unicore.UnicoreAbstract : Connected to <Address xmlns="http://www.w3.org/2005/08/addressing">https://zam052v02.zam.kfa-juelich.de:8080/EMI-UNICOREX-RC/services/TargetSystemFactoryService?res=default_target_system_factory</Address>
[2013-06-21 11:35:03,163] DEBUG unicore.security.TDOutHandler : No issuer was set, won't add any ETD/User assertion
[2013-06-21 11:35:03,473] DEBUG unicore.client.BaseWSRFClient : Calling service at wsaTo: https://zam052v02.zam.kfa-juelich.de:8080/EMI-UNICOREX-RC/services/TargetSystemFactoryService?res=default_target_system_factory
[2013-06-21 11:35:03,477] DEBUG unicore.client.ReliableProxy : Method [GetResourcePropertyDocument] [<GetResourcePropertyDocument xmlns="http://docs.oasis-open.org/wsrf/rp-2"/>]
[2013-06-21 11:35:03,490] DEBUG unicore.security.TDOutHandler : No TD assertion available.
[2013-06-21 11:35:03,683] DEBUG unicore.security.AuthSSLProtocolSocketFactory : Using alias <1>
[2013-06-21 11:35:03,683] DEBUG unicore.security.AuthSSLProtocolSocketFactory : Certificate chain '1':
[2013-06-21 11:35:03,683] DEBUG unicore.security.AuthSSLProtocolSocketFactory :  Certificate 1:
[2013-06-21 11:35:03,683] DEBUG unicore.security.AuthSSLProtocolSocketFactory :   Subject DN: CN=Eric Frizziero, L=Padova, OU=Personal Certificate, O=INFN, C=IT
[2013-06-21 11:35:03,683] DEBUG unicore.security.AuthSSLProtocolSocketFactory :   Signature Algorithm: SHA1withRSA
[2013-06-21 11:35:03,689] DEBUG unicore.security.AuthSSLProtocolSocketFactory :   Valid from: Fri Sep 28 15:46:55 CEST 2012
[2013-06-21 11:35:03,689] DEBUG unicore.security.AuthSSLProtocolSocketFactory :   Valid until: Sat Sep 28 15:46:55 CEST 2013
[2013-06-21 11:35:03,689] DEBUG unicore.security.AuthSSLProtocolSocketFactory :   Issuer: CN=INFN CA, O=INFN, C=IT
[2013-06-21 11:35:03,691] FATAL unicore.security.AuthSSLProtocolSocketFactory : 
java.lang.NullPointerException
    at eu.unicore.security.util.KeystoreUtil.loadTruststore(KeystoreUtil.java:169)
    at eu.unicore.security.util.client.AuthSSLProtocolSocketFactory.createKeyStore(AuthSSLProtocolSocketFactory.java:90)
    at eu.unicore.security.util.client.AuthSSLProtocolSocketFactory.createSSLContext(AuthSSLProtocolSocketFactory.java:197)
    at eu.unicore.security.util.client.AuthSSLProtocolSocketFactory.getSSLContext(AuthSSLProtocolSocketFactory.java:268)
    at eu.unicore.security.util.client.AuthSSLProtocolSocketFactory.createSocket(AuthSSLProtocolSocketFactory.java:314)
    at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
    at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361)
    at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
    at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
    at eu.unicore.security.util.client.RedirectingHttpClient.executeMethod(RedirectingHttpClient.java:56)
    at org.codehaus.xfire.transport.http.CommonsHttpMessageSender.send(CommonsHttpMessageSender.java:369)
    at org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:123)
    at org.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:48)
    at org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)
    at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
    at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:79)
    at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:114)
    at org.codehaus.xfire.client.Client.invoke(Client.java:336)
    at eu.unicore.security.xfireutil.client.ReliableProxy.handleRequest(ReliableProxy.java:122)
    at eu.unicore.security.xfireutil.client.ReliableProxy.doInvoke(ReliableProxy.java:102)
    at eu.unicore.security.xfireutil.client.ReliableProxy.invoke(ReliableProxy.java:69)
    at sun.proxy.$Proxy6.GetResourcePropertyDocument(Unknown Source)
    at de.fzj.unicore.wsrflite.xmlbeans.client.BaseWSRFClient.GetResourcePropertyDocument(BaseWSRFClient.java:347)
    at de.fzj.unicore.uas.client.TSFClient.getResourcePropertiesDocument(TSFClient.java:74)
    at de.fzj.unicore.uas.client.TSFClient.getAccessibleTargetSystems(TSFClient.java:133)
    at fr.in2p3.jsaga.adaptor.unicore.job.UnicoreJobControlAdaptor.connect(UnicoreJobControlAdaptor.java:82)
    at fr.in2p3.jsaga.engine.factories.JobAdaptorFactory.connect(JobAdaptorFactory.java:66)
    at fr.in2p3.jsaga.engine.factories.JobAdaptorFactory.connect(JobAdaptorFactory.java:61)
    at fr.in2p3.jsaga.impl.job.AbstractSyncJobFactoryImpl.doCreateJobServiceSync(AbstractSyncJobFactoryImpl.java:72)
    at fr.in2p3.jsaga.impl.job.JobFactoryImpl.doCreateJobService(JobFactoryImpl.java:35)
    at org.ogf.saga.job.JobFactory.createJobService(JobFactory.java:202)
    at org.ogf.saga.job.JobFactory.createJobService(JobFactory.java:146)
    at fr.in2p3.jsaga.command.JobRun.main(JobRun.java:77)
[2013-06-21 11:35:03,693] DEBUG unicore.client.ReliableProxy : Error making call for GetResourcePropertyDocument on https://zam052v02.zam.kfa-juelich.de:8080/EMI-UNICOREX-RC/services/TargetSystemFactoryService?res=default_target_system_factory
org.codehaus.xfire.XFireRuntimeException: Could not invoke service.. Nested exception is org.codehaus.xfire.fault.XFireFault: java.lang.NullPointerException
org.codehaus.xfire.fault.XFireFault: java.lang.NullPointerException
    at org.codehaus.xfire.fault.XFireFault.createFault(XFireFault.java:89)
    at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:83)
    at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:114)
    at org.codehaus.xfire.client.Client.invoke(Client.java:336)
    at eu.unicore.security.xfireutil.client.ReliableProxy.handleRequest(ReliableProxy.java:122)
    at eu.unicore.security.xfireutil.client.ReliableProxy.doInvoke(ReliableProxy.java:102)
    at eu.unicore.security.xfireutil.client.ReliableProxy.invoke(ReliableProxy.java:69)
    at sun.proxy.$Proxy6.GetResourcePropertyDocument(Unknown Source)
    at de.fzj.unicore.wsrflite.xmlbeans.client.BaseWSRFClient.GetResourcePropertyDocument(BaseWSRFClient.java:347)
    at de.fzj.unicore.uas.client.TSFClient.getResourcePropertiesDocument(TSFClient.java:74)
    at de.fzj.unicore.uas.client.TSFClient.getAccessibleTargetSystems(TSFClient.java:133)
    at fr.in2p3.jsaga.adaptor.unicore.job.UnicoreJobControlAdaptor.connect(UnicoreJobControlAdaptor.java:82)
    at fr.in2p3.jsaga.engine.factories.JobAdaptorFactory.connect(JobAdaptorFactory.java:66)
    at fr.in2p3.jsaga.engine.factories.JobAdaptorFactory.connect(JobAdaptorFactory.java:61)
    at fr.in2p3.jsaga.impl.job.AbstractSyncJobFactoryImpl.doCreateJobServiceSync(AbstractSyncJobFactoryImpl.java:72)
    at fr.in2p3.jsaga.impl.job.JobFactoryImpl.doCreateJobService(JobFactoryImpl.java:35)
    at org.ogf.saga.job.JobFactory.createJobService(JobFactory.java:202)
    at org.ogf.saga.job.JobFactory.createJobService(JobFactory.java:146)
    at fr.in2p3.jsaga.command.JobRun.main(JobRun.java:77)
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
    at eu.unicore.security.util.client.AuthSSLProtocolSocketFactory.createSSLContext(AuthSSLProtocolSocketFactory.java:212)
    at eu.unicore.security.util.client.AuthSSLProtocolSocketFactory.getSSLContext(AuthSSLProtocolSocketFactory.java:268)
    at eu.unicore.security.util.client.AuthSSLProtocolSocketFactory.createSocket(AuthSSLProtocolSocketFactory.java:314)
    at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
    at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361)
    at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
    at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
    at eu.unicore.security.util.client.RedirectingHttpClient.executeMethod(RedirectingHttpClient.java:56)
    at org.codehaus.xfire.transport.http.CommonsHttpMessageSender.send(CommonsHttpMessageSender.java:369)
    at org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:123)
    at org.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:48)
    at org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)
    at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
    at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:79)
    ... 17 more
Caused by: java.lang.NullPointerException
    at eu.unicore.security.util.KeystoreUtil.loadTruststore(KeystoreUtil.java:169)
    at eu.unicore.security.util.client.AuthSSLProtocolSocketFactory.createKeyStore(AuthSSLProtocolSocketFactory.java:90)
    at eu.unicore.security.util.client.AuthSSLProtocolSocketFactory.createSSLContext(AuthSSLProtocolSocketFactory.java:197)
    ... 31 more
[2013-06-21 11:35:03,694] ERROR unicore.client.TSFClient : Can't get accessible target system list.
org.codehaus.xfire.XFireRuntimeException: Could not invoke service.. Nested exception is org.codehaus.xfire.fault.XFireFault: java.lang.NullPointerException
org.codehaus.xfire.fault.XFireFault: java.lang.NullPointerException
    at org.codehaus.xfire.fault.XFireFault.createFault(XFireFault.java:89)
    at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:83)
    at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:114)
    at org.codehaus.xfire.client.Client.invoke(Client.java:336)
    at eu.unicore.security.xfireutil.client.ReliableProxy.handleRequest(ReliableProxy.java:122)
    at eu.unicore.security.xfireutil.client.ReliableProxy.doInvoke(ReliableProxy.java:102)
    at eu.unicore.security.xfireutil.client.ReliableProxy.invoke(ReliableProxy.java:69)
    at sun.proxy.$Proxy6.GetResourcePropertyDocument(Unknown Source)
    at de.fzj.unicore.wsrflite.xmlbeans.client.BaseWSRFClient.GetResourcePropertyDocument(BaseWSRFClient.java:347)
    at de.fzj.unicore.uas.client.TSFClient.getResourcePropertiesDocument(TSFClient.java:74)
    at de.fzj.unicore.uas.client.TSFClient.getAccessibleTargetSystems(TSFClient.java:133)
    at fr.in2p3.jsaga.adaptor.unicore.job.UnicoreJobControlAdaptor.connect(UnicoreJobControlAdaptor.java:82)
    at fr.in2p3.jsaga.engine.factories.JobAdaptorFactory.connect(JobAdaptorFactory.java:66)
    at fr.in2p3.jsaga.engine.factories.JobAdaptorFactory.connect(JobAdaptorFactory.java:61)
    at fr.in2p3.jsaga.impl.job.AbstractSyncJobFactoryImpl.doCreateJobServiceSync(AbstractSyncJobFactoryImpl.java:72)
    at fr.in2p3.jsaga.impl.job.JobFactoryImpl.doCreateJobService(JobFactoryImpl.java:35)
    at org.ogf.saga.job.JobFactory.createJobService(JobFactory.java:202)
    at org.ogf.saga.job.JobFactory.createJobService(JobFactory.java:146)
    at fr.in2p3.jsaga.command.JobRun.main(JobRun.java:77)
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
    at eu.unicore.security.util.client.AuthSSLProtocolSocketFactory.createSSLContext(AuthSSLProtocolSocketFactory.java:212)
    at eu.unicore.security.util.client.AuthSSLProtocolSocketFactory.getSSLContext(AuthSSLProtocolSocketFactory.java:268)
    at eu.unicore.security.util.client.AuthSSLProtocolSocketFactory.createSocket(AuthSSLProtocolSocketFactory.java:314)
    at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
    at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361)
    at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
    at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
    at eu.unicore.security.util.client.RedirectingHttpClient.executeMethod(RedirectingHttpClient.java:56)
    at org.codehaus.xfire.transport.http.CommonsHttpMessageSender.send(CommonsHttpMessageSender.java:369)
    at org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:123)
    at org.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:48)
    at org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)
    at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
    at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:79)
    ... 17 more
Caused by: java.lang.NullPointerException
    at eu.unicore.security.util.KeystoreUtil.loadTruststore(KeystoreUtil.java:169)
    at eu.unicore.security.util.client.AuthSSLProtocolSocketFactory.createKeyStore(AuthSSLProtocolSocketFactory.java:90)
    at eu.unicore.security.util.client.AuthSSLProtocolSocketFactory.createSSLContext(AuthSSLProtocolSocketFactory.java:197)
    ... 31 more
Exception in thread "main" NoSuccess: java.lang.NullPointerException
    at fr.in2p3.jsaga.adaptor.unicore.job.UnicoreJobControlAdaptor.connect(UnicoreJobControlAdaptor.java:95)
    at fr.in2p3.jsaga.engine.factories.JobAdaptorFactory.connect(JobAdaptorFactory.java:66)
    at fr.in2p3.jsaga.engine.factories.JobAdaptorFactory.connect(JobAdaptorFactory.java:61)
    at fr.in2p3.jsaga.impl.job.AbstractSyncJobFactoryImpl.doCreateJobServiceSync(AbstractSyncJobFactoryImpl.java:72)
    at fr.in2p3.jsaga.impl.job.JobFactoryImpl.doCreateJobService(JobFactoryImpl.java:35)
    at org.ogf.saga.job.JobFactory.createJobService(JobFactory.java:202)
    at org.ogf.saga.job.JobFactory.createJobService(JobFactory.java:146)
    at fr.in2p3.jsaga.command.JobRun.main(JobRun.java:77)
Caused by: java.lang.NullPointerException
    at fr.in2p3.jsaga.adaptor.unicore.job.UnicoreJobControlAdaptor.connect(UnicoreJobControlAdaptor.java:82)
    ... 7 more

I would like to point out that the same job submission works fine via JSAGA-API.

What's the problem submitting via script?

Thanks,
E r i c.

PS:

ll /home/frizzier/EMI-truststore.jks
-rw-rw-r-- 1 frizzier frizzier 2134 Jun 11 12:15 /home/frizzier/EMI-truststore.jks
ll /home/frizzier/.globus/mykeystore.jks
-rw-rw-r-- 1 frizzier frizzier 2462 Jun 21 11:34 /home/frizzier/.globus/mykeystore.jks

RE: UNICORE adaptor: how to use the correct context? - Added by Schwarz Lionel almost 6 years ago

Eric,
it seems the truststore is null, this could come from a typo in your config file, please fix it as follows:

<session>
      <context type="JKS">
      <attribute name="Keystore" value="/home/frizzier/.globus/mykeystore.jks"/>
      <attribute name="KeystorePass" value="passwd"/>
      <attribute name="truststore" value="/home/frizzier/EMI-truststore.jks"/>
      <attribute name="truststorePass" value="passwd"/>
    </context>
</session>

I'm not sure why your config works with the API...

RE: UNICORE adaptor: how to use the correct context? - Added by Frizziero Eric almost 6 years ago

I have changed the context file "jsaga-jks-context.xml":

<?xml version="1.0" encoding="UTF-8"?>
<jsaga-default xmlns="http://www.in2p3.fr/jsaga/session">
    <contexts>
       <context type="JKS">
            <job type="unicore"/>
        </context>
    </contexts>

 <session>
<context type="JKS">
 <attribute name="Keystore" value="/home/frizzier/.globus/mykeystore.jks"/>
 <attribute name="KeystorePass" value="passwd"/>
 <attribute name="truststore" value="/home/frizzier/EMI-truststore.jks"/>
 <attribute name="truststorePass" value="passwd"/>
</context>
</session>
</jsaga-default>

but I obtain the same error:

jsaga-job-run.sh -Executable /bin/hostname -r unicore://zam052v02.zam.kfa-juelich.de:8080/?Target=EMI-UNICOREX-RC -Output output.txt -Error error.txt
[2013-06-21 13:14:21,453] DEBUG fr.in2p3.jsaga.adaptor.unicore.UnicoreAbstract : Connected to <Address xmlns="http://www.w3.org/2005/08/addressing">https://zam052v02.zam.kfa-juelich.de:8080/EMI-UNICOREX-RC/services/TargetSystemFactoryService?res=default_target_system_factory</Address>
[2013-06-21 13:14:21,735] DEBUG unicore.security.TDOutHandler : No issuer was set, won't add any ETD/User assertion
[2013-06-21 13:14:22,050] DEBUG unicore.client.BaseWSRFClient : Calling service at wsaTo: https://zam052v02.zam.kfa-juelich.de:8080/EMI-UNICOREX-RC/services/TargetSystemFactoryService?res=default_target_system_factory
[2013-06-21 13:14:22,054] DEBUG unicore.client.ReliableProxy : Method [GetResourcePropertyDocument] [<GetResourcePropertyDocument xmlns="http://docs.oasis-open.org/wsrf/rp-2"/>]
[2013-06-21 13:14:22,068] DEBUG unicore.security.TDOutHandler : No TD assertion available.
[2013-06-21 13:14:22,263] DEBUG unicore.security.AuthSSLProtocolSocketFactory : Using alias <1>
[2013-06-21 13:14:22,263] DEBUG unicore.security.AuthSSLProtocolSocketFactory : Certificate chain '1':
[2013-06-21 13:14:22,263] DEBUG unicore.security.AuthSSLProtocolSocketFactory :  Certificate 1:
[2013-06-21 13:14:22,264] DEBUG unicore.security.AuthSSLProtocolSocketFactory :   Subject DN: CN=Eric Frizziero, L=Padova, OU=Personal Certificate, O=INFN, C=IT
[2013-06-21 13:14:22,264] DEBUG unicore.security.AuthSSLProtocolSocketFactory :   Signature Algorithm: SHA1withRSA
[2013-06-21 13:14:22,269] DEBUG unicore.security.AuthSSLProtocolSocketFactory :   Valid from: Fri Sep 28 15:46:55 CEST 2012
[2013-06-21 13:14:22,269] DEBUG unicore.security.AuthSSLProtocolSocketFactory :   Valid until: Sat Sep 28 15:46:55 CEST 2013
[2013-06-21 13:14:22,269] DEBUG unicore.security.AuthSSLProtocolSocketFactory :   Issuer: CN=INFN CA, O=INFN, C=IT
[2013-06-21 13:14:22,271] FATAL unicore.security.AuthSSLProtocolSocketFactory : 
java.lang.NullPointerException
    at eu.unicore.security.util.KeystoreUtil.loadTruststore(KeystoreUtil.java:169)
    at eu.unicore.security.util.client.AuthSSLProtocolSocketFactory.createKeyStore(AuthSSLProtocolSocketFactory.java:90)
    at eu.unicore.security.util.client.AuthSSLProtocolSocketFactory.createSSLContext(AuthSSLProtocolSocketFactory.java:197)
    at eu.unicore.security.util.client.AuthSSLProtocolSocketFactory.getSSLContext(AuthSSLProtocolSocketFactory.java:268)
    at eu.unicore.security.util.client.AuthSSLProtocolSocketFactory.createSocket(AuthSSLProtocolSocketFactory.java:314)
    at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
    at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361)
    at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
    at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)

[...]

I tried to modify the script "jsaga-job-run.sh" adding the information of the truststore:

# set system properties
#PROPERTIES=
PROPERTIES="${PROPERTIES} -Djsaga.default.contexts=file:///usr/local/jsaga-0.9.15/etc/jsaga-jks-context.xml" 
PROPERTIES="${PROPERTIES} -Djavax.net.ssl.trustStore=/home/frizzier/EMI-truststore.jks" 
PROPERTIES="${PROPERTIES} -Djavax.net.ssl.trustStorePassword=passwd" 
PROPERTIES="${PROPERTIES} -DJSAGA_HOME=$JSAGA_HOME" 
PROPERTIES="${PROPERTIES} -Ddebug" 

and the job submission via script works fine:

jsaga-prova-job-run.sh -b -Executable /bin/hostname -r unicore://zam052v02.zam.kfa-juelich.de:8080/?Target=EMI-UNICOREX-RC -Output output.txt -Error error.txt
[2013-06-21 13:33:20,345]  INFO fr.in2p3.jsaga.adaptor.unicore.job.UnicoreJobControlAdaptor : Unicore server 1.6.0 at https://zam052v02.zam.kfa-juelich.de:8080/EMI-UNICOREX-RC/services/TargetSystemService?res=d554a9de-84f2-4452-a570-207755158bd1
[unicore://zam052v02.zam.kfa-juelich.de:8080/?Target=EMI-UNICOREX-RC]-[https://zam052v02.zam.kfa-juelich.de:8080/EMI-UNICOREX-RC/services/JobManagement?res=8b3b9b1d-7646-4195-a0cd-266c8b6789e5]

The job submission doesn't work fine using the context file. Why? Is there a bug?

Thanks,
E r i c.

RE: UNICORE adaptor: how to use the correct context? - Added by Schwarz Lionel almost 6 years ago

Sorry I made a mistake myself, rather write:
<session>
<context type="JKS">
<attribute name="Keystore" value="/home/frizzier/.globus/mykeystore.jks"/>
<attribute name="KeystorePass" value="passwd"/>
<attribute name="Truststore" value="/home/frizzier/EMI-truststore.jks"/>
<attribute name="TruststorePass" value="passwd"/>
</context>
</session>

Capital T for Truststore and TruststorePass

RE: UNICORE adaptor: how to use the correct context? - Added by Frizziero Eric almost 6 years ago

Hi Lionel,

now, it also works fine with the context file. Thanks!

If I come back to your question "Does this fit your needs?", I thought it was possible to use a single context file for all the adaptors and each adaptor automatically then chooses its own context.
As you said before this is not true.

I'm going to modify the jsaga-job-* scripts by adding something like this:

If the resource URL is "unicore" then context file "JKS" 
If the resource URL is "WMS" or "CREAM" then context file "VOMS" 

I think with this workaround my code could work fine.

Thanks,
E r i c.

RE: UNICORE adaptor: how to use the correct context? - Added by Schwarz Lionel almost 6 years ago

Hi Eric,

That's exactly how JSAGA works, it chooses the appropriate context depending on the URL. This is the role of the tags:
<job type="cream">
<job type="unicore">
so yes, all contexts can be defined in one single file, but this implies that all these contexts are initialized when the session is created.

Lionel

RE: UNICORE adaptor: how to use the correct context? - Added by Frizziero Eric almost 6 years ago

ok, I understand what you say, but then why the wrong context is choosen (VOMS instead of JKS) when I use the UNICORE adaptor (see my first post)?

jsaga-job-run.sh -b -Executable /bin/hostname -r unicore://zam052v02.zam.kfa-juelich.de:8080/?Target=EMI-UNICOREX-RC -Output output.txt -Error error.txt
Exception in thread "main" NoSuccess: java.io.FileNotFoundException: /tmp/x509up_u500 (No such file or directory)
    at fr.in2p3.jsaga.adaptor.security.VOMSSecurityAdaptor.createSecurityCredential(VOMSSecurityAdaptor.java:189)
    at fr.in2p3.jsaga.impl.context.ContextImpl.createCredential(ContextImpl.java:282)

Thanks,
E r i c.

RE: UNICORE adaptor: how to use the correct context? - Added by Schwarz Lionel almost 6 years ago

No, JSAGA does not "choose" the VOMS context with Unicore URL, the jsaga-* command first creates the default session and then checks that all contexts in the default session are initialized. You get this exception because your VOMS context is not initialized.
This has nothing to do with the Unicore URL, you would have got the same error with any URL.

When using jsaga-* commands, all contexts in the default session MUST be initialized, whatever URL are used afterwards.

Lionel

RE: UNICORE adaptor: how to use the correct context? - Added by Frizziero Eric almost 6 years ago

ok, now I understand completely about how to use the contexts! :-)

Now, the single context file works fine for my use-case.

Thank you very much for your help!
E r i c.

(1-10/10)