Axis2 Rampart Error WSPasswordCallback cannot be resolved to a type
posted 4 years ago
I had been struggling with this for about a week with the same issue so I thought I would contribute back to help anyone with the same issue now I have solved it.
Essentially I implemented the Basic Rampart Sample02 which is included in the rampart distribution.
to do this I created a simple Java project in eclipse added the Service class and also the Password Callback Handler.
After adding all the dependencies I used the Axis2 plugin to create a service.aar file and in the wizard selecting the services.xml file to be included from the rampart sample02 folder
and deployed it to the axis2 using the front end admin console usually found at http://localhost:8080/axis2/ if deployed to a local server.
then I needed to add the rampart.mar files to the \axis2\WEB-INF\modules\ folder of the axis2.war that is deployed from the rampart modules folder when you unpack the rampart download
and also copy the contents of the lib folder from for example C:\Rampart\rampart-dist-1.6.0-bin\rampart-1.6.0\lib\ to \axis2\WEB-INF\lib\ and restart the server
I then created another simple java project called client and added the Client.java file from the rampart samples02 added all the dependencies (essentially just the axis2 lib folder) and ran the client.
(In the client I had to find the endpoint I was using and also the axis2.xml config file which is located in the rampart sample02 folder called client.axis2.xml so I swapped this one out for the real one and referenced it)
At this point I had been following tutorials and expected it to run.
The client started outputting this error
which I could not figure out what the problem was as axis2 has the wss4j.jar in the lib folder and the service.aar file had both the service and PWCBHandler.java which was the password callback class.
so after changing from glassfish 3.1 to tomcat 7 and going through the same process and still no luck I eventually stumbled across a post about wrapping the PWCBHandler.class in a jar a putting it into the axis2 lib folder.
this worked great news hope this helps someone as when whacking WSPasswordCallback cannot be resolved to a type into google there really is nothing.
(Apologies if I have missed any steps)
feel free to ask any questions and I will try to answer them.