Manager Bean do not returns when the project is on

2019-06-26 01:05发布

问题:

I have a JSF project working with JPA, I do this : retrive some data from mysql database then plot the data in a chart.

Locally works pretty fine, as you can see here:

So I deploy the project in my GlassFish 3 Open Source, which is running in a EC2 instance, then I try to make the same operation again but it seems the ManagedBean do not returns to the page correctly:

This is my ManageBean :

@ManagedBean(name="reportc")
@SessionScoped
public class ReportControl implements Serializable {
    private static final long serialVersionUID = 3269125738504434502L;

    @EJB LogEAO logEAO;

    private int quantity;

    @NotNull(message="informe um intervalo")
    private String time;

    @NotNull(message="informe um ponto")
    private String point;

    private Map<String, Object> data = new HashMap<String, Object>();

    @PostConstruct
    public void init(){
        quantity = 1;
    }

    public String getDataAsJson() {
        return new Gson().toJson(data);
    }

    public String generateReport(){
        this.setTitles();
        this.getValues(getLog());

        return "/showroom/report.xhtml?faces-redirect=true";
    }
    .. methods and get's and set's

I already look in into my server.log to see if there's something wron but it seems everything is alright.

[#|2012-03-31T14:30:06.594+0000|WARNING|glassfish3.1.1|javax.enterprise.resource.webcontainer.jsf.application|_ThreadID=25;_ThreadName=Thread-2;|JSF1064: Unable to find or serve resource, image/structure/pic-1.gif.|#]

[#|2012-03-31T14:30:15.558+0000|FINE|glassfish3.1.1|org.eclipse.persistence.session.file:/home/ec2-user/usr/local/glassfish3/glassfish3/glassfish/domains/domain1/applications/BrainSet/WEB-INF/classes/_BrainSet.sql|_ThreadID=24;_ThreadName=Thread-2;ClassName=null;MethodName=null;|SELECT ID, TIME, VALUE, id_point FROM log WHERE (((id_point = ?) AND (TIME >= ?)) AND (TIME <= ?))
        bind => [3 parameters bound]|#]

[#|2012-03-31T14:30:15.585+0000|INFO|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=24;_ThreadName=Thread-2;|EXECUTION TIME:0:0|#]

[#|2012-03-31T14:30:15.585+0000|INFO|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=24;_ThreadName=Thread-2;|LOGS SIZE : 0|#]

[#|2012-03-31T14:30:16.690+0000|WARNING|glassfish3.1.1|javax.enterprise.resource.webcontainer.jsf.application|_ThreadID=24;_ThreadName=Thread-2;|JSF1064: Unable to find or serve resource, image/structure/pic-1.gif.|#]

[#|2012-03-31T14:35:53.578+0000|FINE|glassfish3.1.1|org.eclipse.persistence.session.file:/home/ec2-user/usr/local/glassfish3/glassfish3/glassfish/domains/domain1/applications/BrainSet/WEB-INF/classes/_BrainSet.sql|_ThreadID=28;_ThreadName=Thread-2;ClassName=null;MethodName=null;|SELECT ID, TIME, VALUE, id_point FROM log WHERE (((id_point = ?) AND (TIME >= ?)) AND (TIME <= ?))
        bind => [3 parameters bound]|#]

[#|2012-03-31T14:35:53.605+0000|INFO|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=28;_ThreadName=Thread-2;|EXECUTION TIME:0:0|#]

[#|2012-03-31T14:35:53.605+0000|INFO|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=28;_ThreadName=Thread-2;|LOGS SIZE : 0|#]

I really don't know why this is happening, besides is my first time trying to deploy a project which use JPA and JSF together. What could be doing this ?

EDIT: Just one more thing, in local mode when I click to generate the report it takes some seconds to go to the database, make the maths and return to my page, but when it's in production mode when I click to generate the report it just refresh the page, why is that happening ? I really need to know why ... help me out guys, please.

EDIT 2:

You guys can see it online here: http://50.19.242.172:8080/BrainSet/showroom/report.xhtml

回答1:

Just played with the chart again...

I do get charts properly... could it be that you had no data gathered in the production in the beginning...? Cause now there is

Also i'm getting alerts saying

serverError: class javax.faces.el.EvaluationException For input string: "true"

check you EL expressions related to the "drop downs" of the chart....

b.t.w here another successful screenshot :

So it seems like working... you might need to redefine your question...



回答2:

The solution was :

I had to give permissions to some user in MySQL, enable the remote connection in MySQL, put JDBC driver in glassfish_installation\glassfish\modules\ and restart it, initialize the logEAO and put the annotation @Table(name="table_name") because it depends of each file system in operationals system as can be seen here:

JPA: MySQL says table don't exist, but it exist actually.



回答3:

Did you try Ctrl + F5 in the browser to force reload page ?