You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by viji <vi...@beo.in> on 2019/12/05 09:10:57 UTC

Axis2 WS Security- Issue in loading merlin file path

Hello,

i am working on a web application and one of its module uses axis2
webservice with ws security rampart.
The application running on a linux server, and currently all the files
related to application moved to windows file server and all the jks files
also.

So while setting, org.apache.ws.security.crypto.merlin.file  for rampart
configuration ,


now getting an exception

12:49:32,674 ERROR [org.apache.rampart.util.RampartUtil] (pool-16-thread-1)
Error loading crypto properties.:
org.apache.ws.security.WSSecurityException: null cannot create instance
        at
deployment.webapp.war//org.apache.ws.security.components.crypto.CryptoFactory.getInstance(CryptoFactory.java:122)
        at
deployment.webapp.war//org.apache.rampart.util.RampartUtil.createCrypto(RampartUtil.java:347)
        at
deployment.webapp.war//org.apache.rampart.util.RampartUtil.getSignatureCrypto(RampartUtil.java:397)
        at
deployment.webapp.war//org.apache.rampart.RampartEngine.process(RampartEngine.java:137)
        at
deployment.webapp.war//org.apache.rampart.handler.RampartReceiver.invoke(RampartReceiver.java:92)
        at
deployment.webapp.war//org.apache.axis2.engine.Phase.invokeHandler(Phase.java:335)
        at
deployment.webapp.war//org.apache.axis2.engine.Phase.invoke(Phase.java:308)
        at
deployment.webapp.war//org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:250)
        at
deployment.webapp.war//org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:156)
        at
deployment.webapp.war//org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:357)
        at
deployment.webapp.war//org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:414)
        at
deployment.webapp.war//org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:225)
        at
deployment.webapp.war//org.apache.axis2.client.OperationClient.execute(OperationClient.java:150)
        at
deployment.webapp.war//com.external.service.ServiceStub.receiptRequest(ServiceStub.java:182)
        at
deployment.webapp.war//com.external.service.ServiceStubHandler.sendAndProcessResponse(ServiceStubHandler.java:206)
        at
deployment.webapp.war//com.external.service.ServiceStubHandler.processServiceRequest(ServiceStubHandler.java:179)
        at
deployment.webapp.war//com.external.service.ServiceStubHandler.requestService(ServiceStubHandler.java:97)
        at java.base/java.lang.Thread.run(Thread.java:844)
