首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么glassfish服务器在重新启动后才加载bean?

为什么glassfish服务器在重新启动后才加载bean?
EN

Stack Overflow用户
提问于 2021-04-06 15:59:36
回答 1查看 133关注 0票数 0

当触发rtu.smallview.xhtml操作事件时,它从java、数据库select请求信息,并将其交回xhtml。

xhtml没有显示来自数据库的数据,所以我在java中添加了断点,以找出出了什么问题,但是当程序加载时,它从未命中bean中的断点。

当程序加载时,服务器输出就是这样说的:

代码语言:javascript
复制
Info:   WELD-000119: Not generating any bean definitions from Beans.RTU.RTU_SmallView_Bean because of underlying class loading error: Type pojo.rtu.RTU_unit not found.  If this is unexpected, enable DEBUG logging to see the full error.

因此,我停止了服务器,再次清理和构建项目,当它第一次运行时,它加载bean,信息将被检索和显示。尽管如果我再次清理和构建该项目,当它第二次运行时,它会显示相同的焊缝-000119错误。

我只复制和粘贴代码,使RTU部分运行到一个新项目,而服务器永远不会抛出此错误,而且每次请求bean和每次启动服务器时,它都能工作。

编辑1:当我重新启动NetBeans和清理并在项目启动后构建它时,它说:

代码语言:javascript
复制
Note: C:\Users\Administrator\Documents\NetBeansProjects\OIUSA_1\src\java\Beans\RTU\RTU_SmallView_Bean.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

这是它提到的唯一的java类,下面是我为该类使用的代码:

代码语言:javascript
复制
package Beans.RTU;

import Database.RTU.RTU_SmallView_Select;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Named;
import javax.enterprise.context.RequestScoped;
import pojo.rtu.RTU_unit;

/**
 *
 * @author Administrator
 */
@Named(value = "rtu_SmallView_Bean")
@RequestScoped
public class RTU_SmallView_Bean {

    public RTU_SmallView_Bean() {
        try {
            RTU_SmallView_Select selectData;
            selectData = new RTU_SmallView_Select();
            this.smallViewList = selectData.getData();
        } catch (Exception ex) {
            System.out.println(ex.getMessage());
        }
    }

    List<RTU_unit> smallViewList = new ArrayList();
    String unit_type;
    int unit_number;
    String rig_name;
    String location_name;

    public List<RTU_unit> getSmallViewList() {
        return smallViewList;
    }

    public void setSmallViewList(List<RTU_unit> smallViewList) {
        this.smallViewList = smallViewList;
    }

    public String getUnit_type() {
        return unit_type;
    }

    public void setUnit_type(String unit_type) {
        this.unit_type = unit_type;
    }

    public int getUnit_number() {
        return unit_number;
    }

    public void setUnit_number(int unit_number) {
        this.unit_number = unit_number;
    }

    public String getRig_name() {
        return rig_name;
    }

    public void setRig_name(String rig_name) {
        this.rig_name = rig_name;
    }

    public String getLocation_name() {
        return location_name;
    }

    public void setLocation_name(String location_name) {
        this.location_name = location_name;
    }
}

我的项目结构如下:

资料来源:

  1. Beans.RTU.RTU_SmallView_Bean.java
  2. Database.RTU.RTU_SmallView_Select.java
  3. pojo.rtu.RTU_unit.java

网页:

  1. rtu.rtu_smallview.xhtml

我认为这与实际的服务器有关,但我不知道从哪里开始查找这个错误。如果您想查看bean的实际代码以及其他什么,请告诉我,我将用所有的代码编辑这个问题。谢谢

EN

回答 1

Stack Overflow用户

发布于 2021-04-07 15:03:26

问题已经解决,文件RTU_Unit.java在一个名为pojo.rtu的文件夹中。我删除了这个文件夹,用一个新的名称pojo.rtus重新制作了它,重构了新文件夹的文件RTU_Unit.java,问题就解决了。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66972204

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档