Andrew,
If you have control of the java code (and I assume you do), I would recode it
to have a separate constructor, and a method (or methods) that actually do
stuff. The constructor should be named the same as the class, and in your case
take in a string (assuming you want to pass in a single xml file at a time).
The java code should look something like this. You will implement the doStuff
method (or whatever it make sense to call it to do your actual conversion and
return the base64 string).
public class IRMark {
protected String filename;
public IRMMark (String filename)
{
this. filename =filename;
Init.init();
}
public String doStuff()
{
return filename;
}
}
In ColdFusion you would do something like this
<cfobject action="create" type="Java" class="IRMark" name="myObj">
<cfset myObj.init("input.xml")>
<cfset ret=myObj.doStuff()>
I would start with this code (maybe commenting out the Init.init() in java for
now, and then see if it succeeds. Then I would start adding the code that
actually does stuff.
You will need to restart CF when you make code changes. If you are going to be
doing this a lot, I suggest getting Mark Mandel's JavaLoader.cfc. It has
greatly eased my Java/CF development.
Russ
> -----Original Message-----
> From: Andrew Whone [mailto:[EMAIL PROTECTED]
> Sent: Monday, April 16, 2007 9:24 AM
> To: CF-Talk
> Subject: Re: CF and Java
>
> Thanks for all the help but still no joy.
> I have been compiling the class file in the classes library and not moving
> it.
> All the jars are in the class path.
> I have been calling the method using:
> <cfobject action="create" type="Java" class="IRMark" name="myObj">
> <cfset ret=myObj.main("input.xml")>
> And
> <cfset aFileName = ArrayNew(1)>
> <cfset aFileName[1] = "input.xml">
> <cfscript>
> jArray = aFileName.toArray();
> </cfscript>
> <cfobject action="create" type="Java" class="IRMark" name="myObj">
> <cfset ret=myObj.main(jArray)>
> I am using xmlsec 1.0 (I am not sure what the 1.2 refers to in Phils
> reply)
> I do have a log4j.jar in C:\CFusionMX7\lib so there is a probably a
> conflict but I don't know how to solve it.
> The error message I get is always HTTP500 The web page cannot be
> displayed.
> I received another reply in the Java forum of this site, so I tried that
> code and still get the same error.
> Any more help will begratefully received.
> A+
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion MX7 and Flex 2
Build sales & marketing dashboard RIAâs for your business. Upgrade now
http://www.adobe.com/products/coldfusion/flex2?sdid=RVJT
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275358
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4