Javaに関する様々な情報をご紹介します。

Javaに関する様々な情報をご紹介します。
評価

0

java.exeが残る。

batで呼び出したjava処理がbat正常終了後もjava.exeが残ってしまいます。
解決方法の心当たり、調査方法等、思い当たることがあれば、どうかご教授ください。

○詳細(補足)
DBサーバからタスクスケジューラでbatを定期実行させ、
bat内でjava autoBatch.BootServlet http://hogehoge/hogehogeBatchのように記述して、
APサーバのjavaプログラムを実行している。

・ソースをコメント化して動確等していますが、一回目はJavaプロセスが削除されるものの
二回目動かすと消えないというケースもあります。 
・java.exeが残る原因にスレッド処理による事例があるようですが、スレッド処理は行っていません。
・他にも、javaで処理を行うbatはいくつかあるのですが、ひとつだけがバッチ正常終了後もjava.exeが残ります。

処理内容:
主にDB処理、select、insert、update

○環境
APサーバ
・OS
Windows Server 2012 R2
・jdk
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b18)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
・Wildfly
バージョン:8.0.0 final

・ドライブ構成
C : Windows、JDKなど
D : wildfly、warファイル(javaプログラムなど)

DBサーバ
・OS
Windows Server 2012 R2

・ドライブ構成
C : Windowsなど
O : bat

11

回答

4539

閲覧

11件の回答

評価

0

デッドロックでもしてるんじゃない?
としか言いようが無い。

せめてbatから起動したプロセスがなにしてるのかぐらい書いてくれないと…

評価

0

自分の書いたコードが終了していることくらいは、確認してるのか?

評価

0

デッドロック、その他のロックを含めて調査してみていますが、よく分からず。。。                        
プログラムの処理は最後まで完了していることを確認しております。                        
                        
ソースコードをほぼそのまま貼らせて頂きます。色々と説明をするよりもと思いましたので。                        
以下のようにすると、javaプロセスが残らないことが確認できています。                        
1・GUMのループとMENのループをさせない。                        
2・MENのループをさせない。                        
3・insUpdJITSUKKNメソッドを使用しない。                        
                        
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                        
public class InfoUpdateBatch extends HttpServlet {                        
                        
    public void init(ServletConfig config) throws ServletException {                        
        // 環境初期化                        
        super.init(config);                        
    }                        
                        
    public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException,java.io.IOException {                        
                        
        String sKinouName = ConstMs.INFOUPDATE_PGNAME;                        
        Date crnDate = new Date();                        
        String sCurrentDate = DateUtil.dateTime2String(crnDate);                        
        String[] sMsgAppStr = new String[]{sCurrentDate, sKinouName};                        
                        
        // 開始ログを出力                        
        Log.info(ResourceUtil.getMessage("CM0048I", sMsgAppStr));                        
                        
        try {                        
            // バッチ起動時刻を引数に情報更新処理を実行                        
            InfoUpdateDAO InfDao = new InfoUpdateDAO();                        
            InfDao.InfoUpdateExec(sCurrentDate);                        ←InfoUpdateDAOのInfoUpdateExecを呼び出し
                        
        } catch(Exception e) {                        
            crnDate = new Date();                        
            sCurrentDate = DateUtil.dateTime2String(crnDate);                        
            sMsgAppStr = new String[]{sCurrentDate, sKinouName};                        
            Log.error(ResourceUtil.getMessage("CM0051E", sMsgAppStr), e);                        
            e.printStackTrace();                        
                        
        } finally {                        
            try {                        
                response.getWriter().flush();                        
                response.getWriter().close();                        ←InfoUpdateDAOの処理が終わり、ここまで来ることを確認済み
            } catch(Exception ex) {                        
                ex.printStackTrace();                        
            }                        
        }                        
    }                        
}                        
                        
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                        
                        
public class InfoUpdateDAO extends CommonDAOImpl {                        
                        
    public InfoUpdateDAO() {                        
                        
    }                        
                        
