Search in sources :

Example 6 with SystemException

use of org.omg.CORBA.SystemException in project ACS by ACS-Community.

the class MaciSupervisor method connectToManager.

// ==================================================================
// Internal
// ==================================================================
// ============= Connecting / Disconnecting ===============
/**
	 * 
	 */
protected void connectToManager() throws CannotRetrieveManagerException, NoPermissionEx, SystemException {
    log.fine(connect + "connecting to manager");
    try {
        org.omg.CORBA.Object object = orb.string_to_object(managerLoc);
        managerRef = ManagerHelper.narrow(object);
    } catch (Exception exc) {
        log.fine(connect + "failed to connect to manager: " + exc);
        throw new CannotRetrieveManagerException("could not retrieve manager reference", exc);
    }
    if (managerRef == null) {
        log.fine(connect + "failed to connect to manager: got null manager reference");
        throw new CannotRetrieveManagerException("orb delivered null-reference for manager-location " + managerLoc);
    }
    // <-- may throw "port occupied"
    Administrator admin = acImpl.asCorbaObject(orb);
    administratorClientInfo = managerRef.login(admin);
    log.info(connect + "connected to manager (" + getManagerLocation() + ") as " + administratorClientInfo.h + " (= 0x" + Integer.toHexString(administratorClientInfo.h) + ")");
}
Also used : Administrator(si.ijs.maci.Administrator) SystemException(org.omg.CORBA.SystemException)

Example 7 with SystemException

use of org.omg.CORBA.SystemException in project ACS by ACS-Community.

the class LogLevelSelectorPanel method refreshAllLoggersPanel.

/**
	 * This method makes remote calls and should not be called in the event thread!
	 * @throws AcsJCORBAProblemEx In case of ORB / network failure or if remote process is unresponsive or unreachable.
	 */
private void refreshAllLoggersPanel() throws AcsJCORBAProblemEx {
    try {
        LogLevels defaultLevels = logConf.get_default_logLevels();
        int acsLevel = defaultLevels.minLogLevelLocal;
        try {
            LogTypeHelper logTypeLocal = LogTypeHelper.fromAcsCoreLevel(AcsLogLevelDefinition.fromInteger(acsLevel));
            allLocalCB.setSelectedIndex(logTypeLocal.ordinal());
            model.setCommonLocalLevel(logTypeLocal);
        } catch (AcsJIllegalArgumentEx e) {
            logger.warning("Unexpected log level " + acsLevel + " obtained as default minLogLevelLocal.");
        }
        acsLevel = defaultLevels.minLogLevel;
        try {
            LogTypeHelper logTypeGlobal = LogTypeHelper.fromAcsCoreLevel(AcsLogLevelDefinition.fromInteger(acsLevel));
            allGlobalCB.setSelectedIndex(logTypeGlobal.ordinal());
            model.setCommonGlobalLevel(logTypeGlobal);
        } catch (AcsJIllegalArgumentEx e) {
            logger.warning("Unexpected log level " + acsLevel + " obtained as default minLogLevel.");
        }
    } catch (SystemException ex) {
        AcsJCORBAProblemEx ex2 = new AcsJCORBAProblemEx(ex);
        ex2.setInfo("Failed to retrieve logger names or levels.");
        throw ex2;
    }
}
Also used : AcsJCORBAProblemEx(alma.ACSErrTypeCommon.wrappers.AcsJCORBAProblemEx) SystemException(org.omg.CORBA.SystemException) LogTypeHelper(com.cosylab.logging.engine.log.LogTypeHelper) AcsJIllegalArgumentEx(alma.ACSErrTypeCommon.wrappers.AcsJIllegalArgumentEx) LogLevels(alma.Logging.LoggingConfigurablePackage.LogLevels)

Example 8 with SystemException

use of org.omg.CORBA.SystemException in project wildfly by wildfly.

the class Util method presetOrb.

