3

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

Chamila Adhikarinayake
  • 3,588
  • 5
  • 25
  • 32

2 Answers2

6

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

Satheesh Cheveri
  • 3,621
  • 3
  • 27
  • 46
2

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!!

Yurifull
  • 373
  • 2
  • 5