    /**                        
    * バッチ起動時刻                        
    */                        
    public void InfoUpdateExec(String strBatchStartTime) throws Exception {                        
        List<Map<String, String>> result = new ArrayList<Map<String, String>>();                        
        List<Map<String, String>> resultJdoU = new ArrayList<Map<String, String>>();                        
        List<Map<String, String>> resultDetail = new ArrayList<Map<String, String>>();                        
        List<Map<String, String>> resultJuSts = new ArrayList<Map<String, String>>();                        
        DbAccess db = new DbAccess();                        
        String[] sMsgAppStr ;                        
        String strTMmp = "";                        
                        
        try {                        
            StringBuffer sql = new StringBuffer();                        
                        
            //開始処理                        
            //バッチ処理管理の最終処理実行開始日時 取得                        
            sql.append("SELECT " + System.getProperty("line.separator"));                        
            sql.append("  B.SHORIKAISHIYMDHMS " + System.getProperty("line.separator"));                        
            sql.append("FROM " + System.getProperty("line.separator"));                        
            sql.append(" KT_BCHSKNR B " + System.getProperty("line.separator"));                        
            sql.append("WHERE " + System.getProperty("line.separator"));                        
            sql.append(" B.PRGID = \'" + ConstMs.INFOUPDATE_PGID + "\'" + System.getProperty("line.separator"));                        
            sql.append(" AND B.SYSTEMID = \'_\'" + System.getProperty("line.separator"));                        
            sql.append(" AND B.DELFLG = 0 ");                        
            db.setSql(sql.toString());                        
                        
            result = db.selectMapList();                        
            String strShoriKaishiYmdhms = result.get(0).get("SHORIKAISHIYMDHMS");                        
            //バッチ処理管理の最終処理実行開始日時 取得ログを出力                        
            sMsgAppStr = new String[]{"バッチ処理管理の最終処理実行開始日時" + strShoriKaishiYmdhms, "取得"};                        
            HANLog.info(ResourceUtil.getMessage("BT0011I", sMsgAppStr));                        
                        
            //StringBuffer初期化                        
            sql.setLength(0);                        
            sql.append("SELECT " + System.getProperty("line.separator"));                        
            sql.append("  DISTINCT " + System.getProperty("line.separator"));                        
            sql.append("  YJT.GUCD " + System.getProperty("line.separator"));                        
            sql.append("FROM "+ System.getProperty("line.separator"));                        
            sql.append("  KT_SOJITSU YJT " + System.getProperty("line.separator"));                        
            sql.append("  INNER JOIN KT_ZENSHAGU Z " + System.getProperty("line.separator"));                        
            sql.append("    ON YJT.GUCD = Z.GUCD " + System.getProperty("line.separator"));                        
            sql.append("  LEFT OUTER JOIN KT_JITSUKKN YJTKN " + System.getProperty("line.separator"));                        
            sql.append("    ON YJT.SOHNCD = YJTKN.SOHNCD " + System.getProperty("line.separator"));                        
            sql.append("  LEFT OUTER JOIN KT_HANWKINFO BHI  " + System.getProperty("line.separator"));                        
            sql.append("    ON (YJT.DASUHNID = BHI.DASUHNID AND YJT.DASUWKID = BHI.DASUWKID) " + System.getProperty("line.separator"));                        
            sql.append("WHERE " + System.getProperty("line.separator"));                        
            sql.append("  Z.GUSHUBETSU = \'10\' " + System.getProperty("line.separator"));                        
            sql.append("  AND " + System.getProperty("line.separator"));                        
            sql.append("  ((GREATEST(YJT.UPDYMDHMS,NVL(BHI.UPDYMDHMS,\'1970/01/01\')) >= \'" + strShoriKaishiYmdhms + "\') OR YJTKN.KKNSTATUS = \'20\') " + System.getProperty("line.separator"));                        
            sql.append("ORDER BY " + System.getProperty("line.separator"));                        
            sql.append("  YJT.GUCD");                        
            db.setSql(sql.toString());                        
            result = db.selectMapList();                        
                        
            sMsgAppStr = new String[]{"更新対象のGUMコード 件数"+ result.size(), "取得"};                        
            HANLog.info(ResourceUtil.getMessage("BT0011I", sMsgAppStr));                        

評価

0

                                
            // トランザクション開始                                
            db.beginTrans();                                
                                
            //GUMごとループ開始                                
            for (int progCnt = 0; progCnt < result.size(); progCnt++) {                                
                sMsgAppStr = new String[]{"★GUMループ" + progCnt + "番目:GUMコード" + result.get(progCnt).get("GUCD") + "の処理", "開始"};                                
                HANLog.info(ResourceUtil.getMessage("BT0011I", sMsgAppStr));                                
                //ループ内初期処理                                
                resultJdoU.clear();                                
                resultDetail.clear();                                
                                
                boolean AbiConfFlag = false;                                
                                
                sql.setLength(0);                                
                sql.append("SELECT " + System.getProperty("line.separator"));                                
                sql.append("  B.GUCD " + System.getProperty("line.separator"));                                
                sql.append("  ,B.HANGUNM " + System.getProperty("line.separator"));                                
                sql.append("  ,B.KYUUSHOFLG " + System.getProperty("line.separator"));                                
                sql.append("FROM KT_HANGU B " + System.getProperty("line.separator"));                                
                sql.append("WHERE " + System.getProperty("line.separator"));                                
                sql.append("  B.KKGUCD = " + result.get(progCnt).get("GUCD") + System.getProperty("line.separator"));                                
                sql.append(" AND JISEIFLG = 1 " + System.getProperty("line.separator"));                                
                db.setSql(sql.toString());                                
                resultJdoU = db.selectMapList();                                
                boolean blnJdoUProgFlg = false;                                
                if (resultJdoU.size() == 1) {                                
                    blnJdoUProgFlg = true;                                
                }                                
                sMsgAppStr = new String[]{"★GUMループ" + progCnt + "番目:GUMコード" + result.get(progCnt).get("GUCD") + "のユン生成対象GUM" + blnJdoUProgFlg, "取得"};                                
                HANLog.info(ResourceUtil.getMessage("BT0011I", sMsgAppStr));                                
                                

評価

0

                sql.setLength(0);                                
                sql.append("SELECT "+ System.getProperty("line.separator"));                                
                sql.append("   EN.SOHNCD "+ System.getProperty("line.separator"));                                
                sql.append("   ,EN.HANGUCD AS H_HANGUCD "+ System.getProperty("line.separator"));                                
                sql.append("   ,U.HANGUCD AS U_HANGUCD "+ System.getProperty("line.separator"));                                
                sql.append("   ,EN.UDTL_MSEQ AS H_UDTL_MSEQ "+ System.getProperty("line.separator"));                                
                sql.append("   ,U.UDTL_MSEQ AS U_UDTL_MSEQ "+ System.getProperty("line.separator"));                                
                sql.append("   ,EN.J_UPDKBN "+ System.getProperty("line.separator"));                                
                sql.append("   ,EN.J_UPDYMDHMS "+ System.getProperty("line.separator"));                                
                sql.append("   ,EN.J_GUCD "+ System.getProperty("line.separator"));                                
                sql.append("   ,EN.J_SOKAISHIYMD "+ System.getProperty("line.separator"));                                
                sql.append("   ,EN.J_YOUBICD "+ System.getProperty("line.separator"));                                
                sql.append("   ,EN.J_KAISHIHM "+ System.getProperty("line.separator"));                                
                sql.append("   ,EN.J_ENDHM "+ System.getProperty("line.separator"));                                
                sql.append("   ,EN.J_USHIFLG "+ System.getProperty("line.separator"));                                
                sql.append("   ,EN.BHI_DGJI AS BHI_DGJI "+ System.getProperty("line.separator"));                                
                sql.append("   ,U.XXAYMD "+ System.getProperty("line.separator"));                                
                sql.append("   ,U.XXAKAISHIHM "+ System.getProperty("line.separator"));                                
                sql.append("   ,U.XXAENDHM "+ System.getProperty("line.separator"));                                
                sql.append("   ,U.USHIFLG "+ System.getProperty("line.separator"));                                
                sql.append("   ,EN.J_SAKCD "+ System.getProperty("line.separator"));                                
                sql.append("   ,U.JIUMUFLG "+ System.getProperty("line.separator"));                                
                sql.append("FROM " + System.getProperty("line.separator"));                                
                sql.append("( " + System.getProperty("line.separator"));                                
                sql.append("    SELECT " + System.getProperty("line.separator"));                                
                sql.append("      YJT.SOHNCD " + System.getProperty("line.separator"));                                
                sql.append("      ,YJT.GUCD AS J_GUCD " + System.getProperty("line.separator"));                                
                sql.append("      ,UDTL.HANGUCD " + System.getProperty("line.separator"));                                
                sql.append("      ,UDTL.MSEQ AS UDTL_MSEQ " + System.getProperty("line.separator"));                                
                sql.append("      ,YJT.SOKAISHIYMD AS J_SOKAISHIYMD " + System.getProperty("line.separator"));                                
                sql.append("      ,YJT.KAISHIHM AS J_KAISHIHM " + System.getProperty("line.separator"));                                
                sql.append("      ,YJT.ENDHM AS J_ENDHM" + System.getProperty("line.separator"));                                
                sql.append("      ,DECODE(YJT.USHIKBN,'1','0','1') AS J_USHIFLG " + System.getProperty("line.separator"));                                
                sql.append("      ,YJT.UPDKBN AS J_UPDKBN " + System.getProperty("line.separator"));                                
                sql.append("      ,YJT.UPDYMDHMS AS J_UPDYMDHMS " + System.getProperty("line.separator"));                                
                sql.append("      ,YJT.YOUBICD AS J_YOUBICD " + System.getProperty("line.separator"));                                
                sql.append("      ,BHI.DGJI AS BHI_DGJI " + System.getProperty("line.separator"));                                
                sql.append("      ,YJT.SAKCD AS J_SAKCD " + System.getProperty("line.separator"));                                
                sql.append("    FROM " + System.getProperty("line.separator"));                                
                sql.append("      KT_SOJITSU YJT " + System.getProperty("line.separator"));                                
                sql.append("      LEFT OUTER JOIN KT_JITSUKKN YJTKN " + System.getProperty("line.separator"));                                
                sql.append("        ON YJT.SOHNCD = YJTKN.SOHNCD " + System.getProperty("line.separator"));                                
                sql.append("      LEFT OUTER JOIN KT_HANWKINFO BHI " + System.getProperty("line.separator"));                                
                sql.append("        ON (YJT.DASUHNID = BHI.DASUHNID AND YJT.DASUWKID = BHI.DASUWKID) " + System.getProperty("line.separator"));                                
                sql.append("      LEFT OUTER JOIN " + System.getProperty("line.separator"));                                
                sql.append("        (SELECT * FROM KT_HANDTL UD WHERE UD.DELFLG = 0) UDTL " + System.getProperty("line.separator"));                                
                sql.append("        ON YJT.SOHNCD = UDTL.SOHNCD " + System.getProperty("line.separator"));                                
                sql.append("    WHERE " + System.getProperty("line.separator"));                                
                sql.append("      YJT.GUCD = \'" + result.get(progCnt).get("GUCD") + "\'" + System.getProperty("line.separator"));                                
                sql.append("      AND " + System.getProperty("line.separator"));                                
                sql.append("      ((GREATEST(YJT.UPDYMDHMS,NVL(BHI.UPDYMDHMS,\'1970/01/01\')) >= \'" + strShoriKaishiYmdhms + "\') OR YJTKN.KKNSTATUS = \'20\')" + System.getProperty("line.separator"));                                
                sql.append(") EN " + System.getProperty("line.separator"));                                
                sql.append("FULL OUTER JOIN " + System.getProperty("line.separator"));                                
                sql.append("( " + System.getProperty("line.separator"));                                
                sql.append("    SELECT " + System.getProperty("line.separator"));                                
                sql.append("      U.HANGUCD " + System.getProperty("line.separator"));                                
                sql.append("      ,UDTL.MSEQ AS UDTL_MSEQ " + System.getProperty("line.separator"));                                
                sql.append("      ,U.XXAYMD " + System.getProperty("line.separator"));                                
                sql.append("      ,U.XXAKAISHIHM " + System.getProperty("line.separator"));                                
                sql.append("      ,U.XXAENDHM " + System.getProperty("line.separator"));                                
                sql.append("      ,U.USHIFLG " + System.getProperty("line.separator"));                                
                sql.append("      ,U.JIUMUFLG " + System.getProperty("line.separator"));                                
                sql.append("    FROM " + System.getProperty("line.separator"));                                
                sql.append("      KT_HAN U " + System.getProperty("line.separator"));                                
                sql.append("      LEFT OUTER JOIN " + System.getProperty("line.separator"));                                
                sql.append("        (SELECT * FROM KT_HANDTL UD WHERE UD.DELFLG = 0) UDTL " + System.getProperty("line.separator"));                                
                sql.append("        ON U.HANGUCD = UDTL.HANGUCD " + System.getProperty("line.separator"));                                
                sql.append("    WHERE " + System.getProperty("line.separator"));                                
                sql.append("      U.GUCD = \'" + result.get(progCnt).get("GUCD") + "\'" + System.getProperty("line.separator"));                                
                sql.append("      AND (U.HASEIDTLCD = \'00\' OR U.HASEIDTLCD IS NULL) " + System.getProperty("line.separator"));                                
                sql.append("      AND U.DELFLG = 0 " + System.getProperty("line.separator"));                                
                sql.append("      AND U.HNTSHOGIFLG = 0 " + System.getProperty("line.separator"));                                
                sql.append(") U " + System.getProperty("line.separator"));                                
                sql.append("ON " + System.getProperty("line.separator"));                                
                sql.append("  EN.HANGUCD = U.HANGUCD " + System.getProperty("line.separator"));                                
                sql.append("OR " + System.getProperty("line.separator"));                                
                sql.append("  (EN.J_SOKAISHIYMD = U.XXAYMD " + System.getProperty("line.separator"));                                
                sql.append("   AND EN.J_KAISHIHM = U.XXAKAISHIHM " + System.getProperty("line.separator"));                                
                sql.append("   AND EN.J_ENDHM = U.XXAENDHM) " + System.getProperty("line.separator"));                                
                sql.append("WHERE " + System.getProperty("line.separator"));                                
                sql.append("   U.HANGUCD IS NULL " + System.getProperty("line.separator"));                                
                sql.append("   OR " + System.getProperty("line.separator"));                                
                sql.append("   EN.SOHNCD IS NOT NULL " + System.getProperty("line.separator"));                                
                sql.append("ORDER BY " + System.getProperty("line.separator"));                                
                sql.append("   NVL(EN.J_SOKAISHIYMD,U.XXAYMD) " + System.getProperty("line.separator"));                                
                sql.append("  ,NVL(EN.J_KAISHIHM,U.XXAKAISHIHM) " + System.getProperty("line.separator"));                                
                sql.append("  ,NVL(EN.J_ENDHM,U.XXAENDHM) " + System.getProperty("line.separator"));                                
                sql.append("  ,EN.SOHNCD ");                                
                db.setSql(sql.toString());                                
                resultDetail = db.selectMapList();                                
                sMsgAppStr = new String[]{"★GUMループ" + progCnt + "番目:GUMコード" + result.get(progCnt).get("GUCD") + "の平情報、ユン情報 件数" + resultDetail.size(), "取得"};                                
                HANLog.info(ResourceUtil.getMessage("BT0011I", sMsgAppStr));                                

評価

0

                                
                String strPtn ;                                
                //MENループ開始                                
                for (int dtlCnt = 0; dtlCnt < resultDetail.size(); dtlCnt++) {                                
                    strPtn = "";                                
                                
                    //MENループ開始ログを出力                                
                    sMsgAppStr = new String[]{"★★MENループ" + dtlCnt + "番目:HOU本コード" + resultDetail.get(dtlCnt).get("SOHNCD") + "の処理", "開始"};                                
                    HANLog.info(ResourceUtil.getMessage("BT0011I", sMsgAppStr));                                
                                
                    if (!StringUtils.isBlankOrNull(resultDetail.get(dtlCnt).get("SOHNCD")) &&                                
                            StringUtils.isBlankOrNull(resultDetail.get(dtlCnt).get("H_HANGUCD")) &&                                
                            StringUtils.isBlankOrNull(resultDetail.get(dtlCnt).get("U_HANGUCD"))                                
                            ) {                                
                        sMsgAppStr = new String[]{"★★MENループ" + dtlCnt + "番目:HOU本コード" + resultDetail.get(dtlCnt).get("SOHNCD") + "のア)処理", "開始"};                                
                        HANLog.info(ResourceUtil.getMessage("BT0011I", sMsgAppStr));                                
                                
                        if (resultDetail.get(dtlCnt).get("J_UPDKBN").equals("3")) {                                
                            strPtn = "6";                                
                            sMsgAppStr = new String[]{"★★MENループ" + dtlCnt + "番目:HOU本コード" + resultDetail.get(dtlCnt).get("SOHNCD") + "のア)?処理パターン" + strPtn, "開始"};                                
                            HANLog.info(ResourceUtil.getMessage("BT0011I", sMsgAppStr));                                
                            this.insUpdJITSUKKN(db,resultDetail.get(dtlCnt),strPtn);                                
                                
                        } else {                                
                            if(blnJdoUProgFlg) {                                
                                strPtn = "8";                                
                                sMsgAppStr = new String[]{"★★MENループ" + dtlCnt + "番目:HOU本コード" + resultDetail.get(dtlCnt).get("SOHNCD") + "のア)?処理パターン" + strPtn, "開始"};                                
                                HANLog.info(ResourceUtil.getMessage("BT0011I", sMsgAppStr));                                
                                this.insUpdJITSUKKN(db,resultDetail.get(dtlCnt),strPtn);                                
                                this.insUpdM(db,resultDetail.get(dtlCnt),strPtn,resultJdoU);                                
                                
                            } else {                                
                                strPtn = "1";                                
                                sMsgAppStr = new String[]{"★★MENループ" + dtlCnt + "番目:HOU本コード" + resultDetail.get(dtlCnt).get("SOHNCD") + "のア)?処理パターン" + strPtn, "開始"};                                
                                HANLog.info(ResourceUtil.getMessage("BT0011I", sMsgAppStr));                                
                                this.insUpdJITSUKKN(db,resultDetail.get(dtlCnt),strPtn);                                
                                AbiConfFlag = true;                                
                            }                                
                        }                                
                                
                    } else if                                
                            (StringUtils.isBlankOrNull(resultDetail.get(dtlCnt).get("SOHNCD")) &&                                
                            StringUtils.isBlankOrNull(resultDetail.get(dtlCnt).get("H_HANGUCD")) &&                                
                            !StringUtils.isBlankOrNull(resultDetail.get(dtlCnt).get("U_HANGUCD"))                                
                            ) {                                
                        sMsgAppStr = new String[]{"★★MENループ" + dtlCnt + "番目:HOU本コード" + resultDetail.get(dtlCnt).get("SOHNCD") + "のイ)処理", "開始"};                                
                        HANLog.info(ResourceUtil.getMessage("BT0011I", sMsgAppStr));                                
                        AbiConfFlag = true;                                
                                
                    } else if                                
                    (!StringUtils.isBlankOrNull(resultDetail.get(dtlCnt).get("SOHNCD")) &&                                
                            StringUtils.isBlankOrNull(resultDetail.get(dtlCnt).get("H_HANGUCD")) &&                                
                            !StringUtils.isBlankOrNull(resultDetail.get(dtlCnt).get("U_HANGUCD"))                                
                            ) {                                
                        sMsgAppStr = new String[]{"★★MENループ" + dtlCnt + "番目:HOU本コード" + resultDetail.get(dtlCnt).get("SOHNCD") + "のウ)処理", "開始"};                                
                        HANLog.info(ResourceUtil.getMessage("BT0011I", sMsgAppStr));                                
                                
                        if (resultDetail.get(dtlCnt).get("J_UPDKBN").equals("3")) {                                
                            strPtn = "6";                                
                            sMsgAppStr = new String[]{"★★MENループ" + dtlCnt + "番目:HOU本コード" + resultDetail.get(dtlCnt).get("SOHNCD") + "のウ)?処理パターン" + strPtn, "開始"};                                
                            HANLog.info(ResourceUtil.getMessage("BT0011I", sMsgAppStr));                                
                            this.insUpdJITSUKKN(db,resultDetail.get(dtlCnt),strPtn);                                
                                

評価

0

                        } else {                                
                            if(blnJdoUProgFlg) {                                
                                strPtn = "9";                                
                                sMsgAppStr = new String[]{"★★MENループ" + dtlCnt + "番目:HOU本コード" + resultDetail.get(dtlCnt).get("SOHNCD") + "のウ)?処理パターン" + strPtn, "開始"};                                
                                HANLog.info(ResourceUtil.getMessage("BT0011I", sMsgAppStr));                                
                                
                                this.insUpdJITSUKKN(db,resultDetail.get(dtlCnt),strPtn);                                
                                this.insUpdM(db,resultDetail.get(dtlCnt),strPtn,resultJdoU);                                
                                
                            } else {                                
                                sMsgAppStr = new String[]{"★★MENループ" + dtlCnt + "番目:HOU本コード" + resultDetail.get(dtlCnt).get("SOHNCD") + "のウ)?処理", "開始"};                                
                                HANLog.info(ResourceUtil.getMessage("BT0011I", sMsgAppStr));                                
                                
                                if (AbiConfFlag) {                                
                                    strPtn = "3";                                
                                    sMsgAppStr = new String[]{"★★MENループ" + dtlCnt + "番目:HOU本コード" + resultDetail.get(dtlCnt).get("SOHNCD") + "のウ)?処理パターン" + strPtn, "開始"};                                
                                    HANLog.info(ResourceUtil.getMessage("BT0011I", sMsgAppStr));                                
                                    this.insUpdJITSUKKN(db, resultDetail.get(dtlCnt), strPtn);                                
                                
                                } else {                                
                                    sMsgAppStr = new String[]{"★★MENループ" + dtlCnt + "番目:HOU本コード" + resultDetail.get(dtlCnt).get("SOHNCD") + "のウ)?処理", "開始"};                                
                                    HANLog.info(ResourceUtil.getMessage("BT0011I", sMsgAppStr));                                
                                
                                    if (!resultDetail.get(dtlCnt).get("J_USHIFLG").equals(resultDetail.get(dtlCnt).get("USHIFLG"))) {                                
                                        strPtn = "5";                                
                                        sMsgAppStr = new String[]{"★★MENループ" + dtlCnt + "番目:HOU本コード" + resultDetail.get(dtlCnt).get("SOHNCD") + "のウ)?処理パターン" + strPtn, "開始"};                                
                                        HANLog.info(ResourceUtil.getMessage("BT0011I", sMsgAppStr));                                
                                
                                        this.insUpdJITSUKKN(db, resultDetail.get(dtlCnt), strPtn);                                
                                        this.insUpdMDtl(db, resultDetail.get(dtlCnt), resultDetail.get(dtlCnt).get("U_HANGUCD"),strPtn);                                
                                        AbiConfFlag = true;                                
                                
                                    } else {                                
                                        sMsgAppStr = new String[]{"★★MENループ" + dtlCnt + "番目:HOU本コード" + resultDetail.get(dtlCnt).get("SOHNCD") + "のウ)?処理", "開始"};                                
                                        HANLog.info(ResourceUtil.getMessage("BT0011I", sMsgAppStr));                                
                                
                                        String strBhiJ = "";                                
                                        if (!StringUtils.isBlankOrNull(resultDetail.get(dtlCnt).get("BHI_DGJI"))) {                                
                                            if (Integer.parseInt(resultDetail.get(dtlCnt).get("BHI_DGJI")) >= 1) {                                
                                                strBhiJ = "1";                                
                                            } else {                                
                                                strBhiJ = "0";                                
                                            }                                
                                
                                            if (!strBhiJ.equals(resultDetail.get(dtlCnt).get("JIUMUFLG"))) {                                
                                                strPtn = "5";                                
                                                sMsgAppStr = new String[]{"★★MENループ" + dtlCnt + "番目:HOU本コード" + resultDetail.get(dtlCnt).get("SOHNCD") + "のウ)?処理パターン" + strPtn, "開始"};                                
                                                HANLog.info(ResourceUtil.getMessage("BT0011I", sMsgAppStr));                                
                                
                                                this.insUpdJITSUKKN(db, resultDetail.get(dtlCnt), strPtn);                                
                                                this.insUpdMDtl(db, resultDetail.get(dtlCnt), resultDetail.get(dtlCnt).get("U_HANGUCD"), strPtn);                                
                                
                                            } else {                                
                                                strPtn = "2";                                
                                                sMsgAppStr = new String[]{"★★MENループ" + dtlCnt + "番目:HOU本コード" + resultDetail.get(dtlCnt).get("SOHNCD") + "のウ)?処理パターン" + strPtn, "開始"};                                
                                                HANLog.info(ResourceUtil.getMessage("BT0011I", sMsgAppStr));                                
                                                this.insUpdJITSUKKN(db, resultDetail.get(dtlCnt), strPtn);                                
                                                this.insUpdMDtl(db, resultDetail.get(dtlCnt), resultDetail.get(dtlCnt).get("U_HANGUCD"), strPtn);                                
                                            }                                
                                        }                                
                                
                                    }                                
                                }                                
                                
                            }                                
                                
                        }                                
                                

評価

0

                    } else if                                
                            (!StringUtils.isBlankOrNull(resultDetail.get(dtlCnt).get("SOHNCD")) &&                                
                            !StringUtils.isBlankOrNull(resultDetail.get(dtlCnt).get("H_HANGUCD"))                                
                            ) {                                
                        sMsgAppStr = new String[]{"★★MENループ" + dtlCnt + "番目:HOU本コード" + resultDetail.get(dtlCnt).get("SOHNCD") + "のエ)処理", "開始"};                                
                        HANLog.info(ResourceUtil.getMessage("BT0011I", sMsgAppStr));                                
                                
                        if (blnJdoUProgFlg) {                                
                            strPtn = "10";                                
                            sMsgAppStr = new String[]{"★★MENループ" + dtlCnt + "番目:HOU本コード" + resultDetail.get(dtlCnt).get("SOHNCD") + "のエ)?処理パターン" + strPtn, "開始"};                                
                            HANLog.info(ResourceUtil.getMessage("BT0011I", sMsgAppStr));                                
                            this.insUpdJITSUKKN(db, resultDetail.get(dtlCnt), strPtn);                                
                            this.insUpdM(db, resultDetail.get(dtlCnt), strPtn, resultJdoU);                                
                            this.insUpdMDtl(db, resultDetail.get(dtlCnt), resultDetail.get(dtlCnt).get("H_HANGUCD"), strPtn);                                
                                
                        } else if                                
                                (!resultDetail.get(dtlCnt).get("J_SOKAISHIYMD").equals(resultDetail.get(dtlCnt).get("XXAYMD")) ||                                
                                !resultDetail.get(dtlCnt).get("J_KAISHIHM").equals(resultDetail.get(dtlCnt).get("XXAKAISHIHM")) ||                                
                                !resultDetail.get(dtlCnt).get("J_ENDHM").equals(resultDetail.get(dtlCnt).get("XXAENDHM")) ||                                
                                !resultDetail.get(dtlCnt).get("J_USHIFLG").equals(resultDetail.get(dtlCnt).get("USHIFLG")) ||                                
                                resultDetail.get(dtlCnt).get("J_UPDKBN").equals("3")                                
                                )                                
                        {                                
                            strPtn = "4";                                
                            sMsgAppStr = new String[]{"★★MENループ" + dtlCnt + "番目:HOU本コード" + resultDetail.get(dtlCnt).get("SOHNCD") + "のエ)?処理パターン" + strPtn, "開始"};                                
                            HANLog.info(ResourceUtil.getMessage("BT0011I", sMsgAppStr));                                
                                
                            this.insUpdJITSUKKN(db, resultDetail.get(dtlCnt), strPtn);                                
                            AbiConfFlag = true;                                
                                
                        } else {                                
                            sMsgAppStr = new String[]{"★★MENループ" + dtlCnt + "番目:HOU本コード" + resultDetail.get(dtlCnt).get("SOHNCD") + "のエ)?処理", "開始"};                                
                            HANLog.info(ResourceUtil.getMessage("BT0011I", sMsgAppStr));                                
                                
                            if (!StringUtils.isBlankOrNull(resultDetail.get(dtlCnt).get("BHI_DGJI"))) {                                
                                String strJ = "";                                
                                if (Integer.parseInt(resultDetail.get(dtlCnt).get("BHI_DGJI")) >= 1) {                                
                                    strJ = "1";                                
                                } else {                                
                                    strJ = "0";                                
                                }                                
                                
                                if (strJ.equals(resultDetail.get(dtlCnt).get("JIUMUFLG"))) {                                
                                    strPtn = "6";                                
                                    sMsgAppStr = new String[]{"★★MENループ" + dtlCnt + "番目:HOU本コード" + resultDetail.get(dtlCnt).get("SOHNCD") + "のエ)?処理パターン" + strPtn, "開始"};                                
                                    HANLog.info(ResourceUtil.getMessage("BT0011I", sMsgAppStr));                                
                                
                                    this.insUpdJITSUKKN(db, resultDetail.get(dtlCnt), strPtn);                                
                                } else {                                
                                    strPtn = "4";                                
                                    sMsgAppStr = new String[]{"★★MENループ" + dtlCnt + "番目:HOU本コード" + resultDetail.get(dtlCnt).get("SOHNCD") + "のエ)?処理パターン" + strPtn, "開始"};                                
                                    HANLog.info(ResourceUtil.getMessage("BT0011I", sMsgAppStr));                                
                                
                                    this.insUpdJITSUKKN(db, resultDetail.get(dtlCnt), strPtn);                                
                                }                                
                            }                                
                                
                        }                                
                                
                    } else {                                
                        String strHoHNCd = resultDetail.get(dtlCnt).get("SOHNCD");                                
                        String strENCd = resultDetail.get(dtlCnt).get("H_HANGUCD");                                
                        String strHANCd = resultDetail.get(dtlCnt).get("U_HANGUCD");                                
                        sMsgAppStr = new String[]{strHoHNCd, strENCd,strHANCd};                                
                                
                        // 開始ログを出力                                
                        HANLog.error(ResourceUtil.getMessage("BT0012E"), sMsgAppStr,new Exception());                                
                    }                                
                                
                }//MENループ終了                                
                                
            }//GUMごとループ終了                                

評価

0

                                
            sql.setLength(0);                                
            sql.append("SELECT " + System.getProperty("line.separator"));                                
            sql.append("   U.HANGUCD " + System.getProperty("line.separator"));                                
            sql.append("  ,U.HNTSHOGIFLG " + System.getProperty("line.separator"));                                
            sql.append("  ,U.JUSTATUS " + System.getProperty("line.separator"));                                
            sql.append("  ,MIN(YJT2.JSKKBN) AS MIN_JSKKBN " + System.getProperty("line.separator"));                                
            sql.append("  ,MAX(YJT2.JSKKBN) AS MAX_JSKKBN " + System.getProperty("line.separator"));                                
            sql.append("FROM " + System.getProperty("line.separator"));                                
            sql.append("   KT_HAN U " + System.getProperty("line.separator"));                                
            sql.append("     INNER JOIN (SELECT * FROM KT_HANDTL UD WHERE UD.DELFLG = 0) UDTL " + System.getProperty("line.separator"));                                
            sql.append(  "     ON U.HANGUCD = UDTL.HANGUCD  " + System.getProperty("line.separator"));                                
            sql.append("     INNER JOIN KT_SOJITSU YJT  " + System.getProperty("line.separator"));                                
            sql.append("       ON UDTL.SOHNCD = YJT.SOHNCD " + System.getProperty("line.separator"));                                
            sql.append("     LEFT OUTER JOIN  " + System.getProperty("line.separator"));                                
            sql.append("        (SELECT * FROM KT_HANDTL UD WHERE UD.DELFLG = 0) UDTL2 " + System.getProperty("line.separator"));                                
            sql.append("       ON U.HANGUCD = UDTL2.HANGUCD  " + System.getProperty("line.separator"));                                
            sql.append("     LEFT OUTER JOIN KT_SOJITSU YJT2 " + System.getProperty("line.separator"));                                
            sql.append("       ON UDTL2.SOHNCD = YJT2.SOHNCD  " + System.getProperty("line.separator"));                                
            sql.append("WHERE  " + System.getProperty("line.separator"));                                
            sql.append("     ( GREATEST(YJT.UPDYMDHMS,UDTL.UPDYMDHMS) >= \'" + strShoriKaishiYmdhms  + "\')" + System.getProperty("line.separator"));                                
            sql.append("GROUP BY " + System.getProperty("line.separator"));                                
            sql.append("   U.HANGUCD " + System.getProperty("line.separator"));                                
            sql.append("   ,U.HNTSHOGIFLG " + System.getProperty("line.separator"));                                
            sql.append("   ,U.JUSTATUS " + System.getProperty("line.separator"));                                
            db.setSql(sql.toString());                                
            resultJuSts = db.selectMapList();                                
                                
            //HOUHOU状況更新ログを出力                                
            sMsgAppStr = new String[]{"★HOUHOU状況更新:最終処理実行開始日時" + strShoriKaishiYmdhms + "以上の対象データ 件数" + resultJuSts.size(), "取得"};                                
            HANLog.info(ResourceUtil.getMessage("BT0011I", sMsgAppStr));                                
                                
            for (int i5 = 0; i5 < resultJuSts.size(); i5++) {                                
                this.updMJun(db, resultJuSts.get(i5));                                
            }                                
                                
            //終了処理                                
            strTMmp = DateUtil.parseDate(DateUtil.getStrCurrentYmdHmmss(), "yyyyMMddHHmmss", "yyyy/MM/dd HH:mm:ss");                                
            sql.setLength(0);                                
            sql.append("UPDATE KT_BCHSKNR " + System.getProperty("line.separator"));                                
            sql.append("SET " + System.getProperty("line.separator"));                                
            sql.append("   SHORIKAISHIYMDHMS = \'" + strBatchStartTime + "\' " + System.getProperty("line.separator"));                                
            sql.append(" , SHORIENDYMDHMS = \'" + strTMmp + "\' " + System.getProperty("line.separator"));                                
            sql.append(" , UPDUSRID = \'" + ConstMs.INFOUPDATE_PGID + "\' " + System.getProperty("line.separator"));                                
            sql.append(" , UPDYMDHMS = \'" + strTMmp + "\' " + System.getProperty("line.separator"));                                
            sql.append("WHERE "+ System.getProperty("line.separator"));                                
            sql.append(" PRGID = \'" + ConstMs.INFOUPDATE_PGID + "\'" + System.getProperty("line.separator"));                                
            sql.append(" AND SYSTEMID = \'_\'" + System.getProperty("line.separator"));                                
            sql.append(" AND DELFLG = 0 ");                                
            db.setSql(sql.toString());                                
            db.execute();                                
                                
            //バッチ処理管理更新ログを出力                                
            sMsgAppStr = new String[]{"バッチ処理管理", "更新"};                                
            HANLog.info(ResourceUtil.getMessage("BT0011I", sMsgAppStr));                                
                                
            // トランザクション終了                                
            db.commit();                                
                                
            //正常終了ログを出力                                
            sMsgAppStr = new String[]{strTMmp, ConstMs.INFOUPDATE_PGNAME};                                
            HANLog.info(ResourceUtil.getMessage("CM0049I", sMsgAppStr));                                
                                
        } catch(Exception e) {                                
            //異常終了ログを出力                                
            strTMmp = DateUtil.parseDate(DateUtil.getStrCurrentYmdHmmss(), "yyyyMMddHHmmss", "yyyy/MM/dd HH:mm:ss");                                
            sMsgAppStr = new String[]{strTMmp, ConstMs.INFOUPDATE_PGNAME};                                
            HANLog.error(ResourceUtil.getMessage("CM0051E", sMsgAppStr), e);                                
            db.rollback();                                
            throw e;                                
        } finally {                                
            db.close();                                
        }                                
    }                                
                                

評価

0

