JSF Web应用程序中的Java ConcurrentModificationException

时间:2013-07-01 07:50:39

标签: java jsf weblogic-10.x concurrentmodification

大家好我在jsp / jsf页面中有以下组件:

  • 下拉菜单
  • 一张桌子
  • 添加按钮
  • 保存按钮

页面以这种方式工作:1。从下拉列表中选择一个元素,2。按下添加按钮3.表格显示并添加所选元素4.保存。

我报告了Bean的代码。

问题是调用此Bean的页面给出了以下异常:

    java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:977)
at java.util.HashMap$KeyIterator.next(HashMap.java:1012)
at weblogic.utils.enumerations.IteratorEnumerator.nextElement(IteratorEnumerator.java:25)
at com.sun.webui.jsf.util.UploadFilter.doFilter(UploadFilter.java:374)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:57)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:176)
  

(当用户点击链接时会显示此页面,单击链接时会显示例外情况。) bean代码使用一个链表,我想它会给出错误,但我不知道为什么:

public class GuiInserimentoReqPlant extends AbstractSessionBean {

private static final long serialVersionUID = 1L;
private String nomeClasse = this.getClass().getSimpleName();
private String distrib = getUserBean().getCurrentDatasource();
private String username = getUserBean().getUser();
private Logger logger;
private Option[] plantNames;
private String indexPlantNames;

private static final String EJBBUNDLE = "resources.ejbname";
private ResourceBundle bundle;

private SamGuiManagerG05Remote samGuiManager05 = null;
private DefaultTableDataProvider plantProvider;
private List<SettTbPlant> listaPlant;

@EJB(name = "SamGuiManagerFactory", mappedName = "SamGuiManagerFactory")
SamGuiManagerFactoryI samGuiManagerFactory;
private String taxid = getUserBean().getDisco();

private String deletePlant;

public GuiInserimentoReqPlant() throws IOException {

    super();
    getUserBean().navigationStatus();

    logger = Logger.getLogger(this.getClass());
    logger.info(LogMessages.getLog4jString(username, distrib, taxid, "Costruttore"));
    // logger.debug("COSTRUTTORE");

    // listaPlant = new ArrayList<SettTbPlant>();
    plantProvider = new DefaultTableDataProvider();
}


private void _init() throws Exception {
}

@Override
public void init() {
    // Perform initializations inherited from our superclass
    super.init();
    // Perform application initialization that must complete
    // *before* managed components are initialized
    // TODO - add your own initialiation code here

    // <editor-fold defaultstate="collapsed" desc="Managed Component Initialization">
    // Initialize automatically managed components
    // *Note* - this logic should NOT be modified
    try {
        _init();
        logger.info(LogMessages.getLog4jString(username, distrib, taxid, "Init eseguito"));
    } catch (Exception e) {
        logger.info(LogMessages.getLog4jString(username, distrib, taxid, "SessionBean1 Initialization Failure: " + e.getMessage()));
        // log("SessionBean1 Initialization Failure", e);
        throw e instanceof FacesException ? (FacesException) e : new FacesException(e);
    }

    // </editor-fold>
    // Perform application initialization that must complete
    // *after* managed components are initialized
    // TODO - add your own initialization code here

    /*
     * FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put(this.getClass().getSimpleName(), new
     * ALGUISessionBean()); log(this.getClass().getSimpleName() + " init done", null);
     */
}


protected UserBean getUserBean() {
    return (UserBean) getBean("UserBean");
}

protected GUISessionBeanInsertRequest getALGUISessionBean() {
    return (GUISessionBeanInsertRequest) getBean("GUISessionBeanInsertRequest");
}

public void lookup() {

    // log(LogMessages.getLogString(username, distrib, nomeClasse, LogMessages.LOOKUP, LogMessages.INIZIO), null);
    logger.info(LogMessages.getLog4jString(username, distrib, taxid,
            "INIZIO Lookup Gui remota " + SamGuiManagerG05Remote.class.getSimpleName()));
    // logger.info("Lookup Gui remota " + SamGuiManagerG05Remote.class.getSimpleName() + " :: INIZIO");

    try {

        bundle = ResourceBundle.getBundle(EJBBUNDLE);

        String gui = bundle.getString(this.getClass().getSimpleName());
        logger.debug("Gui recuperata da file: " + gui);

        if (samGuiManagerFactory == null) {
            logger.error("SamGuiManagerFactory nulla. Impossibile instanziare il bean");
        }
        SamGui samGui = samGuiManagerFactory.getGui(gui);
        logger.debug("Recupero GUI dalla factory: " + samGui.toString());

        samGuiManager05 = (SamGuiManagerG05Remote) samGuiManagerFactory.getSamGuiManager(samGui);
        logger.debug("Recupero il bean remoto");

        PersistenceContextName persistenceContextName = PersistenceContextName.valueOf(getUserBean().getPersistenceContextName());
        samGuiManager05.setPersistenceContextName(persistenceContextName);
        logger.debug("Imposto il contesto di persistenza " + persistenceContextName.toString());

        if (samGuiManager05 == null) {
            log(LogMessages.getLogString(username, distrib, nomeClasse, LogMessages.LOOKUP, LogMessages.LOOKUP_KO), null);

            logger.error("Lookup Gui remota " + SamGuiManagerG05Remote.class.getSimpleName() + " Fallita. Gui Nulla");
        }

    } catch (IllegalArgumentException e) {
        // log(LogMessages.getLogString(username, distrib, nomeClasse, LogMessages.LOOKUP, "KO: " + e.toString(true)), null);

        logger.error(e.getMessage());
    }

    // log(LogMessages.getLogString(username, distrib, nomeClasse, LogMessages.LOOKUP, LogMessages.FINE), null);
    logger.info(LogMessages.getLog4jString(username, distrib, taxid,
            "FINE Lookup Gui remota " + SamGuiManagerG05Remote.class.getSimpleName()));
    // logger.info("Lookup Gui remota " + SamGuiManagerG05Remote.class.getSimpleName() + " Fine");
}

public String getIndexPlantNames() {

    return indexPlantNames;
}

public void setIndexPlantNames(String indexPlantNames) {
    this.indexPlantNames = indexPlantNames;
}

public String addlink_action() throws ProcessException {
    /*
     * Aggiunge un elemento alla lista
     */
    lookup();
    logger.debug("addlink_action " + indexPlantNames);

    if (this.indexPlantNames.equals("-1") == false) {
        if (containingPl(indexPlantNames) == false) {

            SettTbPlant newPlant = new SettTbPlant();
            List<SettTbPlant> listOfPlantsDb = samGuiManager05.getListOfPlants(getUserBean().getDisco());

            for (SettTbPlant pl : listOfPlantsDb) {
                if (pl.getPlant().equals(indexPlantNames)) {
                    newPlant.setPlantname(pl.getPlantname());
                    break;
                }
            }

            newPlant.setPlant(indexPlantNames);

            this.listaPlant.add(newPlant);
        }
    }

    return null;

}

private boolean containingPl(String indexPlantNames) {

    for (SettTbPlant pl : this.listaPlant) {
        if (pl.getPlant().equals(indexPlantNames)) {
            return true;
        }
    }
    return false;

}

public String linksalva_action() {
    return "back";
}

public String linkdel_action() {

    Iterator<SettTbPlant> iterator = this.listaPlant.iterator();
    while(iterator.hasNext()){
        SettTbPlant next = iterator.next();
        if(next.getPlant().equals(deletePlant))
        {
            iterator.remove();
            break;
        }
    }

    return null;

}

public Option[] getPlantNames() throws ProcessException {
    lookup();

    // logger.debug("getPlantNames");
    logger.info(LogMessages.getLog4jString(username, distrib, taxid, "Esecuzione getPlantNames"));

    List<SettTbPlant> listOfPlantsDb = samGuiManager05.getListOfPlants(getUserBean().getDisco());
    this.plantNames = new Option[listOfPlantsDb.size() + 1];

    plantNames[0] = new Option("-1", "Non selezionato");

    for (int i = 0; i < listOfPlantsDb.size(); i++) {

        plantNames[i + 1] = new Option(listOfPlantsDb.get(i).getPlant(), listOfPlantsDb.get(i).getPlant() + " - "
                + listOfPlantsDb.get(i).getPlantname());
    }
    return plantNames;
}

public void setPlantNames(Option[] plantNames) {

    this.plantNames = plantNames;
}

public DefaultTableDataProvider getPlantProvider() {

    ArrayList<SettTbPlant> arrPlant = new ArrayList<SettTbPlant>();

    for (SettTbPlant plant : this.listaPlant) {
        arrPlant.add(plant);
    }
    SettTbPlant[] tableArray = new SettTbPlant[arrPlant.size()];
    arrPlant.toArray(tableArray);

    plantProvider.setArray(tableArray);
    return plantProvider;

}

public void setPlantProvider(DefaultTableDataProvider plantProvider) {
    this.plantProvider = plantProvider;
}

public String getDeletePlant() {
    return deletePlant;
}

public void setDeletePlant(String deletePlant) {
    this.deletePlant = deletePlant;
}

public List<SettTbPlant> getListaPlant() {
    return listaPlant;
}

public void setListaPlant(List<SettTbPlant> listaPlant) {
    this.listaPlant = listaPlant;
}

}

