Link to home
Create AccountLog in
Avatar of Dusty
DustyFlag for United States of America

asked on

Java error on Railo

Windows 2003, Apache2.2, Railo3

When I try to untar a file using the script below, I get this error:

Railo 3.1.2.001 Error (Railo.commons.lang.classexception)
can not load class through its string name, because no definition for the class with the specifed name [org.apache.tools.tar.TarEntry] could be found.

The script works fine on my other server with CFMX 7, can anyone tell me how to fix the problem?

Thanks!


<cfscript>
TarEntry = createobject("java", "org.apache.tools.tar.TarEntry");
TarInputStream = createobject("java", "org.apache.tools.tar.TarInputStream");
FileInputStream = createobject("java", "java.io.FileInputStream");
FileOutputStream = createobject("java", "java.io.FileOutputStream");
FileIO = createobject("java", "java.io.File");
tarfile = "C:\mydir.tar";
outdir = "C:\mydir\";
tin = TarInputStream.init(FileInputStream.init(tarfile));
te = tin.getNextEntry();
while (structkeyexists(variables, 'te'))
{
                destpath = outdir & "\" & te.getName();
                if (te.isDirectory())
                                destpath.mkdir();
                else
                {
                                fos = FileOutputStream.init(destpath);
                                tin.copyEntryContents(fos);
                                fos.close();
                }
                te = tin.getNextEntry();
}
tin.close();
</cfscript>

Open in new window

Avatar of _agx_
_agx_
Flag of United States of America image

org.apache.tools.tar.TarEntry

Looks like Railo doesn't use that particular ant jar. So you need to install it.  MX7 uses ant 1.6. But I'd guess the latest version would work too.  Download and unzip it.  You don't need all of the jars. Just copy the "ant.jar" into Railo's class path and restart.

ie Copy /apache-ant-1.8.2/lib/ant.jar => WEB-INF/railo/lib (I believe) and restart Railo
ASKER CERTIFIED SOLUTION
Avatar of _agx_
_agx_
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Dusty

ASKER

agx --- that worked...once again you have saved the day!... thanks!
As always, you're welcome :)