Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 230
Chamila Adhikarinayake Avatar asked Sep 21 '26 11:09

Chamila Adhikarinayake


2 Answers

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

like image 162
Satheesh Cheveri Avatar answered Sep 23 '26 23:09

Satheesh Cheveri


i'm use W12c, and add this line in the weblogic.xml inside of the project.

org.apache.neethi

Example:

<wls:weblogic-web-app
    xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd">
    <wls:container-descriptor>
        <wls:prefer-application-packages>
            <wls:package-name>org.slf4j</wls:package-name>
            <wls:package-name>org.apache.neethi</wls:package-name>
        </wls:prefer-application-packages>
    </wls:container-descriptor>
</wls:weblogic-web-app>

Congrats!!

like image 33
Yurifull Avatar answered Sep 24 '26 00:09

Yurifull



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!