Why st:include not support relative path at Jenkins 1.519?

719 views
Skip to first unread message

James Yin

unread,
Jun 25, 2013, 3:36:51 AM6/25/13
to jenkin...@googlegroups.com
Hi, Guys

I have a Jenkins plugin, it works find form jenkins 1.3 to 1.517, but after the Jenkins is update to 1.519, the plugin can't work and throw follow exception:

javax.servlet.ServletException: org.apache.commons.jelly.JellyTagException: jar:file:/var/lib/jenkins/plugins/backup/WEB-INF/lib/classes.jar!/org/jvnet/hudson/plugins/backup/BackupWidget/index.jelly:2:57: <st:include> No page found '../BackupLink/ajaxBackupTask.jelly' for class org.jvnet.hudson.plugins.backup.BackupWidget
	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:666)
	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:770)
	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:736)
	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:770)
	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:583)
	at org.kohsuke.stapler.Stapler.service(Stapler.java:214)
	...
Caused by: org.apache.commons.jelly.JellyTagException: jar:file:/var/lib/jenkins/plugins/backup/WEB-INF/lib/classes.jar!/org/jvnet/hudson/plugins/backup/BackupWidget/index.jelly:2:57: <st:include> No page found '../BackupLink/ajaxBackupTask.jelly' for class org.jvnet.hudson.plugins.backup.BackupWidget
	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.apache.commons.jelly.tags.core.CoreTagLibrary$2.run(CoreTagLibrary.java:105)

I use a relative path in st:include to include a jelly in another dir:
<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">
    <st:include page="../BackupLink/ajaxBackupTask.jelly"/>
    <j:if test="${ajax==null and !h.isAutoRefresh(request) and h.hasPermission(app.READ)}">
        <script defer="defer">refreshPart('backupTask',"${rootURL}/backup/ajaxBackupTask");</script>
    </j:if>   
    <st:include page="../BackupLink/ajaxBackupResults.jelly"/>
    <j:if test="${ajax==null and !h.isAutoRefresh(request) and h.hasPermission(app.READ)}">
        <script defer="defer">refreshPart('backupResults',"${rootURL}/backup/ajaxBackupResults");</script>
    </j:if>
</j:jelly>

I don't know why it can't work at 1.519, who can tell me the reason? and how to fix it?

Ulli Hafner

unread,
Jun 25, 2013, 4:01:04 AM6/25/13
to jenkin...@googlegroups.com
Hi James,

in Jenkins 1.519 class loading has been changed. Now all classes and resources are stored in a classes.jar file. For details see: https://issues.jenkins-ci.org/browse/JENKINS-15120

I think using relative paths does not make much sense in jelly views, since actually the class loader is used to resolve the includes. Wouldn't it be easier to use a different approach for your includes? What are you trying to achieve?

Ulli


--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

James Yin

unread,
Jun 25, 2013, 4:35:17 AM6/25/13
to jenkin...@googlegroups.com
Hi, Ulli

Thanks your reply.
I reused ajaxBackupTask.jelly in two class, because we need show same content in two view,
file stuctre:
src/main/java/org/jvnet/hudson/plugins/backup/BackupLink.java
src/main/java/org/jvnet/hudson/plugins/backup/BackupWidget.java
src/main/resources/org/jvnet/hudson/plugins/backup/BackupLink/index.jelly
src/main/resources/org/jvnet/hudson/plugins/backup/BackupLink/ajaxBackupTask.jelly
src/main/resources/org/jvnet/hudson/plugins/backup/BackupLink/ajaxBackupResults.jelly
src/main/resources/org/jvnet/hudson/plugins/backup/BackupWidget/index.jelly

I don't think copy-pasted codes is a good solution.
I found all follow classes and resources are in the classes.jar, so do we can load the resources use relative path or Absolute Path? or another workaround?

Ulli Hafner

unread,
Jun 25, 2013, 5:44:39 AM6/25/13
to jenkin...@googlegroups.com
Hi James, 

do these classes have a super type in common? Then you can place the jelly files there. 

If not you can either consider using a tag lib or use a import with absolute url:

    <script type="text/javascript" src="${resURL}/plugin/analysis-core/yui/utilities.js" />

Ulli

Kevin Fleming (BLOOMBERG/ 731 LEXIN)

unread,
Jun 25, 2013, 9:17:25 AM6/25/13
to jenkin...@googlegroups.com
You can also do something like this:

<st:include page="ajaxBackupResults.jelly" class="BackupLink">

You'll probably need to specify the fully-qualified name of the class that owns the Jelly file.
Message has been deleted

James Yin

unread,
Jun 26, 2013, 5:23:01 AM6/26/13
to jenkin...@googlegroups.com, Kevin Fleming
Hi, Kevin

Thanks for your reply, the class is worked for me.

Thank you again for your help.
Reply all
Reply to author
Forward
0 new messages