xmlparsing in jenkins script using XMLParser
up vote
0
down vote
favorite
I am trying to read the server name from the xml file in a pipeline script.
My Code:
node {
def str = "<root><HTTPTargetConnection><Loadbalancer><server name="myserver" /> </Loadbalancer></HTTPTargetConnection></root>";
def rootNode = new XmlParser().parseText(str);
echo rootNode.HTTPTargetConnection.Loadbalancer.server.@name.value[0];
}
Exception:
[Pipeline] End of Pipeline
*
org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException:
unclassified field groovy.util.Node HTTPTargetConnection at
org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.unclassifiedField(SandboxInterceptor.java:367)
at
org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:363)
at org.kohsuke.groovy.sandbox.impl.Checker$4.call(Checker.java:241)
Please help me in resolving this issue.
jenkins xml-parsing jenkins-pipeline pipeline
add a comment |
up vote
0
down vote
favorite
I am trying to read the server name from the xml file in a pipeline script.
My Code:
node {
def str = "<root><HTTPTargetConnection><Loadbalancer><server name="myserver" /> </Loadbalancer></HTTPTargetConnection></root>";
def rootNode = new XmlParser().parseText(str);
echo rootNode.HTTPTargetConnection.Loadbalancer.server.@name.value[0];
}
Exception:
[Pipeline] End of Pipeline
*
org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException:
unclassified field groovy.util.Node HTTPTargetConnection at
org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.unclassifiedField(SandboxInterceptor.java:367)
at
org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:363)
at org.kohsuke.groovy.sandbox.impl.Checker$4.call(Checker.java:241)
Please help me in resolving this issue.
jenkins xml-parsing jenkins-pipeline pipeline
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am trying to read the server name from the xml file in a pipeline script.
My Code:
node {
def str = "<root><HTTPTargetConnection><Loadbalancer><server name="myserver" /> </Loadbalancer></HTTPTargetConnection></root>";
def rootNode = new XmlParser().parseText(str);
echo rootNode.HTTPTargetConnection.Loadbalancer.server.@name.value[0];
}
Exception:
[Pipeline] End of Pipeline
*
org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException:
unclassified field groovy.util.Node HTTPTargetConnection at
org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.unclassifiedField(SandboxInterceptor.java:367)
at
org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:363)
at org.kohsuke.groovy.sandbox.impl.Checker$4.call(Checker.java:241)
Please help me in resolving this issue.
jenkins xml-parsing jenkins-pipeline pipeline
I am trying to read the server name from the xml file in a pipeline script.
My Code:
node {
def str = "<root><HTTPTargetConnection><Loadbalancer><server name="myserver" /> </Loadbalancer></HTTPTargetConnection></root>";
def rootNode = new XmlParser().parseText(str);
echo rootNode.HTTPTargetConnection.Loadbalancer.server.@name.value[0];
}
Exception:
[Pipeline] End of Pipeline
*
org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException:
unclassified field groovy.util.Node HTTPTargetConnection at
org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.unclassifiedField(SandboxInterceptor.java:367)
at
org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:363)
at org.kohsuke.groovy.sandbox.impl.Checker$4.call(Checker.java:241)
Please help me in resolving this issue.
jenkins xml-parsing jenkins-pipeline pipeline
jenkins xml-parsing jenkins-pipeline pipeline
edited Nov 12 at 9:07
Vadim Kotov
4,28153247
4,28153247
asked Nov 8 at 18:20
Prasad
33
33
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
You're running into sandbox issues. The field in question is not authorized for use and therefore must be approved (in the script approval page).
I thought the same, but in fact it was never showed up in script approval page.
– Prasad
Nov 9 at 14:11
check again after a reboot - I've seem weird behavior with this. Also, you might consider using XMLSlurper instead to see if that works. If you have the same problem you can put the code into a function that you put into a globally shared library and that will avoid the sandbox check.
– Rich Duncan
Nov 9 at 18:43
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
You're running into sandbox issues. The field in question is not authorized for use and therefore must be approved (in the script approval page).
I thought the same, but in fact it was never showed up in script approval page.
– Prasad
Nov 9 at 14:11
check again after a reboot - I've seem weird behavior with this. Also, you might consider using XMLSlurper instead to see if that works. If you have the same problem you can put the code into a function that you put into a globally shared library and that will avoid the sandbox check.
– Rich Duncan
Nov 9 at 18:43
add a comment |
up vote
0
down vote
You're running into sandbox issues. The field in question is not authorized for use and therefore must be approved (in the script approval page).
I thought the same, but in fact it was never showed up in script approval page.
– Prasad
Nov 9 at 14:11
check again after a reboot - I've seem weird behavior with this. Also, you might consider using XMLSlurper instead to see if that works. If you have the same problem you can put the code into a function that you put into a globally shared library and that will avoid the sandbox check.
– Rich Duncan
Nov 9 at 18:43
add a comment |
up vote
0
down vote
up vote
0
down vote
You're running into sandbox issues. The field in question is not authorized for use and therefore must be approved (in the script approval page).
You're running into sandbox issues. The field in question is not authorized for use and therefore must be approved (in the script approval page).
answered Nov 8 at 21:40
Rich Duncan
49138
49138
I thought the same, but in fact it was never showed up in script approval page.
– Prasad
Nov 9 at 14:11
check again after a reboot - I've seem weird behavior with this. Also, you might consider using XMLSlurper instead to see if that works. If you have the same problem you can put the code into a function that you put into a globally shared library and that will avoid the sandbox check.
– Rich Duncan
Nov 9 at 18:43
add a comment |
I thought the same, but in fact it was never showed up in script approval page.
– Prasad
Nov 9 at 14:11
check again after a reboot - I've seem weird behavior with this. Also, you might consider using XMLSlurper instead to see if that works. If you have the same problem you can put the code into a function that you put into a globally shared library and that will avoid the sandbox check.
– Rich Duncan
Nov 9 at 18:43
I thought the same, but in fact it was never showed up in script approval page.
– Prasad
Nov 9 at 14:11
I thought the same, but in fact it was never showed up in script approval page.
– Prasad
Nov 9 at 14:11
check again after a reboot - I've seem weird behavior with this. Also, you might consider using XMLSlurper instead to see if that works. If you have the same problem you can put the code into a function that you put into a globally shared library and that will avoid the sandbox check.
– Rich Duncan
Nov 9 at 18:43
check again after a reboot - I've seem weird behavior with this. Also, you might consider using XMLSlurper instead to see if that works. If you have the same problem you can put the code into a function that you put into a globally shared library and that will avoid the sandbox check.
– Rich Duncan
Nov 9 at 18:43
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53213900%2fxmlparsing-in-jenkins-script-using-xmlparser%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown