Bug 586068

Summary: Overview->Subsystem->OOB view is broken
Product: [Other] RHQ Project Reporter: Heiko W. Rupp <hrupp>
Component: Core UIAssignee: John Sanda <jsanda>
Status: CLOSED CURRENTRELEASE QA Contact: Corey Welton <cwelton>
Severity: medium Docs Contact:
Priority: urgent    
Version: 3.0.0CC: jmarques
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 2.4 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-08-12 16:50:12 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 591531    

Description Heiko W. Rupp 2010-04-26 18:20:08 UTC
Description of problem:

Navigate to Overview->SubsystemView->Suspect metrics

See it bomb with 


UnsupportedOperationException
ERROR: GWT.create() is only usable in client code! It cannot be called, for example, from server code. If you are running a unit test, check that your test case extends GWTTestCase and that GWT.create() is not called from within an initializer or constructor.

or

javax.faces.FacesException: javax.el.ELException: /rhq/subsystem/oobHistory.xhtml @117,79 value="#{item.original.formattedBaseband}": Error reading 'formattedBaseband' on type org.rhq.core.domain.measurement.composite.MeasurementOOBComposite at 

javax.faces.component.UIOutput.getValue(UIOutput.java:184) ... 86 more Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.google.gwt.i18n.client.NumberFormat at org.rhq.core.domain.measurement.MeasurementConverterClient.format(MeasurementConverterClient.java:220) at org.rhq.core.domain.measurement.MeasurementConverterClient.format(MeasurementConverterClient.java:200) at org.rhq.core.domain.measurement.composite.MeasurementOOBComposite.getFormattedBaseband(MeasurementOOBComposite.java:166) 


console log:

Caused by: javax.el.ELException: /rhq/subsystem/oobHistory.xhtml @117,79 value="#{item.original.formattedBaseband}": Error reading 'formattedBaseband' on type org.rhq.core.domain.measurement.composite.MeasurementOOBComposite
        at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:76)
        at javax.faces.component.UIOutput.getValue(UIOutput.java:184)
        ... 86 more
Caused by: java.lang.ExceptionInInitializerError
        at com.google.gwt.i18n.client.NumberFormat.<clinit>(NumberFormat.java:310)
        at org.rhq.core.domain.measurement.MeasurementConverterClient.format(MeasurementConverterClient.java:220)
        at org.rhq.core.domain.measurement.MeasurementConverterClient.format(MeasurementConverterClient.java:200)
        at org.rhq.core.domain.measurement.composite.MeasurementOOBComposite.getFormattedBaseband(MeasurementOOBComposite.java:166)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at javax.el.BeanELResolver.getValue(BeanELResolver.java:62)
        at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
        at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:72)
        at org.jboss.el.parser.AstPropertySuffix.getValue(AstPropertySuffix.java:53)
        at org.jboss.el.parser.AstValue.getValue(AstValue.java:67)
        at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
        at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
        ... 87 more
Caused by: java.lang.UnsupportedOperationException: ERROR: GWT.create() is only usable in client code!  It cannot be called, for example, from server code.  If you are running a unit test, check that your test case extends GWTTestCase and that GWT.create() is not called from within an initializer or constructor.
        at com.google.gwt.core.client.GWT.create(GWT.java:92)
        at com.google.gwt.i18n.client.LocaleInfo.<clinit>(LocaleInfo.java:35)
        ... 102 more

Comment 1 Charles Crouch 2010-04-26 20:29:33 UTC
Greg, can you see whats going on here and if necessary turn back on the old jsf OOB subsystem view

Comment 2 Joseph Marques 2010-04-27 20:58:35 UTC
Charles, the exception is happening *on* the JSF-based subsystem view.  One of the OOB columns uses a class called MeasurementConverterClient in core/domain, which references a GWT client class.  In JSF-land, all of the page render logic is executed server-side, and then serialized out to the client as HTML.  The GWT error is very accurate:

"UnsupportedOperationException
ERROR: GWT.create() is only usable in client code! It cannot be called, for
example, from server code. If you are running a unit test, check that your test
case extends GWTTestCase and that GWT.create() is not called from within an
initializer or constructor."

I'm guessing that Greg used the NumberFormat in GWT because the standard guy in javax.text was not GWT-compile-able.

Comment 3 Charles Crouch 2010-05-12 16:25:17 UTC
John can you work on this, pinging Greg as necessary.

Comment 4 John Sanda 2010-05-14 17:27:07 UTC
This must have been resolved since it was initially reported. I am not able to reproduce the error reported. I am able to bring up all of the subsystem views and perform filtering/searching.

Comment 5 John Sanda 2010-05-21 19:30:51 UTC
Removed GWT dependency from MeasurementOOBComposite.

commit hash: aeebeea6b406adbcfbb9fa246df7aa56564eb5c5

Comment 6 John Sanda 2010-05-24 15:32:45 UTC
It has been pointed out by Joseph Marques that my solution is problematic because it uses a formatter from java.text, and classes in java.text cannot be used in GWT code. The class in question, MeasurementOOBComposite, is currently not used in the GWT UI, but it eventually will be once the JSF view(s) where it is used are ported. In light of this, the formatting code needs to be moved to a layer outside of the core/domain module since those classes are used in both GWT and non-GWT code.

In addition to the code changes, I am going to add checkstyle to the build so that we can flag usage of "restricted" classes/packages.

I am moving this back to ASSIGNED until these changes are complete.

Comment 7 John Sanda 2010-05-24 17:50:56 UTC
Moved the java.text formatting dependencies out of core/domain and into server/jar. The SLSB methods that return the MeasurementOOBComposite objects now do the formatting and pass the results to the MeasurementOOBComposite objects. The GWT text formatting dependencies have been moved into the coregui module.

commit hash: 797f13a4df3a2c1798649557c9911682e3e0b9b8

Comment 8 Corey Welton 2010-05-27 12:52:38 UTC
QA Verified.

Comment 9 Corey Welton 2010-08-12 16:50:12 UTC
Mass-closure of verified bugs against JON.