Skip,

Thanks for comment, definitively in my notes :o)

Jacques

De : "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> Jacques
>
> That is exactly what I did, I added a -soe (and soe.properties, etc) and my
> own container, almost identical to the XUIContainer.  However, this was a
> pure java app and when the GUI thread had control I could not call any Ofbiz
> services because of the class not found error.
>
> Didnt have a problem when called from the container thread, only when called
> by the GUI thread.
>
> Skip
>
> -----Original Message-----
> From: Jacques Le Roux [mailto:[EMAIL PROTECTED]
> Sent: Saturday, September 29, 2007 2:01 PM
> To: [email protected]
> Subject: Re: In case anyone is interested
>
>
> Thanks Skip
>
> Put in my notes, maybe useful later. Not sure there is not a better practice
> for that, though. Like using something similar than
> the -pos parameter in command line ?
>
> Jacques
>
> ----- Message d'origine -----
> De : "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> À : <[email protected]>
> Envoyé : samedi 29 septembre 2007 03:11
> Objet : In case anyone is interested
>
>
> > Yesterday, I sent out this email:
> >
> > Stumped on a complicated question:
> >
> > I am getting the following error:
> >
> > java.lang.ClassNotFoundException:
> > org.ofbiz.service.engine.StandardJavaEngine
> >
> > On this line 81 of
> > org.ofbiz.service.engine.GenericEngineFactory.getGenericEngine:
> >
> >   Class c = loader.loadClass(className);
> >
> >
> > I am running ofbiz as a standalone app, similiar to java ofbiz.jar -pos
> >
> >
> > I have solved the problem and the solution was fairly simple.  I was
> > prepared to do a reflection call to addURL on the ClassLoader, but the the
> > solution turned out to be even simpler than that.
> >
> > When Ofbiz instantiated my container, I simply grabbed the class loader it
> > used to start me up and then passed it to the Ofbiz connection layer like
> > this:
> >
> > ClassLoader loader = Thread.currentThread().getContextClassLoader();
> > if(loader instanceof URLClassLoader)
> > {
> > URLClassLoader urlLoader = (URLClassLoader)loader;
> > connection.setClassLoader (urlLoader);
> >
> > }
> >
> >
> > In the connection layer, I have this code:
> >
> > void resetClassLoader()
> > {
> > if(this.loader == null)
> > return;
> >
> > ClassLoader loader = Thread.currentThread().getContextClassLoader();
> > if(loader != this.loader)
> >         Thread.currentThread().setContextClassLoader(this.loader);
> >
> > }
> >
> > I then simply call resetClassLoader() every time before I call an Ofbiz
> > service.
> >
> > Works a charm.
> >
> > Skip
> >
>
>

Reply via email to