Re: [iText-questions] IText doesn't seem to be thread safe?

2006-07-23 Thread Peter Wilkinson



Bang on the
 money,
  I hadn't
 realised that each servlet was instantiated
 only once.  Rather than force the server
 to create multiple instances I removed the
 class variables and that fixed it.
 
 
Regards
 
Peter Wilkinson
System Developer
Mantel Solutions
 Pty Ltd
 
PO Box 98,
 35 Hamilton Road
Moorooka QLD
 4105
 
P: +61 7 3848
 0001
F: +61 7 3392
 9923
W: www.mantel.com.au
 
The information
 contained in this electronic message (e-mail)
 and any files transmitted with it, is intended
 for the named recipients only.  It may
 contain privileged and or confidential information
 and if you are not the intended recipient
 you must not copy distribute or take any
 action in reliance on it. If you have received
 this electronic message (e-mail) and any
 files transmitted with it in error please
 delete immediately and advise Mantel Solutions
 on 07 3848 0001.


--- Original
 Message ---
  
From: "Paulo Soares" <[EMAIL PROTECTED]>
To: "Post all your questions
 about iText here" 
Date: Thu, 20 Jul 2006 09:01:06
 +0100
Subject: Re: [iText-questions]
 IText doesn't seem to be thread safe?
  
I suspect that it's a problem with the
 server configuration. The app server can
 work in two modes: one where each request
 creates a new instance of the servlet
 and another where the same instance is used
 by all the requests. Your server is configured
 for the latter. Just guessing.Paulo-
 Original Message - From: "Peter Wilkinson"
 <[EMAIL PROTECTED]>To:
 Sent:
 Thursday, July 20, 2006 4:36 AMSubject:
 [iText-questions] IText doesn't seem to be
 thread safe?> I've written
 a jsp page that produces a PDF using iText
 and it work great > until 2 people
 try and run the report at the same time.>>
 I get a variety of errors including>>
  DocumentException : Document is closed.>
  ConcurrentModficationException>
  NullPointerException>>
 as well as pdf's that are corrupt.>>
 I haven't declared a single thing on the
 page as being static.  All the >
 exceptions are generated when trying to call
 a Document method so I'm > wondering
 if maybe the document object isn't thread
 safe?>> This is my document
 creation code.>> document =
 new Document(PageSize.A4.rotate());>
 baseFont = BaseFont.createFont("Helvetica",
 BaseFont.WINANSI, false);> font =
 new Font(baseFont, defaultFontSize);>
 totalFont = new Font(baseFont, 9);>
 totalFont.setStyle(Font.BOLD);> heading1Font
 = new Font(baseFont, 20, Font.BOLDITALIC,
 new Color(0, 0, > 0));> heading2Font
 = new Font(baseFont, 17, Font.BOLDITALIC,
 new Color(0, 0, > 0));> heading3Font
 = new Font(baseFont, 14, Font.BOLDITALIC,
 new Color(0, 0, > 0));> defaultLayoutCell
 = new Cell();> defaultLayoutCell.setBorder(Rectangle.NO_BORDER);>
 ByteArrayOutputStream baos = new ByteArrayOutputStream();>
 writer = PdfWriter.getInstance(document,
 baos);> //writer.setEncryption(false,
 "", "", PdfWriter.AllowCopy | > PdfWriter.AllowPrinting);>
 PageEventHandler pageEventHandler = new PageEventHandler();>
 writer.setPageEvent(pageEventHandler);>
 writer.setViewerPreferences(PdfWriter.PageModeUseOutlines);>
 // step 3: we open the document> document.open();>>
 Regards>> Peter Wilkinson>
 System Developer> Mantel Solutions
 Pty Ltd>> PO Box 98, 35 Hamilton
 Road> Moorooka QLD 4105>>
 P: +61 7 3848 0001> F: +61 7 3392
 9923> W: www.mantel.com.au>>
 The information contained in this electronic
 message (e-mail) and any > files transmitted
 with it, is intended for the named recipients
 only.  It > may contain privileged
 and or confidential information and if you
 are not > the intended recipient you
 must not copy distribute or take any action
 in > reliance on it. If you have received
 this electronic message (e-mail) and >
 any files transmitted with it in error please
 delete immediately and > advise Mantel
 Solutions on 07 3848 0001.>
 ->
 Take Surveys. Earn Cash. Influence the Future
 of IT> Join SourceForge.net's Techsay
 panel and you'll get the chance to share
 > your> opinions on IT &
 business topics through brief surveys --
 and earn cash> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV>
 ___>
 iText-questions mailing list> iText-questions@lists.sourceforge.net>
 https://lists.sourceforge.net/lists/listinfo/itext-questions>
 