public static void presetOrb() throws InvalidName, SystemException {
    Properties properties = new Properties();
    properties.setProperty(ORBConstants.PERSISTENT_SERVER_PORT_PROPERTY, "15151");
    properties.setProperty(ORBConstants.ORB_SERVER_ID_PROPERTY, "1");
    new ContextPropagationManager();
    org.omg.CORBA.ORB sunOrb = org.omg.CORBA.ORB.init(new String[0], properties);
    orb = com.arjuna.orbportability.ORB.getInstance("ClientSide");
    orb.setOrb(sunOrb);
    OA oa = OA.getRootOA(orb);
    org.omg.PortableServer.POA rootPOA = org.omg.PortableServer.POAHelper.narrow(sunOrb.resolve_initial_references("RootPOA"));
    oa.setPOA(rootPOA);
    oa.initOA();
    ORBManager.setORB(orb);
    ORBManager.setPOA(oa);
    // Recovery manager has to be started on client when we want recovery
    // and we start the transaction on client
    recoveryManagerPool = Executors.newFixedThreadPool(1);
    recoveryManagerPool.submit(new Callable<String>() {

        @Override
        public String call() throws Exception {
            RecoveryManager.main(new String[] { "-test" });
            return "Running recovery manager";
        }
    });
}
Also used : OA(com.arjuna.orbportability.OA) Properties(java.util.Properties) ContextPropagationManager(com.arjuna.ats.internal.jts.context.ContextPropagationManager) SystemException(org.omg.CORBA.SystemException) NamingException(javax.naming.NamingException)

Example 9 with SystemException

use of org.omg.CORBA.SystemException in project wildfly by wildfly.

the class DynamicIIOPStub method invoke.

/**
     * Sends a request message to the server, receives the reply from the
     * server, and returns an <code>Object</code> result to the caller.
     */
public Object invoke(String operationName, final StubStrategy stubStrategy, Object[] params) throws Throwable {
    if (operationName.equals("_get_handle") && this instanceof javax.ejb.EJBObject) {
        if (handle == null) {
            handle = new HandleImplIIOP(this);
        }
        return handle;
    } else if (operationName.equals("_get_homeHandle") && this instanceof javax.ejb.EJBHome) {
        if (handle == null) {
            handle = new HomeHandleImplIIOP(this);
        }
        return handle;
    } else {
        //FIXME
        // all invocations are now made using remote invocation
        // local invocations between two different applications cause
        // ClassCastException between Stub and Interface
        // (two different modules are loading the classes)
        // problem was unnoticeable with JacORB because it uses
        // remote invocations to all stubs to which interceptors are
        // registered and a result all that JacORB always used
        // remote invocations
        // remote call path
        // To check whether this is a local stub or not we must call
        // org.omg.CORBA.portable.ObjectImpl._is_local(), and _not_
        // javax.rmi.CORBA.Util.isLocal(Stub s), which in Sun's JDK
        // always return false.
        InputStream in = null;
        try {
            try {
                OutputStream out = (OutputStream) _request(operationName, true);
                stubStrategy.writeParams(out, params);
                tracef("sent request: %s", operationName);
                in = (InputStream) _invoke(out);
                if (stubStrategy.isNonVoid()) {
                    trace("received reply");
                    final InputStream finalIn = in;
                    return doPrivileged(new PrivilegedAction<Object>() {

                        public Object run() {
                            return stubStrategy.readRetval(finalIn);
                        }
                    });
                } else {
                    return null;
                }
            } catch (final ApplicationException ex) {
                trace("got application exception");
                in = (InputStream) ex.getInputStream();
                final InputStream finalIn1 = in;
                throw doPrivileged(new PrivilegedAction<Exception>() {

                    public Exception run() {
                        return stubStrategy.readException(ex.getId(), finalIn1);
                    }
                });
            } catch (RemarshalException ex) {
                trace("got remarshal exception");
                return invoke(operationName, stubStrategy, params);
            }
        } catch (SystemException ex) {
            if (EjbLogger.EJB3_INVOCATION_LOGGER.isTraceEnabled()) {
                EjbLogger.EJB3_INVOCATION_LOGGER.trace("CORBA system exception in IIOP stub", ex);
            }
            throw Util.mapSystemException(ex);
        } finally {
            _releaseReply(in);
        }
    }
}
Also used : InputStream(org.omg.CORBA_2_3.portable.InputStream) OutputStream(org.omg.CORBA_2_3.portable.OutputStream) RemarshalException(org.omg.CORBA.portable.RemarshalException) ApplicationException(org.omg.CORBA.portable.ApplicationException) SystemException(org.omg.CORBA.SystemException) RemarshalException(org.omg.CORBA.portable.RemarshalException) ApplicationException(org.omg.CORBA.portable.ApplicationException) SystemException(org.omg.CORBA.SystemException) HandleImplIIOP(org.jboss.ejb.iiop.HandleImplIIOP) HomeHandleImplIIOP(org.jboss.ejb.iiop.HomeHandleImplIIOP) PrivilegedAction(java.security.PrivilegedAction) HomeHandleImplIIOP(org.jboss.ejb.iiop.HomeHandleImplIIOP)

