Jump to content
Changes to the Jaspersoft community edition download ×

Scriptlet path.


2004 IR Help

Recommended Posts

By: Alexander Wallace - aows

Scriptlet path.

2004-11-29 18:53

Hi. Is it possible to indicate the path to a scriptlet class? I placed it right where the compiled xml (the jasper file) is in a web app, but it can't load it... I have to place the class somewhere in the claspath, which makes sence but i would rather have the scriptlet together with the report. Any clues?

 

 

 

 

By: macoute - macoute

RE: Scriptlet path.

2004-11-30 02:25

yes, the scriplet class must be in the classpath,

and in the xml template, the full qualified scriplet class:

scriptletClass="com.lectra.common.reporting.engine.data.Scriptlet"

 

 

 

 

By: Alexander Wallace - aows

RE: Scriptlet path.

2004-11-30 06:55

So i guess i need to write a classloader if the scriptlets are outside of the classpath in my servlet container...

 

Thanks!

 

 

 

 

By: Bonkers - darthbonkers

RE: Scriptlet path.

2005-06-15 06:45

Hi,

 

i have the same problem, how can i do this with a classloader? has somebody an example?

 

thx a lot

 

 

 

 

By: Brett - bsutton

RE: Scriptlet path.

2004-12-01 00:50

Maybe this is too obvious, but just drop the compiled scriplet into the WEB-INF/classes directory and all should be well.

 

 

 

 

By: Alexander Wallace - aows

RE: Scriptlet path.

2004-12-01 06:42

I wanted to avoid that since i was allowing users to upload reports, i wanted to place the scriptlets and subreports in the same folder where i'm storing the uploaded reports.

 

Right now i'm toying with the idea of keeping all the stuff in database. I don't have time for implementing it right now, but i may give it a try soon....

 

 

 

 

By: Bonkers - darthbonkers

RE: Scriptlet path.

2005-06-21 01:30

maybe somebody will read this..

this means that you must also store images in db you use in your report, i dont know if this is a good idea. i wrote this already with storing reports as blob in db, but it seems to be a bit difficult with images/scriptlets etc. So i put it in a directory where my tomcat/jboss is running. now i have the same problem like you, i cant use scriptlets because the classpath dont work.

 

i tried this but it only works the first time i call the servlet:

 

private void setScriptletLoader(){

try {

URLClassLoader parentLoader = null, scriptletLoader = null;

 

Object currentloader = Thread.currentThread().getContextClassLoader();

if (currentloader instanceof URLClassLoader) parentLoader = (URLClassLoader)currentloader;

scriptletLoader = new URLClassLoader(new URL[]{ new URL(new File(homeDir + System.getProperty("file.separator")).toURL().toString())}, parentLoader);

Thread.currentThread().setContextClassLoader(scriptletLoader);

} catch (IOException e) {

e.printStackTrace();

}

}

 

 

a second time i call the servlet, i get a classnotfoundexception for the scriptlet.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...