Re: [iText-questions] IText doesn't seem to be thread safe?

2006-07-20 Thread Joe Scanlon
Peter -- you declared the document to be ''static'' <%!  %> will be static in your case - move    "Document document;"   On 7/20/06, 
Paulo Soares <[EMAIL PROTECTED]> wrote:
I suspect that it's a problem with the server configuration. The app servercan work in two modes: one where each request creates a new instance of theservlet and another where the same instance is used by all the requests.
Your server is configured for the latter. Just guessing.Paulo- Original Message -From: "Peter Wilkinson" <[EMAIL PROTECTED]
>To: <itext-questions@lists.sourceforge.net>Sent: Thursday, July 20, 2006 4:36 AMSubject: [iText-questions] IText doesn't seem to be thread safe?
> I've written a jsp page that produces a PDF using iText and it work great> until 2 people try and run the report at the same time.>> I get a variety of errors including>>  DocumentException : Document is closed.
>  ConcurrentModficationException>  NullPointerException>> as well as pdf's that are corrupt.>> I haven't declared a single thing on the page as being static.  All the> exceptions are generated when trying to call a Document method so I'm
> wondering if maybe the document object isn't thread safe?>> This is my document creation code.>> document = new Document(PageSize.A4.rotate());> baseFont = BaseFont.createFont("Helvetica", 
BaseFont.WINANSI, false);> font = new Font(baseFont, defaultFontSize);> totalFont = new Font(baseFont, 9);> totalFont.setStyle(Font.BOLD);> heading1Font = new Font(baseFont, 20, Font.BOLDITALIC
, new Color(0, 0,> 0));> heading2Font = new Font(baseFont, 17, Font.BOLDITALIC, new Color(0, 0,> 0));> heading3Font = new Font(baseFont, 14, Font.BOLDITALIC, new Color(0, 0,> 0));> defaultLayoutCell = new Cell();
> defaultLayoutCell.setBorder(Rectangle.NO_BORDER);> ByteArrayOutputStream baos = new ByteArrayOutputStream();> writer = PdfWriter.getInstance(document, baos);> //writer.setEncryption(false, "", "", 
PdfWriter.AllowCopy |> PdfWriter.AllowPrinting);> PageEventHandler pageEventHandler = new PageEventHandler();> writer.setPageEvent(pageEventHandler);> writer.setViewerPreferences(PdfWriter.PageModeUseOutlines
);> // step 3: we open the document> document.open();>> Regards>> Peter Wilkinson> System Developer> Mantel Solutions Pty Ltd>> PO Box 98, 35 Hamilton Road
> Moorooka QLD 4105>> P: +61 7 3848 0001> F: +61 7 3392 9923> W: www.mantel.com.au>> The information contained in this electronic message (e-mail) and any
> files transmitted with it, is intended for the named recipients only.  It> may contain privileged and or confidential information and if you are not> the intended recipient you must not copy distribute or take any action in
> reliance on it. If you have received this electronic message (e-mail) and> any files transmitted with it in error please delete immediately and> advise Mantel Solutions on 07 3848 0001.
> -> Take Surveys. Earn Cash. Influence the Future of IT> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your> opinions on IT & business topics through brief surveys -- and earn cash> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> ___> iText-questions mailing list> 
iText-questions@lists.sourceforge.net> https://lists.sourceforge.net/lists/listinfo/itext-questions>-
Take Surveys. Earn Cash. Influence the Future of ITJoin SourceForge.net's Techsay panel and you'll get the chance to share youropinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___iText-questions mailing list
iText-questions@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/itext-questions
-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions


