11 Replies Latest reply: Nov 29, 2008 9:34 PM by Jesper Pedersen RSS

Web app fails to start - managed beans missing no-argument c

Rob Hills Newbie

The current Web App fails to start cleanly in JBoss 4.3.0.GA_CP02 and throws exceptions when trying to use any functionality because of the absence of no-argument constructors in the managed beans. Eg:

ERROR [javax.enterprise.resource.webcontainer.jsf.managedbean] JSF will be unable to create managed bean frameInfo when it is requested. The following problems where found:
 - Managed bean class org.jboss.profiler.shared.FrameInfo for managed bean frameInfo doesnt declare a public no-argument constructor.

The same error occurs for a number of other beans.

I've submitted a JIRA and patch here:

https://jira.jboss.org/jira/browse/JBPROFILER-55

Cheers,

Rob Hills

  • 1. Re: Web app fails to start - managed beans missing no-argume
    Jesper Pedersen Master

    Well, FrameInfo is located in shared and is not meant to be a managed-bean.

    The web front-end has to build a JSF centric datamodel that exposes the datamodel defined in the shared classes.

    Think of the client.web classes as a view on the classes in shared.

    In regards to JBPROFILER-55 -- I'll leave it open for now. Please, use the 'Web' component for filling issues on the JBoss Profiler 2.x web front-end.

    Thanks for looking into this issue :)

  • 2. Re: Web app fails to start - managed beans missing no-argume
    Jesper Pedersen Master

    A quick follow-up -- look into the CombinedFrameInfo class in the client package which maybe what you are looking for.

    Or create a class hierarchy like ThreadInfoManagedBean -> ThreadInfo -> FrameInfo -- where the last two are from shared and be used in the web ui since they implements Serializable. ThreadInfoManagedBean is a managed bean with a non-arg constructor and defined in faces-config.xml

    Hope this gives you an idea...

  • 3. Re: Web app fails to start - managed beans missing no-argume
    Rob Hills Newbie

    Hi Jesper,

    I should have guessed there'd be more to it than simply providing a no-argument constructor to the offending classes.

    I'll take a closer look at it over the next day or so.

    Cheers,

    Rob Hills

  • 4. Re: Web app fails to start - managed beans missing no-argume
    Jesper Pedersen Master

    Yeah ;)

    The shared package is special, since it contains the datamodel shared between the agent and the clients.

    This means that there should _really_ _really_ good arguments against changing even a single variable or adding a new method as it will result in increased memory / disk space requirements for the agent.

    The good news is that the classes implements Serializable so they can be used as 'raw' data in the web front-end as stated above.

    Thanks for driving into this (have to say that with the reefs just off the shore of Waikiki ;) !

  • 5. Re: Web app fails to start - managed beans missing no-argume
    Rob Hills Newbie

     

    "jesper.pedersen" wrote:
    A quick follow-up -- look into the CombinedFrameInfo class in the client package which maybe what you are looking for.

    Or create a class hierarchy like ThreadInfoManagedBean -> ThreadInfo -> FrameInfo -- where the last two are from shared and be used in the web ui since they implements Serializable. ThreadInfoManagedBean is a managed bean with a non-arg constructor and defined in faces-config.xml

    Hope this gives you an idea...


    It does thanks. As it happens, ThreadInfo is only used in xhtml as a class to hold row data (from treeThreadBean.allThreads where treeThreadBean is a legitimate managed bean. Hence I don't believe I'll need to create a managed bean for ThreadInfo, I can simply remove it from faces-config.xml. From my brief look into the faces-config.xml file it appears that a number of classes have been defined in there as managed beans that shouldn't have been (eg ThreadInfo, Snapshot, FrameInfo, AllocationInfo and others, none of which are referenced anywhere in the .xhtml as managed beans). I'll investigate each one and remove as necessary. If a bean is needed, I'll abstract one into the .web package as discussed.

    Cheers,

    Rob Hills
    Waikiki, Western Australia

  • 6. Re: Web app fails to start - managed beans missing no-argume
    Rob Hills Newbie

    Hi Jesper,

    "jesper.pedersen" wrote:

    The shared package is special, since it contains the datamodel shared between the agent and the clients.

    This means that there should _really_ _really_ good arguments against changing even a single variable or adding a new method as it will result in increased memory / disk space requirements for the agent.


    OK, got all that. After ferreting around the code a bit more tonight I've got a better understanding of these concepts.

    "jesper.pedersen" wrote:

    Thanks for driving into this (have to say that with the reefs just off the shore of Waikiki ;) !


    Hmmm, I think you're thinking of a slightly more exotic Waikiki than the one I live at. Here, the reef is about 2.5NM offshore so it'd take some driving!

    Cheers,

    Rob Hills
    Waikiki, Western Australia

  • 7. Re: Web app fails to start - managed beans missing no-argume
    Rob Hills Newbie

    Hi Jesper,

    OK, I've looked at the classes you talked about and also looked through the xhtml files to see what Managed Beans are actually being used. As a result of that, I've established that a number of the Managed Beans defined in faces-config.xml are redundant. Happily this includes all the "beans" that are not in the web package and which cause errors during the webapp startup.

    I've uploaded a new patch against https://jira.jboss.org/jira/browse/JBPROFILER-55 which removes all the offending bits of faces-config.xml and also modifies web.xml to remove a pesky space from the ajax4jsf servlet name (FacesServlet vs Faces Servlet). That was causing the web app startup to fail with an exception also. As they are inclined to do, that pesky little space took quite a while to locate!

    The next step is to investigate why the home page of the web app keeps reloading itself and never actually rendering properly!

    Cheers,

    Rob Hills

  • 8. Re: Web app fails to start - managed beans missing no-argume
    Rob Hills Newbie

     

    "rhills" wrote:
    The next step is to investigate why the home page of the web app keeps reloading itself and never actually rendering properly!


    OK, that is because index.html redirects to listSnapshots.faces (note camel case url and incorrect extension - web.xml only defines *.xhtml for the RichFaces servlet, presumably by design). Of course listSnapshots.faces returns a 404 which (from web.xml) redirects to index.html which... you get the idea!

    However, the url http://localhost:8080/jboss-profiler/listsnapshots.xhtml works nicely!

    I'll fix a few more things then upload another patch.

    Cheers,

    Rob Hills

  • 9. Re: Web app fails to start - managed beans missing no-argume
    Jesper Pedersen Master

    I have committed a patch against JBPROFILER-56 / JBPROFILER-57 for the index.html issue.

    Please, remember to set the component type to 'Web' when submitting issues so I get notified.

    I'll release Beta3.SP1 soon and then take a look at your patch for Beta4.

    Thanks for working on this.

  • 10. Re: Web app fails to start - managed beans missing no-argume
    Rob Hills Newbie

     

    "jesper.pedersen" wrote:
    Please, remember to set the component type to 'Web' when submitting issues so I get notified.


    Hmmm, I'm sure I'd done that for issues 55 and 56, maybe I'm confused about the component names. In the component name combobox, I see two possibly relevant names, "Web" and "WEB-FrontEnd". I'd assumed that was the one you were referring to.

    Rob Hills
    Waikiki, WA

  • 11. Re: Web app fails to start - managed beans missing no-argume
    Jesper Pedersen Master

    You did actually set the component type to 'Web' which is correct.

    Looks like there is something going on with notifications for the project - I'll look into it.