10 Replies Latest reply on Apr 24, 2007 6:11 AM by 524919

    opmnctl causes problems

    524919
      I am not sure if this is the right forum - but maybe someone can point me into the rigth direction.

      Since installing APEX 3.0 and APACHE I do have problems to run other (java) processes which had no problems for over a year.

      Trying to run a java program I get the following error:
      start crs2ic: Do Apr 19 13:35:00 CEST 2007
      java.sql.SQLException: E/A-Exception: The Network Adapter could not establish the connection
      at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
      at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
      at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:333)
      at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:404)
      at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:468)
      at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)
      at java.sql.DriverManager.getConnection(DriverManager.java:512)
      at java.sql.DriverManager.getConnection(DriverManager.java:193)
      at at.cati.infocenter.db.DBConnection.Init(DBConnection.java:47)
      at at.sis.cati.crs2ic.crs2ic.<init>(crs2ic.java:38)
      at at.sis.cati.crs2ic.crs2ic.main(crs2ic.java:476)
      end crs2ic: Do Apr 19 13:35:04 CEST 2007

      After shuting down Apache with opmnctl shutdown I can start the java process without any problems.

      - what can cause this situation
      - where to go for more help

      regards
      friedrich
        • 1. Re: opmnctl causes problems
          524919
          And it also lets BEA Weblogic fail during start
          • 2. Re: opmnctl causes problems
            437966
            Hi,

            This is a long shot, but are Apache and BEA Weblogic webservers trying to use the same port, like port 80?

            If so, one has to change. The Apache port is set in the httpd.conf file.

            HTH,

            Jim
            • 3. Re: opmnctl causes problems
              524919
              No Apache uses 7779
              and BEA uses 7301

              and it does not explain the java program from being executed.

              rgds, friedrich
              • 4. Re: opmnctl causes problems
                495211
                friedrich,

                What does your java app do? can you provide the source code?

                Since Apache is a Web server and APEX has a HTTP listener itself, chances are that there could be a port conflict issue there. Once one of the conflicting daemons is down, the conflict is resolved automatically in favor of the remaining one.

                RB
                • 5. Re: opmnctl causes problems
                  524919
                  Yes I can send the source - but the program is splitt up into many classes

                  What it does - it tries to open jdbc connections into our ORACLE DBs

                  So will send the main class and the one opening the database connections

                  the property parameteres used are:
                  #
                  # Create Environment-Variables f. crs2ic-scripts
                  #
                  export CRS2IC_HOME=/home/crs2ic
                  export CRS2IC_JDBC_DRIVER=oracle.jdbc.driver.OracleDriver
                  export CRS2IC_JDBC_CONNECTION_CRS2IC=jdbc:oracle:thin:crs2ic/crs2ic@127.0.0.1:1521:OKVDWH
                  export CRS2IC_JDBC_CONNECTION_ICL=jdbc:oracle:thin:icload/icload@127.0.0.1:1521:OKVDB8
                  export CRS2IC_JDBC_CONNECTION_IC=jdbc:oracle:thin:infocenter/infocenter@127.0.0.1:1521:OKVDWH
                  export CRS2IC_MAIL_OPERATOR=friedrich.harasleben@coface.at
                  export JWSDP_PATH=/home/crs2ic/jwsdp-1.5
                  export JAVA_HOME=/usr/java/j2sdk1.4.2_06
                  export NLS_LANG=american_america.UTF8



                  package at.cati.infocenter.db;

                  import java.sql.CallableStatement;
                  import java.sql.Connection;
                  import java.sql.DriverManager;
                  import java.sql.PreparedStatement;
                  import java.sql.SQLException;
                  import java.sql.Statement;

                  /**
                  * This class provides a comfortable (wrapping) interface for JDBC-Connection
                  * @author Helmut
                  *
                  */
                  public class DBConnection
                  {
                  private static final int STATE_NEW = 0;
                  private static final int STATE_INIT = 1;
                  private int state;

                  private Connection mDbConn;

                  public DBConnection()
                  {
                  state = STATE_NEW;
                  }

                  /**
                  * This method initilized the connection.
                  * This must be done before any other operations.
                  *
                  * @param pConnectionProp Name of the system-property that holds the JDBC connection-string
                  * @throws Exception
                  */
                  public void Init(String pConnectionProp) throws Exception
                  {
                  String jdbcDriver = System.getProperty("jdbc.driver");
                  String jdbcConnection = System.getProperty(pConnectionProp);

                  if(jdbcDriver == null)
                  throw new Exception("jdbc.driver not defined!");

                  if(jdbcConnection == null)
                  throw new Exception("jdbc.connection "+pConnectionProp+" not defined!");

                  Class.forName(jdbcDriver);
                  mDbConn = DriverManager.getConnection(jdbcConnection);

                  if(mDbConn.getMetaData().supportsTransactionIsolationLevel(Connection.TRANSACTION_SERIALIZABLE) )
                  mDbConn.setAutoCommit(false);

                  state = STATE_INIT;

                  }

                  /**
                  * This method closes a previously opended (init) connection
                  * @throws Exception
                  */
                  public void Close() throws Exception
                  {
                  if(state != STATE_INIT)
                  throw new Exception("Close called on uninitialized Connection");

                  mDbConn.close();
                  }

                  /**
                  * This method commits the outstanding transaction
                  * @throws Exception
                  */
                  public void Commit() throws Exception
                  {
                  if(state != STATE_INIT)
                  throw new Exception("Commit called on uninitialized Connection");

                  if(mDbConn.getMetaData().supportsTransactionIsolationLevel(Connection.TRANSACTION_SERIALIZABLE) )
                  mDbConn.commit();
                  }

                  /**
                  * This method is a wrapper for JDBC
                  * @param sql
                  * @return
                  * @throws Exception
                  */
                  public PreparedStatement prepareStatement(String sql) throws Exception
                  {
                  if(state != STATE_INIT)
                  throw new Exception("prepareStatement called on uninitialized Connection");

                  return(mDbConn.prepareStatement(sql));
                  }

                  /**
                  * This method is a wrapper for JDBC
                  * @param pStrStmt
                  * @return
                  * @throws Exception
                  */
                  public CallableStatement prepareCall(String pStrStmt) throws Exception
                  {
                  CallableStatement stmt;

                  if(state != STATE_INIT)
                  throw new Exception("prepareCall called on uninitialized Connection");

                  stmt = mDbConn.prepareCall(pStrStmt);
                  return(stmt);
                  }

                  /**
                  * This method rolls back the outstanding transaction
                  * @throws SQLException
                  */
                  public void rollback() throws SQLException
                  {
                  mDbConn.rollback();
                  }

                  /**
                  * This method is a wrapper for JDBC
                  * @return
                  * @throws Exception
                  */
                  public Statement createStatement() throws Exception
                  {
                  Statement stmt;

                  if(state != STATE_INIT)
                  throw new Exception("createStatement called on uninitialized Connection");

                  stmt = mDbConn.createStatement();
                  return(stmt);
                  }
                  }


                  and this is the main class (snipped part of the program)

                  package at.sis.cati.crs2ic;

                  import java.io.File;
                  import java.sql.PreparedStatement;
                  import java.util.Arrays;

                  import at.cati.infocenter.db.DBConnection;
                  import at.cati.infocenter.db.CtlParameter;
                  import at.cati.infocenter.ConcurrentType;
                  import at.cati.infocenter.Protocol;

                  //
                  // scheduled transfer of all CRS Data (Common Risc System) to IC (InfoCenter)
                  //
                  public class crs2ic
                  {
                  private DBConnection mDbConnProtCrs2Ic; // Protocol for "outer loop"
                  private DBConnection mDbConnCrs2Ic; // prc_crs2load_entity AND Loading of §§
                  private DBConnection mDbConnProtCrsPar; // Protocol for Load §-File
                  private DBConnection mDbConnLoadIc; // ic_load.load_infocenter
                  private DBConnection mDbConnSt2Ic; // prc_st2ic
                  private Protocol mProt;
                  private String mXmlWorkDirectory;
                  private String mXmlArchDirectory;
                  private String mParagraphPropertyFile;

                  private boolean mDoBu = false;
                  private boolean mDoPa = false;
                  private boolean mDoRe = false;
                  private boolean mDoBux = false;
                  private boolean mDoPax = false;
                  private boolean mDoEnt = false;
                  private boolean mDoPat = false;

                  public crs2ic() throws Exception
                  {
                  mDbConnProtCrs2Ic = new DBConnection();
                  mDbConnProtCrs2Ic.Init("jdbc.connection.icl");

                  mDbConnCrs2Ic = new DBConnection();
                  mDbConnCrs2Ic.Init("jdbc.connection.crs2ic");

                  mDbConnProtCrsPar = new DBConnection();
                  mDbConnProtCrsPar.Init("jdbc.connection.icl");

                  mDbConnLoadIc = new DBConnection();
                  mDbConnLoadIc.Init("jdbc.connection.icl");

                  mDbConnSt2Ic = new DBConnection();
                  mDbConnSt2Ic.Init("jdbc.connection.ic");

                  }

                  public void Run() throws Exception
                  {
                  String protState = new String("OK");

                  mProt = new Protocol(mDbConnProtCrs2Ic, "CRS2IC");

                  try
                  {

                  mProt.ChkRecentCrs2IcErrors();
                  CtlParameter ctlPar = new CtlParameter(mDbConnProtCrs2Ic);
                  String buStageDirectory = ctlPar.getBuStageDirectory();
                  String paStageDirectory = ctlPar.getPaStageDirectory();
                  String reStageDirectory = ctlPar.getReStageDirectory();
                  mXmlWorkDirectory = ctlPar.getCrs2IcXmlWorkDir();
                  mXmlArchDirectory = ctlPar.getCrs2IcXmlArchDir();
                  mParagraphPropertyFile = ctlPar.getParagraphPropertyFile();
                  workBuDir(buStageDirectory);
                  workPaDir(paStageDirectory);
                  workReDir(reStageDirectory);
                  workXmlDir();
                  startEntityTransfer(protState);
                  if(protState.equals("ERR") )
                  {
                  mProt.Write("skipping §-Transfer, because of error in buyer-transfer");
                  }
                  else
                  {
                  startSt2Ic(protState);
                  mProt.Write("successfully completed");
                  }

                  }
                  catch(Exception e)
                  {
                  protState = "ERR"; < ====== this is the place it fails
                  mProt.Write("Error crs2ic.Run");
                  mProt.Write(e.toString()+": "+e.getMessage());
                  for(int i=0; i<e.getStackTrace().length;i++)
                  {
                  mProt.Write(e.getStackTrace().toString());
                  }
                  }

                  mProt.Close(protState);

                  mDbConnSt2Ic.Commit();
                  mDbConnSt2Ic.Close();

                  mDbConnLoadIc.Commit();
                  mDbConnLoadIc.Close();

                  mDbConnProtCrsPar.Commit();
                  mDbConnProtCrsPar.Close();

                  mDbConnCrs2Ic.Commit();
                  mDbConnCrs2Ic.Close();

                  mDbConnProtCrs2Ic.Commit();
                  mDbConnProtCrs2Ic.Close();
                  }

                  .
                  .
                  snipped
                  .
                  .

                  public static void main(String[] args)
                  {
                  /*
                  * arguments:
                  * [-bu] -- Buyer-Ascii
                  * [-pa] -- Paragraph-Ascii
                  * [-re] -- Reference
                  * [-bux] -- Buyer-XML
                  * [-pax] -- Paragraph-XML
                  * [-ent] -- Entity-Transfer
                  * [-pat] -- Paragraph-Transfer
                  */

                  try
                  {
                  crs2ic crs2ic = new crs2ic();
                  if(args.length == 0)
                  {
                  // do all steps
                  crs2ic.mDoBu = true;
                  crs2ic.mDoPa = true;
                  crs2ic.mDoRe = true;
                  crs2ic.mDoBux = true;
                  crs2ic.mDoPax = true;
                  crs2ic.mDoEnt = true;
                  crs2ic.mDoPat = true;
                  }
                  else
                  {
                  for(int i = 0; i < args.length; i++)
                  {
                  if("-bu".equals(args[i]))
                  crs2ic.mDoBu = true;
                  else if("-pa".equals(args[i]))
                  crs2ic.mDoPa = true;
                  else if("-re".equals(args[i]))
                  crs2ic.mDoRe = true;
                  else if("-bux".equals(args[i]))
                  crs2ic.mDoBux = true;
                  else if("-pax".equals(args[i]))
                  crs2ic.mDoPax = true;
                  else if("-ent".equals(args[i]))
                  crs2ic.mDoEnt = true;
                  else if("-pat".equals(args[i]))
                  crs2ic.mDoPat = true;
                  else
                  {
                  System.out.println(" arguments:");
                  System.out.println(" [-bu] -- Buyer-Ascii");
                  System.out.println(" [-pa] -- Paragraph-Ascii");
                  System.out.println(" [-re] -- Reference");
                  System.out.println(" [-bux] -- Buyer-XML");
                  System.out.println(" [-pax] -- Paragraph-XML");
                  System.out.println(" [-ent] -- Entity-Transfer");
                  System.out.println(" [-pat] -- Paragraph-Transfer");
                  throw new Exception("unknown argument ()");
                  }
                  }
                  }
                  crs2ic.Run();
                  }
                  catch(Exception e)
                  {
                  e.printStackTrace();
                  System.exit(1);
                  }

                  }

                  }
                  • 6. Re: opmnctl causes problems
                    Chris Slattery
                    is the database on the same machine as the app server ?
                    • 7. Re: opmnctl causes problems
                      524919
                      Yes weblogic server and database are on the same database - but my java program does not use the weblogic server - it connects thru JDBC directly

                      friedrich
                      • 8. Re: opmnctl causes problems
                        524919
                        And we also found óut if running omn produces a lot of outputs like

                        tcp 0 0 fidelio:54295 fidelio:6100 TIME_WAIT
                        tcp 0 0 fidelio:54294 fidelio:6100 TIME_WAIT
                        tcp 0 0 fidelio:54293 fidelio:6100 TIME_WAIT
                        tcp 0 0 fidelio:54292 fidelio:6100 TIME_WAIT
                        • 9. Re: opmnctl causes problems
                          495211
                          friedrich,
                          <p>
                          your code loks fair, as far as i can see. Class Protocol is missing and I'm afraid it's important to understand the problem completely.
                          <p>
                          TIP: take a look at these directions to format your code properly.
                          <p>
                          RB
                          • 10. Re: opmnctl causes problems
                            524919
                            RB

                            Took a look at your recommended side - hopefully I did I correct this time - sorry.

                            I added the protocol class - could you have a look at it.

                            regards
                            friedrich

                            package at.cati.infocenter;

                            import java.sql.CallableStatement;
                            import java.sql.PreparedStatement;
                            import java.sql.ResultSet;
                            import java.sql.Types;
                            import at.cati.infocenter.db.DBConnection;

                            /**
                            * This class provides all services concerning protocol-handling.
                            * It uses the related procedures in the database package PAC_COMMON (Schema ICLOAD):
                            * - prc_new_ldprot
                            * - prc_write_ldprot
                            * - prc_close_ldprot
                            * - prc_chk_concurrent
                            * - fun_chk_recent_crs2ic_errors
                            *
                            * @author Helmut Handl
                            *
                            */
                            public class Protocol
                            {
                              private DBConnection mDbConn;
                              public Protocol(DBConnection pDbConn, String pIfType) throws Exception
                              {
                                mDbConn = pDbConn;
                                NewLdProt(pIfType);
                              }
                             
                              /**
                               * This methods checks, if there are any other interfaces active.
                               * It is using icload.pac_common_prc_chk_concurrent.
                               * @param pType the active interfaces are outputed in pType
                               * @throws Exception
                               */
                              public void ChkConcurrent(ConcurrentType pType) throws Exception
                              {
                                CallableStatement stmt;
                                String            strStmt = "{ call PAC_COMMON.PRC_CHK_CONCURRENT(?,?,?,?,?,?,?,?,?,?) }";

                                stmt = mDbConn.prepareCall(strStmt);
                               
                                stmt.registerOutParameter(1, Types.INTEGER);
                                stmt.registerOutParameter(2, Types.INTEGER);
                                stmt.registerOutParameter(3, Types.INTEGER);
                                stmt.registerOutParameter(4, Types.INTEGER);
                                stmt.registerOutParameter(5, Types.INTEGER);
                                stmt.registerOutParameter(6, Types.INTEGER);
                                stmt.registerOutParameter(7, Types.INTEGER);
                                stmt.registerOutParameter(8, Types.INTEGER);
                                stmt.registerOutParameter(9, Types.INTEGER);
                                stmt.registerOutParameter(10, Types.INTEGER);
                               
                                    stmt.executeQuery();
                                                     
                                pType.setAkcIcl(stmt.getInt(1));
                                pType.setIclRewe(stmt.getInt(2));
                                pType.setIclIc(stmt.getInt(3));
                                pType.setS004(stmt.getInt(4));
                                pType.setS007(stmt.getInt(5));
                                pType.setS050(stmt.getInt(6));
                                pType.setCrs2Ic(stmt.getInt(7));
                                pType.setCrsBuy(stmt.getInt(8));
                                pType.setCrsPar(stmt.getInt(9));
                                pType.setParIc(stmt.getInt(10));
                               
                                stmt.close();
                               
                              }
                             
                              /**
                               * The Method "Mail" is not yet implemented
                               *
                               */
                              public void Mail()
                              {
                                //
                              }
                             
                              /**
                               * This method opens a new protocl
                               * @param pIfType name of the Interface
                               * @throws Exception
                               */
                              private void NewLdProt(String pIfType) throws Exception
                              {
                               
                                CallableStatement stmt;
                                String            strStmt = "{ call PAC_COMMON.PRC_NEW_LDPROT('" + pIfType +"') }";

                                stmt = mDbConn.prepareCall(strStmt);
                                stmt.execute();
                                mDbConn.Commit();
                                 
                              }
                             
                              /**
                               * This method closes an open protocol
                               * @param pState State (OK, ERR) of the interface
                               * @throws Exception
                               */
                              public void Close(String pState) throws Exception
                              {
                               
                                CallableStatement stmt;
                                String            strStmt = "{ call PAC_COMMON.PRC_CLOSE_LDPROT(?) }";

                                stmt = mDbConn.prepareCall(strStmt);
                                stmt.setString(1, pState);

                                stmt.execute();
                                stmt.close();
                                mDbConn.Commit();
                                 
                              }
                             
                              /**
                               * This method writes a message-line to the protocol
                               * @param pMsg message to be written
                               * @throws Exception
                               */
                              public void Write(String pMsg) throws Exception
                              {
                               
                                CallableStatement stmt;
                                String            strStmt = "{ call PAC_COMMON.PRC_WRITE_LDPROT(?) }";

                                stmt = mDbConn.prepareCall(strStmt);
                                stmt.setString(1, pMsg);

                                stmt.execute();
                                stmt.close();
                                mDbConn.Commit();
                                 
                              }
                             
                              /**
                               * This method checks, if the last interface with type "ICL_IC" had an error.
                               * If so, it throws an exception.
                               * @throws Exception if last interface "ICL_IC" had errors
                               */
                              public void ChkIclIcOK() throws Exception
                              {
                                ResultSet rs;
                                PreparedStatement stmt;
                                String state;
                                stmt = mDbConn.prepareStatement("SELECT STATE FROM LOAD_PROTOCOL WHERE IF_TYPE='ICL_IC' ORDER BY ID DESC");
                                rs = stmt.executeQuery();
                                if(rs.next() )
                                {
                                  state = rs.getString("STATE");
                                  if(state.equals("ERR")) {
                                    stmt.close();
                                    throw new Exception("Last ICL_IC had errors");
                                  }
                                }
                                stmt.close();
                              }

                              /**
                               * This method checks, if there are unreviewed protocols concerning
                               * CRS->IC with errors.
                               * @throws Exception if errors were found
                               */
                              public void ChkRecentCrs2IcErrors() throws Exception
                              {
                                CallableStatement stmt;
                                // Oracle-JDBC does not support BOOLEAN -> wrap it to number
                            //    String            strStmt = "{ ?= call PAC_COMMON.FUN_CHK_RECENT_CRS2IC_ERRORS }";
                                String            strStmt;

                                strStmt  = "declare ";
                                strStmt += "  vnu_ret number; ";
                                strStmt += "begin ";
                                strStmt += "  if not PAC_COMMON.FUN_CHK_RECENT_CRS2IC_ERRORS then ";
                                strStmt += "    vnu_ret := 0; ";
                                strStmt += "  else ";
                                strStmt += "    vnu_ret := 1; ";
                                strStmt += "  end if; ";
                                strStmt += "  ? := vnu_ret; ";
                                strStmt += "end; ";
                                stmt = mDbConn.prepareCall(strStmt);
                                stmt.registerOutParameter(1, Types.INTEGER);
                                stmt.execute();
                                int state = stmt.getInt(1);
                            /*    ResultSet rs = stmt.getResultSet();
                                boolean state = rs.getBoolean(1);
                            */
                                if(state == 0)
                                {
                                    stmt.close();
                                    throw new Exception("Recent Errors in CRS2IC-Interfaces found");
                                }

                                stmt.close();
                              }

                              /**
                               * This method checks, if there are unreviewed protocols concerning
                               * IC->CDE with errors.
                               * @throws Exception if errors were found
                               */
                              public void ChkRecentIc2CdeErrors() throws Exception
                              {
                                PreparedStatement stmt;
                                String            strStmt;
                                ResultSet rs;
                                int cnt = 0;

                                strStmt  = "select count(*) from load_protocol " +
                                             "where state = 'ERR'     and if_type = 'IC2CDE'";
                                stmt = mDbConn.prepareStatement(strStmt);
                                rs = stmt.executeQuery();
                                if(rs.next()) {
                                     cnt = rs.getInt(1);
                                }
                                if(cnt > 0) {
                                    stmt.close();
                                    throw new Exception("Recent Errors in IC2CDE-Interfaces found");
                                }

                                stmt.close();
                              }

                              /**
                               * this operation returns the ID of the curren LOAD_PROTODOL
                               * @return ID
                               * @throws Exception
                               */
                              public Long getLdprotId() throws Exception {
                                     CallableStatement stmt;
                                     String            strStmt;

                                     strStmt = "{ ?= call PAC_COMMON.FUN_GET_LDPROT_ID }";
                                     stmt = mDbConn.prepareCall(strStmt);
                                     stmt.registerOutParameter(1, Types.BIGINT);
                                     stmt.execute();
                                     long id = stmt.getLong(1);
                                     stmt.close();
                                     return(new Long(id));
                              }

                            }