Re: [iText-questions] IText doesn't seem to be thread safe?

2006-07-20 Thread Paulo Soares
I suspect that it's a problem with the server configuration. The app server 
can work in two modes: one where each request creates a new instance of the 
servlet and another where the same instance is used by all the requests. 
Your server is configured for the latter. Just guessing.

Paulo

- Original Message - 
From: "Peter Wilkinson" <[EMAIL PROTECTED]>
To: 
Sent: Thursday, July 20, 2006 4:36 AM
Subject: [iText-questions] IText doesn't seem to be thread safe?


> I've written a jsp page that produces a PDF using iText and it work great 
> until 2 people try and run the report at the same time.
>
> I get a variety of errors including
>
>  DocumentException : Document is closed.
>  ConcurrentModficationException
>  NullPointerException
>
> as well as pdf's that are corrupt.
>
> I haven't declared a single thing on the page as being static.  All the 
> exceptions are generated when trying to call a Document method so I'm 
> wondering if maybe the document object isn't thread safe?
>
> This is my document creation code.
>
> document = new Document(PageSize.A4.rotate());
> baseFont = BaseFont.createFont("Helvetica", BaseFont.WINANSI, false);
> font = new Font(baseFont, defaultFontSize);
> totalFont = new Font(baseFont, 9);
> totalFont.setStyle(Font.BOLD);
> heading1Font = new Font(baseFont, 20, Font.BOLDITALIC, new Color(0, 0, 
> 0));
> heading2Font = new Font(baseFont, 17, Font.BOLDITALIC, new Color(0, 0, 
> 0));
> heading3Font = new Font(baseFont, 14, Font.BOLDITALIC, new Color(0, 0, 
> 0));
> defaultLayoutCell = new Cell();
> defaultLayoutCell.setBorder(Rectangle.NO_BORDER);
> ByteArrayOutputStream baos = new ByteArrayOutputStream();
> writer = PdfWriter.getInstance(document, baos);
> //writer.setEncryption(false, "", "", PdfWriter.AllowCopy | 
> PdfWriter.AllowPrinting);
> PageEventHandler pageEventHandler = new PageEventHandler();
> writer.setPageEvent(pageEventHandler);
> writer.setViewerPreferences(PdfWriter.PageModeUseOutlines);
> // step 3: we open the document
> document.open();
>
> Regards
>
> Peter Wilkinson
> System Developer
> Mantel Solutions Pty Ltd
>
> PO Box 98, 35 Hamilton Road
> Moorooka QLD 4105
>
> P: +61 7 3848 0001
> F: +61 7 3392 9923
> W: www.mantel.com.au
>
> The information contained in this electronic message (e-mail) and any 
> files transmitted with it, is intended for the named recipients only.  It 
> may contain privileged and or confidential information and if you are not 
> the intended recipient you must not copy distribute or take any action in 
> reliance on it. If you have received this electronic message (e-mail) and 
> any files transmitted with it in error please delete immediately and 
> advise Mantel Solutions on 07 3848 0001.





> -
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share 
> your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV





> ___
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> 


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions


Re: [iText-questions] IText doesn't seem to be thread safe?

2006-07-20 Thread Bruno Lowagie
Peter Wilkinson wrote:

> It is declared in the jsp file like
>  
> <%!
>   Document document;
> %>

Why are you using JSP to create a binary data file?
If your PDFs are corrupt, maybe you shouldn't look
in the direction of thread safeness, maybe you are
experiencing a completely different problem.

Just like other mailinglist subscribers we are using
iText at Ghent University in a multithreaded environment.
About 800 professors and their staff are generating
student grading lists using the same web app since 1999.

We would have had some serious problems by now
if we experienced the same problems you are reporting.

best regards,
Bruno

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions


Re: [iText-questions] IText doesn't seem to be thread safe?

2006-07-19 Thread Peter Wilkinson



It is declared
 in the jsp file like
 