    private void insUpdJITSUKKN(DbAccess db, Map<String, String> map,String strKbn) throws Exception {                                
        StringBuffer sql = new StringBuffer();                                
    try {                                
            String[] sMsgAppStr = new String[]{"★★★insUpdJITSUKKN HOU本コード:" + map.get("SOHNCD") + "区分:" + strKbn, "開始"};                                
            HANLog.info(ResourceUtil.getMessage("BT0011I", sMsgAppStr));                                
            String strKKNKBN = "";                                
            String strKKNStatus = "";                                
            String strBunrui = "";                                
            String strhkNaiyou = "";                                
                                
            sql.append(" SELECT SOHNCD ");                                
            sql.append(" FROM KT_JITSUKKN ");                                
            sql.append(" WHERE ");                                
            sql.append(" SOHNCD = " + map.get("SOHNCD"));                                
            db.setSql(sql.toString());                                
            List<Map<String, String>> resultTmp = db.selectMapList();                                
                                
            boolean insFlg = false;                                
            if (resultTmp == null ||  resultTmp.size() == 0) {                                
                insFlg = true;                                
                                
            }                                
                                
            switch (strKbn) {                                
            case "1":                                
                strKKNKBN = "00";                                
                strKKNStatus = "20";                                
                strBunrui = "10";                                
                break;                                
                                
            case "2":                                
                strKKNKBN = "10";                                
                strKKNStatus = "00";                                
                strBunrui = "10";                                
                strhkNaiyou = ResourceUtil.getMessage("BT0016I");                                
                break;                                
                                
            case "3":                                
                strKKNKBN = "20";                                
                strKKNStatus = "20";                                
                strBunrui = "10";                                
                break;                                
                                
            case "4":                                
                strKKNKBN = "50";                                
                strKKNStatus = "20";                                
                if (!map.get("J_USHIFLG").equals(map.get("USHIFLG"))) {                                
                    strBunrui = "40";                                
                } else if (map.get("J_UPDKBN").equals("3")) {                                
                    strBunrui = "30";                                
                } else {                                
                    strBunrui = "20";                                
                }                                
                break;                                
                                
            case "5":                                
                strKKNKBN = "30";                                
                strKKNStatus = "20";                                
                strBunrui = "10";                                
                break;                                
                                
            case "6":                                
                strKKNKBN = "40";                                
                strKKNStatus = "13";                                
                strBunrui = "10";                                
                break;                                
                                
            case "7":                                 
                break;                                
                                
            case "8":                                
            case "10":                                
                strKKNKBN = "91";                                
                strKKNStatus = "00";                                
                strBunrui = "10";                                
                if (insFlg) {                                
                    strhkNaiyou = ResourceUtil.getMessage("BT0013I");                                
                } else {                                
                    strhkNaiyou = ResourceUtil.getMessage("BT0014I");                                
                }                                
                break;                                
                                
            case "9":                                
                strKKNKBN = "91";                                
                strKKNStatus = "00";                                
                strBunrui = "10";                                
                if (insFlg) {                                
                    strhkNaiyou = ResourceUtil.getMessage("BT0013I");                                
                } else {                                
                    strhkNaiyou = ResourceUtil.getMessage("BT0015I");                                
                }                                
                break;                                
                                
            default:                                
                                
            }                                
                                
            String strTMmp = DateUtil.parseDate(DateUtil.getStrCurrentYmdHmmss(), "yyyyMMddHHmmss", "yyyy/MM/dd HH:mm:ss");                                
                                
            //Insert                                
            sql.setLength(0);                                
            if (insFlg) {                                
                sql.append(" INSERT INTO KT_JITSUKKN ( " + System.getProperty("line.separator"));                                
                sql.append("   SOHNCD " + System.getProperty("line.separator"));                                
                sql.append(" , KKNKBN " + System.getProperty("line.separator"));                                
                sql.append(" , JITSUJuNYMDHMS " + System.getProperty("line.separator"));                                
                sql.append(" , KKNSTATUS " + System.getProperty("line.separator"));                                
                sql.append(" , BUNRUI " + System.getProperty("line.separator"));                                
                sql.append(" , LASTKKNUSRID " + System.getProperty("line.separator"));                                
                sql.append(" , LASTKKNUYMDHMS " + System.getProperty("line.separator"));                                
                sql.append(" , hkUNAIYOU " + System.getProperty("line.separator"));                                
                sql.append(" , UPDUSRID" + System.getProperty("line.separator"));                                
                sql.append(" , UPDYMDHMS" + System.getProperty("line.separator"));                                
                sql.append(" , ENTUSRID" + System.getProperty("line.separator"));                                
                sql.append(" , ENTYMDHMS" + System.getProperty("line.separator"));                                
                sql.append(" ) " + System.getProperty("line.separator"));                                
                sql.append(" VALUES ( " + System.getProperty("line.separator"));                                
                sql.append("   " + map.get("SOHNCD") + " " + System.getProperty("line.separator"));                                
                sql.append(" , \'" + strKKNKBN + "\' ");                                
                sql.append(" , \'" + map.get("J_UPDYMDHMS") + "\' " + System.getProperty("line.separator"));                                
                sql.append(" , \'" + strKKNStatus + "\' " + System.getProperty("line.separator"));                                
                sql.append(" , \'" + strBunrui + "\' " + System.getProperty("line.separator"));                                
                sql.append(" , NULL " + System.getProperty("line.separator"));                                
                sql.append(" , NULL " + System.getProperty("line.separator"));                                
                if (StringUtils.isBlankOrNull(strhkNaiyou)) {                                
                    sql.append(" , NULL " + System.getProperty("line.separator"));                                
                } else {                                
                    sql.append(" , \'" + strhkNaiyou + "\' " + System.getProperty("line.separator"));                                
                }                                
                sql.append(" , \'" + ConstMs.INFOUPDATE_PGID + "\' " + System.getProperty("line.separator"));                                
                sql.append(" , \'" + strTMmp + "\' " + System.getProperty("line.separator"));                                
                sql.append(" , \'" + ConstMs.INFOUPDATE_PGID + "\' " + System.getProperty("line.separator"));                                
                sql.append(" , \'" + strTMmp + "\' " + System.getProperty("line.separator"));                                
                sql.append(" )");                                
                db.setSql(sql.toString());                                
                db.execute();                                
                                
            //Update                                
            } else {                                
                sql.append("UPDATE KT_JITSUKKN " + System.getProperty("line.separator"));                                
                sql.append("SET " + System.getProperty("line.separator"));                                
                sql.append("   KKNKBN = \'" + strKKNKBN + "\' " + System.getProperty("line.separator"));                                
                sql.append(" , JITSUJuNYMDHMS = \'" + map.get("J_UPDYMDHMS") + "\' " + System.getProperty("line.separator"));                                
                sql.append(" , KKNSTATUS = \'" + strKKNStatus + "\' " + System.getProperty("line.separator"));                                
                sql.append(" , BUNRUI = \'" + strBunrui + "\' " + System.getProperty("line.separator"));                                
                if (StringUtils.isBlankOrNull(strhkNaiyou)) {                                
                    sql.append(" , hkUNAIYOU = NULL " + System.getProperty("line.separator"));                                
                } else {                                
                    sql.append(" , hkUNAIYOU = \'" + strhkNaiyou  + "\' " + System.getProperty("line.separator"));                                
                }                                
                sql.append(" , UPDUSRID = \'" + ConstMs.INFOUPDATE_PGID + "\' " + System.getProperty("line.separator"));                                
                sql.append(" , UPDYMDHMS = \'" + strTMmp + "\' " + System.getProperty("line.separator"));                                
                sql.append("WHERE "+ System.getProperty("line.separator"));                                
                sql.append(" SOHNCD = " + map.get("SOHNCD"));                                
                db.setSql(sql.toString());                                
                db.execute();                                
            }                                
                                
        }catch(Exception ex){                                
            throw ex;                                
        }                                
    }                                
以下省略。                                
}                                
                                
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                

評価

0

こういう場所にソースを載せる場合、2つのことに注意するように。
・問題が再現されるミニマムなコード
・そのまま動作するコード
「何が悪いのか分からない」と言っても、関係なさそうな所から少しずつ削って都度実行するくらいはできよう。
その結果、行でもブロックでも、「これがないと再現しない、あると再現する」という箇所も付記しておくといい。

質問から6ヶ月以上経過しているので、回答を書き込むことはできません。