zava
Elite Observer

Script render problem on generation

Jump to solution

Hi Community,

I have, as usual, a strange problem.

I have in template a beanshell script render

    $CMS_RENDER(script:"generate_newsletter_html", newsletterId:#row.fs_id )$

the beanshell script

import de.itelligence.firstspirit.opt.webapp.utils.Newsletter;

try{

          newsletterId = context.getVariableValue("newsletterId");

          newsletterId = String.valueOf(newsletterId);

          html = de.itelligence.firstspirit.opt.webapp.utils.Newsletter.getHtml(newsletterId, context);

          return html;

 

} catch(ex){

            return ex.toString();

}

everything is working ok on javaClient preview, I got my html, the Newsletter class work correct.

The problem come when I try to send teh newsletter, I got the page without my dynamic html generated from my Newsletter class.

preview:

Screen shot 2013-03-07 at 11.04.59 .jpg

generated html, no UM code, nothing....

Screen shot 2013-03-07 at 11.07.14 .jpg

Newsletter class is installed on Preview, Staging, Webedit...

I think something is missing on generation, looks like the Newsletter class is not installed.

If I return in beanshell script  just the newsletterId as text, I got it on my generated html.

Any idea?

Best regards,

Antonio

0 Kudos
1 Solution

Accepted Solutions

The jar should be made available to the generation as "normal" resource, currently it's only available as web-resource:

<module>

    <name>i-telligence-Mod</name>

    <version>@VERSION@</version>

    <description></description>

    <vendor>i-telligence UG</vendor>

    <class>de.itelligence.firstspirit.opt.webapp.configuration.WebAppModule</class>

    <components>

        <web-app>

            <name>i-telligence WebApp</name>

            <description></description>

            <class>de.itelligence.firstspirit.opt.webapp.configuration.WebApp</class>

            <configurable>de.itelligence.firstspirit.opt.webapp.configuration.WebAppConfiguration</configurable>

            <web-xml>web.xml</web-xml>

            <resources>

                <resource>lib/webapp-@VERSION@.jar</resource>

            </resources>

            <web-resources>

                <resource>itelligence.tld</resource>

                <resource>configuration.properties</resource>

                <resource>lib/webapp-@VERSION@-webapp.jar</resource>

                <resource>lib/CoordinateTool.jar</resource>

            </web-resources>

        </web-app>

    </components>

    <resources>

        <resource scope="server">lib/CoordinateTool.jar</resource>

    </resources>

</module>

Peter

View solution in original post

0 Kudos
6 Replies
Peter_Jodeleit
Crownpeak employee

Do you get any error?

Peter
0 Kudos

Hi Peter,

I forget everytime to check the log files, i just check my java console.

here we are Smiley Happy

07.03.2013 13:44:52 {pID=80366} (de.espirit.firstspirit.generate.SiteProduction): at 0, 0: Script 'generate_newsletter_html' (id=141504) - Class or variable not found: de.itelligence.firstspirit.opt.webapp.utils.Newsletter : at Line: 7 : in file: inline evaluation of: ``__execute() { import de.itelligence.firstspirit.opt.webapp.utils.Newsletter; tr . . . '' : de .itelligence .firstspirit .opt .webapp .utils .Newsletter .getHtml ( newsletterId , context )

at line 7

what I have to do?

0 Kudos

Could you post the module.xml of your module?

Peter
0 Kudos

<module>

    <name>i-telligence-Mod</name>

    <version>@VERSION@</version>

    <description></description>

    <vendor>i-telligence UG</vendor>

    <class>de.itelligence.firstspirit.opt.webapp.configuration.WebAppModule</class>

    <components>

        <web-app>

            <name>i-telligence WebApp</name>

            <description></description>

            <class>de.itelligence.firstspirit.opt.webapp.configuration.WebApp</class>

            <configurable>de.itelligence.firstspirit.opt.webapp.configuration.WebAppConfiguration</configurable>

            <web-xml>web.xml</web-xml>

            <resources>

                <resource>lib/webapp-@VERSION@.jar</resource>

            </resources>

            <web-resources>

                <resource>itelligence.tld</resource>

                <resource>configuration.properties</resource>

                <resource>lib/webapp-@VERSION@-webapp.jar</resource>

                <resource>lib/CoordinateTool.jar</resource>

            </web-resources>

        </web-app>

    </components>

</module>

0 Kudos

The jar should be made available to the generation as "normal" resource, currently it's only available as web-resource:

<module>

    <name>i-telligence-Mod</name>

    <version>@VERSION@</version>

    <description></description>

    <vendor>i-telligence UG</vendor>

    <class>de.itelligence.firstspirit.opt.webapp.configuration.WebAppModule</class>

    <components>

        <web-app>

            <name>i-telligence WebApp</name>

            <description></description>

            <class>de.itelligence.firstspirit.opt.webapp.configuration.WebApp</class>

            <configurable>de.itelligence.firstspirit.opt.webapp.configuration.WebAppConfiguration</configurable>

            <web-xml>web.xml</web-xml>

            <resources>

                <resource>lib/webapp-@VERSION@.jar</resource>

            </resources>

            <web-resources>

                <resource>itelligence.tld</resource>

                <resource>configuration.properties</resource>

                <resource>lib/webapp-@VERSION@-webapp.jar</resource>

                <resource>lib/CoordinateTool.jar</resource>

            </web-resources>

        </web-app>

    </components>

    <resources>

        <resource scope="server">lib/CoordinateTool.jar</resource>

    </resources>

</module>

Peter
0 Kudos

Is working...I have to write a new method with SiteProduction instead GenerationContext too, Smiley Happy and is working.


thanks


0 Kudos