<%!
  Document document;
%>
 
 
Regards
 
Peter Wilkinson
System Developer
Mantel Solutions
 Pty Ltd
 
PO Box 98,
 35 Hamilton Road
Moorooka QLD
 4105
 
P: +61 7 3848
 0001
F: +61 7 3392
 9923
W: www.mantel.com.au
 
The information
 contained in this electronic message (e-mail)
 and any files transmitted with it, is intended
 for the named recipients only.  It may
 contain privileged and or confidential information
 and if you are not the intended recipient
 you must not copy distribute or take any
 action in reliance on it. If you have received
 this electronic message (e-mail) and any
 files transmitted with it in error please
 delete immediately and advise Mantel Solutions
 on 07 3848 0001.


--- Original
 Message ---
  
From: "Eliasen Jan" <[EMAIL PROTECTED]>
To: "Post all your questions
 about iText here" 
Date: Thu, 20 Jul 2006 08:38:18
 +0200
Subject: Re: [iText-questions]
 IText doesn't seem to be thread safe?
  
Hi
 
I am not
 a java expert, but I think that the code
 line you have posted doesn't prove anything.
 We need to se where you ahve declared the
 "document" variable and not where you assign
 something to it.
 


Med venlig
 hilsenJan Eliasen
WM-dataFredrik Bajers Vej 19220  Aalborg ØstTel.: +45 9630 5800,
 direkte: +45 9630 5818Mobil: +45 2518
 8024, fax: +45 9630 5805mailto: [EMAIL PROTECTED]http://www.wmdata.dk
 


From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]
 On Behalf Of Peter WilkinsonSent:
 20. juli 2006 06:05To: Post all
 your questions about iText hereSubject:
 Re: [iText-questions] IText doesn't seem
 to be thread safe?

I don't see
 how that can be with the code I've given?
 
The document
 is created with
 
document = new Document(PageSize.A4.rotate());
 
 
Regards
 
Peter Wilkinson
System Developer
Mantel Solutions
 Pty Ltd
 
PO Box 98,
 35 Hamilton Road
Moorooka QLD
 4105
 
P: +61 7 3848
 0001
F: +61 7 3392
 9923
W: www.mantel.com.au
 
The information
 contained in this electronic message (e-mail)
 and any files transmitted with it, is intended
 for the named recipients only.  It may
 contain privileged and or confidential information
 and if you are not the intended recipient
 you must not copy distribute or take any
 action in reliance on it. If you have received
 this electronic message (e-mail) and any
 files transmitted with it in error please
 delete immediately and advise Mantel Solutions
 on 07 3848 0001.


--- Original
 Message ---
  
From: "David Thielen" <[EMAIL PROTECTED]>
To: "'Post all your questions
 about iText here'" 
Date: Wed, 19 Jul 2006 21:48:21
 -0600
Subject: Re: [iText-questions]
 IText doesn't seem to be thread safe?
  
We run 20
 threads at once as part of our unit test
 with no problems. My guess is that somehow
 it is using the same Document object in each
 thread (which is wrong).
 
thanks -
 dave
 

 
David
 Thielen
www.windwardreports.com
303-499-2544
 x1185
 


From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]
 On Behalf Of Peter WilkinsonSent:
 Wednesday, July 19, 2006 9:36 PMTo:
 itext-questions@lists.sourceforge.netSubject:
 [iText-questions] IText doesn't seem to be
 thread safe?

I've written
 a jsp page that produces a PDF using iText
 and it work great until 2 people try and
 run the report at the same time.
 
I get a variety
 of errors including
 
  DocumentException
 : Document is closed.
  ConcurrentModficationException
  NullPointerException
 
as well as
 pdf's that are corrupt.
 
I haven't declared
 a single thing on the page as being static. 
 All the exceptions are generated when trying
 to call a Document method so I'm wondering
 if maybe the document object isn't thread
 safe?
 
This is my
 document creation code.
 
