0

I'm trying to add a SOAP Handler to a web service.

The annotation added to the web service right after the @WebService annotation is:

@HandlerChain(file="MyHandler.xml")

The web service is packaged with the service class under WEB-INF/classes and the handler class is in a jar located under WEB-INF/lib.

For example:

WEB-INF/classes/com/.../MyService.class
WEB-INF/classes/com/.../MyServiceImpl.class
WEB-INF/classes/com/.../MyHandler.xml
.
.
.
WEB-INF/lib/JarProvidedToMe.jar  <--- Has the handler class (MyHandler.class) in it that is referenced in MyHandler.xml

MyHandler.xml (Changed the fully qualified name):

<?xml version="1.0" encoding="UTF-8"?>
<handler-chains xmlns="http://java.sun.com/xml/ns/javaee">
    <handler-chain>
        <handler>
            <handler-name>com.full.path.MyHandler</handler-name>
            <handler-class>com.full.path.MyHandler</handler-class>
        </handler>
    </handler-chain>
</handler-chains>

When I try to deploy the web service I get ClassNotFoundException for the handler class (MyHandler.class) referenced in the MyHandler.xml.

Using Eclipse I have been able to add my own handler using the dialogs in eclipse. Eclipse put the handler class in the same location as the service class. But I need to be able to use the handler that has been provided to me in a jar file.

The web service is being deployed in an ear file to WebLogic 10.3

Please let me know if I need to describe something better. I'm new to web services and Java.

Thanks.

Yadrif
  • 169
  • 2
  • 11
  • Could you post the relevant portion of MyHandler.xml? – rdcrng Mar 19 '13 at 17:35
  • I modified the original post to include MyHandler.xml – Yadrif Mar 19 '13 at 17:46
  • The only other thing I can think of is verify again that your provided jar is actually present on the classpath, i.e. you haven't made a mistake packaging it. – rdcrng Mar 19 '13 at 17:48
  • 1
    I found why I was getting ClassNotFoundException... The issue was really that the handler code was throwing an exception in the constructor. For some reason this showed up as ClassNotFound. – Yadrif Mar 26 '13 at 13:59

1 Answers1

2

The issue was really that the handler code (MyHandler) was throwing an exception in the constructor. This was causing WebLogic to display a ClassNotFoundException. I fixed the issue causing the constructor to throw an exception and the handler is attached and invoked properly.

Yadrif
  • 169
  • 2
  • 11