ambari-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tom Beerbower (JIRA)" <>
Subject [jira] [Commented] (AMBARI-10748) Views: IllegalAccessError: tried to access class
Date Sat, 25 Apr 2015 18:18:38 GMT


Tom Beerbower commented on AMBARI-10748:

I think that the main objective here is to make sure that we can include classes and jars
in a view that don't conflict other versions of those classes used by Ambari.  We also want
to make sure that there aren't any other obstacles that prevent us from deploying Spring web
apps as views.  So far, I've found the following issues that need to be addressed to support
Spring apps as views...

# Class loading order.  The classes in the WEB-INF/lib or WEB-INF/classes should have priority
over classes on the parent class loader.  There is a bug here.  The fix involves minimal changes
and is minimal risk, I think.  Fixing the ClassLoader issue gets past the {{IllegalAccessError}}
noted above but exposes a couple of other issues for Spring apps.  This issue could potentially
be a separate Jira since it is not specific to deploying Spring apps.
# Ambari's embedded Jetty server not setup to support JSP. {code}500 JSP support not configured{code}This
is really just configuration (make javac available) and making sure that the right jsp dependencies
({{jsp-2.1-glassfish, ant, ant-launcher}}) are included for ambari-server.  Again, changes
and risk are minimal.  This is not Spring specific since we should support JSPs in any view
but in a Spring MVC app the view is usually a JSP.
# Ambari internal usage of Spring.  We currently use Spring to setup the Ambari web app and
we set this as the root context for all of the deployed view web apps ... {code}context.getServletContext().setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE,
springWebAppContext){code}  This results in the following exception because the root web app
context is from a different version of Spring loaded by a different class loader... {code}java.lang.IllegalStateException:
Context attribute is not of type WebApplicationContext:
startup date [Thu Jan 01 00:00:00 UTC 1970]; parent:
        at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(
        at org.springframework.web.servlet.FrameworkServlet.initServletBean(
        at org.springframework.web.servlet.HttpServletBean.init(
        at javax.servlet.GenericServlet.init(
{code}  I'm still evaluating this.  I'll update this Jira once I have an understanding of
what is involved to fix.

As suggested, I'm developing a simple Spring based web app deployed as view to work through
these issues.  I will push the Spring example under ambari-views/examples once the issues
are resolved.

Also, I don't see a workaround in the existing released Ambari.  I think that code changes
are required.

> Views: IllegalAccessError: tried to access class
> ------------------------------------------------
>                 Key: AMBARI-10748
>                 URL:
>             Project: Ambari
>          Issue Type: Bug
>            Reporter: Tom Beerbower
>            Assignee: Tom Beerbower
>             Fix For: 2.1.0
> Deploying a spring web app within a view.
> Certain spring jars are being picked up from /usr/lib/ambari-server as opposed to my
web app's WEB-INF/lib directory.  
> For example, when  my view web app gets instantiated (when the web.xml is processed),
classes from the jar spring-context are loaded from:
> {code}
> Latest exception from my view:
> IllegalAccessError: tried to access class
from class
> at
> at
> at<init>(
> at<init>(
> at<init>(
> at
> at
> at
> at<init>(
> at hortonworks.hdp.refapp.ecm.service.core.indexstore.SolrIndexStore.initialize(
> at hortonworks.hdp.refapp.ecm.registry.ECMBeanRefresher.refreshIndexStoreInAppContext(
> at hortonworks.hdp.refapp.ecm.registry.ECMBeanRefresher.refreshBeans(
> at hortonworks.hdp.refapp.ecm.view.DocumentManagementViewService.createAppContext(
> at hortonworks.hdp.refapp.ecm.view.DocumentManagementViewService.initialize(
> at hortonworks.hdp.refapp.ecm.view.DocumentManagementViewService.getDocumentService(
> at
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> {code}

This message was sent by Atlassian JIRA

View raw message