现在是上面调用Bean的代码。

 public class GuiInserimentoRichiesta_01 extends AbstractPageBean {

private String nomeClasse = this.getClass().getSimpleName();
private String distrib = getUserBean().getCurrentDatasource();
private String username = getUserBean().getUser();
private Logger logger;
private Option[] processNames;
private Option[] months;
private Option[] rateCodes;

private String indexProcessNames;
private Long indexMonths;
private String indexRateCode;

private static final String EJBBUNDLE = "resources.ejbname";
private ResourceBundle bundle;

private Date dataSchedulazione;

private DropDown processTypeId = new DropDown();

private SamGuiManagerG05Remote samGuiManager05 = null;

@EJB(name = "SamGuiManagerFactory", mappedName = "SamGuiManagerFactory")
SamGuiManagerFactoryI samGuiManagerFactory;
private String taxid = getUserBean().getDisco();

private Checkbox cb_NameY = new Checkbox();
private Checkbox cb_NameM = new Checkbox();
private Checkbox cb_NameG = new Checkbox();
private Checkbox cb_NameD = new Checkbox();

private UploadedFile fileToUpload;

public GuiInserimentoRichiesta_01() throws IOException {

    getUserBean().navigationStatus();

    logger = Logger.getLogger(this.getClass());
    logger.info(LogMessages.getLog4jString(username, distrib, taxid, "Costruttore"));
    // logger.debug("COSTRUTTORE");

    this.dataSchedulazione = new Date();
    this.dataSchedulazione.setTime(new Date().getTime());

    // if (getALGUISessionBean().getDataToSetOnEditFileds() != null)
    // this.startTime = getALGUISessionBean().getDataToSetOnEditFileds();
}

protected UserBean getUserBean() {
    return (UserBean) getBean("UserBean");
}

protected GUISessionBeanInsertRequest getALGUISessionBean() {
    return (GUISessionBeanInsertRequest) getBean("GUISessionBeanInsertRequest");
}

protected GuiInserimentoReqPlant getALGUISessionBeanPlant() {
    return (GuiInserimentoReqPlant) getBean("guiInserimentoReqPlant");
}

protected GuiInserimentoReqRelco getALGUISessionBeanRelco() {
    return (GuiInserimentoReqRelco) getBean("guiInserimentoReqRelco");
}

protected GUISessionBeanDisplayRett getALGUISessionVisualizzaRichieste() {
    return (GUISessionBeanDisplayRett) getBean("GUISessionBeanDisplayRett");
}

public String buttonSlectProc() throws ProcessException {

    lookup();
    this.getALGUISessionBean().setCurrentProcess(this.indexProcessNames);
    List<SettTbBatchprocess> uidproc = samGuiManager05.getIdBatchProcessDescription(this.getIndexProcessNames(), getUserBean()
            .getDisco());
    this.getALGUISessionBean().setIdProcessName(uidproc.get(0).getProcessnum());

    logger.info("id del processo:" + uidproc.get(0).getProcessnum());

    List<SettTbBatchtype> valuesForProcess = samGuiManager05.getValuesForRatecode(getALGUISessionBean().getIdProcessName(),
            getUserBean().getDisco());

    List<SettTbBatchtype> batchTypeList = samGuiManager05.getValuesForProcess(valuesForProcess.get(0).getRatecode(), uidproc.get(0)
            .getProcessnum(), getUserBean().getDisco());

    SettTbBatchtype valuesForDropDows = batchTypeList.get(0);

    logger.info("valorid del processo: " + valuesForDropDows.getIsvisibleplant() + " - " + valuesForDropDows.getIsvisiblerelco());

    if (valuesForDropDows.getIsvisibleplant().compareTo("Y") == 0) {
        getALGUISessionBean().setFlagPlant(true);
    } else {
        getALGUISessionBean().setFlagPlant(false);
    }
    if (valuesForDropDows.getIsvisiblerelco().compareTo("Y") == 0) {
        getALGUISessionBean().setFlagRelco(true);
    } else {
        getALGUISessionBean().setFlagRelco(false);
    }

    List<SettTbBatchprocess> procDesc = samGuiManager05.getIdBatchProcessDescription(this.getIndexProcessNames(), getUserBean()
            .getDisco());

    logger.info("nome del processo: " + procDesc.get(0).getName() + "  -  " + procDesc.get(0).getDescription());

    getALGUISessionBean().setProcessName(procDesc.get(0).getName());

    return "processType";
}

public String changeRT_action() throws ProcessException {

    lookup();

    logger.info("id rate code:" + this.getIndexRateCode());

    List<SettTbBatchtype> batchTypeList = samGuiManager05.getValuesForProcess(this.getIndexRateCode(), getALGUISessionBean()
            .getIdProcessName(), getUserBean().getDisco());

    SettTbBatchtype valuesForDropDows = batchTypeList.get(0);

    logger.info("id del processo: " + valuesForDropDows.getIsvisibleplant() + " - " + valuesForDropDows.getIsvisiblerelco());

    if (valuesForDropDows.getIsvisibleplant().compareTo("Y") == 0) {
        getALGUISessionBean().setFlagPlant(true);
    } else {
        getALGUISessionBean().setFlagPlant(false);
    }
    if (valuesForDropDows.getIsvisiblerelco().compareTo("Y") == 0) {
        getALGUISessionBean().setFlagRelco(true);
    } else {
        getALGUISessionBean().setFlagRelco(false);
    }

    getALGUISessionBeanPlant().settingListaPlant(new LinkedList<SettTbPlant>());
    getALGUISessionBeanRelco().settingListOfRelco(new LinkedList<SettTbRelco>());

    return null;

}

public String linkButtonPlant() {
    logger.debug(LogMessages.getLog4jString(username, distrib, taxid, "Fine linkButtonPlant"));
    return "table_pl";
}

public String linkButtonRelco() {
    logger.debug(LogMessages.getLog4jString(username, distrib, taxid, "Fine linkButtonRelco"));
    return "table_re";
}

public String button1_action() {

    logger.info(LogMessages.getLog4jString(username, distrib, taxid, "Inizio Button action 1"));
    this.lookup();
    FacesMessage fm = new FacesMessage();
    FacesContext fc = FacesContext.getCurrentInstance();
    try {


        logger.debug("button1_action inizio");

        if ((fileToUpload != null)
                && ((this.cb_NameD.isChecked()) || (this.cb_NameY.isChecked()) || (this.cb_NameG.isChecked())
                        || (this.cb_NameM.isChecked()) || (getALGUISessionBeanPlant().gettingListaPlant().size() != 0) || (getALGUISessionBeanRelco()
                        .gettingListOfRelco().size() != 0))) {

            throw new Exception(
                    "Non e' possibile selezionare contemporanemente un file e le componenti o impianti o SdV, eliminare le Sdv, impianti, componenti selezionate o il file, riselezionare il file");
        }

        SettTbMonth dataByIdMouth = samGuiManager05.getPeriodById(new Long(this.getIndexMonths()), getUserBean().getDisco());

        String currpalnt = null;
        String relco = null;

        if (fileToUpload != null) {
            logger.debug("button1_action fileToUpload non è null :: INIZIO" + "file bytes " + fileToUpload.getBytes().length);

            if (fileToUpload.getOriginalName().contains(".csv") == false) {
                throw new Exception("Selezionare soltanto file .csv");
            }

            File destFile;
            //String pathFile = samGuiManager05.getFilePath(getUserBean().getDisco(), "BILANCIAMENTO_SOTT_SAM").getFilepath();

            //logger.debug("Recupero file path di caricamento : " + pathFile);

            destFile = new File("tempfile.csv");

            logger.debug("Cartella di destinazione: " + destFile.toString());
            fileToUpload.write(destFile);

            BufferedReader in = new BufferedReader(new FileReader(destFile));

            Long insertRequest = samGuiManager05.insertRequest(null, dataByIdMouth.getStarttime(), dataByIdMouth.getStoptime(), this
                    .getALGUISessionBean().getCurrentProcess(), getUserBean().getDisco(), this.getIndexRateCode(), "", getUserBean()
                    .getUser(), currpalnt, relco, this.dataSchedulazione, new Long(1));

            while (in.ready()) {
                String s = in.readLine();
                samGuiManager05.insertIntoStoricoRett(insertRequest, null, null, null, s, getUserBean().getDisco());
                logger.debug("button1_action fileToUpload non è null :: CICLO FOR insertIntoStoricoRett " + s);
            }
            in.close();

            destFile.delete();
            logger.debug("button1_action fileToUpload non è null :: FINE");

        } else {
            logger.debug("button1_action fileToUpload null :: INIZIO ");
            List<SettTbPlant> listaPlant = getALGUISessionBeanPlant().gettingListaPlant();
            List<SettTbRelco> listOfRelco = getALGUISessionBeanRelco().gettingListOfRelco();
            List<String> components = new LinkedList<String>();
            if (this.cb_NameD.isChecked())
                components.add("D");
            if (this.cb_NameY.isChecked())
                components.add("Y");
            if (this.cb_NameG.isChecked())
                components.add("G");
            if (this.cb_NameM.isChecked())
                components.add("M");

            if ((components.size() == 0) && (listaPlant.size() == 0) && (listOfRelco.size() == 0)) {
                samGuiManager05.insertRequest(null, dataByIdMouth.getStarttime(), dataByIdMouth.getStoptime(), this
                        .getALGUISessionBean().getCurrentProcess(), getUserBean().getDisco(), this.getIndexRateCode(), "",
                        getUserBean().getUser(), currpalnt, relco, this.dataSchedulazione, new Long(1));

                logger.debug("ho inserito solo la richiesta in batchrequest");
            } else {
                Long insertRequest = samGuiManager05.insertRequest(null, dataByIdMouth.getStarttime(), dataByIdMouth.getStoptime(),
                        this.getALGUISessionBean().getCurrentProcess(), getUserBean().getDisco(), "C", "", getUserBean().getUser(),
                        currpalnt, relco, this.dataSchedulazione, new Long(1));
                logger.debug("ho inserito in batchrequest e continuo");

                if ((components.size() > 0) && (listaPlant.size() > 0) && (listOfRelco.size() > 0)) {
                    for (int i = 0; i < components.size(); i++) {
                        for (int j = 0; j < listaPlant.size(); j++) {
                            for (int k = 0; k < listOfRelco.size(); k++) {
                                samGuiManager05.insertIntoStoricoRett(insertRequest, listOfRelco.get(k).getRelco(), listaPlant.get(j)
                                        .getPlant(), components.get(i), null, getUserBean().getDisco());

                            }
                        }
                    }
                    logger.debug("inserendo in storico rettifica tutte e tre gli elementi selezionati");
                } else if ((components.size() > 0) && (listaPlant.size() > 0)) {
                    for (int i = 0; i < components.size(); i++) {
                        for (int j = 0; j < listaPlant.size(); j++) {
                            samGuiManager05.insertIntoStoricoRett(insertRequest, null, listaPlant.get(j).getPlant(), components.get(i),
                                    null, getUserBean().getDisco());

                        }
                    }
                    logger.debug("inserendo in storico rettifica tutte e due gli elementi selezionati");
                } else if ((listaPlant.size() > 0) && (listOfRelco.size() > 0)) {
                    for (int j = 0; j < listaPlant.size(); j++) {
                        for (int k = 0; k < listOfRelco.size(); k++) {
                            samGuiManager05.insertIntoStoricoRett(insertRequest, listOfRelco.get(k).getRelco(), listaPlant.get(j)
                                    .getPlant(), null, null, getUserBean().getDisco());

                        }
                    }
                    logger.debug("inserendo in storico rettifica tutte e due gli elementi selezionati");
                } else if ((components.size() > 0) && (listOfRelco.size() > 0)) {
                    for (int i = 0; i < components.size(); i++) {
                        for (int k = 0; k < listOfRelco.size(); k++) {
                            samGuiManager05.insertIntoStoricoRett(insertRequest, listOfRelco.get(k).getRelco(), null,
                                    components.get(i), null, getUserBean().getDisco());

                        }
                    }
                    logger.debug("inserendo in storico rettifica tutte e due gli elementi selezionati");
                } else if ((components.size() > 0)) {
                    for (int i = 0; i < components.size(); i++) {
                        samGuiManager05.insertIntoStoricoRett(insertRequest, null, null, components.get(i), null, getUserBean()
                                .getDisco());

                    }
                    logger.debug("inserendo in storico rettifica un elemento selezionato");
                } else if ((listaPlant.size() > 0)) {
                    for (int j = 0; j < listaPlant.size(); j++) {
                        samGuiManager05.insertIntoStoricoRett(insertRequest, null, listaPlant.get(j).getPlant(), null, null,
                                getUserBean().getDisco());

                    }
                    logger.debug("inserendo in storico rettifica un elemento selezionato");
                } else if ((listOfRelco.size() > 0)) {
                    for (int k = 0; k < listOfRelco.size(); k++) {
                        samGuiManager05.insertIntoStoricoRett(insertRequest, listOfRelco.get(k).getRelco(), null, null, null,
                                getUserBean().getDisco());

                    }
                    logger.debug("inserendo in storico rettifica un elemento selezionato");
                }
            }
        }
        logger.info(LogMessages.getLog4jString(username, distrib, taxid, "Fine Button action 1"));

    //  getALGUISessionBeanPlant().settingListaPlant(new LinkedList<SettTbPlant>());
    //  getALGUISessionBeanRelco().settingListOfRelco(new LinkedList<SettTbRelco>());

        GUISessionBeanDisplayRett alguiSessionVisualizzaRichieste = this.getALGUISessionVisualizzaRichieste();
        alguiSessionVisualizzaRichieste.setCurrentGui(GuiRisultatiRettifiche_01.class.getSimpleName());
        alguiSessionVisualizzaRichieste.setProcessNum(getALGUISessionBean().getIdProcessName());

        return "0";

    }

    catch (ProcessException e) {

        logger.error("PROCESS EXCEPTION :: " + e.getMessage(), e);

        String errMsg = MessageUtil.getMessage("it.eni.italgas.sam.web.dictionary", e.getMessage());
        logger.debug("MESSAGGIO DI ERRORE: " + errMsg);
        if (e.getNote() != null)
            errMsg = errMsg.replace("{0}", e.getNote());

        String msg = MessageUtil.getMessage("it.eni.italgas.sam.web.dictionary", "ErroreInserimentoRichiesta");
        fm.setSeverity(FacesMessage.SEVERITY_FATAL);
        fm.setSummary(msg);
        fc.addMessage(null, fm);

        logger.info(LogMessages.getLog4jString(username, distrib, taxid, "Fine Button action 1"));
        fileToUpload = null;
        return null;

    } catch (Exception e) {

        logger.error("EXCEPTION: " + e.getMessage(), e);

        String msg = MessageUtil.getMessage("it.eni.italgas.sam.web.dictionary", "SysError");
        if (e != null)
            msg = msg.replace("{0}", e.getMessage());
        // msg = "Errore generico in fase di elaborazione delle rettifiche";
        fm.setSeverity(FacesMessage.SEVERITY_FATAL);
        fm.setSummary(msg);
        fc.addMessage(null, fm);

        logger.info(LogMessages.getLog4jString(username, distrib, taxid, "Fine Button action 1"));
        fileToUpload = null;
        return null;
    }


}

public void lookup() {

    // log(LogMessages.getLogString(username, distrib, nomeClasse, LogMessages.LOOKUP, LogMessages.INIZIO), null);
    logger.info(LogMessages.getLog4jString(username, distrib, taxid,
            "INIZIO Lookup Gui remota " + SamGuiManagerG05Remote.class.getSimpleName()));
    // logger.info("Lookup Gui remota " + SamGuiManagerG05Remote.class.getSimpleName() + " :: INIZIO");

    try {

        bundle = ResourceBundle.getBundle(EJBBUNDLE);

        String gui = bundle.getString(this.getClass().getSimpleName());
        logger.debug("Gui recuperata da file: " + gui);

        if (samGuiManagerFactory == null) {
            logger.error("SamGuiManagerFactory nulla. Impossibile instanziare il bean");
        }
        SamGui samGui = samGuiManagerFactory.getGui(gui);
        logger.debug("Recupero GUI dalla factory: " + samGui.toString());

        samGuiManager05 = (SamGuiManagerG05Remote) samGuiManagerFactory.getSamGuiManager(samGui);
        logger.debug("Recupero il bean remoto");

        PersistenceContextName persistenceContextName = PersistenceContextName.valueOf(getUserBean().getPersistenceContextName());
        samGuiManager05.setPersistenceContextName(persistenceContextName);
        logger.debug("Imposto il contesto di persistenza " + persistenceContextName.toString());

        if (samGuiManager05 == null) {
            log(LogMessages.getLogString(username, distrib, nomeClasse, LogMessages.LOOKUP, LogMessages.LOOKUP_KO), null);

            logger.error("Lookup Gui remota " + SamGuiManagerG05Remote.class.getSimpleName() + " Fallita. Gui Nulla");
        }

    } catch (IllegalArgumentException e) {
        // log(LogMessages.getLogString(username, distrib, nomeClasse, LogMessages.LOOKUP, "KO: " + e.toString(true)), null);

        logger.error(e.getMessage());
    }

    // log(LogMessages.getLogString(username, distrib, nomeClasse, LogMessages.LOOKUP, LogMessages.FINE), null);
    logger.info(LogMessages.getLog4jString(username, distrib, taxid,
            "FINE Lookup Gui remota " + SamGuiManagerG05Remote.class.getSimpleName()));
    // logger.info("Lookup Gui remota " + SamGuiManagerG05Remote.class.getSimpleName() + " Fine");
}

public Date getDataSchedulazione() {
    return dataSchedulazione;
}

public void setDataSchedulazione(Date dataSchedulazione) {
    this.dataSchedulazione = dataSchedulazione;
}

public String getIndexProcessNames() {

    return indexProcessNames;
}

public void setIndexProcessNames(String indexProcessNames) {
    this.indexProcessNames = indexProcessNames;
}

public Long getIndexMonths() {
    return indexMonths;
}

public void setIndexMonths(Long indexMonths) {
    this.indexMonths = indexMonths;
}

public String getIndexRateCode() {
    return indexRateCode;
}

public void setIndexRateCode(String indexRateCode) {
    this.indexRateCode = indexRateCode;
}

public Option[] getRateCodes() throws ProcessException {

    logger.info(LogMessages.getLog4jString(username, distrib, taxid, "Esecuzione getRateCodes"));
    // logger.debug("getRateCodes");

    logger.info("current process: " + getALGUISessionBean().getIdProcessName());

    List<SettTbBatchtype> valuesForProcess = samGuiManager05.getValuesForRatecode(getALGUISessionBean().getIdProcessName(),
            getUserBean().getDisco());

    logger.info("query di recupero rate code effettuata");

    this.rateCodes = new Option[valuesForProcess.size()];

    for (int i = 0; i < valuesForProcess.size(); i++) {
        rateCodes[i] = new Option(valuesForProcess.get(i).getRatecode(), valuesForProcess.get(i).getName());
    }

    return rateCodes;
}

public void setRateCodes(Option[] rateCodes) {

    this.rateCodes = rateCodes;
}

public Option[] getMonths() throws ProcessException {
    lookup();
    // logger.debug("getMonths");
    logger.info(LogMessages.getLog4jString(username, distrib, taxid, "Esecuzione getMonths"));

    List<SettTbMonth> molist = samGuiManager05.getSettTbAllMonthsWithoutBilDate(getUserBean().getDisco());
    months = new Option[molist.size()];
    int i = 0;
    for (SettTbMonth m : molist) {
        months[i] = new Option(m.getUidmonth(), m.getMese() + " - " + m.getAnno());
        i++;
    }

    return months;
}

public void setMonths(Option[] months) {
    this.months = months;
}

public Option[] getProcessNames() throws ProcessException {
    lookup();

    // logger.debug("getProcessNames");
    logger.info(LogMessages.getLog4jString(username, distrib, taxid, "Inizio Selezione lista processi"));

    List<SettTbBatchprocess> batchProcessList = samGuiManager05.getAllProcess(getUserBean().getDisco());

    processNames = new Option[batchProcessList.size()];
    int i = 0;
    for (SettTbBatchprocess settTbBatchprocess : batchProcessList) {

        logger.debug("Processnum: " + settTbBatchprocess.getProcessnum() + " Nome : " + settTbBatchprocess.getName());

        processNames[i] = new Option(settTbBatchprocess.getDescription(), settTbBatchprocess.getName());
        i++;
    }

    // logger.debug("Selezione lista processi completa");
    logger.info(LogMessages.getLog4jString(username, distrib, taxid, "Selezione lista processi completa"));

    return processNames;
}

}

孤立的问题:

                    <webuijsf:upload id="fileUpload" required="true" style="left: 255px; top: 420px; position: absolute" 
                    rendered="#{GUISessionBeanInsertRequest.flagRelco}"
                    uploadedFile="#{guiInserimentoRichiesta_01.fileToUpload}" />

我不知道为什么但是从Bean的jsp中删除上面的代码页面正常工作..(没有上传)

问题是必需的=“真实”..但这不能解释为什么例外..(但现在页面效果很好)......很奇怪......

0 个答案:

没有答案