document = new Document(PageSize.A4.rotate());
 baseFont = BaseFont.createFont("Helvetica",
 BaseFont.WINANSI, false);  font
 = new Font(baseFont, defaultFontSize); totalFont
 = new Font(baseFont, 9); totalFont.setStyle(Font.BOLD); heading1Font
 = new Font(baseFont, 20, Font.BOLDITALIC,
 new Color(0, 0, 0)); heading2Font
 = new Font(baseFont, 17, Font.BOLDITALIC,
 new Color(0, 0, 0)); heading3Font
 = new Font(baseFont, 14, Font.BOLDITALIC,
 new Color(0, 0, 0)); defaultLayoutCell
 = new Cell(); defaultLayoutCell.setBorder(Rectangle.NO_BORDER);
 ByteArrayOutputStream baos = new
 ByteArrayOutputStream(); writer
 = PdfWriter.getInstance(document, baos);  //writer.setEncryption(false,
 "", "", PdfWriter.AllowCopy | PdfWriter.AllowPrinting);
 PageEventHandler pageEventHandler
 = new PageEventHandler();
 writer.setPageEvent(pageEventHandler); writer.setViewerPreferences(PdfWriter.PageModeUseOutlines);
 // step 3: we open the document document.open();
 
Regards
 
Peter Wilkinson
Syste

Re: [iText-questions] IText doesn't seem to be thread safe?

2006-07-19 Thread Eliasen Jan



Hi
 
I am not a java expert, but I think that the code line you 
have posted doesn't prove anything. We need to se where you ahve declared the 
"document" variable and not where you assign something to 
it.
 


Med venlig 
hilsenJan 
Eliasen
WM-dataFredrik Bajers Vej 19220  
Aalborg ØstTel.: +45 9630 5800, direkte: 
+45 9630 5818Mobil: +45 2518 8024, fax: +45 9630 5805mailto: 
[EMAIL PROTECTED]http://www.wmdata.dk
 


