java.lang.RuntimeException: Velocity could not be initialized!

I developed on my win machine, so I guess I ran in this error a bit too late smile

The test server is a linux machine now and I guess I have to specify where the log should exist?

Whole exception:

http://pastebin.com/hqDrWm23

 

Thx in advance

 

7 answers

This widget could not be displayed.

Could you give a bit of background? What's your question?

This widget could not be displayed.

I created a new Velocity object:

VelocityEngine ve = new VelocityEngine()

I used it with a VelocityContext and everything worked fine on my Win machine. I guess there was no problem to create the velocity.log but now on linux on my test server it crashes.

After that I thought that pulling Velocity from the ComponentAccessor will be a better way and maybe there everything is configured. That last bit I´ll try tomorrow.

This widget could not be displayed.

Ok, I tried this way now:

VelocityManager velocityManager = ComponentAccessor.getVelocityManager()

Map<String, Object> context = new HashMap<String, Object>()

context.put("issueSummary", "summary")
context.put("issueKey", "SD-678")

Path path = Paths.get(this.class.getResource("view/email/subject.vm").toURI())

log.debug(velocityManager.getBody(path.parent.toString(), path.fileName.toString(), context))

But that will throw a much bigger exception:

http://pastebin.com/GJs4DuCh

Can someone point me the correct way to go here?

 

This widget could not be displayed.

Why are you passing just the filename? Yours Paths stuff is wrong and not necessary.

This widget could not be displayed.

Because the method is:

public String getBody(String templateDirectory, String template, Map<String, Object> contextParameters) throws VelocityException

Do you have an working example?

You meant this, right? :o

velocityManager.getEncodedBodyForContent(this.class.getResource("view/email/subject.vm").getText("utf-8"), "", context)
This widget could not be displayed.

Oh right... sorry. I don't have any problem with this, so don't think I can help...

Does that last line right?

This widget could not be displayed.

The last one works fine!

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 22, 2018 in Marketplace Apps

How a Marketplace app tech team is achieving gender diversity

Hello! My name is Genevieve Blanch, and I'm the Marketing Manager at RefinedWiki, creators of apps to give teams the tools to customize Atlassian platforms. Currently, 44% of the tech team at Re...

531 views 3 19
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you