You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ambari.apache.org by Tom Beerbower <tb...@hortonworks.com> on 2015/04/25 20:31:10 UTC
Review Request 33553: Views: IllegalAccessError: tried to access class
-----------------------------------------------------------
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
Re: Review Request 33553: Views: IllegalAccessError: tried to access
class
Posted by Jonathan Hurley <jh...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/33553/#review81684
-----------------------------------------------------------
Ship it!
Ship It!
- Jonathan Hurley
On April 27, 2015, 11:11 a.m., Tom Beerbower wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/33553/
> -----------------------------------------------------------
>
> (Updated April 27, 2015, 11:11 a.m.)
>
>
> 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 Spring app view (ambari-views/examples/hello-spring) and existing view examples.
>
> New unit tests added.
>
> All existing tests pass ...
>
> Results :
>
> Tests run: 2894, Failures: 0, Errors: 0, Skipped: 17
>
> [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
>
>
Re: Review Request 33553: Views: IllegalAccessError: tried to access
class
Posted by Tom Beerbower <tb...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/33553/
-----------------------------------------------------------
(Updated April 27, 2015, 3:11 p.m.)
Review request for Ambari, Jonathan Hurley and Nate Cole.
Changes
-------
updated testing
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 (updated)
-------
Manual testing with Spring app view (ambari-views/examples/hello-spring) and existing view examples.
New unit tests added.
All existing tests pass ...
Results :
Tests run: 2894, Failures: 0, Errors: 0, Skipped: 17
[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
Re: Review Request 33553: Views: IllegalAccessError: tried to access
class
Posted by Nate Cole <nc...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/33553/#review81614
-----------------------------------------------------------
Ship it!
Ship It!
- Nate Cole
On April 25, 2015, 2:31 p.m., Tom Beerbower wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/33553/
> -----------------------------------------------------------
>
> (Updated April 25, 2015, 2:31 p.m.)
>
>
> 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
>
>