Package com.sun.messaging.jmq.jmsserver.util

Examples of com.sun.messaging.jmq.jmsserver.util.BrokerException


                Map props)
          throws BrokerException
     {
         if (!FAULT_INJECTION) return;
         if (checkFault(value, props)) {
             BrokerException ex = new BrokerException("Fault Insertion: "
                   + value);
             throw ex;
         }   
     }
View Full Code Here


                } else {
             url = new JMXServiceURL(protocol, null, port, urlpath);
                }
      }
  } catch (MalformedURLException mfe)  {
      throw new BrokerException(rb.getString(rb.W_JMX_CREATE_URL_FOR_CONNECTOR_FAILED,
          name), mfe);
  }

  configuredURL = url;
    }
View Full Code Here

  if (connectorServer != null)  {
      return;
  }

  if (mbs == null)  {
      throw new BrokerException(rb.getString(rb.X_JMX_CANT_CREATE_CONNECTOR_SVR, name));
  }

        useSSL = config.getBooleanProperty(CONNECTOR_PROPBASE
          +  name
          + SSL_SUFFIX, false);

  /*
   * Query property that specifies if the broker is to be trusted.
   * If this property is not set, by default the broker is *not*
   * trusted.
   */
        brokerHostTrusted = config.getBooleanProperty(CONNECTOR_PROPBASE
          +  name
          + BROKER_HOST_TRUSTED_SUFFIX, false);

  backlog = config.getIntProperty(CONNECTOR_PROPBASE
          +  name
          + BACKLOG_SUFFIX, 0);

  try  {
      /*
       * We only support the RMI protocol in MQ 4.0
       */
      if (configuredURL.getProtocol().equals("rmi"))  {
    boolean useAuth = true;
    if (useAuth)  {
        env.put(JMXConnectorServer.AUTHENTICATOR, new MQJMXAuthenticator(this));
    }

    /*
     * Use MQ specific server socket factory only if:
     *  - SSL is enabled
     *  - need to specify a specific host/IP on a multihome system
     */
          if ((useSSL) ||
         (jmxHostname != null && !jmxHostname.equals(Globals.HOSTNAME_ALL))) {
                    MQRMIServerSocketFactory ssf
        = new MQRMIServerSocketFactory(jmxHostname, backlog, useSSL);
                    env.put(RMIConnectorServer.RMI_SERVER_SOCKET_FACTORY_ATTRIBUTE,
          ssf);
    }

    /*
     * Use MQ specific client socket factory only if:
     *  - need to specify a specific host/IP on a multihome system
     */
          if (jmxHostname != null && !jmxHostname.equals(Globals.HOSTNAME_ALL)) {
                    MQRMIClientSocketFactory csf
        = new MQRMIClientSocketFactory(jmxHostname,
            brokerHostTrusted, useSSL);
                    env.put(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE,
          csf);
    } else  {
        /*
         * Use MQ specific client socket factory only if:
         * - SSL is enabled and brokerHostTrusted is true
         * If brokerHostTrusted is false, use the JDK provided
         * javax.rmi.ssl.SslRMIClientSocketFactory
         */
        if (useSSL)  {
      if (brokerHostTrusted)  {
                            MQRMIClientSocketFactory csf
        = new MQRMIClientSocketFactory(jmxHostname,
            brokerHostTrusted, useSSL);
                            env.put(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE,
          csf);
      } else  {
                            env.put(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE,
          new javax.rmi.ssl.SslRMIClientSocketFactory());
      }
        }
    }
      }

            cs = JMXConnectorServerFactory.newJMXConnectorServer(configuredURL, env, mbs);
  } catch (Exception e)  {
      throw new BrokerException(rb.getString(rb.W_JMX_ERROR_CREATING_CONNECTOR,
          name), e);
  }

  cs.addNotificationListener(listener, null, this);