From: 
[EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of Peter 
WilkinsonSent: 20. juli 2006 06:05To: Post all your 
questions about iText hereSubject: Re: [iText-questions] IText 
doesn't seem to be thread safe?

I don't see how that can be with the code I've 
given?
 
The document is created with
 
document = new Document(PageSize.A4.rotate());
 
 
Regards
 
Peter Wilkinson
System Developer
Mantel Solutions Pty Ltd
 
PO Box 98, 35 Hamilton Road
Moorooka QLD 4105
 
P: +61 7 3848 0001
F: +61 7 3392 9923
W: www.mantel.com.au
 
The information contained in this electronic 
message (e-mail) and any files transmitted with it, is intended for the named 
recipients only.  It may contain privileged and or confidential information 
and if you are not the intended recipient you must not copy distribute or take 
any action in reliance on it. If you have received this electronic message 
(e-mail) and any files transmitted with it in error please delete immediately 
and advise Mantel Solutions on 07 3848 0001.


--- Original Message 
---
  
From: "David Thielen" <[EMAIL PROTECTED]>
To: "'Post all your questions about iText here'" 
Date: Wed, 19 Jul 2006 21:48:21 -0600
Subject: Re: [iText-questions] IText doesn't seem to be thread 
safe?
  
We run 20 threads at once as part of our unit test with no 
problems. My guess is that somehow it is using the same Document object in each 
thread (which is wrong).
 
thanks - dave
 

 
David Thielen
www.windwardreports.com
303-499-2544 x1185
 


From: 
[EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of Peter 
WilkinsonSent: Wednesday, July 19, 2006 9:36 PMTo: 
itext-questions@lists.sourceforge.netSubject: [iText-questions] IText 
doesn't seem to be thread safe?

I've written a jsp page that produces a PDF using 
iText and it work great until 2 people try and run the report at the same 
time.
 
I get a variety of errors including
 
  DocumentException : Document is 
closed.
  ConcurrentModficationException
  NullPointerException
 
as well as pdf's that are corrupt.
 
I haven't declared a single thing on the page as 
being static.  All the exceptions are generated when trying to call a 
Document method so I'm wondering if maybe the document object isn't thread 
safe?
 
This is my document creation code.
 
document = new Document(PageSize.A4.rotate());
 baseFont = BaseFont.createFont("Helvetica", BaseFont.WINANSI, 
false);  font = new Font(baseFont, 
defaultFontSize); totalFont = new Font(baseFont, 
9); totalFont.setStyle(Font.BOLD); heading1Font = new 
Font(baseFont, 20, Font.BOLDITALIC, new Color(0, 0, 0)); heading2Font = 
new Font(baseFont, 17, Font.BOLDITALIC, new Color(0, 0, 
0)); heading3Font = new Font(baseFont, 14, Font.BOLDITALIC, new 
Color(0, 0, 0)); defaultLayoutCell = new 
Cell(); defaultLayoutCell.setBorder(Rectangle.NO_BORDER);
 ByteArrayOutputStream baos = new 
ByteArrayOutputStream(); writer = PdfWriter.getInstance(document, 
baos);  //writer.setEncryption(false, "", "", PdfWriter.AllowCopy 
| PdfWriter.AllowPrinting);
 PageEventHandler pageEventHandler = new PageEventHandler();
 writer.setPageEvent(pageEventHandler); writer.setViewerPreferences(PdfWriter.PageModeUseOutlines);
 // step 3: we open the document document.open();
 
Regards
 
Peter Wilkinson
System Developer
Mantel Solutions Pty Ltd
 
PO Box 98, 35 Hamilton Road
Moorooka QLD 4105
 
P: +61 7 3848 0001
F: +61 7 3392 9923
W: www.mantel.com.au
 
The information contained in this electronic 
message (e-mail) and any files transmitted with it, is intended for the named 
recipients only.  It may contain privileged and or confidential information 
and if you are not the intended recipient you must not copy distribute or take 
any action in reliance on it. If you have received this electronic message 
(e-mail) and any files transmitted with it in error please delete immediately 
and advise Mantel Solutions on 07 3848 0001.



-Take 
Surveys. Earn Cash. Influence the Future of ITJoin SourceForge.net's Techsay 
panel and you'll get the chance to share youropinions on IT & business 
topics through brief surveys -- and earn 
cashhttp://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV



Re: [iText-questions] IText doesn't seem to be thread safe?

2006-07-19 Thread Peter Wilkinson



I don't see
 how that can be with the code I've given?
 
The document
 is created with
 
document = new Document(PageSize.A4.rotate());
 
 
Regards
 
Peter Wilkinson
System Developer
Mantel Solutions
 Pty Ltd
 
PO Box 98,
 35 Hamilton Road
Moorooka QLD
 4105
 
P: +61 7 3848
 0001
F: +61 7 3392
 9923
W: www.mantel.com.au
 
The information
 contained in this electronic message (e-mail)
 and any files transmitted with it, is intended
 for the named recipients only.  It may
 contain privileged and or confidential information
 and if you are not the intended recipient
 you must not copy distribute or take any
 action in reliance on it. If you have received
 this electronic message (e-mail) and any
 files transmitted with it in error please
 delete immediately and advise Mantel Solutions
 on 07 3848 0001.


--- Original
 Message ---
  
From: "David Thielen" <[EMAIL PROTECTED]>
To: "'Post all your questions
 about iText here'" 
Date: Wed, 19 Jul 2006 21:48:21
 -0600
Subject: Re: [iText-questions]
 IText doesn't seem to be thread safe?
  
We run 20
 threads at once as part of our unit test
 with no problems. My guess is that somehow
 it is using the same Document object in each
 thread (which is wrong).
 
thanks -
 dave
 

 
David
 Thielen
www.windwardreports.com
303-499-2544
 x1185
 


From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]
 On Behalf Of Peter WilkinsonSent:
 Wednesday, July 19, 2006 9:36 PMTo:
 itext-questions@lists.sourceforge.netSubject:
 [iText-questions] IText doesn't seem to be
 thread safe?

I've written
 a jsp page that produces a PDF using iText
 and it work great until 2 people try and
 run the report at the same time.
 
I get a variety
 of errors including
 
  DocumentException
 : Document is closed.
  ConcurrentModficationException
  NullPointerException
 
