diff --git a/dbPort/src/org/compiere/db/CConnection.java b/dbPort/src/org/compiere/db/CConnection.java index 1c584e394c..cc03c60949 100644 --- a/dbPort/src/org/compiere/db/CConnection.java +++ b/dbPort/src/org/compiere/db/CConnection.java @@ -150,13 +150,16 @@ public class CConnection implements Serializable } } // CConnection + /** Default jboss port **/ + private final static int DEFAULT_APP_SERVER_PORT = 1099; + /** Name of Connection */ private String m_name = "Standard"; /** Application Host */ private String m_apps_host = "MyAppsServer"; /** Application Port */ - private int m_apps_port = 1099; + private int m_apps_port = DEFAULT_APP_SERVER_PORT; /** Database Type */ private String m_type = ""; @@ -548,10 +551,17 @@ public class CConnection implements Serializable { log.config(m_connectionProfile + " -> " + connectionProfile); m_connectionProfile = connectionProfile; + if (PROFILE_WAN.equals(m_connectionProfile)) + setAppsPort(80); + else + setAppsPort(DEFAULT_APP_SERVER_PORT); Ini.setProperty(Ini.P_CONNECTION, toStringLong()); } else m_connectionProfile = connectionProfile; + + //reset initial context to null + m_iContext = null; } else log.warning("Invalid: " + connectionProfile); @@ -1542,7 +1552,7 @@ public class CConnection implements Serializable } catch (CommunicationException ce) // not a "real" error { - // m_appsException = ce; + m_appsException = ce; String connect = (String)m_env.get(Context.PROVIDER_URL); log.warning (connect + "\n - " + ce.toString () diff --git a/dbPort/src/org/compiere/util/CLogErrorBuffer.java b/dbPort/src/org/compiere/util/CLogErrorBuffer.java index 8ed0969d90..b1315373a4 100644 --- a/dbPort/src/org/compiere/util/CLogErrorBuffer.java +++ b/dbPort/src/org/compiere/util/CLogErrorBuffer.java @@ -20,6 +20,8 @@ import java.sql.*; import java.util.*; import java.util.logging.*; +import javax.swing.JOptionPane; + import org.compiere.model.*; /** @@ -188,7 +190,7 @@ public class CLogErrorBuffer extends Handler String loggerName = record.getLoggerName(); // class name String className = record.getSourceClassName(); // physical class String methodName = record.getSourceMethodName(); // - if (DB.isConnected() + if (DB.isConnected(false) && !methodName.equals("saveError") && !methodName.equals("get_Value") && !methodName.equals("dataSave") @@ -200,6 +202,25 @@ public class CLogErrorBuffer extends Handler MIssue.create(record); m_issueError = true; } + else + { + //display to user if database connection not available + if (!methodName.equals("saveError") + && !methodName.equals("get_Value") + && !methodName.equals("dataSave") + && loggerName.indexOf("Issue") == -1 + && loggerName.indexOf("CConnection") == -1) + { + if(Ini.isClient()) + { + JOptionPane.showMessageDialog(null, getFormatter().format(record), "Error", JOptionPane.ERROR_MESSAGE); + } + else + { + System.err.println(getFormatter().format(record)); + } + } + } } } } // publish