This is the exception that I am seeing when I try to consume a webservice.

java.lang.RuntimeException: Undefined 'Security policy namespace cannot be null.' resource property
at org.apache.rampart.RampartException.getMessage(RampartException.java:81)
at org.apache.rampart.RampartException.(RampartException.java:41)
at org.apache.rampart.RampartException.(RampartException.java:57)
at org.apache.rampart.RampartMessageData.setWSSecurityVersions(RampartMessageData.java:373)
at org.apache.rampart.RampartMessageData.(RampartMessageData.java:261)
at org.apache.rampart.MessageBuilder.build(MessageBuilder.java:61)
at org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:65)
at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:262)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:427)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:406)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at com.eloqua.secure.api.service.EloquaStub.retrieve(EloquaStub.java:2220)

This is how I am engaging rampart.

ConfigurationContext serviceContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem("/usr/axis2-1.6.0/repository", "/usr/axis2-1.6.0/conf/axis2.xml");
EloquaStub serviceStub = new EloquaStub(serviceContext, "<Link to the WSDL>");


ServiceClient client = serviceStub._getServiceClient();
client.engageModule("rampart");
Options options = client.getOptions();              
options.setUserName("<USERNAME>");
options.setPassword("**<PASSWORD>**");

RetrieveResponse retrieveResp = serviceStub.retrieve(retrieveData); //this where I am trying to consume to webservice.

I verified the path to axis2.xml and the repository. The following have been installed.

rahas-1.6.0.mar
rampart-1.6.0.mar

The code can find the above two files along with other modules. The permissions are set correctly. I know this because I do not see a "FileNotFound" exception.

I have set AXIS2_HOME path in the environment.

My questions are as follows.

  • What does the exception message mean?
  • How to resolve this issue?
有帮助吗?

解决方案

This error was because of classpath not being set correctly. I had two folders with similar axis jars. For some reason tomcat was in a weird state when this happen. I removed the the second folder from the classpath and it resolved itself.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top