• Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting WSSecurityException  RSS feed

 
sudha perumal
Greenhorn
Posts: 9
Eclipse IDE Java Notepad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm working on a webservice provider component.
I'm getting WSSecurityException.
PFB the exception

'processSOAPRequest An error occurred when trying to read the trust store using JConfig. The JConfig file being used was null
java.security.GeneralSecurityException: org.apache.ws.security.WSSecurityException: class org.apache.ws.security.components.crypto.Merlin cannot create instance'

I'm using WAS7.

Im struggling with this issue for a week.
Please help me out at the earliest.
Thanks in advance.
 
Carles Gasques
Ranch Hand
Posts: 199
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I understand that you have a web service that is looking for a trust store path.
This trust store path is declared in a properties file managed by JConfig.
But JConfig can't find the properties file.

First thought, take a look to the JConfig descriptor config.xml and where is placed.
Is it placed in the classpath?


Best reggards,
 
sudha perumal
Greenhorn
Posts: 9
Eclipse IDE Java Notepad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. It is placed in the classpath only.
I little bit confused whether it is placed in classpath. But I got it confirmed by renaming the JKS file.
The log clearly showed that there is no such file like that.
 
Carles Gasques
Ranch Hand
Posts: 199
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I expected that this JConfig api searched first the classpath looking for the configuration file,
but seems that it has to be explicitly declared (systemPath)


Is this parameter pointing to the config file?


 
sudha perumal
Greenhorn
Posts: 9
Eclipse IDE Java Notepad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry. I didn't get it.
But I'm not using JConfig.xml explicitly since I'm using WAS7 and Spring3.
Using beans.xml file with SpringApplicationContext, property file is getting loaded.
WSF2ProviderDefaultHandler class helps to read the property file.
 
Carles Gasques
Ranch Hand
Posts: 199
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Without the full stack trace is hard to tell what is going on.
I was guessing that the JConfig reference means that you are using this library to dynamically reload properties at runtime
and the config.xml (not some Spring descriptor file named config.xml) required for JConfig couldn't be found.
 
sudha perumal
Greenhorn
Posts: 9
Eclipse IDE Java Notepad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
PFB the stack trace


