Comments (6)
Just realised that I was running a slightly old version of Jinjava, updated to 2.1.11 and unfortunately still having the same issue.
from jinjava.
@matthewrk, this sounds like the same issue you're having. #39
from jinjava.
@boulter thanks!, it seems that it is indeed related but I can't seem to find what the conflict is.
I started a blank project with the test case from #39 and sure enough it worked, so then I copied in my dependencies for Spring Boot and it produced the error that I described above.
This is my maven file for my simple test project:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>JinJavaTest</groupId>
<artifactId>JinJavaTest</artifactId>
<version>1.0-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.7.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.hubspot.jinjava</groupId>
<artifactId>jinjava</artifactId>
<version>2.1.0</version>
</dependency>
</dependencies>
</project>
And this is the dependency tree (just from mvn dependency:tree):
[INFO] JinJavaTest:JinJavaTest:jar:1.0-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:1.3.7.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter:jar:1.3.7.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot:jar:1.3.7.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-autoconfigure:jar:1.3.7.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:1.3.7.RELEASE:compile
[INFO] | | | +- ch.qos.logback:logback-classic:jar:1.1.7:compile
[INFO] | | | | \- ch.qos.logback:logback-core:jar:1.1.7:compile
[INFO] | | | +- org.slf4j:jcl-over-slf4j:jar:1.7.21:compile
[INFO] | | | +- org.slf4j:jul-to-slf4j:jar:1.7.21:compile
[INFO] | | | \- org.slf4j:log4j-over-slf4j:jar:1.7.21:compile
[INFO] | | +- org.springframework:spring-core:jar:4.2.7.RELEASE:compile
[INFO] | | \- org.yaml:snakeyaml:jar:1.16:runtime
[INFO] | +- org.springframework.boot:spring-boot-starter-validation:jar:1.3.7.RELEASE:compile
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.0.36:compile
[INFO] | | \- org.hibernate:hibernate-validator:jar:5.2.4.Final:compile
[INFO] | | +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] | | +- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile
[INFO] | | \- com.fasterxml:classmate:jar:1.1.0:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.6.7:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.6.7:compile
[INFO] | | \- com.fasterxml.jackson.core:jackson-core:jar:2.6.7:compile
[INFO] | +- org.springframework:spring-web:jar:4.2.7.RELEASE:compile
[INFO] | | +- org.springframework:spring-aop:jar:4.2.7.RELEASE:compile
[INFO] | | | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] | | +- org.springframework:spring-beans:jar:4.2.7.RELEASE:compile
[INFO] | | \- org.springframework:spring-context:jar:4.2.7.RELEASE:compile
[INFO] | \- org.springframework:spring-webmvc:jar:4.2.7.RELEASE:compile
[INFO] | \- org.springframework:spring-expression:jar:4.2.7.RELEASE:compile
[INFO] \- com.hubspot.jinjava:jinjava:jar:2.1.0:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.7.21:compile
[INFO] +- com.google.guava:guava:jar:17.0:compile
[INFO] +- org.javassist:javassist:jar:3.18.1-GA:compile
[INFO] +- org.jsoup:jsoup:jar:1.8.1:compile
[INFO] +- de.odysseus.juel:juel-api:jar:2.2.7:compile
[INFO] +- de.odysseus.juel:juel-impl:jar:2.2.7:compile
[INFO] +- de.odysseus.juel:juel-spi:jar:2.2.7:runtime
[INFO] +- org.apache.commons:commons-lang3:jar:3.4:compile
[INFO] \- com.google.code.findbugs:annotations:jar:3.0.0:compile
In that state it errors with:
[TemplateError{severity=FATAL, reason=SYNTAX_ERROR, message=TemplateSyntaxException: Method not found: class com.hubspot.jinjava.lib.filter.UpperFilter.filter(java.lang.String, com.hubspot.jinjava.interpret.JinjavaInterpreter), fieldName=null, lineno=1}]
08:41:04.718 [main] DEBUG jinjava - hello {{ testvar | upper }}
But by simply moving the JinJava dependency to the top of the dependencies list, it works. That is true of both my simple test project and my main project where I originally experienced the issue. So it seems to be a conflict somewhere, I just don't know where! I can't see any shared libraries in the dependency tree.
from jinjava.
My guess is it's this line:
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.0.36:compile
try excluding that.
from jinjava.
@boulter yep that did the trick, along with org.glassfish.javax.el:3.0.0 which comes from undertow on my main project.
I'm fairly new to Java so sorry if this is a stupid question, but these are all EL packages, which a bit of googling tells me are "Expression Language" packages. Are they all alternate implementations of the same interface? Having a hard time gauging the significance of these excludes and what exactly is happening here. Thanks for your help so far.
from jinjava.
Here's some background on Java's EL. https://en.wikipedia.org/wiki/Unified_Expression_Language. Tomcat includes an implementation of EL 3.0 whereas Jinjava uses JUEL's 2.0 implementation.
from jinjava.
Related Issues (20)
- Can Dict key be an integer? HOT 2
- CVEs in current version: 2.7.0
- time for 2.7.1 / 2.8.0 ?
- Unexpected behavior comparing empty strings to 0
- Is the expression interpolation recursive? HOT 1
- Problem with using the function in nested interpretation HOT 2
- SnakeYAML 1.27 vulnerability in Jinjava 2.7.1 HOT 1
- Add {% hubl %} tag
- Maps in string representation in Сontext
- Support for "with" statement
- Resolve function with map like contructs HOT 1
- Mixing include and extends does not work
- Fix CVEs in version 2.7.1
- Inconsistent implementation with jinja2 HOT 1
- trouble with coercision in test
- Add support for java records HOT 1
- Rendering template with custom function in Scala throws NullPointerException HOT 4
- [question] receiving fixes flow // GHSA-h75v-3vvj-5mfj CVE-2024-34064 HOT 2
- upgrade commons-net to 3.10.0
- Fix eager execution handling of `{% print foo|render %}`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jinjava.