-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/33553/
-----------------------------------------------------------

Review request for Ambari, Jonathan Hurley and Nate Cole.


Bugs: AMBARI-10748
    https://issues.apache.org/jira/browse/AMBARI-10748


Repository: ambari


Description
-------

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...

1. 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 but exposes a couple of 
other issues for Spring apps. 

2. Ambari's embedded Jetty server not setup to support JSP.
        500 JSP support not configured
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.

3. 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 ...
        
context.getServletContext().setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE,
 springWebAppContext)
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...
        java.lang.IllegalStateException: Context attribute is not of type 
WebApplicationContext: 
org.springframework.web.context.support.GenericWebApplicationContext@774189d0: 
startup date [Thu Jan 01 00:00:00 UTC 1970]; parent: 
org.springframework.context.support.ClassPathXmlApplicationContext@318511f0
        at 
org.springframework.web.context.support.WebApplicationContextUtils.getWebApplicationContext(WebApplicationContextUtils.java:124)
        at 
org.springframework.web.context.support.WebApplicationContextUtils.getWebApplicationContext(WebApplicationContextUtils.java:99)
        at 
org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:514)
        at 
org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:484)
        at 
org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
        at javax.servlet.GenericServlet.init(GenericServlet.java:241)


Diffs
-----

  ambari-project/pom.xml 12ae96c 
  ambari-server/pom.xml 896a202 
  
ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariHandlerList.java
 7c68311 
  
ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
 8b767d7 
  
ambari-server/src/main/java/org/apache/ambari/server/controller/FailsafeHandlerList.java
 26395cc 
  
ambari-server/src/main/java/org/apache/ambari/server/controller/FailsafeServletResponse.java
 094c4c5 
  
ambari-server/src/main/java/org/apache/ambari/server/view/ViewArchiveUtility.java
 8720d7c 
  
ambari-server/src/main/java/org/apache/ambari/server/view/ViewClassLoader.java 
PRE-CREATION 
  ambari-server/src/main/java/org/apache/ambari/server/view/ViewExtractor.java 
fdce03c 
  
ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariHandlerListTest.java
 04a4b15 
  
ambari-server/src/test/java/org/apache/ambari/server/controller/FailsafeHandlerListTest.java
 8d1ba0d 
  
ambari-server/src/test/java/org/apache/ambari/server/controller/FailsafeServletResponseTest.java
 249a3f5 
  
ambari-server/src/test/java/org/apache/ambari/server/view/ViewClassLoaderTest.java
 PRE-CREATION 

Diff: https://reviews.apache.org/r/33553/diff/


Testing
-------

Manual testing with a Spring app view and existing view examples.

New unit tests added.

All existing tests pass ...

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 37:54 min
[INFO] Finished at: 2015-04-25T07:34:25-04:00
[INFO] Final Memory: 52M/571M
[INFO] ------------------------------------------------------------------------


Thanks,

Tom Beerbower

Reply via email to