You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Davy Moskofian <Da...@dimail.epfl.ch> on 2001/07/12 14:40:35 UTC
cannot find class java/lang/Thread
Hi,
I have installed FOP on my Sun station.
When I try to execute the fop.sh command, I get the following error
message:
"Unable to initialize threads: cannot find class java/lang/Thread"
Can anyone tell me if there is a solution to this problem ?
Thanks a lot
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org
Re: Java Extensions in Xalan vs Fop
Posted by Gareth Noyce <ga...@stng.co.uk>.
> I hear your pain, brother. :-) So I have enclosed a ZIP which contains all
> the files I used, on Windows 98, to make this work - the XML, XSL, the
> extension class (source and compiled classfile), a batch file to run
things,
> even the PDF output.
Father Arved, thank for you for your preaching!
Ok, this initially didn't work, but the bat file made me notice something
that I'd not seen before. My classpath was too long for the commandline that
you included in the batch file to run. Thinking this might have something to
do with it I cut it all down to just the FOP and Xalan stuff that I need
right now. Lo! All worked out of the tin. All my example files, your batch
file -- pretty much everything I've been playing with since Thursday.
So, the evils of the CLASSPATH seem to have struck again. For the record,
everything you'd included in your example I had in my classpath (bar the
example java I'd written), but it just seemed to get ignored. Removing bits
make all the difference.
That is some weight off my shoulders, although I feel a little silly having
wasted so long playing around with it!
Thank you again for your help and support.
Best Regards
Gareth Noyce
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org
Re: Java Extensions in Xalan vs Fop
Posted by Arved Sandstrom <Ar...@chebucto.ns.ca>.
At 03:06 PM 7/16/01 +0100, Gareth Noyce wrote:
>I've pretty much lost enough time to this problem now, so I'm effectively
>giving up. For the record, I've tried the following:
>
[ SNIP ]
I hear your pain, brother. :-) So I have enclosed a ZIP which contains all
the files I used, on Windows 98, to make this work - the XML, XSL, the
extension class (source and compiled classfile), a batch file to run things,
even the PDF output.
I am using the Xerces/Xalan pair from xalan-j_2_2_D6. The FOP is 0.19.0-CVS.
The JDK is jdk1.3.0_02.
You should be able to test this in about 2 minutes. If it doesn't work then
I am baffled.
Regards,
Arved
Re: Java Extensions in Xalan vs Fop
Posted by Gareth Noyce <ga...@stng.co.uk>.
> > >I understand this error to be along the lines of a "Can't find class
> > >BchDate", as I had the same problem with Xalan whilst learning how to
> > >implement extensions.
> >
> > I think you're right, as far as the semantics of the ERROR message is
> > concerned. One reason you can't find a class is because you didn't
compile
> > the source; are you sure you have the _classfile_ available that
> > corresponds
> > to your BchDate class?
Hi,
I've pretty much lost enough time to this problem now, so I'm effectively
giving up. For the record, I've tried the following:
* Gone back to basics and compiled IntDate from the Xalan examples. Made a
new XML and XSL file for this, paying attention to Arved's example from
earlier.
* Made sure that IntDate was compiled and on the classpath.
* Ran the test files through Xalan. These output an FO file (test.fo) which
was passed to FOP. This processed to a PDF file with no problems. The Java
extension ran in Xalan correctly.
* Repeated the above process, using "java" and "xalan://" namespaces
examples, as documented in the Xalan docs -- running the xsl and xml through
Xalan as before. Each time, the output FO file was pushed through FOP. In
every instance, Xalan correctly found/ran the Java extension and processed
the XSLT, resulting in an FO file that FOP will happily convert to PDF.
Essentially, I have _no_ problem running Java Extensions through Xalan on my
machine! :-)
* Took the various files from the above process and tried to run them
through FOP without going through Xalan first. In every case either the
error "ERROR: IntDate" was returned or: "Error: no such method
java.lang.String.getDate([CONTEXT], #String, #String)" depending on my use
of the Java or xmlns:my-class="Xalan://" namespace respectively was raised.
I cannot get the same XML/XSL to process through FOP without error.
* Played with the -cp option to try and get FOP to pick up another path...
I've checked the documentation and can find no further clues as to setup or
configuration for FOP, or why this should be happening. Either I am missing
something siginificant on the configuration front here, or I'm blind to some
documentation that explains it.
I've run through the debug output and it's pretty clear that it's a case of
the class not being found. I am at a loss as to why this is, especially as
Xalan clearly has no problems finding, running, or spitting my class's
output to the resultant FO file. I can even add a main() to my class and run
it from the commandline /anywhere/. I've tried packaging the class as
Arved's example from yesterday, and whilst java and Xalan have no problem
finding this, FOP still can't. This has frustrated me no end, but I just
cannot afford to spend anymore time trying to configure this.
Obviously I've proved that I can use Xalan in combination with FOP to meet
my needs, so that may have to be my fallback position.
If anyone has any suggestions, please email me. I'll probably come back and
look at this problem in the future. For now I've got deadlines to meet! ;-)
Thanks Arved for the pointers here and on Comp.text.xml...
Regards
Gareth Noyce
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org
Re: Java Extensions in Xalan vs Fop
Posted by Gareth Noyce <ga...@stng.co.uk>.
> >I understand this error to be along the lines of a "Can't find class
> >BchDate", as I had the same problem with Xalan whilst learning how to
> >implement extensions.
>
> I think you're right, as far as the semantics of the ERROR message is
> concerned. One reason you can't find a class is because you didn't compile
> the source; are you sure you have the _classfile_ available that
corresponds
> to your BchDate class?
Hi, thanks for the reply,
Firstly, yes the class file is present on the class path. The class is
compiled -- I can call util.BchDate (I've just packaged it to follow your
example) from anywhere on the commandline and the function main I added to
test the classpath works as expected, passes a dummy date to getDate, and
the formatted string is returned. From this I take it that the java code is
correct, works fine, and is present (compiled) on the classpath.. All is
well in that regard.
As previsouly mentioned, all my files work fine in Xalan. No changes need to
be made _at all_ to get Xalan to run the Java and output an FO file. This is
also true for the test files created with your example code discussed below:
> My final example is very close to yours. Here is the stylesheet root:
Thanks for that, I've cut and past your example snippets into two new files,
and the errors returned by FOP are the same. However, when the bchext
namespace prefix is used I now get:
Error: For extension function, could not find method
java.lang.String.getDate([expressionContext])
To me this indicates that the "xalan://util.BchDate" prefix is being ignored
entirely. I see no reason why FOP should believe that getDate is a method of
class String and call it as such. It's not like getDate returns a string
even! :-)
So, with the failure of that may I ask you the following:
Are you running this under NT?
Where on your classpath did you put the util.BchDate package (ie:
c:\data\bch\javacode\)?
What version of FOP are you using?
Any other suggestions?!
Thanks for your time, Best Regards
Gareth Noyce
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org
Re: Java Extensions in Xalan vs Fop
Posted by Arved Sandstrom <Ar...@chebucto.ns.ca>.
At 02:31 PM 7/12/01 +0100, Gareth Noyce wrote:
[ SNIP ]
>I'll leave out the Java class for brevity, it's basically the same as the
>3-java-namespace example from Xalan.
>
>The Java class is on the classpath, I included a function 'main' to test
>this and all works fine. The XML, XSL and Java will all process through
>Xalan as expected, and an XSL:FO file is produced correctly, no problems.
>However, I wish to use FOP to do all this in one go with the usual
>"java -jar fop.jar -xml g-test.xml -xsl g-test.xsl -pdf out.pdf" -- and this
>is where my problem crops up. When I run the command as shown, the error:
>
><filepath>; Line 123; Column 87; ERROR: BchDate
>
>is shown.
>
>I understand this error to be along the lines of a "Can't find class
>BchDate", as I had the same problem with Xalan whilst learning how to
>implement extensions.
I think you're right, as far as the semantics of the ERROR message is
concerned. One reason you can't find a class is because you didn't compile
the source; are you sure you have the _classfile_ available that corresponds
to your BchDate class?
Reason I ask that is, this burned me, too, for about an hour. I never
thought to compile the extension class. When I did, everything worked (i.e.
having FOP do everything all at once as with your command line above).
My final example is very close to yours. Here is the stylesheet root:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:bchext="xalan://util.BchDate"
xmlns:java="http://xml.apache.org/xslt/java"
exclude-result-prefixes="java">
and here are 2 segments of the stylesheet that shows use of the functions:
<xsl:variable name="format" select="string('EEE MMM dd yyyy')"/>
<xsl:variable name="year" select="'2001'"/>
<xsl:variable name="month" select="'07'"/>
<xsl:variable name="day" select="'18'"/>
...
<fo:block border-right-width="0.5pt" text-align="center"
vertical-align="middle" border-style="solid" line-height="11pt">
<xsl:variable name="formatter"
select="java:java.text.SimpleDateFormat.new($format)"/>
<!-- <xsl:variable name="formatdate"
select="bchext:getDate($year,$month,$day)"/> -->
<xsl:variable name="formatdate"
select="java:util.BchDate.getDate($year,$month,$day)"/>
<xsl:value-of select="java:format($formatter,$formatdate)"/>
</fo:block>
My BchDate.java is identical to the Xalan IntDate.java.
I commented out the call to getDate() that uses the class format
declaration; that also works just fine.
Regards,
Arved Sandstrom
Fairly Senior Software Type
e-plicity (http://www.e-plicity.com)
Wireless * B2B * J2EE * XML --- Halifax, Nova Scotia
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org
Re: Java Extensions in Xalan vs Fop
Posted by Gareth Noyce <ga...@stng.co.uk>.
> > The Java class is on the classpath, I included a function 'main' to test
> > this and all works fine. The XML, XSL and Java will all process through
> > Xalan as expected, and an XSL:FO file is produced correctly, no
problems.
> > However, I wish to use FOP to do all this in one go with the usual
> > "java -jar fop.jar -xml g-test.xml -xsl g-test.xsl -pdf out.pdf" -- and
this
> > is where my problem crops up. When I run the command as shown, the
error:
> I may get something wrong, but don't you have to specify an additional
> -cp for you BchDate class? fop.jar contains a manifest file which
> specifies the classpath to use. If you need more than the standard
> packages, I'd write something like:
>
> java -jar -cp yourPath fop.jar -xml .......
>
> I didn't test this but it's worth a try.
Hi Jeremias,
Thanks for the response; I've already tried explicitly giving the classpath,
and I've also put the compiled class in the same directory as the fop.jar
file to see if that made any difference. Neither of these has solved the
problem.
Can anyone offer any other suggestions?
Regards
Gareth Noyce
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org
Re: Java Extensions in Xalan vs Fop
Posted by Jeremias Maerki <je...@outline.ch>.
> The Java class is on the classpath, I included a function 'main' to test
> this and all works fine. The XML, XSL and Java will all process through
> Xalan as expected, and an XSL:FO file is produced correctly, no problems.
> However, I wish to use FOP to do all this in one go with the usual
> "java -jar fop.jar -xml g-test.xml -xsl g-test.xsl -pdf out.pdf" -- and this
> is where my problem crops up. When I run the command as shown, the error:
I may get something wrong, but don't you have to specify an additional
-cp for you BchDate class? fop.jar contains a manifest file which
specifies the classpath to use. If you need more than the standard
packages, I'd write something like:
java -jar -cp yourPath fop.jar -xml .......
I didn't test this but it's worth a try.
Jeremias Märki
mailto:jeremias.maerki@outline.ch
OUTLINE AG
Postfach 3954 - Rhynauerstr. 15 - CH-6002 Luzern
Fon +41 (41) 317 2020 - Fax +41 (41) 317 2029
Internet http://www.outline.ch
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org
Java Extensions in Xalan vs Fop
Posted by Gareth Noyce <ga...@stng.co.uk>.
Hi all,
Firstly, many thanks for the hard work on FOP -- it's a great piece of work.
Unfortunately I've stumbled upon a problem which I'm at a loss to figure
out. I'm hoping that someone on the list will be able to shed some light on
the problem.
I've been playing with Java Extension functions under Xalan with great
success. I need to move one of these over to go through FOP in order to
process dates, so I've slightly amended the example as provided with Xalan
to better suit my needs and to test the process.
I've got a small test xml file which contains the following:
[g-test.xml]
--
<?xml version="1.0"?>
<gtest>
<date>2001-07-11</date>
</gtest>
--
The XSL file generates a FO file suitable for processing by FOP. Cutting out
most of the cruft, the file is as follows:
[g-test.xsl]
--
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:java="http://xml.apache.org/xslt/java" xmlns:bchext="xalan://BchDate">
<xsl:template match="/">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<!-- Layout the page dimensions. A4 landscape... -->
[SNIP]
<!-- Start the page sequence... Each page will follow this
odel... -->
[SNIP]
</fo:root>
</xsl:template>
<xsl:template match="date">
<!-- This is the format mask for SimpleDateFormat -->
<xsl:variable name="format" select="string('EEE MMM dd yyyy')"/>
<xsl:variable name="date" select="string(.)"/>
<fo:table font-size="7pt">
[TABLE COLUMN SETUP / SNIP]
<fo:table-header>
[SNIP]
</fo:table-header>
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:block border-right-width="0.5pt" text-align="center"
vertical-align="middle" border-style="solid" line-height="11pt">
<xsl:variable name="formatter"
select="java:java.text.SimpleDateFormat.new($format)"/>
<xsl:variable name="formatdate" select="java:BchDate.getDate
($date)"/>
<xsl:value-of select="java:format($formatter,
$formatdate)"/>
</fo:block>
</fo:table-cell>
...
[SNIP]
...
</fo:table-row>
</fo:table-body>
</fo:table>
</xsl:template>
</xsl:stylesheet>
--
I'll leave out the Java class for brevity, it's basically the same as the
3-java-namespace example from Xalan.
The Java class is on the classpath, I included a function 'main' to test
this and all works fine. The XML, XSL and Java will all process through
Xalan as expected, and an XSL:FO file is produced correctly, no problems.
However, I wish to use FOP to do all this in one go with the usual
"java -jar fop.jar -xml g-test.xml -xsl g-test.xsl -pdf out.pdf" -- and this
is where my problem crops up. When I run the command as shown, the error:
<filepath>; Line 123; Column 87; ERROR: BchDate
is shown.
I understand this error to be along the lines of a "Can't find class
BchDate", as I had the same problem with Xalan whilst learning how to
implement extensions.
Can anyone point out what stupid mistake I am making here? I'm at a loss as
to why the same files will process with Xalan-j_2_2_D6 and yet not with
FOP-0.19 which, as I understand it, uses Xalan for the XSLT stage... I've
double checked the CLASS_PATH settings, tested the Java and been all over
the website trying to figure out if I should be using a different namespace
setting for FOP (things aren't particularly clear, there or in the docs).
I'm running NT4 for development, and the server is 2k. Java is JDK1.3.1 from
Sun.
I'm sorry for the length of the post. I thought it would save time to
explain things as verbosly as possible!
Thanks in advance for your time, & best regards
Gareth Noyce
P.S. I'll happily send all my test files to anyone off list if it helps.
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org
Re: cannot find class java/lang/Thread
Posted by Alex McLintock <al...@yahoo.com>.
--- Davy Moskofian <Da...@dimail.epfl.ch> wrote: > Hi,
>
> I have installed FOP on my Sun station.
> When I try to execute the fop.sh command, I get the following error
> message:
> "Unable to initialize threads: cannot find class java/lang/Thread"
> Can anyone tell me if there is a solution to this problem ?
You really need to make sure that you can run java programs on your system.
It sounds like it isn't set up properly (or your environment isn't).
FOP isn't an idiot proof application - you do need to know some Java and XML.
Alex
=====
Alex McLintock alex@OWAL.co.uk Open Source Consultancy in London
OpenWeb Analysts Ltd, http://www.OWAL.co.uk/
DR WHO COMPETITION: http://www.diversebooks.com/cgi-bin/caption/captions.cgi?date=200104
Get Your XML T-Shirt <t-shirt/> at http://www.inversity.co.uk/
____________________________________________________________
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org
Re: AW: cannot find class java/lang/Thread
Posted by Davy Moskofian <Da...@dimail.epfl.ch>.
Thanks a lot for your help Klaus, it works !
cheers
Klaus Gotthardt wrote:
> is classes.zip in your classpath?
>
> Klaus
>
> > -----Ursprüngliche Nachricht-----
> > Von: Davy.Moskofian@di.epfl.ch [mailto:Davy.Moskofian@di.epfl.ch]Im
> > Auftrag von Davy Moskofian
> > Gesendet: Donnerstag, 12. Juli 2001 14:41
> > An: fop-dev@xml.apache.org
> > Betreff: cannot find class java/lang/Thread
> >
> >
> > Hi,
> >
> > I have installed FOP on my Sun station.
> > When I try to execute the fop.sh command, I get the following error
> > message:
> > "Unable to initialize threads: cannot find class java/lang/Thread"
> > Can anyone tell me if there is a solution to this problem ?
> >
> > Thanks a lot
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
> > For additional commands, email: fop-dev-help@xml.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
> For additional commands, email: fop-dev-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org
AW: cannot find class java/lang/Thread
Posted by Klaus Gotthardt <k....@em.uni-frankfurt.de>.
is classes.zip in your classpath?
Klaus
> -----Ursprüngliche Nachricht-----
> Von: Davy.Moskofian@di.epfl.ch [mailto:Davy.Moskofian@di.epfl.ch]Im
> Auftrag von Davy Moskofian
> Gesendet: Donnerstag, 12. Juli 2001 14:41
> An: fop-dev@xml.apache.org
> Betreff: cannot find class java/lang/Thread
>
>
> Hi,
>
> I have installed FOP on my Sun station.
> When I try to execute the fop.sh command, I get the following error
> message:
> "Unable to initialize threads: cannot find class java/lang/Thread"
> Can anyone tell me if there is a solution to this problem ?
>
> Thanks a lot
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
> For additional commands, email: fop-dev-help@xml.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org