I have the following Velocity template in JIRA (note, extra lines kept in):
NOTE: Please REPLY-TO this email when replying to this issue.
##parse("templates/email/includes/issueplugins.vm")
#if($comment.getId())[ ${baseurl}/browse/${issue.getKey()} ] #end ##?page=${tabpanel-comment}&focusedCommentId=${comment.getId()}#action_${comment.getId()} ] #end
#if($remoteUser.fullName)
$i18n.getText("template.issue.commented.on", $remoteUser.fullName, $issue.getKey())
#dashes($!remoteUser.fullName)--------------#dashes($issue.getKey())-
#end
#if($changelog)
#changes([])
#end
#comment()
#visibility()
#parse("templates/email/text/includes/issuesummary.vm")
#parse("templates/email/text/includes/footer.vm")
There is no line following that last line. When do I this on the very last line:
##parse("templates/email/text/includes/footer.vm")
I get the following error:
An error occurred whilst rendering this message. Please contact the administrators, and inform them of this bug.
Details:
-------
org.apache.velocity.exception.ParseErrorException: Lexical error:
org.apache.velocity.runtime.parser.TokenMgrError:
Lexical error at line 20, column 51. Encountered: <EOF> after : ""
at org.apache.velocity.app.VelocityEngine.evaluate(VelocityEngine.java:272)
at org.apache.velocity.app.VelocityEngine.evaluate(VelocityEngine.java:202)
...
I found the following issue from 2004:
https://issues.apache.org/jira/browse/VELOCITY-272
Which seems to suggest this was a bug fixed in 1.5. Checking in my JIRA System Info, I see that JIRA 4.2.1 appears to suggest version 1.6 is in use:
Atlassian Template Renderer Velocity 1.6 Plugin - 1.1.1
When I move the line starting #if($comment.getId()) to the end, the error goes away. Am I doing something wrong here at the end of the template, or is this a bug?
EDIT
Hmm. When I did this:
#if($comment.getId())[ ${baseurl}/browse/${issue.getKey()} ] #end ##?page=${tabpanel-comment}&focusedCommentId=${comment.getId()}#action_${comment.getId()} ] #end
As the last line, with no empty line following it, I got the same error. However, if I add a line after that line (just hit ENTER once), it works.
Do Velocity template's require an ending space? I'm confused.
~/tech/atlassian/atlassian-jira-4.4.1-standalone $ find . -name "*velocity*.jar"
./atlassian-jira/WEB-INF/lib/velocity-1.4-atlassian-9.jar
./atlassian-jira/WEB-INF/lib/velocity-tools-1.3.jar
./atlassian-jira/WEB-INF/lib/atlassian-velocity-0.8.jar
And no, they haven't; see this discussion from a few days ago..
Related
I would like to determine whether the javadoc command that we issue from a makefile encounters any errors or warnings. Currently, I can see that we're encountering errors due to import statements that are not on the classpath that we specify to javadoc (but should be). I ultimately want to fix our javadoc invocation and content and then lock it down so that any error or warning will be caught by the makefile and stop the build. However, as far as I can tell, the documentation does not mention any return code values from the javadoc command. Note that we're using Java 7 and running javadoc from a command in a GNU makefile, not from Ant or Maven. What do you recommend that I do?
UPDATE: My command looks like this:
<path1>/javadoc -overview <path2>/overview.html -sourcepath <path3> <file1> <file2> <dir1> <dir2> -d <output_dir>
There's nothing I can see in that call that would cause errors to be treated as warnings.
Here's a fragment from the output that shows the error/warning messages I'm seeing:
....
Constructing Javadoc information...
../../../<path>/<filename>.java:5: error: package javax.servlet.http does not exist
import javax.servlet.http.HttpSessionBindingEvent;
....
The word "error" appears in them, but at the end, the output says only "50 warnings". If I add another issue (such as the #invalid tag suggested in one of the answers), I get 51 warnings.
I just tried from the commandline, when no errors are present, a value of zero is returned:
> javadoc my.package.name
> ....
> echo $?
> 0
After editing a javadoc command with:
/**
* #invalid
*/
and running the same javadoc command again, I get an error message and a return code of 1:
> javadoc my.package.name
> ....
> ./my/package/name/Coordinate.java:21: error: unknown tag: invalid
> * #invalid
> ^
> ....
> echo $?
> 1
So you just should check if the return value of javadoc is 0 or not. If you do not know how to check that return, read this SO question and answer
Even though javadoc 1.7 reports errors, it returns with a zero return value, so the build doesn't catch it. However, javadoc 1.8 returns with a nonzero return value, which the build does catch.
I am using the below piece of code to copy and filter the properties from the properties file and it is working fine.There are one variable which is not static and I need to pass as a paramter so it could work on correct file.I am using -Penv=test or -Penv=at but I am getting the error.
task createLocalProp(type:Copy) << {
from "templates/local.properties.template"
into ("$buildDir/properties")
def myProps = new Properties()
file("Properties/${env}/local_${env}.properties").withInputStream{
myProps.load(it);
}
filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: myProps)
}
Error:
C:\GRADLE_WORK\XXXX-GRADLE>gradle -b build_localprop.gradle createLocalProp -Pen
v=test
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\GRADLE_WORK\XXX-GRADLE\build_localprop.gradle' line: 37
* What went wrong:
Could not compile build file 'C:\GRADLE_WORK\XXXX-GRADLE\build_localprop.gradle'
.
> startup failed:
build file 'C:\GRADLE_WORK\XXX-GRADLE\build_localprop.gradle': 37: expecting
EOF, found '<<' # line 37, column 33.
task createLocalProp(type:Copy) << {
^
1 error
I'm not sure right now why the compiler error happens, but you should not configure the task in execution phase, but in configuration phase. << syntax is a shortcut for doLast and thus even if it would compile it would probably not work as expected. Remove the << and probably everything is ok.
I ran into a similar error reporting the bottom of my gradle file had an error. In reality it was a missing closing bracket in the middle of the file that I missed when doing a diff merge conflict.
I am planing to install head pluging for elasticsearch.
in both these two official documentation, http://mobz.github.io/elasticsearch-head/ and http://docs.couchbase.com/admin/elastic/install-plugin.html they said to use this:
bin/plugin -install mobz/elasticsearch-head
I did, but i got the following error:
PS C:\elasticsearch-1.3.9\elasticsearch-1.3.9> bin/plugin -install mobz/elasticsearch-head
Exception in thread "main" org.elasticsearch.common.settings.SettingsException: Failed to load settings from [file:/C:/
lasticsearch-1.3.9/elasticsearch-1.3.9/config/elasticsearch.yml]
at org.elasticsearch.common.settings.ImmutableSettings$Builder.loadFromStream(ImmutableSettings.java:947)
at org.elasticsearch.common.settings.ImmutableSettings$Builder.loadFromUrl(ImmutableSettings.java:931)
at org.elasticsearch.node.internal.InternalSettingsPreparer.prepareSettings(InternalSettingsPreparer.java:77)
at org.elasticsearch.plugins.PluginManager.main(PluginManager.java:382)
Caused by: unacceptable character ' ' (0x0) special characters are not allowed
in "'reader'", position 13489
at org.elasticsearch.common.jackson.dataformat.yaml.snakeyaml.reader.StreamReader.checkPrintable(StreamReader.j
va:93)
at org.elasticsearch.common.jackson.dataformat.yaml.snakeyaml.reader.StreamReader.update(StreamReader.java:192)
at org.elasticsearch.common.jackson.dataformat.yaml.snakeyaml.reader.StreamReader.peek(StreamReader.java:146)
at org.elasticsearch.common.jackson.dataformat.yaml.snakeyaml.scanner.ScannerImpl.scanToNextToken(ScannerImpl.j
va:1199)
at org.elasticsearch.common.jackson.dataformat.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.j
va:289)
at org.elasticsearch.common.jackson.dataformat.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:2
6)
at org.elasticsearch.common.jackson.dataformat.yaml.snakeyaml.parser.ParserImpl$ParseImplicitDocumentStart.prod
ce(ParserImpl.java:195)
at org.elasticsearch.common.jackson.dataformat.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158)
at org.elasticsearch.common.jackson.dataformat.yaml.snakeyaml.parser.ParserImpl.getEvent(ParserImpl.java:168)
at org.elasticsearch.common.jackson.dataformat.yaml.YAMLParser.nextToken(YAMLParser.java:331)
at org.elasticsearch.common.xcontent.json.JsonXContentParser.nextToken(JsonXContentParser.java:50)
at org.elasticsearch.common.settings.loader.XContentSettingsLoader.load(XContentSettingsLoader.java:60)
at org.elasticsearch.common.settings.loader.XContentSettingsLoader.load(XContentSettingsLoader.java:45)
at org.elasticsearch.common.settings.loader.YamlSettingsLoader.load(YamlSettingsLoader.java:46)
at org.elasticsearch.common.settings.ImmutableSettings$Builder.loadFromStream(ImmutableSettings.java:944)
... 3 more
as I was trying to diagnosis the error, I found that there might b something wrong in elasticsearch.yml file. I went to that file, and opened it using notpadd++, and it was all commented except the last three-four lines, they were letters not understandable. this is a print screen of them:
could you help please
In that file you shouldn't have those chars. Remove them and start over. Or take a clean instance of ES, take the config file from that and use it.
In the http://ant.apache.org/manual/tutorial-HelloWorldWithAnt.html
echo Main-Class: oata.HelloWorld>myManifest
md build\jar
jar cfm build\jar\HelloWorld.jar myManifest -C build\classes .
java -jar build\jar\HelloWorld.jar
Note: Do not have blanks around the >-sign in the echo Main-Class instruction because it would falsify it!
Anyone know why there is such Note. I do not see any difference when we hae balnks around >-sign.
You are correct, it makes no difference. Not sure what the message on the tutorial means.
Just a guess.
It probably meant to stress the need for getting the line correctly copied. Main-Class attribute
Any value other than 'Main-Class:' will fail the jar creation.
With a white space after - Main - Class or
just before : 'Main-Class : gives the error invalid header field name: ..
EDITED
Thanks to Alvas' answer. I just learned that the following problem is caused by the 'not-so-up-to-date' NLTK since the latest 15-12-09 StanfordNLP requires more dependencies than previous versions. The exact solution to this problem is within this link https://github.com/nltk/nltk/issues/1239 as Alvas suggested.
StackOverflow identify my problem similar to this post Stanford Parser and NLTK. I still believe the two problems are different since the original one addresses more discussions on the overall proper setup of Standfordnlp while my question is focusing on the error itself. And after all, that doesn't solve my problem.
Follows is my post before I added these comments.
I've read almost all relative topics and possible solutions posted on Stackoverflow and tried them all on my computer. However, no positive result has been achieved. It is becoming frustrating everyday for an amature learning nlp and rookie in java because this problem prevents me from getting to know nltk at the very start. I would like to share the problem again and thanks again for all who tried to solve in advance.
Basically, I intend to parse Chinese characters but start from the English language. Here is the code I used (You probably have seen it because I copied it elsewhere to test):
import os
from nltk.parse import stanford
ini_path = 'C:/Users/qubo/jars/stanford-parser/'
os.environ['STANFORD_PARSER'] = ini_path + 'stanford-parser.jar'
os.environ['STANFORD_MODELS'] = ini_path + 'stanford-parser-3.6.0-models.jar'
os.environ['JAVAHOME'] = 'C:/Program Files/Java/jdk1.8.0_73/'
parser = stanford.StanfordParser(ini_path + 'stanford-parser.jar', ini_path + 'stanford-parser-3.6.0-models.jar')
sentences = parser.raw_parse_sents(("Python is fun. We should all date Python in this case."))
print (sentences)
for line in sentences:
for sentence in line:
sentence.draw()
And now I got this error msg when running parser.raw_parse_sents:
java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at edu.stanford.nlp.parser.common.ParserGrammar.<clinit>(ParserGrammar.java:46)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 1 more
Exception in thread "main"
Traceback (most recent call last):
File "C:\Users\qubo\Desktop\nltkexample.py", line 33, in <module>
sentences = parser.raw_parse_sents(("Python is fun. We should all date Python in this case."))
File "C:\Users\qubo\Miniconda2\lib\site-packages\nltk\parse\stanford.py", line 146, in raw_parse_sents
return self._parse_trees_output(self._execute(cmd, '\n'.join(sentences), verbose))
File "C:\Users\qubo\Miniconda2\lib\site-packages\nltk\parse\stanford.py", line 212, in _execute
stdout=PIPE, stderr=PIPE)
File "C:\Users\qubo\Miniconda2\lib\site-packages\nltk\internals.py", line 134, in java
raise OSError('Java command failed : ' + str(cmd))
OSError: Java command failed : ['C:/Program Files/Java/jdk1.8.0_73/bin\\java.exe', u'-mx1000m', '-cp', 'C:/Users/qubo/jars/stanford-parser/stanford-parser.jar;C:/Users/qubo/jars/stanford-parser/stanford-parser-3.6.0-models.jar', u'edu.stanford.nlp.parser.lexparser.LexicalizedParser', u'-model', u'edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz', u'-sentences', u'newline', u'-outputFormat', u'penn', u'-encoding', u'utf8', 'c:\\users\\qubo\\appdata\\local\\temp\\tmppz8u6r']
[Finished in 0.7s]
I'm using windows 64, Python 2.7.11 and all modules supporting nltk and stanford parser are updated. I've installed the jdk and jre as well. In fact, I've tried different versions and jdk (old or latest, 86 or 64), none was working.
I've tried to set java path directly in internals.py or commenting raise error lines in standford.py, still not working.
I've tried to add JAVAHOME environment variable, no use. In fact, it serves the exact same purpose as this line (as some may claim to be slightly different):
os.environ['JAVAHOME'] = 'C:/Program Files/Java/jdk1.8.0_73/'
Any thoughts? Thanks again!!!
After spending too long on this problem, I finally found the answer buried in one of the comments of this question. I think it's worth posting as a proper answer since other people might look for it here and not find it (I know I missed it at first).
The answer is in this gist, which also contains instructions on how to solve this problem for all Stanford NLTK interfaces (i.e. NER tagger, POS tagger, and all Stanford parsers).
Basically, you need to change the Parser object's classpath property with this function:
from nltk.internals import find_jars_within_path
from nltk.parse.stanford import StanfordParser
parser = StanfordParser(model_path="path/to/englishPCFG.ser.gz")
parser._classpath = tuple(find_jars_within_path(stanford_dir))
All credit for the solution goes to alvas, I'm just reposting it here so it's easier to find.
You need to download slf4j jar from here and add that on the path as well.