[ 
https://issues.apache.org/jira/browse/AXIS2-4930?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13159532#comment-13159532
 ] 

Andreas Veithen commented on AXIS2-4930:
----------------------------------------

Besides the fact that it causes a performance issue and (probably) a memory 
leak (as described in AXIS2-5203), the change is incorrect and unnecessarily 
complex.

Basically, it creates a new class loader with the same URLs as the service 
class loader and with the thread context class loader as parent. This new class 
loader is meant to load JAX-WS handlers. To see why this is incorrect, assume 
that you have a service A and a handler B that both use the same class C. If 
all these classes are in the service archive, then C will be loaded twice 
because the new class loader doesn't delegate to the service class loader. If A 
and B attempt to share an instance of C, then this will result in an error.

In addition to that, "merging" the context class loader with the service class 
loader would only make sense in scenarios where the context class loader is not 
an ancestor of the service class loader (more precisely where the service class 
loader doesn't delegate to the context class loader). This is certainly not the 
case for a WAR deployment because the context class loader will be the 
application class loader and the service class loader delegates to the 
application class loader. I don't know any type of deployment where this 
scenario would occur.

I think that the correct solution for the issue is to either set the service 
class loader as the context class loader or to make sure that Axis2 uses the 
service class loader instead of the context class loader when loading a JAX-WS 
handler.
                
> handler class can't find, when using @HandlerChain in jaxws
> -----------------------------------------------------------
>
>                 Key: AXIS2-4930
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4930
>             Project: Axis2
>          Issue Type: Bug
>          Components: jaxws
>         Environment: Linux, JDK 1.6
>            Reporter: Kasun Weranga Gunathilake
>            Assignee: Isuru Eranga Suriarachchi
>             Fix For: 1.6.0
>
>         Attachments: jaxwshand.jar, patch.txt
>
>
> When I used @HandlerChain in jaxws with handler class define in the 
> handlerchain.xml, It throws an exception by saying handler class can't find. 
> AFAIU the issue comes because of classloader doesn't add the service jar to 
> the class path.
> This is the exception.
> [ERROR] java.lang.ClassNotFoundException: HandlerResolverImpl cannot load the 
> following class Throwable Exception 
> Occured:com.javacoda.jaxws.order.InfoHandler
> org.apache.axis2.AxisFault: java.lang.ClassNotFoundException: 
> HandlerResolverImpl cannot load the following class Throwable Exception 
> Occured:com.javacoda.jaxws.order.InfoHandler
>       at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
>       at 
> org.apache.axis2.jaxws.server.JAXWSMessageReceiver.receive(JAXWSMessageReceiver.java:242)
>       at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
>       at 
> org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
>       at 
> org.apache.axis2.transport.http.HTTPWorker.service(HTTPWorker.java:296)
>       at 
> org.apache.axis2.transport.http.server.AxisHttpService.doService(AxisHttpService.java:281)
>       at 
> org.apache.axis2.transport.http.server.AxisHttpService.handleRequest(AxisHttpService.java:187)
>       at 
> org.apache.axis2.transport.http.server.HttpServiceProcessor.run(HttpServiceProcessor.java:82)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>       at java.lang.Thread.run(Thread.java:619)
> Caused by: javax.xml.ws.WebServiceException: 
> java.lang.ClassNotFoundException: HandlerResolverImpl cannot load the 
> following class Throwable Exception 
> Occured:com.javacoda.jaxws.order.InfoHandler
>       at 
> org.apache.axis2.jaxws.ExceptionFactory.createWebServiceException(ExceptionFactory.java:175)
>       at 
> org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:70)
>       at 
> org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:128)
>       at 
> org.apache.axis2.jaxws.handler.HandlerResolverImpl.resolveHandlers(HandlerResolverImpl.java:359)
>       at 
> org.apache.axis2.jaxws.handler.HandlerResolverImpl.getHandlerClasses(HandlerResolverImpl.java:143)
>       at 
> org.apache.axis2.jaxws.handler.HandlerResolverImpl.getHandlerChain(HandlerResolverImpl.java:167)
>       at 
> org.apache.axis2.jaxws.server.EndpointController.handleRequest(EndpointController.java:240)
>       at 
> org.apache.axis2.jaxws.server.EndpointController.invoke(EndpointController.java:103)
>       at 
> org.apache.axis2.jaxws.server.JAXWSMessageReceiver.receive(JAXWSMessageReceiver.java:161)
>       ... 9 more
> Caused by: java.lang.ClassNotFoundException: HandlerResolverImpl cannot load 
> the following class Throwable Exception 
> Occured:com.javacoda.jaxws.order.InfoHandler
>       at 
> org.apache.axis2.jaxws.spi.handler.BaseHandlerResolver$1.run(BaseHandlerResolver.java:313)
>       at 
> org.apache.axis2.java.security.AccessController.doPrivileged(AccessController.java:132)
>       at 
> org.apache.axis2.jaxws.spi.handler.BaseHandlerResolver.forName(BaseHandlerResolver.java:300)
>       at 
> org.apache.axis2.jaxws.spi.handler.BaseHandlerResolver.loadClass(BaseHandlerResolver.java:113)
>       at 
> org.apache.axis2.jaxws.handler.HandlerResolverImpl.resolveHandlers(HandlerResolverImpl.java:356)
>       ... 14 more
>  

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to