This is confusing for me - because I have successfully overwritten
coldfusion classes successfully with JavaLoader, but people seem to
have difficulty.

I did it when loading Hibernate, as it uses the new version of log4j,
and it worked perfectly.. the classLoader should look at the top level
class loader before it looks below it.

If you want to run JavaLoader without the connection to the default
ColdFusion classpath, you can init it this way:

jl = createObject("component", "JavaLoader").init(paths, JavaCast("null", ""));

This will mean it is its own seperate classpath outside of ColdFusion.

Hope that helps,

Mark

On 12/1/06, Andrea <[EMAIL PROTECTED]> wrote:
>
> Hi Mark, it's getting interesting ... I tried the classLoader, pretty
> cool. The only thing is that it looks like I cannot override classes
> which are already loaded, which was the actual purpose...
>
> By the way refactoring is really a lot of work (if done manually!!!)
> pretty quick if you use some editor like netbeans or similar... :)
>
> So how do you override a class ? do you set an empty init
> parentClassLoader and then  pass through only the classpath you need ?
>
>
> cheers,
> Andrea
>
> skateboard.com.au wrote:
> > Hi Mark
> >
> > Thought I'd take this offline as I didn't want my issues to take up too
> > much of the lists time.
> >
> > Maybe it is something I am doing but I could not get it to work.
> >
> > I load in the API.jar and the newer log4j.jar using your classloader
> > utility. The load in fine etc. I can see all their properties etc.
> >
> > The problem is that the API I load always goes to the coldfusionmx/lib
> > directory to invoke org.apache.log4j.Logger. Not the one I load with
> > your classloader.
> >
> > thanks anyway
> >
> > cheers
> >
> > Drew
> >
> >
> >
> >
> >
> > -----Original Message-----
> > From: "Mark Mandel" <[EMAIL PROTECTED]>
> > To: cfaussie@googlegroups.com
> > Date: Thu, 30 Nov 2006 10:26:05 +1100
> > Subject: [cfaussie] Re: java classpaths etc etc
> >
> > >
> > > The neat thing is - The CF classpath doesn't even see the new version
> > > of log4j - you've think of it as your own personal classpath that
> > > you've loaded externally.
> > >
> > > (Which is essentially what you've done)
> > >
> > > This external classpath can see down into the CF classpath, *but* the
> > > CF classpath below it can't see up.
> > >
> > > Does that make sense?
> > >
> > > Mark
> > >
> > > On 11/30/06, skateboard.com.au <[EMAIL PROTECTED]> wrote:
> > > >
> > > > Fair enough, I'll give it a shot. Would I need to reinitiate the
> > > older
> > > > version of log4j at the end of the process or does the CF server
> > > itself
> > > > ignore classes loaded at runtime?
> > > >
> > > >
> > > >
> > > >
> > > > -----Original Message-----
> > > > From: "Mark Mandel" <[EMAIL PROTECTED]>
> > > > To: cfaussie@googlegroups.com
> > > > Date: Thu, 30 Nov 2006 10:01:07 +1100
> > > > Subject: [cfaussie] Re: java classpaths etc etc
> > > >
> > > > >
> > > > > Why not -
> > > > >
> > > > > Have you newer version of log4j.jar sitting where you want it, and
> > > then
> > > > > go -
> > > > >
> > > > > paths = ArrayNew(1);
> > > > > paths[1] = expandPath("log4j.jar") //newest version
> > > > > paths[2] = expandPath("my3rdPartyAPI.jar") //your api
> > > > >
> > > > > jl = createObject("component", "JavaLoader").init(paths);
> > > > >
> > > > > myAPI = jl.create("my3rdPartyAPIClass");
> > > > > //this will load the newer log4j, as the class loading will look to
> > > > > the loader first.
> > > > >
> > > > > Does that make more sense?
> > > > >
> > > > > Mark
> > > > >
> > > > > On 11/30/06, skateboard.com.au <[EMAIL PROTECTED]> wrote:
> > > > > >
> > > > > > Hi Mark
> > > > > >
> > > > > > Thanks for you advice. I can't see how your approach will work in
> > > my
> > > > > > case though. I have to use a jar that uses a different version of
> > > > > log4j
> > > > > > that cf uses. I do not have access to modify the package name it
> > > > > calls.
> > > > > >
> > > > > > cheers
> > > > > >
> > > > > > Drew
> > > > > >
> > > > > >
> > > > > > -----Original Message-----
> > > > > > From: "Mark Mandel" <[EMAIL PROTECTED]>
> > > > > > To: cfaussie@googlegroups.com
> > > > > > Date: Thu, 30 Nov 2006 09:33:44 +1100
> > > > > > Subject: [cfaussie] Re: java classpaths etc etc
> > > > > >
> > > > > > >
> > > > > > > Andrea -
> > > > > > >
> > > > > > > That's alot of work! Wow!
> > > > > > >
> > > > > > > I'm guessing then that whatever he is also using with log4j
> > > he's
> > > > > going
> > > > > > > to have to refactor as well. Ouch!
> > > > > > >
> > > > > > > Using an external classloader is a much easier solution, I
> > > think
> > > > > > > you'll find. You may want to look into it.
> > > > > > >
> > > > > > > Mark
> > > > > > >
> > > > > > > On 11/30/06, Andrea <[EMAIL PROTECTED]> wrote:
> > > > > > > >
> > > > > > > > First of all I believe that if you are using a jar file,
> > > surely
> > > > > you
> > > > > > > > must have the source code....
> > > > > > > >
> > > > > > > > Can you get the source code of the log4j version you need
> > > (yes)?
> > > > > then
> > > > > > > > modify the structure (eg com.mycompany.log.log4j) refactor
> > > and
> > > > > > > > recompile, make a jar, upload and use that in your java files
> > > > > > > whenever
> > > > > > > > you call the log4j....
> > > > > > > >
> > > > > > > > that will work for sure... already done to override the pdf
> > > > > libraries
> > > > > > > > of CF7
> > > > > > > >
> > > > > > > > Ciao
> > > > > > > > Andrea
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > skateboard.com.au wrote:
> > > > > > > > > Hey Mark
> > > > > > > > >
> > > > > > > > > Thanks, I'll give that a read and see how I go.
> > > > > > > > >
> > > > > > > > > cheers
> > > > > > > > >
> > > > > > > > > Drew
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > -----Original Message-----
> > > > > > > > > From: "Mark Mandel" <[EMAIL PROTECTED]>
> > > > > > > > > To: cfaussie@googlegroups.com
> > > > > > > > > Date: Wed, 29 Nov 2006 16:12:10 +1100
> > > > > > > > > Subject: [cfaussie] Re: java classpaths etc etc
> > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > Drew,
> > > > > > > > > >
> > > > > > > > > > I'd load it all up with JavaLoader
> > > > > > > > > > http://www.compoundtheory.com/?action=javaloader.index
> > > > > > > > > >
> > > > > > > > > > with the latest log4j in it.
> > > > > > > > > >
> > > > > > > > > > I've done it with Hibernate, and it works a charm.
> > > > > > > > > >
> > > > > > > > > > You probably don't want to replace the log4j in CF with
> > > the
> > > > > > > newest
> > > > > > > > > > one, as I know it can cause all sorts of issues.
> > > > > > > > > >
> > > > > > > > > > This should hopefully solve your problem.
> > > > > > > > > >
> > > > > > > > > > Regards,
> > > > > > > > > >
> > > > > > > > > > Mark
> > > > > > > > > >
> > > > > > > > > > On 11/29/06, skateboard.com.au <[EMAIL PROTECTED]>
> > > wrote:
> > > > > > > > > > >
> > > > > > > > > > > Hi Guys
> > > > > > > > > > >
> > > > > > > > > > > I have a jar file that I am calling via cf. The package
> > > > > throws
> > > > > > > an
> > > > > > > > > > error
> > > > > > > > > > > because it requires a newer version of log4j than what
> > > CF
> > > > > uses.
> > > > > > > CF
> > > > > > > > > > won't
> > > > > > > > > > > run on the newer version. Is there some way I can
> > > define a
> > > > > > > classpath
> > > > > > > > > > > specific to the process I am trying to run rather than
> > > to
> > > > > the
> > > > > > > whole
> > > > > > > > > > CF
> > > > > > > > > > > instance? Or am I going about this all wrong??
> > > > > > > > > > >
> > > > > > > > > > > thanks in advance
> > > > > > > > > > >
> > > > > > > > > > > Drew Peacock
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > --
> > > > > > > > > > E: [EMAIL PROTECTED]
> > > > > > > > > > W: www.compoundtheory.com
> > > > > > > > > >
> > > > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > E: [EMAIL PROTECTED]
> > > > > > > W: www.compoundtheory.com
> > > > > > >
> > > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > E: [EMAIL PROTECTED]
> > > > > W: www.compoundtheory.com
> > > > >
> > > > > >
> > > >
> > > >
> > > >
> > > > >
> > > >
> > >
> > >
> > > --
> > > E: [EMAIL PROTECTED]
> > > W: www.compoundtheory.com
> > >
> > > >
>
>
> >
>


-- 
E: [EMAIL PROTECTED]
W: www.compoundtheory.com

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to