项目在线时,Manager Bean不返回 [英] Manager Bean do not returns when the project is online

查看:113
本文介绍了项目在线时,Manager Bean不返回的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用JPA的JSF项目,我这样做:从mysql数据库中检索一些数据,然后将数据绘制在图表中.

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:

因此,我将项目部署在运行于EC2实例中的GlassFish 3 Open Source中,然后再次尝试执行相同的操作,但是ManagedBean似乎无法正确返回页面:

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:

这是我的ManageBean:

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

我已经查看了server.log,看是否有问题,但似乎一切都很好.

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|#]

我真的不知道为什么会这样,除了这是我第一次尝试部署同时使用JPA和JSF的项目. 该怎么做?

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 ?

还有一件事,在本地模式下,当我单击以生成报告时,它需要花费几秒钟才能进入数据库,进行数学运算并返回到我的页面,但是在生产模式下,当我单击以生成报告时,它就会刷新页面上,为什么会发生这种情况? 我真的需要知道为什么……请帮帮我.

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.

你们可以在这里在线查看它: http://50.19.242.172:8080/BrainSet/showroom/report.xhtml

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

推荐答案

解决方案是:

我必须向MySQL中的某些用户授予权限,在MySQL中启用远程连接,将JDBC驱动程序放入glassfish_installation\glassfish\modules\中并重新启动它,初始化logEAO并将注释@Table(name="table_name")放进去,因为它取决于每个文件可以在运营系统中找到系统,如下所示:

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表示表不存在,但实际上存在.

这篇关于项目在线时,Manager Bean不返回的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