hi im putting it here because i cant add tickets, get spam error

Hi it seems the debug launcher of eclipse doesnt get the red5.xml properly, every time i try to load it, the red5.xml config is not found properly even though it is actually bound in /bin/. The problem is the fp.isFile() seems to this its trying to load the file from the argument of main, this seemed to work for me


public static void main(String[] args) throws Exception, Throwable {

        if (false) {
            allocator = new DebugPooledByteBufferAllocator(true);
            ByteBuffer.setAllocator(allocator);
        }

        if (args.length == 1) {
            red5Config = args[0];
        }

        long time = System.currentTimeMillis();

        log.info("RED5 Server (http://www.osflash.org/red5)");
        log.info("Loading red5 global context from: " + red5Config);

        // Detect root of Red5 configuration and set as system property
        String root;
        Boolean isClassFile = false;
        String classpath = System.getProperty("java.class.path");
        File fp = new File(red5Config);
        fp = fp.getCanonicalFile();
        if (!fp.isFile()) {
            // Given file does not exist, search it on the classpath
            String[] paths = classpath.split(System
                    .getProperty("path.separator"));
            for (String element : paths) {
                fp = new File(element + "/" + red5Config);
                fp = fp.getCanonicalFile();
                if (fp.isFile()) {
                    isClassFile = true;
                    break;
                }
            }
        }
       
        if (!fp.isFile() || !isClassFile) {
            throw new Exception("could not find configuration file "
                    + red5Config + " on your classpath " + classpath);
        }
       
        root = fp.getAbsolutePath();
        root = root.replace('\\', '/');
        int idx = root.lastIndexOf('/');
        root = root.substring(0, idx);
        System.setProperty("red5.config_root", root);
        log.info("Setting configuation root to " + root);

        // Setup system properties so they can be evaluated by Jetty
        Properties props = new Properties();
        props.load(new FileInputStream(root + "/red5.properties"));
        Iterator it = props.keySet().iterator();
        while (it.hasNext()) {
            String key = (String) it.next();
            if (key != null && !key.equals("")) {
                System.setProperty(key, props.getProperty(key));
            }
        }

        // Store root directory of Red5
        idx = root.lastIndexOf('/');
        root = root.substring(0, idx);
        if (System.getProperty("file.separator").equals("/")) {
            // Workaround for linux systems
            root = "/" + root;
        }
        System.setProperty("red5.root", root);
        log.info("Setting Red5 root to " + root);

        try {
            ContextSingletonBeanFactoryLocator.getInstance(red5Config)
                    .useBeanFactory("red5.common");
        } catch (Exception e) {
            // Don't raise wrapped exceptions as their stacktraces may confuse
            // people...
            raiseOriginalException(e);
        }

        long startupIn = System.currentTimeMillis() - time;
        log.info("Startup done in: " + startupIn + " ms");

    }

}
_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org

Reply via email to