title: WSO2 ESB: JAR file with callback handler not loading
body: <p>I am trying to setup a proxy service that hides the security of a back end service, following the tutorial found <a href="http://soasecurity.org/2012/11/05/how-to-invoke-secured-backend-service-using-wso2-esb/" rel="nofollow">here</a>.
  For the password callback handler I follow the instructions found <a href="http://soasecurity.org/2010/02/07/how-to-create-a-password-callback-class/" rel="nofollow">here</a>.
  All pretty basic and straightforward.</p>
  
  <p>I compiled the <code>PWCBHandler</code> class into a JAR file and put it in the esbhome\repository\components\lib folder together with all the JAR files from wss4j-1.6.15\lib.</p>
  
  <p>I see no warnings or errors during startup of the ESB. However when I test the proxy service, I get the following error in the log:</p>
  
  <pre><code>org.apache.axis2.AxisFault: Error in obtaining a token
      at org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:76)
      at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
  ...
  Caused by: org.apache.rampart.RampartException: Error in obtaining a token
      at org.apache.rampart.util.RampartUtil.getToken(RampartUtil.java:779)
      at org.apache.rampart.util.RampartUtil.getIssuedToken(RampartUtil.java:675)
  ...
  Caused by: org.apache.rampart.RampartException: Cannot load password callback class: PWCBHandler
      at org.apache.rampart.util.RampartUtil.getPasswordCB(RampartUtil.java:144)
      at org.apache.rampart.util.RampartUtil.getPasswordCB(RampartUtil.java:118)
      at org.apache.rampart.util.RampartUtil.getToken(RampartUtil.java:723)
  ...
      ... 26 more
  Caused by: java.lang.ClassNotFoundException: PWCBHandler
      at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
      at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
      at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
      at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
      ... 26 more
  Caused by: java.lang.ClassNotFoundException: PWCBHandler
      at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
      at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
      at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
      at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:190)
      at org.apache.ws.security.util.Loader.loadClass(Loader.java:200)
      at org.apache.ws.security.util.Loader.loadClass(Loader.java:163)
      at org.apache.rampart.util.RampartUtil.getPasswordCB(RampartUtil.java:142)
      ... 28 more
  [2014-06-16 15:56:23,103]  WARN - FaultHandler ERROR_CODE : 0
  [2014-06-16 15:56:23,103]  WARN - FaultHandler ERROR_MESSAGE : Unexpected error during sending message out
  [2014-06-16 15:56:23,103]  WARN - FaultHandler ERROR_DETAIL : org.apache.synapse.SynapseException: Unexpected error during sending message out
      at org.apache.synapse.core.axis2.Axis2Sender.handleException(Axis2Sender.java:170)
      at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:69)
  ...
  </code></pre>
  
  <p>In other words, the ESB and Rampart know about the <code>PWCBHandler</code> class but it cannot load / access it.</p>
  
  <p>At this point I have no ideas where to look further. Is there a way where I can check which JAR files were loaded during startup? What might prohibit the loading of the <code>PWCBHandler</code> JAR?</p>
  
  <p>Thanks for your feedback,</p>
  
  <p>Olivier</p>