as well as
 pdf's that are corrupt.
 
I haven't declared
 a single thing on the page as being static. 
 All the exceptions are generated when trying
 to call a Document method so I'm wondering
 if maybe the document object isn't thread
 safe?
 
This is my
 document creation code.
 
document = new Document(PageSize.A4.rotate());
 baseFont = BaseFont.createFont("Helvetica",
 BaseFont.WINANSI, false);  font
 = new Font(baseFont, defaultFontSize); totalFont
 = new Font(baseFont, 9); totalFont.setStyle(Font.BOLD); heading1Font
 = new Font(baseFont, 20, Font.BOLDITALIC,
 new Color(0, 0, 0)); heading2Font
 = new Font(baseFont, 17, Font.BOLDITALIC,
 new Color(0, 0, 0)); heading3Font
 = new Font(baseFont, 14, Font.BOLDITALIC,
 new Color(0, 0, 0)); defaultLayoutCell
 = new Cell(); defaultLayoutCell.setBorder(Rectangle.NO_BORDER);
 ByteArrayOutputStream baos = new
 ByteArrayOutputStream(); writer
 = PdfWriter.getInstance(document, baos);  //writer.setEncryption(false,
 "", "", PdfWriter.AllowCopy | PdfWriter.AllowPrinting);
 PageEventHandler pageEventHandler
 = new PageEventHandler();
 writer.setPageEvent(pageEventHandler); writer.setViewerPreferences(PdfWriter.PageModeUseOutlines);
 // step 3: we open the document document.open();
 
Regards
 
Peter Wilkinson
System Developer
Mantel Solutions
 Pty Ltd
 
PO Box 98,
 35 Hamilton Road
Moorooka QLD
 4105
 
P: +61 7 3848
 0001
F: +61 7 3392
 9923
W: www.mantel.com.au
 
The information
 contained in this electronic message (e-mail)
 and any files transmitted with it, is intended
 for the named recipients only.  It may
 contain privileged and or confidential information
 and if you are not the intended recipient
 you must not copy distribute or take any
 action in reliance on it. If you have received
 this electronic message (e-mail) and any
 files transmitted with it in error please
 delete immediately and advise Mantel Solutions
 on 07 3848 0001.



-Take
 Surveys. Earn Cash. Influence the Future
 of ITJoin SourceForge.net's Techsay panel
 and you'll get the chance to share youropinions
 on IT & business topics through brief
 surveys -- and earn cashhttp://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


___iText-questions
 mailing listiText-questions@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/itext-questions


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions


Re: [iText-questions] IText doesn't seem to be thread safe?

2006-07-19 Thread David Thielen



We run 20 threads at once as part of our unit test with no 
problems. My guess is that somehow it is using the same Document object in each 
thread (whihc is wrong).
 
thanks - dave
 

 
David Thielen
www.windwardreports.com
303-499-2544 x1185
 


From: 
[EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of Peter 
WilkinsonSent: Wednesday, July 19, 2006 9:36 PMTo: 
itext-questions@lists.sourceforge.netSubject: [iText-questions] IText 
doesn't seem to be thread safe?

I've written a jsp page that produces a PDF using 
iText and it work great until 2 people try and run the report at the same 
time.
 
I get a variety of errors including
 
  DocumentException : Document is 
closed.
  ConcurrentModficationException
  NullPointerException
 
as well as pdf's that are corrupt.
 
I haven't declared a single thing on the page as 
being static.  All the exceptions are generated when trying to call a 
Document method so I'm wondering if maybe the document object isn't thread 
safe?
 
This is my document creation code.
 
document = new Document(PageSize.A4.rotate());
 baseFont = BaseFont.createFont("Helvetica", BaseFont.WINANSI, 
false);  font = new Font(baseFont, 
defaultFontSize); totalFont = new Font(baseFont, 
9); totalFont.setStyle(Font.BOLD); heading1Font = new 
Font(baseFont, 20, Font.BOLDITALIC, new Color(0, 0, 0)); heading2Font = 
new Font(baseFont, 17, Font.BOLDITALIC, new Color(0, 0, 
0)); heading3Font = new Font(baseFont, 14, Font.BOLDITALIC, new 
Color(0, 0, 0)); defaultLayoutCell = new 
Cell(); defaultLayoutCell.setBorder(Rectangle.NO_BORDER);
 ByteArrayOutputStream baos = new 
ByteArrayOutputStream(); writer = PdfWriter.getInstance(document, 
baos);  //writer.setEncryption(false, "", "", PdfWriter.AllowCopy 
| PdfWriter.AllowPrinting);
 PageEventHandler pageEventHandler = new PageEventHandler();
 writer.setPageEvent(pageEventHandler); writer.setViewerPreferences(PdfWriter.PageModeUseOutlines);
 // step 3: we open the document document.open();
 
