6

So I am struggling with getting a sample app to work. I'm using Primefaces 3.3M4-SNAPSHOT, JBOSS 7 web profile (CDI and JSF Mojarra).

I have my backing bean:

@Named
@ViewScoped
@URLMapping(id = "viewEditor", pattern = "/editor/e", viewId = "/editor/editor.jsf")
public class ViewEditor implements Serializable {

public void deleteNode() {
    selectedNode.getChildren().clear();
    selectedNode.getParent().getChildren().remove(selectedNode);
    selectedNode.setParent(null);

    selectedNode = null;

}
}

My xhtml:

        <p:contextMenu for="docs">
            <p:menuitem value="View" update="documentPanel"
                icon="ui-icon ui-icon-search" oncomplete="documentDialog.show()" />
            <p:menuitem value="Delete"
                actionListener="#{viewEditor.deleteNode}" update="docs"
                icon="ui-icon ui-icon-close" />
        </p:contextMenu>

When I run my app, this is the exception I get:

javax.el.ELException: /editor/editor.xhtml: The class 'application.ViewEditor$Proxy$_$$_WeldClientProxy' does not have the property 'deleteNode'.
    com.sun.faces.facelets.compiler.AttributeInstruction.write(AttributeInstruction.java:94)
    com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:82)
    com.sun.faces.facelets.compiler.UILeaf.encodeAll(UILeaf.java:183)
    javax.faces.render.Renderer.encodeChildren(Renderer.java:168)

Did anyone come across the same issue as I did?

Antoine Sabot-Durand
  • 4,875
  • 17
  • 33
Tommy Chan
  • 622
  • 7
  • 14
  • There's missing information here. You probably use more than what you say. Where does this @ViewScoped comes from ? Seam 3 Faces I guess since you have prettyfaces annotation as well. The error you get suggest el was looking for a property so try to call "getDeleteNode()". Are you sure you don't an other occurrence of "deleteNode" in JSF page ? Could you send complete info or a github link ? – Antoine Sabot-Durand Oct 30 '11 at 02:45
  • Hi Antoine, to my knowledge it @Viewscoped is an ee6 annotation: http://download.oracle.com/javaee/6/api/javax/faces/bean/ViewScoped.html I'm not sure if seem faces is used out of the box for jboss 7. I'm simply trying to create the sample app as describe in the primefaces showcase here http://www.primefaces.org/showcase-labs/ui/treeTableContextMenu.jsf – Tommy Chan Oct 31 '11 at 17:19
  • Yes @ViewScoped is in JSF spec but not in CDI. The code you're showing is not consistent and only works because you don't need this bean in viewscope and having it in the request work as well. If it changes... It won't work. – Antoine Sabot-Durand Nov 01 '11 at 05:08

2 Answers2

6

Okay got the answer. It turns out that the namespace for primefaces has changed from

xmlns:p="http://primefaces.prime.com.tr/ui"

to

xmlns:p="http://primefaces.org/ui"

By changing the namespace everything worked. Wow that was an elusive thing to track down.

Tommy Chan
  • 622
  • 7
  • 14
  • 1
    Just for future reference: I've also seen such "does not have the property" errors when the invoked method simply threw some runtime exception (null pointer), or when `@PostContruct` methods failed, but probably only in Composite Components; see also [JSF2 composite component throws PropertyNotFoundException for action method](http://stackoverflow.com/questions/3487489/jsf2-composite-component-throws-propertynotfoundexception-for-action-method) and bug [JAVASERVERFACES-1806](http://java.net/jira/browse/JAVASERVERFACES-1806). – Arjan Feb 13 '12 at 20:44
0

In my case the reason was completely different.

I copied a class including serialVersionUID field:

private static final long serialVersionUID = 5443351151396868724L;

so I had two different classes and objects with the same serialVersionUID and this was the clue of the problem.

FloatOverflow
  • 791
  • 9
  • 9