Custom policies something failing with java.lang.NoClassDefFoundError
Hello RAM team,
We are using RAM 7.5.0.2. We have uploaded the custom policy bundled zip file with:
1.) custom policy jar file
2.) ramclient jar file and
3.) axis jar file.
in the RAM Administration page under Custom Extensions.
However, we are facing this issue frequently where our custom policies fail with the error :
This policy encountered an error during execution.
java.lang.NoClassDefFoundError: com/ibm/ram/client/RAMSession at com.deloitte.dsam.policy.VersioningPolicy.test(VersioningPolicy.java:127) at com.ibm.ram.repository.lifecycle.AssetLifecycleManager.runAssetPolicies(AssetLifecycleManager.java:2475) at com.ibm.ram.repository.lifecycle.AssetLifecycleManager.handleEventCycle(AssetLifecycleManager.java:1734) at com.ibm.ram.repository.lifecycle.AssetLifecycleManager.handleEvent(AssetLifecycleManager.java:524) at com.ibm.ram.repository.lifecycle.AssetLifecycleManager.save(AssetLifecycleManager.java:406) at com.ibm.ram.repository.lifecycle.AssetLifecycleManager.save(AssetLifecycleManager.java:361) at com.ibm.ram.repository.assets.AssetManager.primUpdateAssetWithState(AssetManager.java:3606) at com.ibm.ram.repository.assets.AssetManager.updateAssetWithState(AssetManager.java:3425) at com.ibm.ram.repository.assets.AssetManager.updateAsset(AssetManager.java:3395) at com.ibm.ram.repository.assets.AssetManager.updateAsset(AssetManager.java:3369) at com.ibm.ram.repository.web.upload.SubmitAssetHandler.uploadAsset(SubmitAssetHandler.java:276) at com.ibm.ram.repository.web.upload.SubmitAssetHandler.doFinishAction(SubmitAssetHandler.java:926) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:589) at org.apache.el.parser.AstValue.invoke(AstValue.java:159) at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276) at com.sun.faces.application.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88) at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102) at javax.faces.component.UICommand.broadcast(UICommand.java:387) at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:458) at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:763) at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1663) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1597) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:131) at com.ibm.ram.repository.web.security.RAMServletFilter.doFilter(RAMServletFilter.java:514) 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.ram.repository.web.filters.JavascriptSecurityFilter.doFilter(JavascriptSecurityFilter.java:33) 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.ram.repository.web.filters.GZipFilter.doFilter(GZipFilter.java:42) 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.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:91) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:864) at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583) 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.HttpICLReadCallback.complete(HttpICLReadCallback.java:83) 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)
When this issue occurs, the workaround approach that we follow is we go to the "Administration page" under Custom Extensions, click on modify and reupload the same bundled zip file and the custom policies start working fine.
Would you have any thoughts on what may cause this error to happen?
Please let me know if you need further information.
Thanks!
Regards,
Sripriya
One answer
It more than just ramclient.jar. you need all of the jars out of the ramclient.zip (except the ANT jars).
PS: In the latest version of RAM (actually starting with RAM 7510) you not supply the client jars at all if you are trying to access the same RAM instance in the policy as the RAM that is running. In that case the AssetPolicy.getPolicyContext().getRAMSession() gives you a RAMSession to work with. This RAMSession is far more efficient than the ramclient's RAMSession because it knows how to talk directly to RAM without going through HTTP.
PS: In the latest version of RAM (actually starting with RAM 7510) you not supply the client jars at all if you are trying to access the same RAM instance in the policy as the RAM that is running. In that case the AssetPolicy.getPolicyContext().getRAMSession() gives you a RAMSession to work with. This RAMSession is far more efficient than the ramclient's RAMSession because it knows how to talk directly to RAM without going through HTTP.