Package org.osgi.framework

Examples of org.osgi.framework.ServiceException


            for (Object o = m_lockedRegsMap.get(reg); (o != null); o = m_lockedRegsMap.get(reg))
            {
                // We don't allow cycles when we call out to the service factory.
                if (o.equals(Thread.currentThread()))
                {
                    throw new ServiceException(
                        "ServiceFactory.getService() resulted in a cycle.",
                        ServiceException.FACTORY_ERROR,
                        null);
                }
View Full Code Here


                {
                    throw (ServiceException) ex.getException();
                }
                else
                {
                    throw new ServiceException(
                        "Service factory exception: " + ex.getException().getMessage(),
                        ServiceException.FACTORY_EXCEPTION, ex.getException());
                }
            }
            return svcObj;
View Full Code Here

        {
            svcObj = m_factory.getService(bundle, this);
        }
        catch (Throwable th)
        {
            throw new ServiceException(
                "Service factory exception: " + th.getMessage(),
                ServiceException.FACTORY_EXCEPTION, th);
        }
        if (svcObj != null)
        {
            for (int i = 0; i < m_classes.length; i++)
            {
                Class clazz = Util.loadClassUsingClass(
                    svcObj.getClass(), m_classes[i], Felix.m_secureAction);
                if ((clazz == null) || !clazz.isAssignableFrom(svcObj.getClass()))
                {
                    if (clazz == null)
                    {
                        throw new ServiceException(
                            "Service cannot be cast due to missing class: " + m_classes[i],
                            ServiceException.FACTORY_ERROR);
                    }
                    else
                    {
                        throw new ServiceException(
                            "Service cannot be cast: " + m_classes[i],
                            ServiceException.FACTORY_ERROR);
                    }
                }
            }
        }
        else
        {
            throw new ServiceException(
                "Service factory returned null.", ServiceException.FACTORY_ERROR);
        }
        return svcObj;
    }
View Full Code Here

        HttpService httpService = getHttpService();
        try {
            httpService.registerServlet(contextRoot, cxf, new Hashtable<String, String>(), null);
            LOG.info("Successfully registered CXF DOSGi servlet at " + contextRoot);
        } catch (Exception e) {
            throw new ServiceException("CXF DOSGi: problem registering CXF HTTP Servlet", e);
        }       
        Bus bus = cxf.getBus();
       
        String address = constructAddress(dswContext, contextRoot);
        ServerFactoryBean factory = createServerFactoryBean();
View Full Code Here

            Object svc = bundleContext.getService(sr);
            if (svc instanceof HttpService) {
                return (HttpService) svc;
            }
        }
        throw new ServiceException("CXF DOSGi: No HTTP Service could be found to publish CXF endpoint in.");
    }
View Full Code Here

                    }
                }
            }
                       
            throw new InvocationTargetException(
                    new ServiceException(REMOTE_EXCEPTION_TYPE, theCause));
        }
    }
View Full Code Here

          pair = null;
        }
      }

      if (pair == null) {
        throw new ServiceException(interfaceName, ServiceException.UNREGISTERED);
      }
      return pair.service;
    }
View Full Code Here

    @Override
    public Object getService(Bundle bundle, ServiceRegistration serviceRegistration) {
        try {
            return connectionManager.createConnectionFactory();
        } catch (ResourceException e) {
            throw new ServiceException("Error creating connection factory", e);
        }
    }
View Full Code Here

        if (ref != null) {
            service = bundle.getBundleContext().getService(ref);
        }
       
        if (service == null) {
            throw new ManagementException(new ServiceException(type.getName(), ServiceException.UNREGISTERED));
        }
       
        return type.cast(service);
    }
View Full Code Here

    @Override
    public Object getService(Bundle bundle, ServiceRegistration serviceRegistration) {
        try {
            return $getResource();
        } catch (ResourceException e) {
            throw new ServiceException("Error creating connection factory", e);
        }
    }
View Full Code Here

TOP

Related Classes of org.osgi.framework.ServiceException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.