0

I'm trying to show a list of all records in my database. My view looks like :

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <h:head>
        <title>Facelet Title</title>
    </h:head>
    <h:body>
        Hello from Facelets

        <h:dataTable var="p" value="#{productController.findAll()}" 
                     border="1" cellpadding="2" cellspacing="2">

            <h:column>
                <f:facet name="header">Id</f:facet>
                <h:outputText value="#{p.id}"></h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Name</f:facet>
                <h:outputText value="#{p.name}"></h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Price</f:facet>
                <h:outputText value="#{p.price}"></h:outputText>
            </h:column>
             <h:column>
                <f:facet name="header">Quantity</f:facet>
                <h:outputText value="#{p.quantity}"></h:outputText>
            </h:column>      
        </h:dataTable>

    </h:body>
</html>

I hava a war and ejb project. In my ejb project I made a created an entity of my database table named product. Also I created a new package named model which include "AbstractFacade" and "ProductFacade". Now in my war project, I created a package named "controller". Here I want to make a link to the view. When I try to create a new JSF Managed bean (I used as scope : Session) and use this code:

@Named(value= "productController")
@SessionScoped
@ManagedBean
public class ProductController implements Serializable {

    @EJB
    private ProductFacade productFacade;
    private Product product = new Product();


    public List<Product> findAll(){
        return this.productFacade.findAll();

    }
}

I always get this error when I try to deploy my project :

/Users/Wutz/NetBeansProjects/BankApp/BankApp-war/nbproject/build-impl.xml:1051: The module has not been deployed.

See the server log for details.

When I have a look at this line it tells me this:

  <nbdeploy clientUrlPart="${client.urlPart}" debugmode="false" forceRedeploy="${forceRedeploy}"/>

Anyone who can tell what i'm doing wrong? I can't figure this out.

Tiny
  • 27,221
  • 105
  • 339
  • 599
Tim Dirks
  • 35
  • 1
  • 5
  • 1
    All that JSF code is irrelevant for now. The webapp hasn't even deployed. The most relevant part is the mentioned detail in the server log. Yet this information is missing in the question. – BalusC Jun 18 '15 at 19:37
  • 1
    The main cause could be found on the server log. You are merely showing a line from `build-impl.xml` (one of Ant scripts) which is responsible for building and deploying the application. You are mixing annotations (`@Named(value= "productController")`, `@SessionScoped`, `@ManagedBean`). Have either CDI or JSF manage your beans. Furthermore, you are implementing business logic in an accessor method [which is invoked several times by nature](http://stackoverflow.com/a/2090062/1391249). Get rid of it and place the logic somewhere else such as a method decorated by `@PostConstruct`. – Tiny Jun 18 '15 at 23:06

0 Answers0