I am working with the YUICompressor Java library, and noticed some odd behavior. Placing the yuicompressor-2.4.2.jar into the CF classpath and using createObject() throws the following error:
An exception occurred when instantiating a Java object. The class must not be an interface or an abstract class. Error: ''.
The same code, using javaloader to create() an object of the same class runs successfully on CF 8 and CF 9. Running it on Railo 3 produces the same error as the CF classpath.
The class in question is the ErrorReporter. The error is thrown on the init of the JavaScriptCompressor, the reporter is created successfully prior to that. (Even though it is just an interface, and no init method is specified)
On Fri, Mar 5, 2010 at 9:57 AM, TomdeMan <tom.demanin...@gmail.com> wrote: > I am working with the YUICompressor Java library, and noticed some odd > behavior. Placing the yuicompressor-2.4.2.jar into the CF classpath > and using createObject() throws the following error:
> An exception occurred when instantiating a Java object. The class must > not be an interface or an abstract class. Error: ''.
> The same code, using javaloader to create() an object of the same > class runs successfully on CF 8 and CF 9. > Running it on Railo 3 produces the same error as the CF classpath.
> The class in question is the ErrorReporter. The error is thrown on the > init of the JavaScriptCompressor, the reporter is created successfully > prior to that. (Even though it is just an interface, and no init > method is specified)
> Being lazy - where can I find the JavaDoc for YUICompressor?
> Mark
> On Fri, Mar 5, 2010 at 9:57 AM, TomdeMan <tom.demanin...@gmail.com> wrote: > > I am working with the YUICompressor Java library, and noticed some odd > > behavior. Placing the yuicompressor-2.4.2.jar into the CF classpath > > and using createObject() throws the following error:
> > An exception occurred when instantiating a Java object. The class must > > not be an interface or an abstract class. Error: ''.
> > The same code, using javaloader to create() an object of the same > > class runs successfully on CF 8 and CF 9. > > Running it on Railo 3 produces the same error as the CF classpath.
> > The class in question is the ErrorReporter. The error is thrown on the > > init of the JavaScriptCompressor, the reporter is created successfully > > prior to that. (Even though it is just an interface, and no init > > method is specified)
On Thu, Mar 4, 2010 at 6:10 PM, TomdeMan <tom.demanin...@gmail.com> wrote: > I never found them online, I went off the src files that were included > with the jar in the download package.
> On Mar 5, 12:00 am, Mark Mandel <mark.man...@gmail.com> wrote: >> Being lazy - where can I find the JavaDoc for YUICompressor?
>> Mark
>> On Fri, Mar 5, 2010 at 9:57 AM, TomdeMan <tom.demanin...@gmail.com> wrote: >> > I am working with the YUICompressor Java library, and noticed some odd >> > behavior. Placing the yuicompressor-2.4.2.jar into the CF classpath >> > and using createObject() throws the following error:
>> > An exception occurred when instantiating a Java object. The class must >> > not be an interface or an abstract class. Error: ''.
>> > The same code, using javaloader to create() an object of the same >> > class runs successfully on CF 8 and CF 9. >> > Running it on Railo 3 produces the same error as the CF classpath.
>> > The class in question is the ErrorReporter. The error is thrown on the >> > init of the JavaScriptCompressor, the reporter is created successfully >> > prior to that. (Even though it is just an interface, and no init >> > method is specified)
Thanks for that Matt - but I'm looking for the JavaDoc documentation.
Tom - first thing I would do is generate the JavaDoc documentation, so you can browse how the library is implemented. Browsing source for this is tough.
Secondly, if ErrorReporter is an interface - yes, you can't create one. It's an interface.
ColdFusion does have a 'feature' is if you request an interface it will create an implementation for you that does nothing (i.e. not very useful). Railo is probably giving you back the more 'correct' error.
If you do a javadoc of the library, you will be able to see what implements the ErrorReporter interface - I would expect that there is a default implementation with the library, and use that.
> On Thu, Mar 4, 2010 at 6:10 PM, TomdeMan <tom.demanin...@gmail.com> wrote: > > I never found them online, I went off the src files that were included > > with the jar in the download package.
> > On Mar 5, 12:00 am, Mark Mandel <mark.man...@gmail.com> wrote: > >> Being lazy - where can I find the JavaDoc for YUICompressor?
> >> Mark
> >> On Fri, Mar 5, 2010 at 9:57 AM, TomdeMan <tom.demanin...@gmail.com> > wrote: > >> > I am working with the YUICompressor Java library, and noticed some odd > >> > behavior. Placing the yuicompressor-2.4.2.jar into the CF classpath > >> > and using createObject() throws the following error:
> >> > An exception occurred when instantiating a Java object. The class must > >> > not be an interface or an abstract class. Error: ''.
> >> > The same code, using javaloader to create() an object of the same > >> > class runs successfully on CF 8 and CF 9. > >> > Running it on Railo 3 produces the same error as the CF classpath.
> >> > The class in question is the ErrorReporter. The error is thrown on the > >> > init of the JavaScriptCompressor, the reporter is created successfully > >> > prior to that. (Even though it is just an interface, and no init > >> > method is specified)
I can understand Railo's error being correct if it does not have the feature that CF does for creating that skeleton interface object. But what I can't understand is why it would not work on CF without javaloader???
To me it seemed like a conflict of pre-loaded libraries in the CF classpath. I have verified another instance of org.mozilla.javascript.ErrorReporter in one of the other jars. That is why I assumed it worked with JavaLoader.
But not working on Railo with JavaLoader made me wonder if Railo and JavaLoader have something different going on with respect to loading the existing coldfusion libraries.
Which led me to try creating the same implementation the YUI java source used to create the object. I created a java class of the same type but different package. Created the jar and threw it in the cf classpath. Changed my code to create one of my new classes and passed that in, and got the same error, about it being an interface or an abstract class.
My next move would be to repackage the YUICompressor jar, but before I do that the big question to me is...
How did JavaLoader get it to work? What is it doing? Got to be a way to mimic it?
On Mar 5, 12:20 am, Mark Mandel <mark.man...@gmail.com> wrote:
> Thanks for that Matt - but I'm looking for the JavaDoc documentation.
> Tom - first thing I would do is generate the JavaDoc documentation, so you > can browse how the library is implemented. Browsing source for this is > tough.
> Secondly, if ErrorReporter is an interface - yes, you can't create one. It's > an interface.
> ColdFusion does have a 'feature' is if you request an interface it will > create an implementation for you that does nothing (i.e. not very useful). > Railo is probably giving you back the more 'correct' error.
> If you do a javadoc of the library, you will be able to see what implements > the ErrorReporter interface - I would expect that there is a default > implementation with the library, and use that.
> Mark
> On Fri, Mar 5, 2010 at 10:12 AM, Matt Gersting <mgerst...@gmail.com> wrote: > > Is this what you're looking for, Mark?
> > On Thu, Mar 4, 2010 at 6:10 PM, TomdeMan <tom.demanin...@gmail.com> wrote: > > > I never found them online, I went off the src files that were included > > > with the jar in the download package.
> > > On Mar 5, 12:00 am, Mark Mandel <mark.man...@gmail.com> wrote: > > >> Being lazy - where can I find the JavaDoc for YUICompressor?
> > >> Mark
> > >> On Fri, Mar 5, 2010 at 9:57 AM, TomdeMan <tom.demanin...@gmail.com> > > wrote: > > >> > I am working with the YUICompressor Java library, and noticed some odd > > >> > behavior. Placing the yuicompressor-2.4.2.jar into the CF classpath > > >> > and using createObject() throws the following error:
> > >> > An exception occurred when instantiating a Java object. The class must > > >> > not be an interface or an abstract class. Error: ''.
> > >> > The same code, using javaloader to create() an object of the same > > >> > class runs successfully on CF 8 and CF 9. > > >> > Running it on Railo 3 produces the same error as the CF classpath.
> > >> > The class in question is the ErrorReporter. The error is thrown on the > > >> > init of the JavaScriptCompressor, the reporter is created successfully > > >> > prior to that. (Even though it is just an interface, and no init > > >> > method is specified)
On Fri, Mar 5, 2010 at 1:04 PM, Tom de Manincor <tom.demanin...@gmail.com>wrote:
> I can understand Railo's error being correct if it does not have the > feature that CF does for creating that skeleton interface object. > But what I can't understand is why it would not work on CF without > javaloader???
Why does it matter? If you do it correctly (and follow the ideas I suggested below, you can get this working no problem).
I've tried all kinds of stuff to get this to work with the CF classpath with little success, just one error after another coming from classes in the org.mozilla.javascript package.
So I am taking a break with the CF classpath issue and focus on Railo with JavaLoader.
The same code that works in CF with JavaLoader produces the following error in railo:
No matching Constructor for com.yahoo.platform.yui.compressor.JavaScriptCompressor(java.io.StringReader , coldfusion.runtime.java.JavaProxy) found
There is nothing in the stack trace indicating what if anything happened with the java code behind the scenes.
On Mar 5, 3:13 am, Mark Mandel <mark.man...@gmail.com> wrote:
> On Fri, Mar 5, 2010 at 1:04 PM, Tom de Manincor <tom.demanin...@gmail.com>wrote:
> > I can understand Railo's error being correct if it does not have the > > feature that CF does for creating that skeleton interface object. > > But what I can't understand is why it would not work on CF without > > javaloader???
> Why does it matter? If you do it correctly (and follow the ideas I suggested > below, you can get this working no problem).
> I've tried all kinds of stuff to get this to work with the CF > classpath with little success, just one error after another coming > from classes in the org.mozilla.javascript package.
> So I am taking a break with the CF classpath issue and focus on Railo > with JavaLoader.
> The same code that works in CF with JavaLoader produces the following > error in railo:
> No matching Constructor for
> com.yahoo.platform.yui.compressor.JavaScriptCompressor(java.io.StringReader , > coldfusion.runtime.java.JavaProxy) found
> There is nothing in the stack trace indicating what if anything > happened with the java code behind the scenes.
> On Mar 5, 3:13 am, Mark Mandel <mark.man...@gmail.com> wrote: > > Tom,
> > On Fri, Mar 5, 2010 at 1:04 PM, Tom de Manincor < > tom.demanin...@gmail.com>wrote:
> > > I can understand Railo's error being correct if it does not have the > > > feature that CF does for creating that skeleton interface object. > > > But what I can't understand is why it would not work on CF without > > > javaloader???
> > Why does it matter? If you do it correctly (and follow the ideas I > suggested > > below, you can get this working no problem).
> > I think you're making this overly complicated.