Bug 62118 - NamingContextListener creates ServiceRef objects with wrong parameter?
Summary: NamingContextListener creates ServiceRef objects with wrong parameter?
Alias: None
Product: Tomcat 8
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 8.5.27
Hardware: PC All
: P2 normal (vote)
Target Milestone: ----
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2018-02-19 15:05 UTC by Ángel Álvarez Páscua
Modified: 2018-02-19 16:35 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
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