Error: The constructor VelocityTemplate (InputStream) is undefined

0
import java.io.Serializable;
import java.util.Locale;

import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.inject.Named;

import org.apache.velocity.tools.generic.NumberTool;

import com.outjected.email.impl.templating.velocity.VelocityTemplate;

@Named
@RequestScoped
public class EnvioPedidoEmailBean implements Serializable {

private static final long serialVersionUID = 1L;

@Inject
private Mailer mailer;

@Inject
@PedidoEdicao
private Pedido pedido;

public void enviarPedido() {
    MailMessage message = mailer.novaMensagem();

    message.to(this.pedido.getCliente().getEmail())
        .subject("Pedido " + this.pedido.getId())
        .bodyHtml(new VelocityTemplate(getClass().getResourceAsStream("/emails/pedido.template")))
        .put("pedido", this.pedido)
        .put("numberTool", new NumberTool())
        .put("locale", new Locale("pt", "BR"))
        .send();

Dependency

<dependency>
    <groupId>org.apache.velocity</groupId>
    <artifactId>velocity</artifactId>
    <version>1.7</version>
    <scope>compile</scope>
</dependency>

This error continues even though the dependency version is changed ... Error on line 37:

.bodyHtml(new 
VelocityTemplate(getClass().getResourceAsStream("/emails/pedido.template")))
    
asked by anonymous 30.09.2018 / 17:59

1 answer

0

I actually replaced the line:

.bodyHtml(new VelocityTemplate(getClass().getResourceAsStream("/emails/apontamento.template")))

By:

.bodyHtml(new VelocityTemplate(new File("/emails/apontamento.template")))

And it worked ...

    
04.12.2018 / 02:05