I wonder if someone on the list has an idea as to what to try in this situation.
I used to in resin 2.x use the "class loader hack" config, not sure now why. I 
now have potentially a class loader issue loading native code, but ... no hints 
I get from logs.
The code bellow I am using, works great in Resin nightly on windoze in the 
container. It works great on Linux (Fedora 7) in Java outside of resin servlet.
But it fails to ... parse when inside the resin container, it just returns 
blank and no traces or logs.
One time it said: 
        UnsatisfiedLinkError: Native Library already loaded in another 
classloader

But no errors anymore show up. In any case I moved needed loading jars to 
resin/lib and .so files are in LD_PATH and CLASSPATH. 

I wonder what I should try to debug? Anyone?
Even if there's a link on the resin 3.x classloader "hack" if any, or .. a link 
to educate me more on native java integration or on how to hook up remote resin 
to debug,jconsole,jmx or to slap me for a something silly.

There is some google on resin's class loader and on the error I got above once 
but not more. Again works on Windoze and on linux outside of the container....

Stumped,

.V
ps: here is the class, basically a System.Load.

boolean isParsing = false;
        static boolean isInitialized = false;
        DomDocumentBuilder domBuilder = new DomDocumentBuilder();
        private static String MInitializedJvmProperty = "MParser.Initialized";

        /**
         * initialize the XPCOM embedded components with the proper
         * components base directory
         * 
         * @param componentBase
        
         */
        private synchronized static native void initXPCOM(String componentBase) 
throws ParserInitializationException;

        /**
         * Native function. parse an html function using m parser and
         * make callbacks to the java local sink ( DomDocumentBuilder for that
         * matter)
         * 
         * @param html
         *            HTML to parse.
         * @throws ParserInitializationException
         */
        public native void parseHtml(String html)       throws 
ParserInitializationException;

        /**
         * 
         * A callback is being made from native code to this function.
         * 
         * @param domOperation
         * @param domArgument
         */
        public synchronized void callback(String domOperation, String 
domArgument) 
        {
                // System.out.println("called back with :"+domOperation +" " + 
domArgument );
                domBuilder.addInstruction(domOperation, domArgument);
        }

        public Document parse(String html) throws DocumentException
        {
                
                this.domBuilder.reset();
                try
                {
                        this.parseHtml(html);
                }
                catch (Throwable e)
                {
                        System.err.println("Warning: could not parse html :" + 
e.getMessage());
                        throw new DocumentException(e);
                }
                return this.domBuilder.buildDocument();
        }

        public void dump() {
                this.domBuilder.dump();
        }

        /**
         * Initialize the parser with a DLL to load and 
         * component base
         * 
         * @param dllToLoad
         * @param componentsBase
         * @throws ParserInitializationException
         */
        public static void init(String parserLibrary, String componentsBase)    
{
                String initialized = System.getProperty(MnitializedJvmProperty);
                System.out.println("loaded  " + initialized );
                if (initialized == null) 
                {
                        System.setProperty(MInitializedJvmProperty, "true");
                }
                else 
                {
                        System.err.println("Warning : Parser detected an 
additional attempt to initialize XPCOM. operation ignored.");
                        return;
                }
                try
                {
                        //ClassLoader sysCl = 
ClassLoader.getSystemClassLoader();
                        
                        System.load(parserLibrary);
                        initXPCOM(componentsBase);
                        System.out.println("loaded");
                }
                catch (Exception e)
                {
                        e.printStackTrace();
                        System.err.println("Warning:Could not load library 
"+parserLibrary);
                        
                }
                
        }

        /**
         * @return
         */
        public Vector<String> getDomBuilderArguments() {
                return this.domBuilder.getInstructions();

        }

}





      
____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs


_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest

Reply via email to