Using Java's java.util.Calendar

I am trying to use the following like so.

property name=“calendar” inject=“javaloader:java.util.Calendar”;

The idea is that I can use this object to do some data conversion, the problem is that when I try to use it I am getting the below error. So the question is how can this work, I tried using

calendar.getInstance()

even

myCal = calendar.init();

But that gives an error saying it can’t find a constructor with init(‘’), but the javaDocs say there is a default constructor Calendar() so can anyone help in explaining what I am doing wrong here. As you can tell I don’t use JavaLoader much so I am not sure what is going wrong.

Application Execution Exception

Error Type: Object : [N/A]
Error Messages: Object instantiation exception.
An exception occurred while instantiating a Java object. The class must not be an interface or an abstract class. If the class has a constructor that accepts an argument, you must call the constructor explicitly using the init(args) method. Error : Class coldfusion.runtime.java.JavaProxy can not access a member of class java.util.Calendar with modifiers “protected”

Regards,

Andrew Scott

http://www.andyscott.id.au/

why are you using javaloader for that?

Is it a library you are classloading? java.util.Calendar is part of the jDK, just map it in wirebox

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Hmm, the Docs indicate I could. And if I call JavaLoader before creating that file it works. But restart the server and it doesn’t.

What are the advantages over maping it with WireBox? That seems like unnecessary work for me.

Regards,

Andrew Scott

http://www.andyscott.id.au/