boa tarde pessoal.
tenho esse método aqui: http://gist.github.com/572303 que gera um boleto.
coloquei isso dentro de um for:
public void gerarBoletos() {
try {
selecionarParcelasBaixa();
int mes = 0;
List<Boleto> boletos = new ArrayList<Boleto>();
for(MovimentacaoParcela mp : parcelasABaixar)
{
Aluno aluno = mp.getMovimentacao().getAluno();
String valorPagar = mp.getMovimentacao().getVlUnitario().toString();
Date dataProcessamento = new Date();
Calendar vencimento = Calendar.getInstance();
vencimento.add(Calendar.MONTH, mes);
Date dataVencimento = vencimento.getTime();
Boleto boleto = BoletoUtils.gerarBoleto(
dataProcessamento,
dataVencimento,
contaCorrente,
aluno, valorPagar, instrucoes, locaisPagamento);
boletos.add(boleto);
mes++;
}
BoletoUtils.gerarArquivoBoleto(boletos.toArray(new Boleto[boletos.size()]));
} catch (Exception e) {
e.printStackTrace();
addMensagemErro(e);
}
}
Caused by: javax.faces.el.EvaluationException: java.lang.OutOfMemoryError: Java heap space
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:98)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:98)
... 66 more
Caused by: java.lang.OutOfMemoryError: Java heap space
at com.lowagie.text.Image.getInstance(Unknown Source)
at com.lowagie.text.Image.getInstance(Unknown Source)
at br.com.caelum.stella.boleto.transformer.PDFBoletoWriter.writeImage(PDFBoletoWriter.java:117)
at br.com.caelum.stella.boleto.transformer.BoletoTransformer.transform(BoletoTransformer.java:76)
at br.com.caelum.stella.boleto.transformer.BoletoGenerator.to(BoletoGenerator.java:123)
at br.com.caelum.stella.boleto.transformer.BoletoGenerator.toPDF(BoletoGenerator.java:110)
at br.com.caelum.stella.boleto.transformer.BoletoGenerator.toPDF(BoletoGenerator.java:50)
at br.com.caelum.stella.boleto.transformer.BoletoGenerator.toPDF(BoletoGenerator.java:38)
at br.com.athus.util.BoletoUtils.gerarArquivoBoleto(BoletoUtils.java:93)
at br.com.athus.manageds.ManagedMovimentoCaixa.gerarBoletos(ManagedMovimentoCaixa.java:173)
public static void gerarArquivoBoleto(Boleto...boletos) throws IOException
{
String nomeArquivo =
CaminhoUtils.CAMINHO_PASTA_ATHUS + NossoNumeroUtils.getNossoNumeroAtual().toString()
+".pdf";
//Se gerar mais de um boleto, cria um nome aleatório para o arquivo
if (boletos.length > 1)
nomeArquivo = CaminhoUtils.CAMINHO_PASTA_ATHUS + RandomStringUtils.random(5) + ".pdf";
BoletoGenerator gerador = new BoletoGenerator(boletos);
gerador.toPDF(nomeArquivo);
//Após a geração, abre o arquivo pdf
if(Desktop.isDesktopSupported())
Desktop.getDesktop().open(new File(nomeArquivo));
}
li em um posto do blog da caelum que o stella boleto consome memória...tem algo que possa ser feito?



era só o cnpj mesmo