Getting exception java.lang.NoSuchMethodError: org.apache.neethi.Constants.isPolicyElement

Chamila Adhikarinayake picture Chamila Adhikarinayake · Oct 10, 2012 · Viewed 9.7k times · Source

I'm connecting to a web service over SSL. I imported the certificate and added it to the java keystore. Then i created the client stub for the web service using wsdl2java.

when i use this in a program and try to invoke the service it throws follownig (part of the exception)

Exception in thread "main" java.lang.NoSuchMethodError: org.apache.neethi.Constants.isPolicyElement(Ljavax/xml/namespace/QName;)Z
    at org.apache.axis2.util.PolicyUtil.getPolicyChildren(PolicyUtil.java:287)
    at org.apache.axis2.deployment.AxisConfigBuilder.populateConfig(AxisConfigBuilder.java:157)
    at org.apache.axis2.deployment.DeploymentEngine.populateAxisConfiguration(DeploymentEngine.java:857)
    .
    .
    .

my code is kind of like this

public static void main(String[] args) {
    //generated by wsdl2java
    Clientstub stub = new ClientStub(endpoint); 
    .
    .

    //req is the passed parameter
    stub.requestServic(req);        

}

I think i have to import some security policies. if so can some one help me with it(any tutorials or directions).

Thanks in advance

Answer

Satheesh Cheveri picture Satheesh Cheveri · Oct 10, 2012

Looks like you are using older version of neethi.jar, can you add latest version of neethi into classpath. You can find the method org.apache.neethi.Constants.isPolicyElement() from neethi-3.0.1.jar onwards.

You may download this version from

http://www.java2s.com/Code/JarDownload/neethi/neethi-3.0.1.jar.zip