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.
Location for Handler class in Java web service
-
24-03-2022 - |
Frage
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.
Lösung