Reputation: 55
Im getting the next error when I try to load "sidepanel.jelly" in my Jenkins plugin action jelly file.
javax.servlet.ServletException: org.apache.commons.jelly.JellyTagException: file:/C:/Documents%20and%20Settings/Tecnoy/Escritorio/vats_eclipse/src/main/resources/org/jenkinsci/plugins/vats/VatsBuildAction/index.jelly:4:42: <st:include> No page found 'sidepanel.jelly' for class org.jenkinsci.plugins.vats.VatsBuildAction
at org.kohsuke.stapler.jelly.JellyClassTearOff.serveIndexJelly(JellyClassTearOff.java:117)
at org.kohsuke.stapler.jelly.JellyFacet.handleIndexRequest(JellyFacet.java:127)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:717)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:858)
at org.kohsuke.stapler.MetaClass$12.dispatch(MetaClass.java:390)
...
Caused by: org.apache.commons.jelly.JellyTagException: file:/C:/Documents%20and%20Settings/Tecnoy/Escritorio/vats_eclipse/src/main/resources/org/jenkinsci/plugins/vats/VatsBuildAction/index.jelly:4:42: <st:include> No page found 'sidepanel.jelly' for class org.jenkinsci.plugins.vats.VatsBuildAction
at org.kohsuke.stapler.jelly.IncludeTag.doTag(IncludeTag.java:124)
at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:269)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
at org.kohsuke.stapler.jelly.CallTagLibScript$1.run(CallTagLibScript.java:99)
...
My jelly file has the following lines
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:l="/lib/layout" xmlns:t="/lib/hudson">
<l:layout norefresh="true">
<st:include page="sidepanel.jelly" />
<l:main-panel>
<h1>Vats Summary:</h1>
<div id="canvas-holder">
<p><canvas id="chart-area" width="300" height="300"/></p>
</div>
<script type="text/javascript" src="${resURL}/plugin/vats/scripts/chart.min.js"></script>
<script type="text/javascript">
...
</script>
<canvas id="myChart" width="400" height="400"></canvas>
</l:main-panel>
</l:layout>
</j:jelly>
Any idea how can I fix it?
Thanks!
Upvotes: 2
Views: 4213
Reputation: 106
Add the <l:main-panel>
tag and the the <l:layout norefresh="true">
tag to the index.jelly file.
And include the side panel:
<st:include it="${it.build}" page="sidepanel.jelly" />
tag with the buildJelly Example (index.jelly):
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt" xmlns:p="/lib/hudson/project">
<l:layout norefresh="true">
<st:include it="${it.build}" page="sidepanel.jelly" />
<l:main-panel>
<f:validateButton title="${%Restart Jenkins}" progress="${%Restarting...}" method="JksRestart" with="" />
</l:main-panel>
</l:layout>
</j:jelly>
Java Action class example:
package tryPublisher.tryPublisher;
import hudson.model.Action;
import hudson.model.AbstractBuild;
public class ExampleAction implements Action {
AbstractBuild<?,?> build;
public ExampleAction(AbstractBuild<?,?> build) {
this.build = build;
}
@Override
public String getIconFileName() {
return "/plugin/action.png";
}
@Override
public String getDisplayName() {
return "ExampleAction";
}
@Override
public String getUrlName() {
return "ExampleActionUrl";
}
public AbstractBuild<?,?> getBuild() {
return this.build;
}
}
Java Publisher class example:
package tryPublisher.tryPublisher;
import java.io.IOException;
import hudson.Launcher;
import hudson.model.AbstractBuild;
import hudson.model.BuildListener;
import hudson.tasks.BuildStepMonitor;
import hudson.tasks.Publisher;
public class ExamplePublisher extends Publisher {
@Override
public BuildStepMonitor getRequiredMonitorService() {
return BuildStepMonitor.NONE;
}
@Override
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher,
BuildListener listener) throws InterruptedException, IOException {
build.getActions().add(new ExampleAction(build));
return true;
}
}
The .jelly file has to be in the right resources map of the plugin project. In a map with the same name as the name of the Java class implementing Action. The name of the .jelly is important also.
Upvotes: 4