View Full Code Here

    public void syncChangeRecordOnJoin(BrokerAddress broker,  ChangeRecordInfo cri)
        throws BrokerException {

        if (!getProtocolInitComplete()) {
            throw new BrokerException(Globals.getBrokerResources().getKString(
                  BrokerResources.X_CLUSTER_PROTOCOL_NOT_READY),
                  Status.UNAVAILABLE);
        }

        realProtocol.syncChangeRecordOnJoin(broker, cri);
View Full Code Here

         return ProtocolGlobals.getCurrentVersion();
    }

    public int getClusterVersion() throws BrokerException {
        if (!getProtocolInitComplete()) {
            throw new BrokerException(Globals.getBrokerResources().getKString(
                BrokerResources.X_CLUSTER_PROTOCOL_NOT_READY), Status.UNAVAILABLE);
        }
        try {
            if (c.getConfigServer() != null && configServerVersion != null) {
                return configServerVersion.intValue();
View Full Code Here

            ClusterBrokerInfoReply cbi = ClusterBrokerInfoReply.newInstance(
                            getBrokerInfo(), ProtocolGlobals.G_BROKER_INFO_OK);
            return cbi;
        }
        if (!getProtocolInitComplete()) {
            throw new BrokerException(Globals.getBrokerResources().getKString(
                  BrokerResources.X_CLUSTER_PROTOCOL_NOT_READY),
                  Status.UNAVAILABLE);
        }

        return realProtocol.getBrokerInfoReply(remote);
View Full Code Here

  public void changeMasterBroker(BrokerMQAddress newmaster,
                                   BrokerMQAddress oldmaster)
                                   throws BrokerException {
        if (!getProtocolInitComplete()) {
            throw new BrokerException(Globals.getBrokerResources().getKString(
                BrokerResources.X_CLUSTER_PROTOCOL_NOT_READY), Status.UNAVAILABLE);
        }

        realProtocol.changeMasterBroker(newmaster, oldmaster);
    }
View Full Code Here

  if (LOG_TYPE.equals(type)) {
      classname = DEFAULT_LOG_CLASS;
  } else if (BSM_TYPE.equals(type)) {
      classname = DEFAULT_BSM_CLASS;
  } else {
      throw new BrokerException(
      "UNEXPECTED AUDIT TYPE SPECIFIED: " + type);
  }

  String prop = AUDIT_PROP_PREFIX + type + CLASS_PROP_SUBFIX;
  classname = Globals.getConfig().getProperty(prop, classname);

  MQAuditSession asession = null;
  Exception exception = null;
  try {
      asession = (MQAuditSession)Class.forName(classname).newInstance();
        } catch (ClassNotFoundException e) {
      exception = e;
        } catch (InstantiationException e) {
      exception = e;
        } catch (IllegalAccessException e) {
      exception = e;
  } finally {
      if (exception != null) {
    if (exception instanceof BrokerException) {
        throw (BrokerException)exception;
    } else {
        throw new BrokerException(
      br.getString(br.X_FAILED_TO_GET_AUDIT_SESSION,
        classname), exception);
    }
      }
  }
View Full Code Here

  } finally {
      if (exception != null) {
    if (exception instanceof BrokerException) {
        throw (BrokerException)exception;
    } else {
        throw new BrokerException(
      br.getString(br.X_FAILED_TO_GET_AUDIT_SESSION,
        MQ_AUDIT_CLASS), exception);
    }
      }
  }
View Full Code Here

                    defaultHandler.sendError(con, ex, msg);
                }
            }
        } catch (Exception ex) {
ex.printStackTrace(); //LKS-XXX
                defaultHandler.sendError(con, new BrokerException(
                    Globals.getBrokerResources().getKString(
                    BrokerResources.X_INTERNAL_EXCEPTION,
                    "Unexpected Error processing message"), ex), msg);
        }
    }
View Full Code Here

TOP

Related Classes of com.sun.messaging.jmq.jmsserver.util.BrokerException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.