java - Apache Velocity - Failed to eval script due to slf4j dependencies -


continue previous question i'm failing execute scripting in velocity 2.0,

i use jars: velocity-engine-scripting-2.0.jar, velocity-engine-scripting-2.0.jar, commons-collections-3.2.2.jar

i'm trying follow developer guide example:

scriptenginemanager manager = new scriptenginemanager(); manager.registerenginename("velocity", new velocityscriptenginefactory()); scriptengine engine = manager.getenginebyname("velocity");   system.setproperty(velocityscriptengine.velocity_properties, "path/to/velocity.properties"); string script = "hello $world"; writer writer = new stringwriter(); engine.getcontext().setwriter(writer); object result = engine.eval(script); system.out.println(writer); 

i'm getting slf4j error when init, i'm using slf4j-jdk14.jar. didn't find solution fir specific error after adding slf4j-api-1.8.0-alpha2.jar

class org.apache.velocity.script.velocityscriptengine java.lang.nosuchmethoderror: org.slf4j.logger.trace(ljava/lang/string;)v     @ org.apache.velocity.runtime.runtimeinstance.init(runtimeinstance.java:233)     @ org.apache.velocity.script.velocityscriptengine.initvelocityengine(velocityscriptengine.java:212)     @ org.apache.velocity.script.velocityscriptengine.compile(velocityscriptengine.java:299)     @ org.apache.velocity.script.velocityscriptengine.compile(velocityscriptengine.java:288) 
  • notice don't use logging in class don't need migration slf4j.

edit 1:

i found interesting comment in slf4j faq velocity:

the logging strategy adopted velocity project example of "custom logging abstraction" anti-pattern. adopting independent logging abstraction strategy, velocity developers have made life harder themselves, more importantly, made life harder users.

edit 2:

velocity dependencies in runtime are: slf4j-api 1.7.25 , commons-lang 3.5 added classpath still same error

the documentation excerpt found in faq outdated.

the dependencies page states while slf4j-api needed @ compile , runtime, need choose 1 of slf4j bindings, instance slf4j-simple log stderr default.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -