Package org.apache.tomee.catalina

Examples of org.apache.tomee.catalina.TomEERuntimeException


                if (portValue instanceof Integer) {
                    port = (Integer) portValue;
                } else if (portValue instanceof String) {
                    port = Integer.parseInt((String) portValue);
                } else {
                    throw new TomEERuntimeException("port value should be an integer or a string");
                }
                if (port <= 0) {
                    port = NetworkUtil.getNextAvailablePort();
                }
                configuration.setHttpPort(port);
            }
            System.setProperty(TOMEE_EJBCONTAINER_HTTP_PORT, Integer.toString(configuration.getHttpPort()));
            tomEEContainer.container.setup(configuration);
            try {
                tomEEContainer.container.start();

                if (modules instanceof File) {
                    tomEEContainer.container.deploy(appId, ((File) modules), true);
                } else if (modules instanceof String) {
                    tomEEContainer.container.deploy(appId, new File((String) modules), true);
                } else if (modules instanceof String[]) {
                    for (String path : (String[]) modules) {
                        tomEEContainer.container.deploy(appId, new File(path), true);
                    }
                } else if (modules instanceof File[]) {
                    for (File file : (File[]) modules) {
                        tomEEContainer.container.deploy(appId, file, true);
                    }
                } else {
                    try {
                        tomEEContainer.close();
                    } catch (Exception e) {
                        // no-op
                    }
                    tomEEContainer = null;
                    throw Exceptions.newNoModulesFoundException();
                }

                return tomEEContainer;
            } catch (OpenEJBException e) {
                throw new EJBException(e);
            } catch (MalformedURLException e) {
                throw new EJBException(e);
            } catch (ValidationException ve) {
                throw ve;
            } catch (Exception e) {
                if (e instanceof EJBException) {
                    throw (EJBException) e;
                }
                throw new TomEERuntimeException("initialization exception", e);
            } finally {
                if (tomEEContainer == null) {
                    try {
                        tomEEContainer.close();
                    } catch (Exception e) {
View Full Code Here


            final String dir = configuration.getDir();
            if (dir != null) return dir;
            final File file = File.createTempFile("apache-tomee", "-home");
            return file.getAbsolutePath();
        } catch (IOException e) {
            throw new TomEERuntimeException(e);
        }
    }
View Full Code Here

        if (WEBSERVICE_OLDCONTEXT_ACTIVE) {
            try {
                context.destroy();
                context.stop();
            } catch (Exception e) {
                throw new TomEERuntimeException(e);
            }
            Host host = (Host) context.getParent();
            host.removeChild(context);
        } // else let tomcat manages its context
    }
View Full Code Here

        Context context = contexts.remove(path);
        try {
            context.stop();
            context.destroy();
        } catch (Exception e) {
            throw new TomEERuntimeException(e);
        }
        Host host = (Host) context.getParent();
        host.removeChild(context);

        return listeners.remove(completePath);
View Full Code Here

    webappBuilder = (TomcatWebAppBuilder) SystemInstance.get().getComponent(WebAppBuilder.class);
    mBeanServer = Registry.getRegistry(null, null).getMBeanServer();
  }

  public String getUniqueFile() {
    throw new TomEERuntimeException("This method is not used");
  }
View Full Code Here

        if ((WEBSERVICE_OLDCONTEXT_ACTIVE || (refs != null && refs == 0)) && context != null) {
            try {
                context.stop();
                context.destroy();
            } catch (final Exception e) {
                throw new TomEERuntimeException(e);
            }
            final Host host = (Host) context.getParent();
            host.removeChild(context);
        } // else let tomcat manages its context
    }
View Full Code Here

    mBeanServer = Registry.getRegistry(null, null).getMBeanServer();
  }

  @Override
    public String getUniqueFile() {
    throw new TomEERuntimeException("This method is not used");
  }
View Full Code Here

            }

            return file.getAbsolutePath();

        } catch (final IOException e) {
            throw new TomEERuntimeException("Failed to get or create base dir: " + file, e);
        }
    }
View Full Code Here

            Logger.getInstance(LogCategory.OPENEJB, EmbeddedTomEEContainer.class).error(ex.getMessage(), ex);
        }
        tomEEContainer = null;

        if (!errors.isEmpty()) {
            throw Exceptions.newEJBException(new TomEERuntimeException(errors.toString()));
        }
    }
View Full Code Here

                if (portValue instanceof Integer) {
                    port = (Integer) portValue;
                } else if (portValue instanceof String) {
                    port = Integer.parseInt((String) portValue);
                } else {
                    throw new TomEERuntimeException("port value should be an integer or a string");
                }
                if (port <= 0) {
                    port = NetworkUtil.getNextAvailablePort();
                }
                configuration.setHttpPort(port);
            }
            System.setProperty(TOMEE_EJBCONTAINER_HTTP_PORT, Integer.toString(configuration.getHttpPort()));
            tomEEContainer.container.setup(configuration);
            try {
                tomEEContainer.container.start();

                if (modules instanceof File) {
                    tomEEContainer.deployedIds.add(tomEEContainer.container.deploy(appId, ((File) modules), appId != null).getId());
                } else if (modules instanceof String) {
                    tomEEContainer.deployedIds.add(tomEEContainer.container.deploy(appId, new File((String) modules), appId != null).getId());
                } else if (modules instanceof String[]) {
                    for (final String path : (String[]) modules) {
                        tomEEContainer.deployedIds.add(tomEEContainer.container.deploy(appId, new File(path), appId != null).getId());
                    }
                } else if (modules instanceof File[]) {
                    for (final File file : (File[]) modules) {
                        tomEEContainer.deployedIds.add(tomEEContainer.container.deploy(appId, file, appId != null).getId());
                    }
                } else {
                    SystemInstance.get().getProperties().putAll(properties);
                    final Collection<File> files = tomEEContainer.container.getConfigurationFactory().getModulesFromClassPath(null, Thread.currentThread().getContextClassLoader());
                    if (files.size() == 0) {
                        try {
                            tomEEContainer.close();
                        } catch (final Exception e) {
                            // no-op
                        }
                        tomEEContainer = null;
                        throw Exceptions.newNoModulesFoundException();
                    }
                    for (final File file : files) {
                        tomEEContainer.deployedIds.add(tomEEContainer.container.deploy(appId, file, appId != null).getId());
                    }
                }

                return tomEEContainer;
            } catch (final OpenEJBException e) {
                tomEEContainer.close();
                throw new EJBException(e);
            } catch (final MalformedURLException e) {
                tomEEContainer.close();
                throw new EJBException(e);
            } catch (final ValidationException ve) {
                if (tomEEContainer != null) {
                    tomEEContainer.close();
                }
                throw ve;
            } catch (final Exception e) {
                if (tomEEContainer != null) {
                    tomEEContainer.close();
                }
                if (e instanceof EJBException) {
                    throw (EJBException) e;
                }
                throw new TomEERuntimeException("initialization exception", e);
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.tomee.catalina.TomEERuntimeException

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.