Caused by: org.apache.ws.security.components.crypto.CredentialException:
Proxy file (smb://fileserver/cert/cert.jks) not found.
        at
deployment.webapp.war//org.apache.ws.security.components.crypto.Merlin.loadInputStream(Merlin.java:337)
        at
deployment.webapp.war//org.apache.ws.security.components.crypto.Merlin.loadProperties(Merlin.java:179)
        at
deployment.webapp.war//org.apache.ws.security.components.crypto.Merlin.<init>(Merlin.java:140)
        at
deployment.webapp.war//org.apache.ws.security.components.crypto.CryptoFactory.getInstance(CryptoFactory.java:117)
        ... 22 more
Caused by: java.io.FileNotFoundException: smb:/fileserver/cert/cert.jks (No
such file or directory)
        at java.base/java.io.FileInputStream.open0(Native Method)
        at java.base/java.io.FileInputStream.open(FileInputStream.java:196)
        at
java.base/java.io.FileInputStream.<init>(FileInputStream.java:139)
        at java.base/java.io.FileInputStream.<init>(FileInputStream.java:94)
        at
deployment.webapp.war//org.apache.ws.security.components.crypto.Merlin.loadInputStream(Merlin.java:332)


Can anyone please help 

Thanks.



--
Sent from: http://axis.8716.n7.nabble.com/Axis-Java-User-f3.html

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


Re: Axis2 WS Security- Issue in loading merlin file path

Posted by viji <vi...@beo.in>.
Thank you so much for your reply. 

Yes , you are right.The application server is running in linux  and
certificate file is located in another windows system shared location.
So can't we put the certificates in another server which is of different
platform?



--
Sent from: http://axis.8716.n7.nabble.com/Axis-Java-User-f3.html

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


Re: Axis2 WS Security- Issue in loading merlin file path

Posted by "robertlazarski ." <ro...@gmail.com>.
I don't know much about rampart, though this seems to be your problem?

Caused by: org.apache.ws.security.components.crypto.CredentialException:
Proxy file (smb://fileserver/cert/cert.jks) not found.

On Wed, Dec 4, 2019, 23:01 viji <vi...@beo.in> wrote:

> Hello,
>
> i am working on a web application and one of its module uses axis2
> webservice with ws security rampart.
> The application running on a linux server, and currently all the files
> related to application moved to windows file server and all the jks files
> also.
>
> So while setting, org.apache.ws.security.crypto.merlin.file  for rampart
> configuration ,
>
>
> now getting an exception
>
> 12:49:32,674 ERROR [org.apache.rampart.util.RampartUtil] (pool-16-thread-1)
> Error loading crypto properties.:
> org.apache.ws.security.WSSecurityException: null cannot create instance
>         at
>
> deployment.webapp.war//org.apache.ws.security.components.crypto.CryptoFactory.getInstance(CryptoFactory.java:122)
>         at
>
> deployment.webapp.war//org.apache.rampart.util.RampartUtil.createCrypto(RampartUtil.java:347)
>         at
>
> deployment.webapp.war//org.apache.rampart.util.RampartUtil.getSignatureCrypto(RampartUtil.java:397)
>         at
>
> deployment.webapp.war//org.apache.rampart.RampartEngine.process(RampartEngine.java:137)
>         at
>
> deployment.webapp.war//org.apache.rampart.handler.RampartReceiver.invoke(RampartReceiver.java:92)
>         at
>
> deployment.webapp.war//org.apache.axis2.engine.Phase.invokeHandler(Phase.java:335)
>         at
> deployment.webapp.war//org.apache.axis2.engine.Phase.invoke(Phase.java:308)
>         at
>
> deployment.webapp.war//org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:250)
>         at
>
> deployment.webapp.war//org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:156)
>         at
>
> deployment.webapp.war//org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:357)
>         at
>
> deployment.webapp.war//org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:414)
>         at
>
> deployment.webapp.war//org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:225)
>         at
>
> deployment.webapp.war//org.apache.axis2.client.OperationClient.execute(OperationClient.java:150)
>         at
>
> deployment.webapp.war//com.external.service.ServiceStub.receiptRequest(ServiceStub.java:182)
>         at
>
> deployment.webapp.war//com.external.service.ServiceStubHandler.sendAndProcessResponse(ServiceStubHandler.java:206)
>         at
>
> deployment.webapp.war//com.external.service.ServiceStubHandler.processServiceRequest(ServiceStubHandler.java:179)
>         at
>
> deployment.webapp.war//com.external.service.ServiceStubHandler.requestService(ServiceStubHandler.java:97)
>         at java.base/java.lang.Thread.run(Thread.java:844)
> Caused by: org.apache.ws.security.components.crypto.CredentialException:
> Proxy file (smb://fileserver/cert/cert.jks) not found.
>         at
>
> deployment.webapp.war//org.apache.ws.security.components.crypto.Merlin.loadInputStream(Merlin.java:337)
>         at
>
> deployment.webapp.war//org.apache.ws.security.components.crypto.Merlin.loadProperties(Merlin.java:179)
>         at
>
> deployment.webapp.war//org.apache.ws.security.components.crypto.Merlin.<init>(Merlin.java:140)
>         at
>
> deployment.webapp.war//org.apache.ws.security.components.crypto.CryptoFactory.getInstance(CryptoFactory.java:117)
>         ... 22 more
> Caused by: java.io.FileNotFoundException: smb:/fileserver/cert/cert.jks (No
> such file or directory)
>         at java.base/java.io.FileInputStream.open0(Native Method)
>         at java.base/java.io
> .FileInputStream.open(FileInputStream.java:196)
>         at
> java.base/java.io.FileInputStream.<init>(FileInputStream.java:139)
>         at java.base/java.io
> .FileInputStream.<init>(FileInputStream.java:94)
>         at
>
> deployment.webapp.war//org.apache.ws.security.components.crypto.Merlin.loadInputStream(Merlin.java:332)
>
>
> Can anyone please help
>
> Thanks.
>
>
>
> --
> Sent from: http://axis.8716.n7.nabble.com/Axis-Java-User-f3.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
>

Re: Axis2 WS Security- Issue in loading merlin file path

Posted by viji <vi...@beo.in>.
Hello Robertlazarski,

Thank you very much for your support. It works with a file path on the local
file system.


Can any Rampart expert user help me regarding my question, that can we give
merlin certificate file as a  stream instead of certificate file path as
string?



--
Sent from: http://axis.8716.n7.nabble.com/Axis-Java-User-f3.html

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


Re: Axis2 WS Security- Issue in loading merlin file path

Posted by "robertlazarski ." <ro...@gmail.com>.
I am not a rampart user though the examples I see in the docs use a file
path on the local file system. So I would deploy it under WEB-INF/classes
and pass a relative path to it.

On Fri, Dec 6, 2019 at 12:10 AM viji <vi...@beo.in> wrote:

>
> the rampart configuration is done like following
>
>  rampartConfig(String signatureCertFilePath, String certPassword)
>         {
>                 Properties merlinProperties = new Properties();
>
> merlinProperties.put("org.apache.ws.security.crypto.merlin.keystore.type",
> "JKS");
>
>
> merlinProperties.put("org.apache.ws.security.crypto.merlin.file",signatureCertFilePath);
>
>
> merlinProperties.put("org.apache.ws.security.crypto.merlin.keystore.password",
> certPassword);
>                 CryptoConfig cryptoConfig = new CryptoConfig();
>                 cryptoConfig.setProvider(Merlin.class.getName());
>                 cryptoConfig.setProp(merlinProperties);
>                 RampartConfig rampartConfig = new RampartConfig();
>                 rampartConfig.setSigCryptoConfig(cryptoConfig);
>       }
>
> So you mean instead of string path , we should give some sort of stream
>
>
>
> --
> Sent from: http://axis.8716.n7.nabble.com/Axis-Java-User-f3.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
>

Re: Axis2 WS Security- Issue in loading merlin file path

Posted by viji <vi...@beo.in>.
the rampart configuration is done like following 

 rampartConfig(String signatureCertFilePath, String certPassword)
	{
		Properties merlinProperties = new Properties();
		merlinProperties.put("org.apache.ws.security.crypto.merlin.keystore.type",
"JKS");
	
merlinProperties.put("org.apache.ws.security.crypto.merlin.file",signatureCertFilePath);
	
merlinProperties.put("org.apache.ws.security.crypto.merlin.keystore.password",
certPassword);
		CryptoConfig cryptoConfig = new CryptoConfig();
		cryptoConfig.setProvider(Merlin.class.getName());
		cryptoConfig.setProp(merlinProperties);
		RampartConfig rampartConfig = new RampartConfig();
		rampartConfig.setSigCryptoConfig(cryptoConfig);
      }

So you mean instead of string path , we should give some sort of stream 



--
Sent from: http://axis.8716.n7.nabble.com/Axis-Java-User-f3.html

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


Re: Axis2 WS Security- Issue in loading merlin file path

Posted by "robertlazarski ." <ro...@gmail.com>.
You need an input stream of some sort, the three choices I would apply
would be to store the cert in a DB in PEM format, in the WEB-INF/classes
dir and use getResourceAsStream(), or figure out how to use the smb
protocol from Java - in that order.

On Wed, Dec 4, 2019 at 11:01 PM viji <vi...@beo.in> wrote:

> Hello,
>
> i am working on a web application and one of its module uses axis2
> webservice with ws security rampart.
> The application running on a linux server, and currently all the files
> related to application moved to windows file server and all the jks files
> also.
>
> So while setting, org.apache.ws.security.crypto.merlin.file  for rampart
> configuration ,
>
>
> now getting an exception
>
> 12:49:32,674 ERROR [org.apache.rampart.util.RampartUtil] (pool-16-thread-1)
> Error loading crypto properties.:
> org.apache.ws.security.WSSecurityException: null cannot create instance
>         at
>
> deployment.webapp.war//org.apache.ws.security.components.crypto.CryptoFactory.getInstance(CryptoFactory.java:122)
>         at
>
> deployment.webapp.war//org.apache.rampart.util.RampartUtil.createCrypto(RampartUtil.java:347)
>         at
>
> deployment.webapp.war//org.apache.rampart.util.RampartUtil.getSignatureCrypto(RampartUtil.java:397)
>         at
>
> deployment.webapp.war//org.apache.rampart.RampartEngine.process(RampartEngine.java:137)
>         at
>
> deployment.webapp.war//org.apache.rampart.handler.RampartReceiver.invoke(RampartReceiver.java:92)
>         at
>
> deployment.webapp.war//org.apache.axis2.engine.Phase.invokeHandler(Phase.java:335)
>         at
> deployment.webapp.war//org.apache.axis2.engine.Phase.invoke(Phase.java:308)
>         at
>
> deployment.webapp.war//org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:250)
>         at
>
> deployment.webapp.war//org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:156)
>         at
>
> deployment.webapp.war//org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:357)
>         at
>
> deployment.webapp.war//org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:414)
>         at
>
> deployment.webapp.war//org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:225)
>         at
>
> deployment.webapp.war//org.apache.axis2.client.OperationClient.execute(OperationClient.java:150)
>         at
>
> deployment.webapp.war//com.external.service.ServiceStub.receiptRequest(ServiceStub.java:182)
>         at
>
> deployment.webapp.war//com.external.service.ServiceStubHandler.sendAndProcessResponse(ServiceStubHandler.java:206)
>         at
>
> deployment.webapp.war//com.external.service.ServiceStubHandler.processServiceRequest(ServiceStubHandler.java:179)
>         at
>
> deployment.webapp.war//com.external.service.ServiceStubHandler.requestService(ServiceStubHandler.java:97)
>         at java.base/java.lang.Thread.run(Thread.java:844)
> Caused by: org.apache.ws.security.components.crypto.CredentialException:
> Proxy file (smb://fileserver/cert/cert.jks) not found.
>         at
>
> deployment.webapp.war//org.apache.ws.security.components.crypto.Merlin.loadInputStream(Merlin.java:337)
>         at
>
> deployment.webapp.war//org.apache.ws.security.components.crypto.Merlin.loadProperties(Merlin.java:179)
>         at
>
> deployment.webapp.war//org.apache.ws.security.components.crypto.Merlin.<init>(Merlin.java:140)
>         at
>
> deployment.webapp.war//org.apache.ws.security.components.crypto.CryptoFactory.getInstance(CryptoFactory.java:117)
>         ... 22 more
> Caused by: java.io.FileNotFoundException: smb:/fileserver/cert/cert.jks (No
> such file or directory)
>         at java.base/java.io.FileInputStream.open0(Native Method)
>         at java.base/java.io
> .FileInputStream.open(FileInputStream.java:196)
>         at
> java.base/java.io.FileInputStream.<init>(FileInputStream.java:139)
>         at java.base/java.io
> .FileInputStream.<init>(FileInputStream.java:94)
>         at
>
> deployment.webapp.war//org.apache.ws.security.components.crypto.Merlin.loadInputStream(Merlin.java:332)
>
>
> Can anyone please help
>
> Thanks.
>
>
>
> --
> Sent from: http://axis.8716.n7.nabble.com/Axis-Java-User-f3.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
>