Regards
 
Peter Wilkinson
System Developer
Mantel Solutions Pty Ltd
 
PO Box 98, 35 Hamilton Road
Moorooka QLD 4105
 
P: +61 7 3848 0001
F: +61 7 3392 9923
W: www.mantel.com.au
 
The information contained in this electronic 
message (e-mail) and any files transmitted with it, is intended for the named 
recipients only.  It may contain privileged and or confidential information 
and if you are not the intended recipient you must not copy distribute or take 
any action in reliance on it. If you have received this electronic message 
(e-mail) and any files transmitted with it in error please delete immediately 
and advise Mantel Solutions on 07 3848 0001.

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions


[iText-questions] IText doesn't seem to be thread safe?

2006-07-19 Thread Peter Wilkinson



I've written
 a jsp page that produces a PDF using iText
 and it work great until 2 people try and
 run the report at the same time.
 
I get a variety
 of errors including
 
  DocumentException
 : Document is closed.
  ConcurrentModficationException
  NullPointerException
 
as well as
 pdf's that are corrupt.
 
I haven't declared
 a single thing on the page as being static. 
 All the exceptions are generated when trying
 to call a Document method so I'm wondering
 if maybe the document object isn't thread
 safe?
 
This is my
 document creation code.
 
document = new Document(PageSize.A4.rotate());
 baseFont = BaseFont.createFont("Helvetica",
 BaseFont.WINANSI, false);  font
 = new Font(baseFont, defaultFontSize); totalFont
 = new Font(baseFont, 9); totalFont.setStyle(Font.BOLD); heading1Font
 = new Font(baseFont, 20, Font.BOLDITALIC,
 new Color(0, 0, 0)); heading2Font
 = new Font(baseFont, 17, Font.BOLDITALIC,
 new Color(0, 0, 0)); heading3Font
 = new Font(baseFont, 14, Font.BOLDITALIC,
 new Color(0, 0, 0)); defaultLayoutCell
 = new Cell(); defaultLayoutCell.setBorder(Rectangle.NO_BORDER);
 ByteArrayOutputStream baos = new
 ByteArrayOutputStream(); writer
 = PdfWriter.getInstance(document, baos);  //writer.setEncryption(false,
 "", "", PdfWriter.AllowCopy | PdfWriter.AllowPrinting);
 PageEventHandler pageEventHandler
 = new PageEventHandler();
 writer.setPageEvent(pageEventHandler); writer.setViewerPreferences(PdfWriter.PageModeUseOutlines);
 // step 3: we open the document document.open();
 
Regards
 
Peter Wilkinson
System Developer
Mantel Solutions
 Pty Ltd
 
PO Box 98,
 35 Hamilton Road
Moorooka QLD
 4105
 
P: +61 7 3848
 0001
F: +61 7 3392
 9923
W: www.mantel.com.au
 
The information
 contained in this electronic message (e-mail)
 and any files transmitted with it, is intended
 for the named recipients only.  It may
 contain privileged and or confidential information
 and if you are not the intended recipient
 you must not copy distribute or take any
 action in reliance on it. If you have received
 this electronic message (e-mail) and any
 files transmitted with it in error please
 delete immediately and advise Mantel Solutions
 on 07 3848 0001.



-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions