Package org.mc4j.ems.connection

Examples of org.mc4j.ems.connection.EmsException


            }

            InputStream is = ClassLoaderFactory.class.getClassLoader().getResourceAsStream(archiveResource);

            if (is == null) {
                throw new EmsException("Unable to find resource to store [" + archiveResource + "]");
            }

            // String tmpPath = System.getProperty("java.io.tmpdir");

            File tmpFile = copyFileToTemp(archiveResource, is, tempDir);

            jarCache.put(archiveResource, tmpFile);

            return tmpFile.toURI().toURL();

        } catch (FileNotFoundException e) {
            throw new EmsException("Unable to store jar [" + archiveResource + "] to temp dir [" + tempDir + "].", e);
        } catch (IOException e) {
            throw new EmsException("Unable to store jar [" + archiveResource + "] to temp dir [" + tempDir + "].", e);
        }
    }
View Full Code Here


        try {
            ByteArrayOutputStream os = new ByteArrayOutputStream();
            XMLEncoder e = new XMLEncoder(new BufferedOutputStream(os));
            e.setExceptionListener(new ExceptionListener() {
                public void exceptionThrown(Exception e) {
                    throw new EmsException("Could not encode connection settings",e);
                }
            });
            e.setPersistenceDelegate(File.class,new PersistenceDelegate() {
                protected Expression instantiate(Object oldInstance, Encoder out) {
                    File f = (File) oldInstance;
View Full Code Here

            Class clazz = Class.forName("org.mc4j.ems.impl.jmx.connection.support.providers.LocalVMProvider",false,cl);
            Method m = clazz.getMethod("getManageableVirtualMachines",(Class[])null);
            Object o = m.invoke(null, new Object[0]);
            return (Map<Integer, LocalVirtualMachine>) o;
        } catch (Exception e) {
           throw new EmsException("Unable to run LocalVMFinder",e);
        }
    }
View Full Code Here

            }

            InputStream is = ClassLoaderFactory.class.getClassLoader().getResourceAsStream(archiveResource);

            if (is == null) {
                throw new EmsException("Unable to find resource to store [" + archiveResource + "]");
            }

            // String tmpPath = System.getProperty("java.io.tmpdir");

            File tmpFile = copyFileToTemp(archiveResource, is, tempDir);

            jarCache.put(archiveResource, tmpFile);

            return tmpFile.toURI().toURL();

        } catch (FileNotFoundException e) {
            throw new EmsException("Unable to store jar [" + archiveResource + "] to temp dir [" + tempDir + "].", e);
        } catch (IOException e) {
            throw new EmsException("Unable to store jar [" + archiveResource + "] to temp dir [" + tempDir + "].", e);
        }
    }
View Full Code Here

            if (historyClass != null) {
                try {
                    this.valueHistory = (ValueHistory) Class.forName(historyClass).newInstance();

                } catch (InstantiationException e) {
                    throw new EmsException("Could not instantiate value history class",e);
                } catch (IllegalAccessException e) {
                    throw new EmsException("Could not access value history class",e);
                } catch (ClassNotFoundException e) {
                    throw new EmsException("Configured ValueHistory class not found",e);
                }
            } else {
                this.valueHistory = new CompleteValueHistory(Integer.valueOf(getControlProperty(CONTROL_ATTRIBUTE_HISTORY_DEPTH,"1")));
            }
        }
View Full Code Here

            newValue = server.getAttribute(bean.getObjectName(), getName());

        } catch (ReflectionException e) {
            supportedType = false;
            registerFailure(e);
            throw new EmsException("Could not load attribute value " + e.toString(),e);
        } catch (InstanceNotFoundException e) {
            registerFailure(e);
            throw new EmsException("Could not load attribute value, bean instance not found " + bean.getObjectName().toString(),e);
        } catch (MBeanException e) {
            registerFailure(e);
            Throwable t = e.getTargetException();
            if (t != null)
                throw new EmsException("Could not load attribute value, target bean threw exception " + t.getLocalizedMessage(),t);
            else
                throw new EmsException("Could not load attribute value " + e.getLocalizedMessage(), e);
        } catch (AttributeNotFoundException e) {
            registerFailure(e);
            throw new EmsException("Could not load attribute value, attribute [" + getName() + "] not found",e);
        } catch(UndeclaredThrowableException e) {
            if (e.getUndeclaredThrowable() instanceof InvocationTargetException) {
                Throwable t = e.getCause();
                if (t.getCause() instanceof NotSerializableException) {
                    supportedType = false;
                    registerFailure(t.getCause());
                    throw new EmsException("Could not load attribute value " + t.getLocalizedMessage(),t.getCause());
                } else
                    throw new EmsException("Could not load attribute value " + t.getLocalizedMessage(),t);
            }
            throw new EmsException("Could not load attribute value " + e.getLocalizedMessage(),e);
        } catch (RuntimeException re) {
            supportedType = false;

            // TODO GH: Figure this one out
            // Getting weblogic.management.NoAccessRuntimeException on wl9
            registerFailure(re);
            throw new EmsException("Could not load attribute value " + re.getLocalizedMessage(),re);
        } catch (NoClassDefFoundError ncdfe) {
            supportedType = false;
            registerFailure(ncdfe);
            throw new EmsException("Could not load attribute value " + ncdfe.getLocalizedMessage(),ncdfe);
        } catch (Throwable t) {
            throw new EmsException("Could not load attribute value " + t.getLocalizedMessage(),t);
        }
        alterValue(newValue);
        return newValue;
    }
View Full Code Here

            }

            InputStream is = ClassLoaderFactory.class.getClassLoader().getResourceAsStream(archiveResource);

            if (is == null) {
                throw new EmsException("Unable to find resource to store [" + archiveResource + "]");
            }

            // String tmpPath = System.getProperty("java.io.tmpdir");

            File tmpFile = copyFileToTemp(archiveResource, is, tempDir);

            jarCache.put(archiveResource, tmpFile);

            return tmpFile.toURI().toURL();

        } catch (FileNotFoundException e) {
            throw new EmsException("Unable to make temporary file store", e);
        } catch (IOException e) {
            throw new EmsException("Unable to make temporary file store", e);
        }
    }
View Full Code Here

            Object managementHome = PortableRemoteObject.narrow(objref, managementHomeClass);
            Method m = managementHomeClass.getMethod("create",new Class[] {});
            Object managementEjb = m.invoke(managementHome);
            return managementEjb;
        } catch (NamingException ne) {
            throw new EmsException("",ne);
        }catch (Exception ce) {
            throw new EmsException("",ce);
        }
    }
View Full Code Here

        try {
            on = new ObjectName(objectName);

            connectionProvider.getMBeanServer().createMBean(className, on);
        } catch (Exception e) {
            throw new EmsException("Could not create MBean", e);
        }
    }
View Full Code Here

        try {
            on = new ObjectName(objectName);

            connectionProvider.getMBeanServer().unregisterMBean(on);
        } catch (Exception e) {
            throw new EmsException("Could not remove MBean", e);
        }
    }
View Full Code Here

TOP

Related Classes of org.mc4j.ems.connection.EmsException

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.