SecurityException Rejected errors

Issue

I am receiving an error message like the following in my logs (or console output):

java.lang.SecurityException: Rejected: <CLASS_NAME>
    at hudson.remoting.ClassFilter.check(ClassFilter.java:44)
    at hudson.remoting.MultiClassLoaderSerializer$Input.resolveClass(MultiClassLoaderSerializer.java:111)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1620)

Environment

Resolution

In new versions of Jenkins core is a security mechanism to prevent unwanted classes from being returned from node machines. There is a workaround however it will require a Jenkins restart.

  • Create a file on the Jenkins master.

  • In the file add the following and save it (You may need to add a line specific to the class being rejected in your error):

^com[.]google[.]inject[.].*
^com[.]sun[.]jndi[.]rmi[.].*
^java[.]rmi[.].*
^org[.]apache[.]commons[.]beanutils[.].*
^org[.]apache[.]commons[.]collections[.]functors[.].*
.*org[.]apache[.]xalan.*
^org[.]codehaus[.]groovy[.]runtime[.].*
^org[.]hibernate[.].*
^org[.]springframework[.](?!(\p{Alnum}+[.])*\p{Alnum}*Exception$).*
^sun[.]rmi[.].*
  • Add the following to the Jenkins JAVA_ARGS:
-Dhudson.remoting.ClassFilter.DEFAULTS_OVERRIDE_LOCATION=
  • After the = add the fully qualified path to the file created above.

  • Restart the Jenkins service and the error message should be resolved.

Have more questions?

0 Comments

Please sign in to leave a comment.