Importing JAR Libraries into Script Unit

28 Sep '14, 11:29 AM
No Forum Badges

Hi everyone,

I'm using a script unit to parse a JSON text.

In order to do this I'm importing the following libraries:

 - com.fasterxml.jackson.core

 - com.fasterxml.jackson.databind

I copied the listed libraries jars into /WebContent/WEB-INF/lib.

As soon as I open the page that should trigger the script the following error is returned:

"startup failed, script1411896046863.groovy: 2: unable to resolve class com.fasterxml.jackson.core @ line 2, column 1.script1411896046863.groovy: 3: unable to resolve class com.fasterxml.jackson.databind @ line 3, column 1.script1411896046863.groovy: 7: unable to resolve class ObjectMapper @ line 7, column 14.script1411896046863.groovy: 7: unable to resolve class ObjectMapper @ line 7, column 23.script1411896046863.groovy: 9: unable to resolve class JsonNode @ line 9, column 10.script1411896046863.groovy: 9: unable to resolve class ObjectMapper @ line 9, column 17.script1411896046863.groovy: 11: unable to resolve class JsonNode @ line 11, column 10.script1411896046863.groovy: 11: unable to resolve class JsonNode @ line 11, column 21.script1411896046863.groovy: 13: unable to resolve class JsonNode @ line 13, column 8. 9 errors"

It seems like the libraries are not present, but they actually are in the lib folder.





x 0
Answer Answer at this question and get points!
Forum Starter - Level 3

Hello Davide. 

To add custom Json libraries that is not comming by default in WebRatio. 


You can create in your Web Application project (In the WebRatio Explorer) a Folder named WebContent, inside this Folder create WEB-INF folder and inside this create lib. 

Then inside lib folder you can add all the external .jar libraries and run in your Script component. Just make sure you read your Custom Library documentation and you can import as normal. 

import org.Library. etc. etc. 



x 2
Forum Starter - Level 3


did you add, just after #input and #output directives, lines such as:

import com.fasterxml.jackson.core.YourClasses

import com.fasterxml.jackson.databind.YourClasses

as appropriate?


x 0
No Forum Badges

Yes I did. 

#input String json

#output String param

import com.fasterxml.jackson.core

import com.fasterxml.jackson.databind



x 0
Forum Starter - Level 3

Hi Davide

as far as I know, in an import directive you should specify a class, or all the classes in a package. When you state "import com.fasterxml.jackson.core", you are addressing a java package, not a Class.

Try to import each class you really need, I mean:

import com.fasterxml.jackson.core.YourClass

(substitute YourClass with the actual one), or all the classes in that package with:

import com.fasterxml.jackson.core.*

This should be correct. Let me know.


x 0
Answer at this question and get points!

Related questions

add html Add logging capability to a Groovy script (unit) Add select all to Checkable List AJAX events problem to external JavaScript Automatic file upload Content module page variable won't assign. Convert selector component result to single value Could not open the editor: This copy of WebRatio is not registered Criptare dati sensibili nel database Data flow from a page which is not visible anymore Execute truncate sql query Export XML file analysis then update MySQL database Get size of Multi Form with Pictures Object Array Getting the absolute path of a RTXBLOBData Groovy and Database Groovy script numer after an error How can I add a credit card payment gateway or integrate paypal in my web app logic? How can i add html into a page? How can I import a view in the Domain Model as an attribute of an Entity? how can i open a pdf file using download dialog How to calculate dates between start and end point? How to Retreive data from Multi Selection Field Array Import an XPDL 2.2 file into a BPM Project Importing jar library JAR importing Merge the result of 2 (or more) flows Missing units when importing project [MOBILE] Script doesn't work! Modifica Entità tramite file xml Modify generated code / inject own HTML, Javascript code into existing generted code. Non riesco a fare funzionare Xml out unit Process model import in other languages script component Script eseguito alla User Login Script Unit e Mysql ScritpUnit and JSON data Setting Upload directory Shuffling Script Standard confirm dialog replacement Unable to execute the script java.lang.NullPointerException upload file and the move it to other location WebRatio 6.1.2: Groovy Version / Versione Groovy Web Ratio Mobile and Foreign Key WebRatio no imports all attributes (fields) of a table