Bug 62118

Summary: NamingContextListener creates ServiceRef objects with wrong parameter?
Product: Tomcat 8 Reporter: Ángel Álvarez Páscua <angel.alvarez.pascua>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 8.5.27   
Target Milestone: ----   
Hardware: PC   
OS: All   

Description Ángel Álvarez Páscua 2018-02-19 15:05:46 UTC
The class NamingContextListener creates new ServiceRef objects this way

        Reference ref = new ServiceRef
            (service.getName(), service.getType(), service.getServiceqname(),
             service.getWsdlfile(), service.getJaxrpcmappingfile());

However, the constructor of the class ServiceRef is

    public ServiceRef(String refname, String serviceInterface, String[] serviceQname, String wsdl, String jaxrpcmapping) {


It seems the class is passing the type from the service when it should be the interface.

In my tests, the application fails with a ClassCastException because it's unable to use the interface (the type attribute of the object service is null), but if I change the service.getType by service.getInterface() ... it all works perfectly fine!
Comment 1 Mark Thomas 2018-02-19 16:35:50 UTC
Thanks for the report and, having looked at the code and the spec, I agree with your assessment.

Fixed in:
- trunk for 9.0.6 onwards
- 8.5.x for 8.5.29 onwards
- 8.0.x for 8.0.51 onwards
- 7.0.x for 7.0.86 onwards