Class cl = Class.forName(pojoClass);
ClassLoader classLoader = ((XBeanServiceUnit) getServiceUnit()).getConfigurationClassLoader(); Class cl = Class.forName(pojoClass, true, classLoader);
    public void registerService() throws Exception {        if (pojo == null) {            Class cl = Class.forName(pojoClass);            pojo = cl.newInstance();        }        // Determine annotations        WebAnnotations wa = null;        String selectedAnnotations = null;        if (annotations != null) {            selectedAnnotations = annotations;            if (!annotations.equals("none")) {                wa = (WebAnnotations) knownAnnotations.get(annotations);                if (wa == null) {                    throw new Exception("Unrecognized annotations: " + annotations);                }            }        } else {            for (Iterator it = knownAnnotations.entrySet().iterator(); it.hasNext();) {                Map.Entry entry = (Map.Entry) it.next();                WebAnnotations w = (WebAnnotations) entry.getValue();                if (w.hasWebServiceAnnotation(pojo.getClass())) {                    selectedAnnotations = (String) entry.getKey();                    wa = w;                    break;                }            }        }        // Determine TypeMappingRegistry        TypeMappingRegistry tm = null;        String selectedTypeMapping = null;        if (typeMapping == null) {            selectedTypeMapping = (wa == null) ? "default" : "jaxb2";        } else {            selectedTypeMapping = typeMapping;        }        tm = (TypeMappingRegistry) knownTypeMappings.get(selectedTypeMapping);        if (tm == null) {            throw new Exception("Unrecognized typeMapping: " + typeMapping);        }        // Create factory        XFire xfire = getXFire();        ObjectServiceFactory factory = null;        Class serviceClass = pojo.getClass();        if (serviceInterface != null) {            serviceClass = Class.forName(serviceInterface);        }        if (wa == null) {            factory = new ObjectServiceFactory(xfire.getTransportManager(),                                               new AegisBindingProvider(tm));        } else if (selectedAnnotations.equals("java5") && selectedTypeMapping.equals("jaxb2")) {            try {                Class clazz = Class.forName("org.codehaus.xfire.jaxws.JAXWSServiceFactory");                Constructor ct = clazz.getDeclaredConstructor(new Class[] { TransportManager.class });                factory = (ObjectServiceFactory) ct.newInstance(new Object[] { xfire.getTransportManager() });            } catch (Exception e) {                factory = new AnnotationServiceFactory(wa,                         xfire.getTransportManager(),                         new AegisBindingProvider(tm));            }        } else {            factory = new AnnotationServiceFactory(wa,                                                    xfire.getTransportManager(),                                                    new AegisBindingProvider(tm));        }        String svcLocalName = (service != null) ? service.getLocalPart() : null;        String svcNamespace = (service != null) ? service.getNamespaceURI() : null;        Map props = new HashMap();        props.put(ObjectServiceFactory.PORT_TYPE, interfaceName);        props.put(ObjectServiceFactory.STYLE, SoapConstants.STYLE_WRAPPED);        props.put(ObjectServiceFactory.USE, SoapConstants.USE_LITERAL);        factory.getSoap11Transports().clear();        factory.getSoap12Transports().clear();        factory.getSoap11Transports().add(JbiTransport.JBI_BINDING);        xfireService = factory.create(serviceClass, svcLocalName, svcNamespace, props);        xfireService.setInvoker(new BeanInvoker(getPojo()));        xfire.getServiceRegistry().register(xfireService);        this.description = generateWsdl();                // Check service name and endpoint name        QName serviceName = xfireService.getName();        QName interfName = xfireService.getServiceInfo().getPortType();        String endpointName = null;        if (service == null) {            service = serviceName;        } else if (!service.equals(serviceName)) {            logger.warn("The service name defined in the wsdl (" + serviceName +                         ") does not match the service name defined in the endpoint spec (" + service +                         "). WSDL description may be unusable.");        }        if (interfaceName == null) {            interfaceName = interfName;        } else if (!interfaceName.equals(interfName)) {            logger.warn("The interface name defined in the wsdl (" + interfName +                     ") does not match the service name defined in the endpoint spec (" + interfaceName +                     "). WSDL description may be unusable.");        }        Definition d = WSDLFactory.newInstance().newWSDLReader().readWSDL(null, description);        javax.wsdl.Service service = d.getService(serviceName);        if (service != null) {            if (service.getPorts().values().size() == 1) {                Port port = (Port) service.getPorts().values().iterator().next();                // Check if this is the same as defined in endpoint spec                endpointName = port.getName();                if (endpoint == null) {                    endpoint = endpointName;                } else if (!endpoint.equals(endpointName)) {                    logger.warn("The endpoint name defined in the wsdl (" + endpointName +                             ") does not match the endpoint name defined in the endpoint spec (" + endpoint +                     "). WSDL description may be unusable.");                }            }        }        if (endpoint == null) {            throw new IllegalArgumentException("endpoint name should be provided");        }    }