Error: The constructor Velocitytemplate(Inputstream) is Undefined

Asked

Viewed 118 times

-1

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 even continues to change the dependency version... Error on line 37:

.bodyHtml(new 
VelocityTemplate(getClass().getResourceAsStream("/emails/pedido.template")))
  • That class MailMessage comes from which library?

  • import com.outjected.email.api.Mailmessage;

1 answer

0


Actually I replaced the line:

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

For:

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

And it worked...

Browser other questions tagged

You are not signed in. Login or sign up in order to post.