[5/27/13 12:39:20:190 IST] 00000024 SystemOut O WebContainer : 0 DEBUG [WSF2ProviderDefaultHandler]:buildWsseUsernameTokenVO ENTER buildWsseUsernameTokenVO()
[5/27/13 12:39:20:190 IST] 00000024 SystemOut O WebContainer : 0 DEBUG [WSF2ProviderDefaultHandler]:buildWsseUsernameTokenVO EXIT getWsseUsernameTokenVO()
[5/27/13 12:39:20:190 IST] 00000024 SystemOut O WebContainer : 0 DEBUG [ConsumerIdentity]:isSenderViaWSM ENTER isSenderViaWSM(), userName:
[5/27/13 12:39:20:190 IST] 00000024 SystemOut O WebContainer : 0 DEBUG [ConsumerIdentity]:isSenderViaWSM EXIT isSenderViaWSM(), bool: false
[5/27/13 12:39:20:190 IST] 00000024 SystemOut O WebContainer : 0 DEBUG [WSF2CryptoFactory]:getCrypto ENTER --> WSF2CryptoFactory.getCrypto()
[5/27/13 12:39:20:190 IST] 00000024 SystemOut O WebContainer : 0 DEBUG [WSF2CryptoFactory]:getCrypto Key Store path read by Crypto props = com/plannet/wsf2/plannet_Internal_Comm_Provider.jks
[5/27/13 12:39:20:190 IST] 00000024 SystemOut O WebContainer : 0 DEBUG [WSF2CryptoFactory]:getCrypto Key Store type read by Crypto props = jks
[5/27/13 12:39:20:253 IST] 00000024 SystemOut O WebContainer : 0 ERROR [WSF2CryptoFactory]:getCrypto WSF2CryptoFactory.getCrypto() - WSSecurityException: class org.apache.ws.security.components.crypto.Merlin cannot create instance
[5/27/13 12:39:20:253 IST] 00000024 SystemOut O WebContainer : 0 DEBUG [FaultManager]:getLogMessage ENTER --> FaultManager.getLogMessage()
[5/27/13 12:39:20:253 IST] 00000024 SystemOut O WebContainer : 0 DEBUG [FaultManager]:getLogMessage szMsgs=1, szParams=1
[5/27/13 12:39:20:253 IST] 00000024 SystemOut O WebContainer : 0 DEBUG [FaultManager]:getLogMessage i=1, j=1
[5/27/13 12:39:20:253 IST] 00000024 SystemOut O WebContainer : 0 DEBUG [FaultManager]:getLogMessage Returning evaluated Log Message= An error occurred when trying to read the trust store using JConfig. The JConfig file being used was null
[5/27/13 12:39:20:253 IST] 00000024 SystemOut O WebContainer : 0 DEBUG [FaultManager]:getLogMessage EXIT --> FaultManager.getLogMessage(), time taken= 0 ms
[5/27/13 12:39:20:253 IST] 00000024 SystemOut O WebContainer : 0 ERROR [WSF2ProviderDefaultHandler2]:processSOAPRequest An error occurred when trying to read the trust store using JConfig. The JConfig file being used was null
java.security.GeneralSecurityException: org.apache.ws.security.WSSecurityException: class org.apache.ws.security.components.crypto.Merlin cannot create instance
at com.plannet.wsf2.crypto.WSF2CryptoFactory.getCrypto(WSF2CryptoFactory.java:249)
at com.plannet.wsf2.handler.WSF2ProviderDefaultHandler.processSOAPRequest(WSF2ProviderDefaultHandler.java:267)
at com.plannet.wsf2.handler.WSF2ProviderDefaultHandler.handleMessage(WSF2ProviderDefaultHandler.java:113)
at com.plannet.wsf2.handler.WSF2ProviderDefaultHandler.handleMessage(WSF2ProviderDefaultHandler.java:68)
at org.apache.axis2.jaxws.handler.HandlerChainProcessor.callHandleMessageWithTracker(HandlerChainProcessor.java:832)
at org.apache.axis2.jaxws.handler.HandlerChainProcessor.handleMessage(HandlerChainProcessor.java:494)
at org.apache.axis2.jaxws.handler.HandlerChainProcessor.callGenericHandlers(HandlerChainProcessor.java:267)
at org.apache.axis2.jaxws.handler.HandlerChainProcessor.processChain(HandlerChainProcessor.java:210)
at org.apache.axis2.jaxws.handler.HandlerInvokerUtils.invokeInboundHandlers(HandlerInvokerUtils.java:65)
at org.apache.axis2.jaxws.handler.impl.HandlerInvokerImpl.invokeInboundHandlers(HandlerInvokerImpl.java:37)
at org.apache.axis2.jaxws.server.EndpointController.inboundHeaderAndHandlerProcessing(EndpointController.java:348)
at org.apache.axis2.jaxws.server.EndpointController.handleRequest(EndpointController.java:260)
at org.apache.axis2.jaxws.server.EndpointController.invoke(EndpointController.java:103)
at org.apache.axis2.jaxws.server.JAXWSMessageReceiver.receive(JAXWSMessageReceiver.java:161)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:189)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
at com.ibm.ws.websvcs.transport.http.WASAxis2Servlet.doPost(WASAxis2Servlet.java:1380)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:738)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1657)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1597)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:131)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:188)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:77)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:908)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:934)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3935)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:276)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:931)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1592)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:276)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1604)
Caused by: org.apache.ws.security.WSSecurityException: class org.apache.ws.security.components.crypto.Merlin cannot create instance
at org.apache.ws.security.components.crypto.CryptoFactory.loadClass(CryptoFactory.java:224)
at org.apache.ws.security.components.crypto.CryptoFactory.getInstance(CryptoFactory.java:117)
at org.apache.ws.security.components.crypto.CryptoFactory.getInstance(CryptoFactory.java:78)
at com.plannet.wsf2.crypto.WSF2CryptoFactory.getCrypto(WSF2CryptoFactory.java:215)
... 49 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:56)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:39)
at java.lang.reflect.Constructor.newInstance(Constructor.java:527)
at org.apache.ws.security.components.crypto.CryptoFactory.loadClass(CryptoFactory.java:219)
... 52 more
Caused by: org.apache.ws.security.components.crypto.CredentialException: Failed to load credentials.
at org.apache.ws.security.components.crypto.Merlin.load(Merlin.java:371)
at org.apache.ws.security.components.crypto.Merlin.loadProperties(Merlin.java:190)
at org.apache.ws.security.components.crypto.Merlin.<init>(Merlin.java:140)
... 57 more
Caused by: java.io.IOException: Invalid keystore format
at com.ibm.crypto.provider.JavaKeyStore.engineLoad(Unknown Source)
at java.security.KeyStore.load(KeyStore.java:414)
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Caused by: java.io.IOException: Invalid keystore format

Can you ascertain that the key store file is valid?
 
sudha perumal
Greenhorn
Posts: 9
Eclipse IDE Java Notepad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure.. That is valid one
 
sudha perumal
Greenhorn
Posts: 9
Eclipse IDE Java Notepad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The issue is resolved now.
The problem is that I mentioned filtering as true for JKS file in pom.xml.
So my JKS file was getting corrupted.

Please refer,
http://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html

Warning: Do not filter files with binary content like images! This will most likely result in corrupt output. If you have both text files and binary files as resources, you need to declare two mutually exclusive resource sets. The first resource set defines the files to be filtered and the other resource set defines the files to copy unaltered.


Thanks for trying to help me.
 
Carles Gasques
Ranch Hand
Posts: 199
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Sudha,
to let us know.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!