Example 10 with SystemException

use of org.omg.CORBA.SystemException in project ACS by ACS-Community.

the class LogLevelSelectorPanel method loggersLbl.

/**
	 * Gets the loggers and their levels.
	 * <p>
	 * This method makes remote calls and should not be called in the event thread! 
	 * 
	 * @return
	 * @throws AcsJCORBAProblemEx In case of ORB / network failure or if remote process is unresponsive or unreachable.
	 */
private LogLevelHelper[] loggersLbl() throws AcsJCORBAProblemEx {
    List<LogLevelHelper> ret = new ArrayList<LogLevelHelper>();
    try {
        // get the logger names
        final String[] logNames = logConf.get_logger_names();
        // get the log levels for each logger
        for (String logName : logNames) {
            try {
                LogLevels logLevels = logConf.get_logLevels(logName);
                ret.add(new LogLevelHelper(logName, logLevels));
            } catch (LoggerDoesNotExistEx ex) {
                logger.warning("Failed to retrieve log levels info for logger '" + logName + "'. Will skip this logger.");
            }
        }
        return ret.toArray(new LogLevelHelper[0]);
    } catch (SystemException ex) {
        AcsJCORBAProblemEx ex2 = new AcsJCORBAProblemEx(ex);
        ex2.setInfo("Failed to retrieve logger names or levels.");
        throw ex2;
    }
}
Also used : AcsJCORBAProblemEx(alma.ACSErrTypeCommon.wrappers.AcsJCORBAProblemEx) SystemException(org.omg.CORBA.SystemException) ArrayList(java.util.ArrayList) LoggerDoesNotExistEx(alma.Logging.LoggerDoesNotExistEx) LogLevels(alma.Logging.LoggingConfigurablePackage.LogLevels)

Aggregations

SystemException (org.omg.CORBA.SystemException)15 ApplicationException (org.omg.CORBA.portable.ApplicationException)8 InputStream (org.omg.CORBA.portable.InputStream)8 OutputStream (org.omg.CORBA.portable.OutputStream)8 RemarshalException (org.omg.CORBA.portable.RemarshalException)8 UnexpectedException (java.rmi.UnexpectedException)7 ServantObject (org.omg.CORBA.portable.ServantObject)7 LogLevels (alma.Logging.LoggingConfigurablePackage.LogLevels)3 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)3 AcsJCORBAProblemEx (alma.ACSErrTypeCommon.wrappers.AcsJCORBAProblemEx)2 LogTypeHelper (com.cosylab.logging.engine.log.LogTypeHelper)2 InetAddress (java.net.InetAddress)2 HashMap (java.util.HashMap)2 ReentrantLock (java.util.concurrent.locks.ReentrantLock)2 NoSuchCharacteristic (alma.ACS.NoSuchCharacteristic)1 AcsJIllegalArgumentEx (alma.ACSErrTypeCommon.wrappers.AcsJIllegalArgumentEx)1 LoggerDoesNotExistEx (alma.Logging.LoggerDoesNotExistEx)1 LogLvlSelNotSupportedException (alma.acs.gui.loglevel.LogLvlSelNotSupportedException)1 CDBFieldDoesNotExistEx (alma.cdbErrType.CDBFieldDoesNotExistEx)1 WrongCDBDataTypeEx (alma.cdbErrType.WrongCDBDataTypeEx)1