} catch (ServletException e) {
throw new JspException("Exception initializing Tuscany webapp: " + e, e);
}
ServletContext servletContext = pageContext.getServletContext();
ComponentContext componentContext = (ComponentContext)servletContext.getAttribute("org.oasisopen.sca.ComponentContext");
Node scaDomain = null;
if (componentContext == null) {
scaDomain = (Node)servletContext.getAttribute(WebAppServletHost.SCA_NODE_ATTRIBUTE);
if (scaDomain == null) {
throw new JspException("SCADomain is null. Check Tuscany configuration in web.xml");
}
}
Class<?> typeClass;
try {
typeClass = Class.forName(type, true, Thread.currentThread().getContextClassLoader());
} catch (ClassNotFoundException e) {
throw new JspException("Reference '" + name + "' type class not found: " + type);
}
Object o;
try {
if (componentContext != null) {
o = componentContext.getService(typeClass, name);
} else {
o = scaDomain.getService(typeClass, name);
}
} catch (Exception e) {
throw new JspException("Exception getting service for reference'" + name + "': " + e, e);